summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/gs_parameters_controller.rb12
-rw-r--r--app/views/gs_parameters/index.html.haml48
-rw-r--r--app/views/gs_parameters/show.html.haml10
3 files changed, 56 insertions, 14 deletions
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
index bd8b44b..106ce76 100644
--- a/app/controllers/gs_parameters_controller.rb
+++ b/app/controllers/gs_parameters_controller.rb
@@ -4,9 +4,15 @@ class GsParametersController < ApplicationController
before_filter :spread_breadcrumbs
def index
- @gs_parameters_unordered = GsParameter.scoped
- @gs_parameters = GsParameter.order([:section, :name])
- @sections = @gs_parameters.pluck(:section).uniq.sort
+ @gs_parameters = GsParameter.order([:entity, :section, :name])
+
+ @entities = Hash.new()
+ @gs_parameters.each do |parameter|
+ if !@entities[parameter.entity]
+ @entities[parameter.entity] = Hash.new()
+ end
+ @entities[parameter.entity][parameter.section] = true
+ end
end
def show
diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml
index 8df2bb3..9d757a0 100644
--- a/app/views/gs_parameters/index.html.haml
+++ b/app/views/gs_parameters/index.html.haml
@@ -2,12 +2,42 @@
- cache(['gs_parameter_all_tables', I18n.locale, @gs_parameters.count, @gs_parameters.reorder(:updated_at).first, @gs_parameters.reorder(:updated_at).last]) do
- if @gs_parameters && @gs_parameters.count > 0
- - if @sections
- - @sections.each do |section|
- %h3= section
- %table.table.table-striped
- -# Template Dependency: gs_parameters/_index_core
- = render "index_core", :gs_parameters => @gs_parameters.where(:section => section)
- - else
- %table.table.table-striped
- = render "index_core", :gs_parameters => @gs_parameters
+ %table.table.table-striped
+ %thead
+ %tr
+ %th
+ %th
+ %th
+ %th
+
+ %tbody
+ - @entities.each do |entity_name, entity|
+ %tr.table.info
+ %td{:colspan => 5}
+ - if !entity_name.blank?
+ %strong= entity_name
+ - entity.each do |section_name, section|
+ %tr.table.success
+ %td
+ %td{:colspan => 4}
+ %strong= section_name
+ - gs_parameters = @gs_parameters.where(:entity => entity_name, :section => section_name)
+ - cache(['gs_parameter_sub_table', I18n.locale, gs_parameters.count, gs_parameters.reorder(:updated_at).first, gs_parameters.reorder(:updated_at).last]) do
+
+ - for gs_parameter in gs_parameters
+ - cache(['gs_parameters_table_single_row', I18n.locale, gs_parameter]) do
+ %tr
+ %td
+ %td
+ %td
+ %span.hidden-phone
+ = truncate(gs_parameter.name, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH'))
+ %span.visible-phone
+ = truncate(gs_parameter.name, :length => GsParameter.get('MOBILE_MAX_STRING_LENGTH'))
+ %td
+ %span.hidden-phone
+ = truncate(gs_parameter.value, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH'))
+ %span.visible-phone
+ = truncate(gs_parameter.value, :length => GsParameter.get('MOBILE_MAX_STRING_LENGTH'))
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter}
+
diff --git a/app/views/gs_parameters/show.html.haml b/app/views/gs_parameters/show.html.haml
index 706625f..85e9b98 100644
--- a/app/views/gs_parameters/show.html.haml
+++ b/app/views/gs_parameters/show.html.haml
@@ -4,10 +4,11 @@
%table.table.table-striped
%tbody
%tr
+ %tr
%td
- %strong= t('gs_parameters.show.name') + ":"
+ %strong= t('gs_parameters.show.entity') + ":"
%td
- = @gs_parameter.name
+ = @gs_parameter.entity
%tr
%td
%strong= t('gs_parameters.show.section') + ":"
@@ -15,6 +16,11 @@
= @gs_parameter.section
%tr
%td
+ %strong= t('gs_parameters.show.name') + ":"
+ %td
+ = @gs_parameter.name
+ %tr
+ %td
%strong= t('gs_parameters.show.value') + ":"
%td
= @gs_parameter.value