Class: Admin::PartialBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/ecrire/app/forms/admin/partial_builder.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (protected)



73
74
75
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 73

def method_missing(method, *args, &block)
  @template.send(method, *args, &block)
end

Instance Method Details

#editorObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 23

def editor
  [
    editor_options,
    (:div, class: %w(main editor)) do
      [
        editor_content,
        (:div, preview, id: "editorSideContent")
      ].join.html_safe
    end
  ].join.html_safe
end

#errorsObject



4
5
6
7
8
9
10
11
12
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 4

def errors
  return unless object.errors.any?
   :div, class: %w(container errors) do
    [
      (:span, h(object.errors.full_messages.to_sentence)),
      link_to("x", "javascript:void(0)", class: %w(dismiss button))
    ].join.html_safe
  end
end

#titleObject



14
15
16
17
18
19
20
21
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 14

def title
   :div, id: "partial_title_wrapper", class: %w(title wrapper) do
    [
      text_field(:title, placeholder: t('.title'), class: %w(input)),
      possible_actions
    ].join.html_safe
  end
end