41 lines
1.2 KiB
Ruby
41 lines
1.2 KiB
Ruby
# encoding: UTF-8
|
|
module ApplicationHelper
|
|
def left_menu()
|
|
ret = ""
|
|
if !@menu_categories.blank?
|
|
ret += "<h4>Kategorie</h4><div class=\"list-group\">"
|
|
|
|
@menu_categories.each do |cat|
|
|
act = false
|
|
if controller_path.to_s.include?('categories') && params[:id].to_i == cat.id
|
|
act = true
|
|
end
|
|
if act.eql?(true)
|
|
ret += "<a href=\"/categories/#{cat.id}\" class=\"list-group-item active\">#{cat.name}</a>"
|
|
else
|
|
ret += "<a href=\"/categories/#{cat.id}\" class=\"list-group-item\">#{cat.name}</a>"
|
|
end
|
|
end
|
|
ret += "</div>"
|
|
end
|
|
if !@menu_infos.blank?
|
|
ret += "<h4>Informacje</h4><div class=\"list-group\">"
|
|
|
|
@menu_infos.each do |info|
|
|
act = false
|
|
if controller_path.to_s.include?('welcome') && params[:id].to_i == info.id
|
|
act = true
|
|
end
|
|
if act.eql?(true)
|
|
ret += "<a href=\"/welcome/show_information?id=#{info.id}\" class=\"list-group-item active\">#{info.name}</a>"
|
|
else
|
|
ret += "<a href=\"/welcome/show_information?id=#{info.id}\" class=\"list-group-item\">#{info.name}</a>"
|
|
end
|
|
end
|
|
ret += "</div>"
|
|
end
|
|
return raw(ret)
|
|
end
|
|
|
|
end
|