Class: Admin::PartialBuilder::Options

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

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ Options

Returns a new instance of Options.



79
80
81
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 79

def initialize(template)
  @template = template
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



99
100
101
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 99

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

Instance Method Details

#editor_optionsObject



87
88
89
90
91
92
93
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 87

def editor_options
  [
    (:a, t('fields.text'), binding: ".editor.content", class: %w(content active)),
    (:a, t('fields.CSS'), binding: ".editor.stylesheet", class: %w(content)),
    (:a, t('fields.JS'), binding: ".editor.javascript", class: %w(content))
  ].join.html_safe
end

#renderObject



83
84
85
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 83

def render
  (:div, editor_options, class: %w(editor options))
end

#t(*args) ⇒ Object



95
96
97
# File 'lib/ecrire/app/forms/admin/partial_builder.rb', line 95

def t(*args)
  I18n.t args[0], scope: %w(admin partials form options)
end