Sha256: 814639a03d6a1f9576e8b4b627ac8eac0c3966463d1f54a7ef61f34e0b674964
Contents?: true
Size: 1.84 KB
Versions: 3
Compression:
Stored size: 1.84 KB
Contents
module Adminpanel class GalleriesController < Adminpanel::ApplicationController load_and_authorize_resource def index @galleries = Gallery.find(:all) end def show @gallery = Gallery.find(params[:id]) end # def edit # @gallery = Gallery.find(params[:id]) # end def create @gallery = Gallery.new(params[:gallery]) if @gallery.save redirect_to gallery_path(@gallery), :notice => t("gallery.success") else render 'new' end end def move_better @gallery = Gallery.find(params[:id]) if @gallery.move_to_better_position flash[:success] = t("gallery.moved") else flash[:warning] = t("gallery.not-moved") end respond_to do |format| format.html do redirect_to galleries_path end format.js do @galleries = Gallery.all render :locals => { :galleries => @galleries } end end end def move_worst @gallery = Gallery.find(params[:id]) if @gallery.move_to_worst_position flash[:success] = t("gallery.moved") else flash[:warning] = t("gallery.not-moved") end respond_to do |format| format.html do redirect_to galleries_path end format.js do @galleries = Gallery.all render :locals => { :galleries => @galleries } end end end def destroy @gallery = Gallery.find(params[:id]) @gallery.destroy redirect_to galleries_path, :notice => t("gallery.deleted") end def update @gallery = Gallery.find(params[:id]) if @gallery.update_attributes(params[:gallery]) redirect_to gallery_path(@gallery) else render 'edit' end end # def new # @gallery = Gallery.new # end end end
Version data entries
3 entries across 3 versions & 1 rubygems