Created
November 3, 2014 09:14
-
-
Save walidvb/269f2a1f8b3bd47fd6c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
form do |f| | |
f.semantic_errors *f.object.errors.keys | |
f.inputs "Details", :class => "collapsible" do | |
f.input :title | |
f.input :author, :label => "Name" | |
f.input :is_private | |
f.input :publish_date, :as => :datepicker | |
f.input :publish_frequency, :as => :number, :label => "Publish Frequency", :step => 1 | |
#TODO: add slug again. Also, understand why this was removed | |
f.input :slug, :placeholder => "cannot be changed afterwards" unless !f.object.slug.nil? | |
f.input :chapters_total | |
f.input :chapter_price_gbp | |
f.input :chapter_price_usd | |
f.input :chapter_price_eur | |
f.input :count_of_fake_users | |
f.input :hashtag | |
f.input :twitter_text, placeholder: "New book from The Pigeonhole – BookTitle by Author" | |
f.input :blurb, as: :wysihtml5, :height => :small, commands: [ :bold, :italic, :h2, :link, :source ], :placeholder => "Displayed on the book page" | |
f.input :short_blurb, as: :wysihtml5, :height => :small, commands: [ :bold, :italic, :h2, :link, :source ], :placeholder => "Displayed on the library. Will copy 255 first characters of the blurb if left empty" | |
input :copyright, :as => :wysihtml5 | |
input :preview, :as => :html_editor | |
input :cover_image, :as => :file, :hint => f.template.image_tag(f.object.cover_image.url(:thumb)) | |
f.input :header_image, :as => :file, :hint => f.template.image_tag(f.object.header_image.url(:thumb)) | |
f.input :square_image, :as => :file, :hint => f.template.image_tag(f.object.square_image.url(:thumb)) | |
f.input :about, :as => :html_editor | |
f.input :splash_video, :placeholder => "The preview video on the book page" | |
end | |
f.inputs "Storyboard", :class => "collapsible" do | |
f.input :discuss_tile, :label => "Featured Comment" | |
f.has_many :tiles, :allow_destroy => true do |t, i| | |
t.inputs "Tile #{i}" do | |
t.input :title, :as => :wysihtml5, :height => :small, commands: [ :bold, :italic ] | |
t.input :chapter_id, :as => :select, :collection => f.object.chapters.map{|c| ["Stave #{c.index+1} #{c.title}", c.id]} | |
t.input :description | |
t.input :image, :as => :file, :hint => t.template.image_tag(t.object.image.url(:thumb)) | |
t.input :release_date, :as => :datepicker | |
t.input :type, :as => :select, :collection => t.object.types, input_html: {class: "wysiwyg-trigger"} | |
t.input :body, input_html: {class: "body-editor"} | |
t.input :preview, as: :boolean | |
t.input :exclusive, as: :boolean | |
t.actions | |
end | |
end | |
end | |
f.inputs("Staves", :class => "content collapsible") do | |
f.input :full_mobi, :as => :file, label: "Released Staves .mobi", :hint => link_to(f.object.full_mobi_file_name, f.object.full_mobi.url) unless f.object.new_record? | |
f.input :dedication, :as => :html_editor | |
f.has_many :chapters, :allow_destroy => true do |chapter, i| | |
chapter.inputs "Stave #{i}" do | |
chapter.input :title | |
#binding.pry | |
#li_content = "<label>Body</label>#{link_to( 'Edit', edit_book_chapter_path(f.object, chapter.object), target: '_blank')}".html_safe unless chapter.object.new_record? | |
#li li_content unless chapter.object.new_record? | |
chapter.input :body, as: :text | |
chapter.input :file, :as => :file, :hint => link_to(chapter.object.file_file_name, chapter.object.file.url) unless chapter.object.new_record? | |
chapter.actions | |
end | |
end | |
end | |
f.inputs "Pay What You Want", class: 'collapsible' do | |
f.input :custom_price | |
f.input :splash_header, :label => "Header image",:as => :file, :hint => f.template.image_tag(f.object.splash_header.url(:thumb)) | |
f.input :splash_thumbnail, :label => "Thumbnail",:as => :file, :hint => f.template.image_tag(f.object.splash_thumbnail.url(:thumb)) | |
end | |
f.inputs "Splash page", class: "collapsible" do | |
f.inputs :splash_page, :allow_destroy => true, for: [:splash_page, (f.object.splash_page || @new_splash)] do |s| | |
s.input :subtitle | |
s.input :message | |
s.input :facebook_message | |
s.input :twitter_message | |
s.input :button_call_to_action, :placeholder=> "Watch the Video" | |
s.input :button_message, :placeholder => "It's really awesome" | |
s.input :button_text, :placeholder => "Watch" | |
s.input :thumbnail, :as => :file, :hint => link_to(image_tag(s.object.thumbnail.url(:thumb)), s.object.thumbnail.url) unless s.object.new_record? | |
s.input :header_image, :as => :file, :hint => link_to(image_tag(s.object.header_image.url(:thumb)), s.object.header_image.url) unless s.object.new_record? | |
s.input :active | |
s.actions | |
end | |
end | |
f.inputs "Technical stuff", class: 'collapsible' do | |
f.input :styles, :class => "css-editor" | |
end | |
f.actions | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment