widget_list 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -287,21 +287,24 @@ Style a row based on the value of the column.
287
287
  #
288
288
  # Handle Dynamic Filters
289
289
  #
290
- if $_REQUEST.key?('switch_grouping') && $_REQUEST['switch_grouping'] == 'Item Name'
291
- groupByFilter = 'item'
292
- countSQL = 'COUNT(1) as cnt,'
293
- groupBySQL = 'GROUP BY name'
294
- groupByDesc = ' (Grouped By Name)'
295
- elsif $_REQUEST.key?('switch_grouping') && $_REQUEST['switch_grouping'] == 'Sku Number'
296
- groupByFilter = 'sku'
297
- countSQL = 'COUNT(1) as cnt,'
298
- groupBySQL = 'GROUP BY sku'
299
- groupByDesc = ' (Grouped By Sku Number)'
300
- else
301
- groupByFilter = 'none'
302
- countSQL = ''
303
- groupBySQL = ''
304
- groupByDesc = ''
290
+ groupBy = WidgetList::List::get_group_by_selection(list_parms)
291
+
292
+ case groupBy
293
+ when 'Item Name'
294
+ groupByFilter = 'item'
295
+ countSQL = 'COUNT(1) as cnt,'
296
+ groupBySQL = 'GROUP BY name'
297
+ groupByDesc = ' (Grouped By Name)'
298
+ when 'Sku Number'
299
+ groupByFilter = 'sku'
300
+ countSQL = 'COUNT(1) as cnt,'
301
+ groupBySQL = 'GROUP BY sku'
302
+ groupByDesc = ' (Grouped By Sku Number)'
303
+ else
304
+ groupByFilter = 'none'
305
+ countSQL = ''
306
+ groupBySQL = ''
307
+ groupByDesc = ''
305
308
  end
306
309
 
307
310
  list_parms['filter'] = []
@@ -13,7 +13,7 @@ ActionController::Base.class_eval {
13
13
  def store_session
14
14
  # Store pre-defined widget_list session items to the actual session
15
15
 
16
- %w(pageDisplayLimit DRILL_DOWNS ROW_LIMIT list_checks SEARCH_FILTER LIST_SEQUENCE LIST_COL_SORT list_count DRILL_DOWN_FILTERS).each { |key|
16
+ %w(pageDisplayLimit DRILL_DOWNS CURRENT_GROUPING ROW_LIMIT list_checks SEARCH_FILTER LIST_SEQUENCE LIST_COL_SORT list_count DRILL_DOWN_FILTERS).each { |key|
17
17
  self.session[key] = $_SESSION[key]
18
18
  }
19
19
 
@@ -1,3 +1,3 @@
1
1
  module WidgetList
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
data/lib/widget_list.rb CHANGED
@@ -893,7 +893,7 @@ module WidgetList
893
893
 
894
894
  if $_REQUEST.key?('drill_down') && !$_REQUEST.key?('searchClear')
895
895
  drillDown = $_REQUEST['drill_down']
896
- $_SESSION.deep_merge!({'DRILL_DOWNS' => { listId => drillDown} }) && !$_REQUEST.key?('searchClear')
896
+ $_SESSION.deep_merge!({'DRILL_DOWNS' => { listId => drillDown} })
897
897
  elsif $_SESSION.key?('DRILL_DOWNS') && $_SESSION['DRILL_DOWNS'].key?(listId) && !$_REQUEST.key?('searchClear')
898
898
  drillDown = $_SESSION['DRILL_DOWNS'][listId]
899
899
  else
@@ -909,6 +909,22 @@ module WidgetList
909
909
  return drillDown, filter
910
910
  end
911
911
 
912
+ def self.get_group_by_selection(list_parms)
913
+ groupBy = ''
914
+
915
+ if $_REQUEST.key?('switch_grouping')
916
+ groupBy = $_REQUEST['switch_grouping']
917
+ $_SESSION.deep_merge!({'CURRENT_GROUPING' => { list_parms['name'] => groupBy} })
918
+ elsif $_SESSION.key?('CURRENT_GROUPING') && $_SESSION['CURRENT_GROUPING'].key?(list_parms['name'])
919
+ groupBy = $_SESSION['CURRENT_GROUPING'][list_parms['name']]
920
+ list_parms['groupBySelected'] = groupBy
921
+ else
922
+ groupBy = ''
923
+ end
924
+
925
+ return groupBy
926
+ end
927
+
912
928
  def clear_sort_get_vars()
913
929
  $_REQUEST.delete('LIST_FILTER_ALL')
914
930
  $_REQUEST.delete('ROW_LIMIT')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: widget_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-05 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel