Class: Admin::Books::FormBuilder

Inherits:
Releaf::Builders::FormBuilder
  • Object
show all
Defined in:
lib/generators/dummy/templates/builders/admin/books/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#book_sequels_sequel_id_optionsObject


7
8
9
10
11
# File 'lib/generators/dummy/templates/builders/admin/books/form_builder.rb', line 7

def book_sequels_sequel_id_options
  original_book = options[:parent_builder].object
  books = Book.where(Book.arel_table[:id].not_eq(original_book.id))
  options_from_collection_for_select(books, :id, :title, object.sequel_id)
end

#render_book_sequels_sequel_idObject


3
4
5
# File 'lib/generators/dummy/templates/builders/admin/books/form_builder.rb', line 3

def render_book_sequels_sequel_id
  releaf_item_field('sequel_id', options: { select_options: book_sequels_sequel_id_options })
end

#richtext_input_attributes(name) ⇒ Object


13
14
15
16
17
18
19
20
21
# File 'lib/generators/dummy/templates/builders/admin/books/form_builder.rb', line 13

def richtext_input_attributes(name)
  attributes = super(name)

  if name == "summary_html"
    attributes[:data][:type] = "summary"
  end

  attributes
end