Sha256: ffdd5d842e243e820da25601e5e20cc56c680a7edcc7293f7547ee3a75e0631d
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
module Dash class PhotosController < DashController def index @meta_title = @title = Photo.model_name.human(count: 2) @photos = Photo.filter(params[:q]).page(params[:p].present? ? params[:p].to_i : 1).per(15) end def new @meta_title = @title = "#{t('dash.grid.create')} #{Photo.model_name.human}" @photo = Photo.new render :form end def create @meta_title = @title = "#{t('dash.grid.create')} #{Photo.model_name.human}" @photo = Photo.new(params[:photo]) if @photo.save redirect_with_flash dash_photos_path, :success, t('dash.flash.success.create'), params else flash_errors @photo render :form end end def show @meta_title = @title = "#{t('dash.grid.update')} #{Photo.model_name.human}" @photo = Photo.find(params[:id]) render :form end def update @meta_title = @title = "#{t('dash.grid.update')} #{Photo.model_name.human}" @photo = Photo.find(params[:id]) if @photo.update_attributes(params[:photo]) redirect_with_flash dash_photos_path, :success, t('dash.flash.success.update'), params else flash_errors @photo render :form end end def destroy Photo.destroy params[:id] redirect_with_flash dash_photos_path, :success, t('dash.flash.success.destroy') end end end
Version data entries
5 entries across 5 versions & 1 rubygems