Sha256: 2d355a174273f0dc7dc72cd30f911921dfcd5fd98860c509b35f75ab35d73a4b

Contents?: true

Size: 940 Bytes

Versions: 10

Compression:

Stored size: 940 Bytes

Contents

module Comfy::Admin::Cms::PagesHelper
  def page_actions(page)
    events = page.aasm.events(permitted: true).map(&:name)
    events.select! do |event|
      can?(:manage, 'contents.page.' + event.to_s)
    end
    events
  end

  def cached_timeout_for_select
    {
        "Uncached" => 0,
        "15 minutes" => 15.minutes,
        "30 minutes" => 30.minutes,
        "1 hour" => 1.hour,
        "3 hours" => 3.hours,
        "24 hours" => 1.day,
        "15 days" => 15.days,
        "30 days" => 30.days
    }.map {|k,v| [k, v.to_i] }
  end

  def site_selector
    select_tag(
        :sites,
        options_for_select(sites_for_select, params[:site_id]),
        {class: 'form-control input-sm site_selector', id: 'js_site_selector'}
    )
  end

  def sites_for_select
    all_sites.map { |site| [site.label, site.id] }
  end

  def all_sites
    Comfy::Cms::Site.all
  end

  def multiple_sites?
    all_sites.size > 1
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cms-fortress-1.3.15 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.14 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.13 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.12 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.11 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.10 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.9 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.8 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.7 app/helpers/comfy/admin/cms/pages_helper.rb
cms-fortress-1.3.6 app/helpers/comfy/admin/cms/pages_helper.rb