lockaz_app/app/controllers/admin/specific_preferences_controller.rb
Nicolas Bally f20fe482c6 initial
2020-04-06 10:38:07 +02:00

81 lines
1.1 KiB
Ruby
Executable File

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