diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/gs_parameters_controller.rb | 18 | ||||
-rw-r--r-- | app/models/ability.rb | 4 | ||||
-rw-r--r-- | app/views/gs_parameters/_index_core.html.haml | 25 | ||||
-rw-r--r-- | app/views/gs_parameters/index.html.haml | 11 | ||||
-rw-r--r-- | app/views/gs_parameters/new.html.haml | 3 |
5 files changed, 27 insertions, 34 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 |