Module: Typus::Controller::FeaturedImage
- Defined in:
- lib/typus/controller/featured_image.rb
Instance Method Summary collapse
Instance Method Details
#remove_featured_image ⇒ Object
15 16 17 18 19 20 |
# File 'lib/typus/controller/featured_image.rb', line 15 def remove_featured_image item = @resource.unscoped.find(params[:id]) item.try(:remove_featured_image) = { :action => 'edit', :id => item.id } redirect_to , :notice => Typus::I18n.t("Featured image removed") end |
#set_featured_image ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/typus/controller/featured_image.rb', line 5 def set_featured_image = Attachment.find(params[:id]) item = params[:resource].constantize.unscoped.find(params[:resource_id]) item.set_featured_image(.id) = { :controller => params[:resource].tableize, :action => 'edit', :id => item.id } redirect_to , :notice => Typus::I18n.t("Featured image set") end |