summaryrefslogtreecommitdiff
path: root/app/controllers/gs_parameters_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
commit39aa7132ceed3d4beab3a9b828e571bbfc67c07e (patch)
tree6c88289c9f99be0af8635636fcdf64102090e5ec /app/controllers/gs_parameters_controller.rb
parent5ad8203ce4f1bfea997960d0b52c626dea24b944 (diff)
parent6f69c1a85055ec7c2515719d79d2a7a4e60cec50 (diff)
Merge branch 'develop'5.1-beta1
Diffstat (limited to 'app/controllers/gs_parameters_controller.rb')
-rw-r--r--app/controllers/gs_parameters_controller.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
new file mode 100644
index 0000000..bd8b44b
--- /dev/null
+++ b/app/controllers/gs_parameters_controller.rb
@@ -0,0 +1,44 @@
+class GsParametersController < ApplicationController
+ load_and_authorize_resource :gs_parameter
+
+ before_filter :spread_breadcrumbs
+
+ def index
+ @gs_parameters_unordered = GsParameter.scoped
+ @gs_parameters = GsParameter.order([:section, :name])
+ @sections = @gs_parameters.pluck(:section).uniq.sort
+ end
+
+ def show
+ @gs_parameter = GsParameter.find(params[:id])
+ end
+
+ def new
+ @gs_parameter = GsParameter.new
+ end
+
+ def edit
+ @gs_parameter = GsParameter.find(params[:id])
+ end
+
+ def update
+ @gs_parameter = GsParameter.find(params[:id])
+ if @gs_parameter.update_attributes(gs_parameter_params)
+ redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ private
+ def gs_parameter_params
+ params.require(:gs_parameter).permit(:value, :class_type, :description)
+ end
+
+ def spread_breadcrumbs
+ add_breadcrumb t("gs_parameters.index.page_title"), gs_parameters_path
+ if @gs_parameter && !@gs_parameter.new_record?
+ add_breadcrumb @gs_parameter, gs_parameter_path(@gs_parameter)
+ end
+ end
+end