Module: Cms::UiElementsHelper

Defined in:
app/helpers/cms/ui_elements_helper.rb

Instance Method Summary collapse

Instance Method Details

#publish_button(type) ⇒ Object

For simple publish buttons


15
16
17
18
# File 'app/helpers/cms/ui_elements_helper.rb', line 15

def publish_button(type)
  html = %Q{<button type="submit" name="#{type}[publish_on_save]" value="true" class="submit"><span>Save And Publish</span></button>'}
  lt_button_wrapper html.html_safe
end

#save_and_publish_button(block, content_type) ⇒ Object

Renders a Save And Publish button if:

  1. Current User has publish rights

  2. Block is publishable


7
8
9
10
11
12
# File 'app/helpers/cms/ui_elements_helper.rb', line 7

def save_and_publish_button(block, content_type)
  if current_user.able_to?(:publish_content) && block.publishable?
    html = %Q{<button type="submit" name="#{content_type.content_block_type.singularize}[publish_on_save]" value="true" class="submit" tabindex="#{next_tabindex}"><span>Save And Publish</span></button>}
    lt_button_wrapper html.html_safe
  end
end

#select_content_type_tag(type, &block) ⇒ Object


21
22
23
24
25
# File 'app/helpers/cms/ui_elements_helper.rb', line 21

def select_content_type_tag(type, &block)
  options = {:rel => "select-#{type.key}"}
  options[:class] = "on" if content_type == type
  (:li, type, nil, options, &block)
end