class Admin::PartialBuilder

Public Instance Methods

editor() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 23
def editor
  [
    editor_options,
    content_tag(:div, class: %w(main editor)) do
      [
        editor_content,
        content_tag(:div, preview, id: "editorSideContent")
      ].join.html_safe
    end
  ].join.html_safe
end
errors() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 4
def errors
  return unless object.errors.any?
  content_tag :div, class: %w(container errors) do
    [
      content_tag(:span, h(object.errors.full_messages.to_sentence)),
      link_to("x", "javascript:void(0)", class: %w(dismiss button))
    ].join.html_safe
  end
end
title() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 14
def title
  content_tag :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

Protected Instance Methods

editor_content() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 53
def editor_content
  content_tag :div, class: %w(content wrapper) do
    [
      text_area(:content, placeholder: t('.content'), class: %w(content editor)),
      text_area(:stylesheet, placeholder: t('.stylesheet'), class: %w(stylesheet hidden editor)),
      text_area(:javascript, placeholder: t('.javascript'), class: %w(javascript hidden editor))
    ].join.html_safe
  end
end
editor_options() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 47
def editor_options
  content_tag :div, class: %w(editor options wrapper) do
    Options.new(@template).render
  end
end
method_missing(method, *args, &block) click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 73
def method_missing(method, *args, &block)
  @template.send(method, *args, &block)
end
possible_actions() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 63
def possible_actions
  content_tag :div, class: %w(possible save actions) do
    content_tag(:div, save_button, class: %w(wrapper standalone))
  end
end
preview() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 37
def preview
  content_tag(:div, id: 'contentPreviewContainer') do
    [
      content_tag(:style),
      content_tag(:script, nil, class: %w(preview), type: 'text/javascript'),
      content_tag(:article, nil, class: %w(content preview)),
    ].join.html_safe
  end
end
save_button() click to toggle source
# File lib/ecrire/app/forms/admin/partial_builder.rb, line 69
def save_button
  button("Save", name: "post[status]", value: "draft", class: %w(button))
end