Sha256: 1e07a1be164486ebf665a13f7b2de1b6436d460da29dac475e3df1c970a0c606
Contents?: true
Size: 688 Bytes
Versions: 13
Compression:
Stored size: 688 Bytes
Contents
module Admin 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
Version data entries
13 entries across 13 versions & 1 rubygems