Module: Georgia::FormsHelper
- Defined in:
- app/helpers/georgia/forms_helper.rb
Instance Method Summary collapse
- #button_to_save(text = nil) ⇒ Object
- #choose_image_tag(imageable, args = {}) ⇒ Object
- #extra_fields? ⇒ Boolean
- #extra_fields_path ⇒ Object
- #link_portlet_tag(link, args = {}) ⇒ Object
- #parent_page_collection ⇒ Object
- #render_template(template) ⇒ Object
- #slide_portlet_tag(slide, args = {}) ⇒ Object
- #sortable(column, title = nil) ⇒ Object
- #subpage_portlet_tag(subpage, args = {}) ⇒ Object
- #widget_portlet_tag(ui_association, args = {}) ⇒ Object
- #widgets_collection ⇒ Object
Instance Method Details
#button_to_save(text = nil) ⇒ Object
19 20 21 22 |
# File 'app/helpers/georgia/forms_helper.rb', line 19 def text=nil text ||= "#{icon_tag 'check'} Save".html_safe content_tag :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
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_path ⇒ Object
56 57 58 |
# File 'app/helpers/georgia/forms_helper.rb', line 56 def extra_fields_path "#{klass_folder}/fields/extra-fields" end |
#link_portlet_tag(link, args = {}) ⇒ Object
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_collection ⇒ Object
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 , args={} Georgia::SlidePortlet.new(self, , 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 ui_association, args={} Georgia::WidgetPortlet.new(self, ui_association, args) end |