Module: Georgia::FormsHelper

Defined in:
app/helpers/georgia/forms_helper.rb

Instance Method Summary collapse

Instance Method Details

#button_to_save(text = nil) ⇒ Object



19
20
21
22
# File 'app/helpers/georgia/forms_helper.rb', line 19

def button_to_save text=nil
  text ||= "#{icon_tag 'check'} Save".html_safe
   :button, text, type: "submit", class: "btn btn-save"
end

#choose_image_tag(imageable, args = {}) ⇒ Object



24
25
26
# File 'app/helpers/georgia/forms_helper.rb', line 24

def choose_image_tag imageable, args={}
  Georgia::MediaLibraryPresenter.new(self, imageable, args).to_s
end

#extra_fields?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'app/helpers/georgia/forms_helper.rb', line 52

def extra_fields?
  lookup_context.exists?('extra-fields', ["#{klass_folder}/fields"], true)
end

#extra_fields_pathObject



56
57
58
# File 'app/helpers/georgia/forms_helper.rb', line 56

def extra_fields_path
  "#{klass_folder}/fields/extra-fields"
end


36
37
38
# File 'app/helpers/georgia/forms_helper.rb', line 36

def link_portlet_tag link, args={}
  Georgia::LinkPortlet.new(self, link, args)
end

#parent_page_collectionObject



44
45
46
# File 'app/helpers/georgia/forms_helper.rb', line 44

def parent_page_collection
  @parent_page_collection ||= Georgia::Page.not_self(@page).joins(current_revision: :contents).uniq.sort_by(&:title).map{|p| [p.title, p.id]}
end

#render_template(template) ⇒ Object



11
12
13
14
15
16
17
# File 'app/helpers/georgia/forms_helper.rb', line 11

def render_template template
  begin
    render "georgia/pages/templates/#{template}", template: template
  rescue
    render "georgia/pages/templates/custom", template: template
  end
end

#slide_portlet_tag(slide, args = {}) ⇒ Object



32
33
34
# File 'app/helpers/georgia/forms_helper.rb', line 32

def slide_portlet_tag slide, args={}
  Georgia::SlidePortlet.new(self, slide, args)
end

#sortable(column, title = nil) ⇒ Object



4
5
6
7
8
9
# File 'app/helpers/georgia/forms_helper.rb', line 4

def sortable(column, title=nil)
  title ||= column.humanize
  direction = (column.to_s == params[:o] && params[:dir] == "asc" ? "desc" : "asc")
  icon = direction == "asc" ? icon_tag('caret-up') : icon_tag('caret-down')
  "#{title} #{link_to(icon, params.merge({o: column, dir: direction}))}".html_safe
end

#subpage_portlet_tag(subpage, args = {}) ⇒ Object



40
41
42
# File 'app/helpers/georgia/forms_helper.rb', line 40

def subpage_portlet_tag subpage, args={}
  Georgia::SubpagePortlet.new(self, subpage, args)
end

#widget_portlet_tag(ui_association, args = {}) ⇒ Object



28
29
30
# File 'app/helpers/georgia/forms_helper.rb', line 28

def widget_portlet_tag ui_association, args={}
  Georgia::WidgetPortlet.new(self, ui_association, args)
end

#widgets_collectionObject



48
49
50
# File 'app/helpers/georgia/forms_helper.rb', line 48

def widgets_collection
  @widgets_collection ||= options_from_collection_for_select(Georgia::Widget.all, :id, :title)
end