Class: Releaf::Builders::ConfirmDialogBuilder

Inherits:
Object
  • Object
show all
Includes:
ResourceDialog
Defined in:
app/builders/releaf/builders/confirm_dialog_builder.rb

Direct Known Subclasses

ConfirmDestroyDialogBuilder

Instance Attribute Summary collapse

Attributes included from Resource

#resource

Attributes included from Template

#template

Instance Method Summary collapse

Methods included from ResourceDialog

#dialog?

Methods included from Resource

#initialize

Methods included from View

#breadcrumb_item, #breadcrumbs, #dialog?, #dialog_name, #flash_item, #flash_notices, #footer_blocks, #footer_primary_block, #footer_secondary_block, #footer_secondary_tools, #footer_tools, #header, #header_extras, #section, #section_blocks, #section_footer, #section_footer_class, #section_header, #section_header_extras, #section_header_text

Methods included from Template

#initialize

Methods included from Base

#default_translation_scope, #html_escape, #icon, #layout_settings, #locale_options, #resource_title, #safe_join, #t, #tag, #template_variable, #translate_locale, #wrapper

Instance Attribute Details

#formObject

Returns the value of attribute form


4
5
6
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 4

def form
  @form
end

Instance Method Details

#cancel_buttonObject


51
52
53
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 51

def cancel_button
  button(t("No"), "ban", class: "secondary", data: {type: 'cancel'}, href: cancel_path)
end

#cancel_pathObject


47
48
49
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 47

def cancel_path
  index_path
end

#confirm_buttonObject


43
44
45
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 43

def confirm_button
  button(t("Yes"), "check", class: "danger", type: 'submit')
end

#confirm_form_optionsObject


39
40
41
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 39

def confirm_form_options
  {builder: Releaf::Builders::FormBuilder, url: confirm_url, as: :resource, method: confirm_method}
end

35
36
37
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 35

def footer_primary_tools
  [cancel_button, confirm_button]
end

#outputObject


6
7
8
9
10
11
12
13
14
15
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 6

def output
  tag(:section, section_attributes) do
    form_for(resource, confirm_form_options) do |form|
      self.form = form
      safe_join do
        section_blocks
      end
    end
  end
end

#section_attributesObject


31
32
33
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 31

def section_attributes
  merge_attributes(super, class: ["confirm"])
end

#section_bodyObject


17
18
19
20
21
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 17

def section_body
  tag(:div, class: "body") do
    section_body_blocks
  end
end

#section_body_blocksObject


23
24
25
26
27
28
29
# File 'app/builders/releaf/builders/confirm_dialog_builder.rb', line 23

def section_body_blocks
  [
    icon(icon_name),
    tag(:div, question_content, class: "question"),
    tag(:div, description_content, class: "description")
  ]
end