summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-06 20:52:04 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-06 20:52:04 +0100
commit464a2f4907bd27b62f7b5cc5d7537b90469b03bd (patch)
tree350c0fe981cfe1cf7d9b4de51ad73b7e3a26449b
parentc500e125c2ee5297b51e463f93940d450dab0813 (diff)
GsParameter can only be created or destroyed by migrations.
-rw-r--r--app/controllers/gs_parameters_controller.rb18
-rw-r--r--app/models/ability.rb4
-rw-r--r--app/views/gs_parameters/_index_core.html.haml25
-rw-r--r--app/views/gs_parameters/index.html.haml11
-rw-r--r--app/views/gs_parameters/new.html.haml3
-rw-r--r--config/locales/views/gs_parameters/de.yml32
-rw-r--r--config/locales/views/gs_parameters/en.yml21
-rw-r--r--config/routes.rb2
8 files changed, 55 insertions, 61 deletions
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
index be3378e..8f693aa 100644
--- a/app/controllers/gs_parameters_controller.rb
+++ b/app/controllers/gs_parameters_controller.rb
@@ -1,6 +1,7 @@
class GsParametersController < ApplicationController
def index
- @gs_parameters = GsParameter.all
+ @gs_parameters = GsParameter.order([:section, :name])
+ @sections = @gs_parameters.pluck(:section).uniq.sort
end
def show
@@ -11,15 +12,6 @@ class GsParametersController < ApplicationController
@gs_parameter = GsParameter.new
end
- def create
- @gs_parameter = GsParameter.new(params[:gs_parameter])
- if @gs_parameter.save
- redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_created')
- else
- render :new
- end
- end
-
def edit
@gs_parameter = GsParameter.find(params[:id])
end
@@ -32,10 +24,4 @@ class GsParametersController < ApplicationController
render :edit
end
end
-
- def destroy
- @gs_parameter = GsParameter.find(params[:id])
- @gs_parameter.destroy
- redirect_to gs_parameters_url, :notice => t('gs_parameters.controller.successfuly_destroyed')
- end
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index f4068ca..0fa40c8 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -73,6 +73,10 @@ class Ability
if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == false
cannot :manage, PhoneNumberRange
end
+
+ # GsParameter can't be created or deleted via the GUI
+ #
+ cannot [:create, :destroy], GsParameter
else
# Any user can do the following stuff.
#
diff --git a/app/views/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml
index cc6fdd9..57fd85f 100644
--- a/app/views/gs_parameters/_index_core.html.haml
+++ b/app/views/gs_parameters/_index_core.html.haml
@@ -1,17 +1,14 @@
-%table
- %tr
- %th= t('gs_parameters.index.name')
+%tr
+ %th= t('gs_parameters.index.name')
+ - if !@sections
%th= t('gs_parameters.index.section')
- %th= t('gs_parameters.index.value')
- %th= t('gs_parameters.index.class_type')
- %th= t('gs_parameters.index.description')
+ %th= t('gs_parameters.index.value')
- - reset_cycle
- - for gs_parameter in gs_parameters
- %tr{:class => cycle('odd', 'even')}
- %td= gs_parameter.name
+- reset_cycle
+- for gs_parameter in gs_parameters
+ %tr{:class => cycle('odd', 'even')}
+ %td= gs_parameter.name
+ - if !@sections
%td= gs_parameter.section
- %td= gs_parameter.value
- %td= gs_parameter.class_type
- %td= gs_parameter.description
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter} \ No newline at end of file
+ %td= gs_parameter.value
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter} \ No newline at end of file
diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml
index 4c9ac84..753e64b 100644
--- a/app/views/gs_parameters/index.html.haml
+++ b/app/views/gs_parameters/index.html.haml
@@ -1,6 +1,15 @@
- title t("gs_parameters.index.page_title")
- if @gs_parameters && @gs_parameters.count > 0
- = render "index_core", :gs_parameters => @gs_parameters
+ - if @sections
+ %table
+ - @sections.each do |section|
+ %tr
+ %td{:colspan => 3}
+ %h3= section
+ = render "index_core", :gs_parameters => @gs_parameters.where(:section => section)
+ - else
+ %table
+ = render "index_core", :gs_parameters => @gs_parameters
= render :partial => 'shared/create_link', :locals => {:child_class => GsParameter} \ No newline at end of file
diff --git a/app/views/gs_parameters/new.html.haml b/app/views/gs_parameters/new.html.haml
deleted file mode 100644
index 845acc2..0000000
--- a/app/views/gs_parameters/new.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-- title t("gs_parameters.new.page_title")
-
-= render "form" \ No newline at end of file
diff --git a/config/locales/views/gs_parameters/de.yml b/config/locales/views/gs_parameters/de.yml
index f6935b8..718b693 100644
--- a/config/locales/views/gs_parameters/de.yml
+++ b/config/locales/views/gs_parameters/de.yml
@@ -1,42 +1,42 @@
de:
gs_parameters:
- name: 'Gsparameter'
+ name: 'Gemeinschaft Parameter'
controller:
- successfuly_created: 'Gsparameter wurde angelegt.'
- successfuly_updated: 'Gsparameter wurde aktualisiert.'
- successfuly_destroyed: 'Gsparameter wurde gelöscht.'
+ successfuly_created: 'Ein Gemeinschaft Parameter wurde angelegt.'
+ successfuly_updated: 'Ein Gemeinschaft Parameter wurde aktualisiert. Bitte rebooten Sie Ihr System jetzt!'
+ successfuly_destroyed: 'Ein Gemeinschaft Parameter wurde gelöscht.'
index:
- page_title: 'Übersicht von Gsparameter'
+ page_title: 'Übersicht aller Gemeinschaft Parameter'
name: 'Name'
section: 'Section'
- value: 'Value'
+ value: 'Wert'
class_type: 'Class type'
- description: 'Description'
+ description: 'Beschreibung'
actions:
- confirm: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Gsparameter'
+ confirm: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Gemeinschaft Parmeter'
destroy: 'Löschen'
edit: 'Bearbeiten'
show: 'Anzeigen'
create: 'Neu anlegen'
- create_for: 'Gsparameter neu anlegen für %{resource}'
+ create_for: 'Gemeinschaft Parmeter neu anlegen für %{resource}'
show:
- page_title: 'Gsparameter bearbeiten'
+ page_title: 'Gemeinschaft Parmeter bearbeiten'
name: 'Name'
section: 'Section'
- value: 'Value'
+ value: 'Wert'
class_type: 'Class type'
- description: 'Description'
+ description: 'Beschreibung'
actions:
confirm: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
destroy: 'Löschen'
edit: 'Bearbeiten'
view_all: 'Alle anzeigen'
new:
- page_title: 'Gsparameter neu anlegen'
+ page_title: 'Gemeinschaft Parmeter neu anlegen'
actions:
back_to_list: 'Zurück zur Übersicht'
edit:
- page_title: 'Gsparameter bearbeiten'
+ page_title: 'Gemeinschaft Parmeter bearbeiten'
actions:
back_to_list: 'Zurück zur Übersicht'
edit: 'Bearbeiten'
@@ -49,12 +49,12 @@ de:
label: 'Section'
hint: ''
value:
- label: 'Value'
+ label: 'Wert'
hint: ''
class_type:
label: 'Class type'
hint: ''
description:
- label: 'Description'
+ label: 'Beschreibung'
hint: ''
button: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/gs_parameters/en.yml b/config/locales/views/gs_parameters/en.yml
index 040a6b8..cf8a9e6 100644
--- a/config/locales/views/gs_parameters/en.yml
+++ b/config/locales/views/gs_parameters/en.yml
@@ -1,26 +1,26 @@
en:
gs_parameters:
- name: 'Gsparameter'
+ name: 'Gemeinschaft parameter'
controller:
- successfuly_created: 'Successfully created Gsparameter.'
- successfuly_updated: 'Successfully updated Gsparameter.'
- successfuly_destroyed: 'Successfully destroyed Gsparameter.'
+ successfuly_created: 'Successfully created a Gemeinschaft parameter.'
+ successfuly_updated: 'Successfully updated a Gemeinschaft parameter. Please reboot your system now!'
+ successfuly_destroyed: 'Successfully destroyed a Gemeinschaft parameter.'
index:
- page_title: 'Listing Gsparameter'
+ page_title: 'Listing Gemeinschaft parameter'
name: 'Name'
section: 'Section'
value: 'Value'
class_type: 'Class type'
description: 'Description'
actions:
- confirm: 'Are you sure you want to delete this Gsparameter?'
+ confirm: 'Are you sure you want to delete this Gemeinschaft parameter?'
destroy: 'Delete'
edit: 'Edit'
show: 'View'
create: 'New'
- create_for: 'New Gsparameter for %{resource}'
+ create_for: 'New Gemeinschaft parameter for %{resource}'
show:
- page_title: 'Show Gsparameter'
+ page_title: 'Show Gemeinschaft parameter'
name: 'Name'
section: 'Section'
value: 'Value'
@@ -31,12 +31,13 @@ en:
destroy: 'Delete'
edit: 'Edit'
view_all: 'View All'
+ reboot_warning: 'Nach der Änderung eines Gemeinschaft Parameters müssen Sie das System neu booten!'
new:
- page_title: 'New Gsparameter'
+ page_title: 'New Gemeinschaft parameter'
actions:
back_to_list: 'Back to Index'
edit:
- page_title: 'Editing Gsparameter'
+ page_title: 'Editing Gemeinschaft parameter'
actions:
back_to_list: 'Back to Index'
edit: 'Edit'
diff --git a/config/routes.rb b/config/routes.rb
index ee333fe..a0ad6aa 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,5 @@
Gemeinschaft42c::Application.routes.draw do
- resources :gs_parameters
+ resources :gs_parameters, :only => [:show, :index, :update, :edit]
resources :automatic_call_distributors