Sha256: ec55b9b3c5c46453182cdcb46b85a0ebf789b3778438c507316d2d034d76bd9a

Contents?: true

Size: 722 Bytes

Versions: 6

Compression:

Stored size: 722 Bytes

Contents

module MultiSite::SiteChooserHelper

  def sites_chooser_thing
    return "" unless current_user.admin? && defined?(Site) && defined?(controller) && controller.sited_model? && controller.template_name == 'index' && Site.several?
    options = Site.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

6 entries across 6 versions & 1 rubygems

Version Path
trusty-cms-7.0.8 vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb
trusty-cms-7.0.7 vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb
trusty-cms-7.0.6 vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb
trusty-cms-7.0.5 vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb
trusty-cms-7.0.4 vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb
trusty-cms-7.0.3 vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb