vita_app/app/controllers/admin/translations_controller.rb
Nicolas Bally 1d3af87d4c initial
2016-04-28 10:07:08 +02:00

75 lines
948 B
Ruby
Executable File

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