Sha256: 1492099b8cf35e36e1fa3d3953fcd93327a1ec35074c65fbf694fcf08518d716
Contents?: true
Size: 744 Bytes
Versions: 27
Compression:
Stored size: 744 Bytes
Contents
module Typus module Controller module FeaturedImage def set_featured_image attachment = Attachment.find(params[:id]) item = params[:resource].constantize.unscoped.find(params[:resource_id]) item.set_featured_image(attachment.id) options = { :controller => params[:resource].tableize, :action => 'edit', :id => item.id } redirect_to options, :notice => Typus::I18n.t("Featured image set") end def remove_featured_image item = @resource.unscoped.find(params[:id]) item.try(:remove_featured_image) options = { :action => 'edit', :id => item.id } redirect_to options, :notice => Typus::I18n.t("Featured image removed") end end end end
Version data entries
27 entries across 27 versions & 1 rubygems