Skip to content

Instantly share code, notes, and snippets.

@fidothe
Forked from jamesweiner/gist:88718
Created April 1, 2009 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fidothe/88724 to your computer and use it in GitHub Desktop.
Save fidothe/88724 to your computer and use it in GitHub Desktop.
.blog
#title
- unless entry_form.heading_image.nil? || !File.exist?(entry_form.heading_image.asset.path(:headline))
= image_tag(entry_form.heading_image.asset.url(:headline))
- else
= image_tag('headline_blank.png')
.image_upload
.threecolumn.noborder
- form_for(image_form, :url => assets_path, :html => {:enctype => 'multipart/form-data', :id => 'headline_image_form'}) do |f|
%p
= f.label :asset, "Headline image"
= f.file_field :asset
= hidden_field_tag :kind, 'heading'
- unless image_form.new_record?
= hidden_field_tag :asset_path, asset_path(image_form)
= f.submit('Upload image')
.twocolumn
- unless entry_form.heading_image.nil?
= image_tag(entry_form.heading_image.asset.url(:cropper), :id => 'cropbox')
- else
= image_tag('headline_source_blank.png', :id => 'cropbox')
.onecolumn.control
.crop_controls
%p.label
Crop
%p
%a#headline_crop.button Headline
%p
%a#headline_save.button Save headline
%p
%a#thumbnail_crop.button Thumbnail
%p
%a#thumbnail_save.button Save thumbnail
%p
- unless entry_form.heading_image.nil? || !File.exist?(entry_form.heading_image.asset.path(:thumbnail))
= image_tag(entry_form.heading_image.asset.url(:thumbnail))
- else
= image_tag('thumbnail_blank.png', :id => 'thumbnail_image')
- form_for(entry_form) do |f|
.threecolumn.noborder
.onecolumn.entry_data
%p
= f.label :title, "Post title"
= f.text_field :title
= hidden_field_tag('heading_image_id', image_form.id)
- if entry_form.draft?
%p
= f.label :url_slug, "URL slug"
= f.text_field :url_slug
- else
%p.label_slug URL slug
%p.field_slug= entry_form.url_slug
%p
= f.label :date
= f.text_field :date
%p= f.label :summary
= f.text_area :summary
.twocolumn
%p.label Post body
#post_body_images
%p.first_label
= f.file_field :asset
= hidden_field_tag :kind, 'inline'
- unless image_form.new_record?
= hidden_field_tag :asset_path, asset_path(image_form)
= f.submit('Upload image')
%ul
- [['image goes here', 'filename.jpg', '![Alt text](/path)'], ['other image goes here', 'filename.jpg', '![Alt text](/path)'], ['my image goes here', 'filename.jpg', '![Alt text](/path)']].each do |image, filename, markdown|
%li
%span.image
= image
%span.filename
= filename
%span.markdown
= markdown
= f.text_area :body
%p
= f.label :tags, "Tags"
=f.text_field :tags
%p.small Separate tags with commas
.threecolumn
.onecolumn.status
- unless entry_form.deleted?
%p
= f.label :status, "Post status"
= f.select :status, entry_form.usable_statuses
- else
%p.label_status Post status
%p.field_status Post is deleted
.onecolumn
.onecolumn.create_entry
%p
- if entry_form.new_record?
= f.submit("Create blog post")
- else
= f.submit("Save changes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment