Sha256: 5aa5e2c255b9344791781f68ad30383ad8eb6759965a278d13a7a1cc543658c7

Contents?: true

Size: 758 Bytes

Versions: 24

Compression:

Stored size: 758 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.to_s}/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

24 entries across 24 versions & 1 rubygems

Version Path
soapbox-0.3.1 app/helpers/plugin_helper.rb
soapbox-0.3.0 app/helpers/plugin_helper.rb
soapbox-0.2.24 app/helpers/plugin_helper.rb
soapbox-0.2.23 app/helpers/plugin_helper.rb
soapbox-0.2.21 app/helpers/plugin_helper.rb
soapbox-0.2.20 app/helpers/plugin_helper.rb
soapbox-0.2.18 app/helpers/plugin_helper.rb
soapbox-0.2.16 app/helpers/plugin_helper.rb
soapbox-0.2.15 app/helpers/plugin_helper.rb
soapbox-0.2.14 app/helpers/plugin_helper.rb
soapbox-0.2.12 app/helpers/plugin_helper.rb
soapbox-0.2.11 app/helpers/plugin_helper.rb
soapbox-0.2.10 app/helpers/plugin_helper.rb
soapbox-0.2.9 app/helpers/plugin_helper.rb
soapbox-0.2.8 app/helpers/plugin_helper.rb
soapbox-0.2.7 app/helpers/plugin_helper.rb
soapbox-0.2.6 app/helpers/plugin_helper.rb
soapbox-0.2.5 app/helpers/plugin_helper.rb
soapbox-0.2.4 app/helpers/plugin_helper.rb
soapbox-0.2.3 app/helpers/plugin_helper.rb