Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Edit project form
- = form_for @project, :html => { :multipart => true } do |f|
- = f.error_messages
- %p
- = f.label :thumbnail_image
- = f.file_field :thumbnail_image
- %br
- = image_tag @project.thumbnail_image.url(:preview)
- %p
- = f.label :main_image
- = f.file_field :main_image
- %br
- = image_tag @project.main_image.url(:preview)
- %p
- = f.label :additional_images
- %br
- = f.fields_for :additional_images do |image|
- - if image.object.new_record?
- = image.file_field :additional_image
- %br
- = f.fields_for :additional_images do |image|
- - unless image.object.new_record?
- = link_to image_tag(image.object.additional_image.url(:thumb)), image.object.additional_image.url(:original)
- = image.label "Delete?"
- = image.check_box :_destroy
- %p
- = f.label :title
- = f.text_field :title
- %p
- = f.label :summary
- = f.text_field :summary
- %p
- = f.label :link
- = f.text_field :link
- %p
- = f.label :in_selected_projects?
- = f.check_box :in_selected_projects_list
- %p
- = f.label :category
- = f.select :category_list, options_for_select(['web', 'print', 'brand'])
- %p
- Comma separated tag list ...
- %br
- = f.label :tags
- = f.text_field :tag_list
- %h1
- Make Featured
- %p
- = label_tag :make_featured_project
- = check_box_tag :make_featured
- %p
- = label_tag :left
- = radio_button_tag "position", :left
- = label_tag :right
- = radio_button_tag "position", :right
- %p
- = f.label :featured_project_title
- = f.text_field :featured_project_title
- %p
- = f.label :featured_project_summary
- = f.text_field :featured_project_summary
- %p
- = f.submit
- ## project controller update method
- def update
- @project = Project.find(params[:id])
- if @project.update_attributes(params[:project])
- if params[:make_featured]
- raise @project.inspect
- config = ApplicationConfigs.find(1)
- config.front_page_featured_project_a = @project[:id]
- config.save
- end
- redirect_to edit_project_path(@project), :notice => "Successfully updated project."
- else
- render :action => 'edit'
- end
- end
Add Comment
Please, Sign In to add comment