Module: Koi::Content::Editor::ItemFormComponent::ContentFormHelper

Defined in:
app/components/koi/content/editor/item_form_component.rb

Instance Method Summary collapse

Instance Method Details

#content_background_field(args = {}) ⇒ Object



74
75
76
77
# File 'app/components/koi/content/editor/item_form_component.rb', line 74

def content_background_field(args = {})
  govuk_select :background, Katalyst::Content.config.backgrounds,
               **{ label: { size: "s" } }.deep_merge(args)
end

#content_buttonsObject



84
85
86
87
88
89
# File 'app/components/koi/content/editor/item_form_component.rb', line 84

def content_buttons
  tag.div(class: "actions") do
    concat(admin_save("Done"))
    concat(admin_discard(data: { action: "click->kpop--frame#dismiss:prevent" }))
  end
end

#content_heading_field(args = {}) ⇒ Object



46
47
48
49
# File 'app/components/koi/content/editor/item_form_component.rb', line 46

def content_heading_field(args = {})
  govuk_text_field :heading,
                   **{ label: { text: "Heading", size: "s" } }.deep_merge(args)
end

#content_heading_fieldsetObject



39
40
41
42
43
44
# File 'app/components/koi/content/editor/item_form_component.rb', line 39

def content_heading_fieldset
  govuk_fieldset(legend: { text: "Heading", size: "m" }) do
    concat(content_heading_field(label: nil))
    concat(content_heading_style_field)
  end
end

#content_heading_style_field(args = {}) ⇒ Object



51
52
53
54
55
56
57
# File 'app/components/koi/content/editor/item_form_component.rb', line 51

def content_heading_style_field(args = {})
  govuk_collection_radio_buttons :heading_style,
                                 Katalyst::Content.config.heading_styles,
                                 :itself,
                                 :itself,
                                 **{ small: true, legend: { text: "Style", size: "s" } }.deep_merge(args)
end

#content_http_method_field(methods, args = {}) ⇒ Object



64
65
66
67
# File 'app/components/koi/content/editor/item_form_component.rb', line 64

def content_http_method_field(methods, args = {})
  govuk_select :http_method, methods,
               **{ label: { text: "HTTP method", size: "s" } }.deep_merge(args)
end

#content_target_field(targets, args = {}) ⇒ Object



69
70
71
72
# File 'app/components/koi/content/editor/item_form_component.rb', line 69

def content_target_field(targets, args = {})
  govuk_select :target, targets,
               **{ label: { text: "HTTP target", size: "s" } }.deep_merge(args)
end

#content_url_field(args = {}) ⇒ Object



59
60
61
62
# File 'app/components/koi/content/editor/item_form_component.rb', line 59

def content_url_field(args = {})
  govuk_text_field :url,
                   **{ label: { text: "URL", size: "s" } }.deep_merge(args)
end

#content_visible_field(args = {}) ⇒ Object



79
80
81
82
# File 'app/components/koi/content/editor/item_form_component.rb', line 79

def content_visible_field(args = {})
  govuk_check_box_field :visible,
                        **{ label: { text: "Visible? ", size: "s" }, small: true }.deep_merge(args)
end