Sha256: d8419e61245ff3acc915124a692091a720b0eeaa361fdb42ffeb807fb7fde884
Contents?: true
Size: 751 Bytes
Versions: 3
Compression:
Stored size: 751 Bytes
Contents
module PluginHelper def plugin_nav(parent = nil, id = nil) if parent.nil? plugins = Plugin.active.where("parent_id is ?", parent) else plugins = Plugin.active.where("parent_id=?", parent) end html = "" html << "<ul id='#{ id || "" }'>" permissions = YAML::load(File.open("#{RAILS_ROOT}/config/permissions.yml")) plugins.each do |plugin| next if permissions[plugin] && !current_user.can?(["admin","create"],plugin) html << "<li #{ plugin.children.empty? ? "" : "class='has_sub'" }>" html << link_to(plugin.title, (eval(plugin.route) rescue "#bad_route")) html << plugin_nav(plugin.id) if !plugin.children.empty? html << "</li>" end html << "</ul>" html.html_safe end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
soapbox-0.1.3 | app/helpers/plugin_helper.rb |
soapbox-0.1.2 | app/helpers/plugin_helper.rb |
soapbox-0.1.1 | app/helpers/plugin_helper.rb |