Sha256: 3a1cb5d052532eae04555523e8cfce38db01f0efd8cccdcf0ea9529b65eb9ddc
Contents?: true
Size: 695 Bytes
Versions: 9
Compression:
Stored size: 695 Bytes
Contents
module MultiSite::SiteChooserHelper def sites_chooser_thing return "" unless admin? && defined?(Site) && defined?(controller) && controller.sited_model? && controller.template_name == 'index' && Site.several? options = Site.find(:all).map{ |site| "<li>" + link_to( site.name, "#{request.path}?site_id=#{site.id}", :class => site == current_site ? 'fg' : '') + "</li>" }.join("") chooser = %{<div id="site_chooser">} #chooser << link_to("sites", admin_sites_url, {:id => 'show_site_list', :class => 'expandable'}) chooser << %{<ul id="nav"><li>Current Site: #{current_site.name}} chooser << %{<ul class="expansion">#{options}</ul></li></ul>} chooser << %{</div>} chooser end end
Version data entries
9 entries across 9 versions & 1 rubygems