Created
May 1, 2011 03:18
-
-
Save cloudbring/950215 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
%tr | |
%td | |
= t("filename") | |
\: | |
%td= f.file_field :attachment | |
%td | |
= t("tags") | |
\: | |
%td= f.autocomplete_field :tag_name, autocomplete_tag_name_images_path | |
- if @product.has_variants? | |
%tr | |
%td | |
= Variant.model_name.human | |
\: | |
%td= f.select :viewable_id, @variants | |
- else | |
= hidden_field_tag :product_id, @product.id | |
%tr | |
%td | |
= t("alt_text") | |
\: | |
%td= f.text_area :alt |
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
# THE Begining of the form that calls _form.html.haml above | |
= form_for(:image, :url => admin_product_image_url(@product), :html => { :method => :put, :multipart => true }) do |f| | |
%table.basic-table | |
%tr | |
%td | |
= t("thumbnail") | |
\: | |
%td= link_to(image_tag(@image.attachment.url(:mini)), @image.attachment.url(:product)) | |
= render :partial => "form", :locals => { :f => f } | |
%p.form-buttons | |
= button t("update") | |
= t('or') | |
= link_to t("cancel"), admin_product_images_url(@product), :id => "cancel_link" |
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
Image.class_eval do | |
begin | |
acts_as_taggable # Adds tags to a tag model created by the plugin automatically. | |
rescue NameError | |
puts "Run rails generate acts_as_taggable_on:migrations" | |
end | |
begin | |
autocomplete :tag, :name | |
rescue | |
puts "Run rails generate autocomplete" | |
end | |
end |
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
# Injecting routes from a gem | |
Rails.application.routes.draw do | |
# Add your extension routes here | |
namespace :admin do | |
namespace :products do | |
namespace :images do | |
resources :autocomplete_tag_name, :on => :collection | |
end | |
end | |
end | |
namespace :images do | |
resources :autocomplete_tag_name, :on => :collection | |
end | |
end |
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
admin_products_images_autocomplete_tag_name_index GET /admin/products/images/autocomplete_tag_name(.:format) {:action=>"index", :controller=>"admin/products/images/autocomplete_tag_name"} | |
POST /admin/products/images/autocomplete_tag_name(.:format) {:action=>"create", :controller=>"admin/products/images/autocomplete_tag_name"} | |
new_admin_products_images_autocomplete_tag_name GET /admin/products/images/autocomplete_tag_name/new(.:format) {:action=>"new", :controller=>"admin/products/images/autocomplete_tag_name"} | |
edit_admin_products_images_autocomplete_tag_name GET /admin/products/images/autocomplete_tag_name/:id/edit(.:format) {:action=>"edit", :controller=>"admin/products/images/autocomplete_tag_name"} | |
admin_products_images_autocomplete_tag_name GET /admin/products/images/autocomplete_tag_name/:id(.:format) {:action=>"show", :controller=>"admin/products/images/autocomplete_tag_name"} | |
PUT /admin/products/images/autocomplete_tag_name/:id(.:format) {:action=>"update", :controller=>"admin/products/images/autocomplete_tag_name"} | |
DELETE /admin/products/images/autocomplete_tag_name/:id(.:format) {:action=>"destroy", :controller=>"admin/products/images/autocomplete_tag_name"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment