bievre_reno_app/app/controllers/admin/mail_contents_controller.rb
Caroline Girard d727d313b7 initial
2018-09-11 13:49:55 +02:00

73 lines
985 B
Ruby
Executable File

# -*- encoding : utf-8 -*-
class Admin::MailContentsController < ApplicationController
before_filter :auth_admin
layout "admin"
before_filter :find_mail_contents
def index
end
def show
@mail_content = MailContent.find(params[:id])
render :layout => false
end
def edit
@mail_content = MailContent.find(params[:id])
end
def update
@mail_content = MailContent.find(params[:id])
respond_to do |format|
if @mail_content.update_attributes(params.require(:mail_content).permit!)
flash[:notice] = "Le menu à été modifié avec succès."
if @reorder
format.js {
render :action => "update" }
else
format.js {
@mail_content = MailContent.find(@mail_content.id)
render :action => "update_row" }
end
end
end
end
protected
def find_mail_contents
@mail_contents = MailContent.all #.order("key ASC")
end
end