Created
April 1, 2009 14:54
-
-
Save jamesweiner/88718 to your computer and use it in GitHub Desktop.
entry form with beginnings of inline image uploads
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
.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 | |
%li | |
%span.image | |
image here | |
%span.filename | |
filename.jpg | |
%span.markdown | |
 | |
%li | |
%span.image | |
image here | |
%span.filename | |
filename.jpg | |
%span.markdown | |
 | |
%li | |
%span.image | |
image here | |
%span.filename | |
filename.jpg | |
%span.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