widget_list 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,7 +7,13 @@
7
7
 
8
8
  ****
9
9
 
10
- This is my first gem ever!
10
+ This is my first gem ever! It is an exciting gem because it is being used in production by a fortune 500 company. Please use and give me feedback/issues/pull requests.
11
+
12
+ ****
13
+
14
+ ## Summary
15
+
16
+ ****
11
17
 
12
18
  I feel like there are not very good lists in ruby/rails and/or dont care to find any because nothing will compare to widget_list's implementation.
13
19
 
@@ -29,7 +35,7 @@ In rails you have will_paginate and other ones like it using the ActiveRecord ap
29
35
  * Grouping/Predefined report filter feature
30
36
  * Either use a custom advanced searching form you build, or use the ransack dependency to build out a powerful filtering mechanism on the DOWN ARROW form users click. (See screenshots below)
31
37
  * Granular control over site-wide list parameter defaults using [A WidgetList Helper][1] or by simply copying the desired partial from the gem's app/views/widget_list/list_partials into your app/views/widget_list/list_partials and modifying the template for your "site-wide template" and outer list shells
32
- * Support for theme plugins such as [The Blue Sky Basin Theme][2]
38
+ ** Support for theme plugins such as [The Blue Sky Basin Theme][2]
33
39
 
34
40
  ****
35
41
 
@@ -37,24 +43,34 @@ In rails you have will_paginate and other ones like it using the ActiveRecord ap
37
43
 
38
44
  ****
39
45
 
40
- Main Example Loaded:
46
+ ### Main Example Loaded:
47
+
41
48
  ![](http://davidrenne.com/github/widget_list/main.png)
42
49
 
43
- Filter Drop Downs:
50
+ ###Filter Drop Downs:
51
+
44
52
  ![](http://davidrenne.com/github/widget_list/filtered.png)
45
53
 
46
- Searching a row (with wild card search):
54
+ ###Searching a row (with wild card search):
55
+
47
56
  ![](http://davidrenne.com/github/widget_list/search.png)
48
57
 
49
- Searching "name=asdf_18" (With ActiveRecord and Ransack hook):
58
+ ###Searching "name=asdf_18" (With ActiveRecord and Ransack hook):
59
+
50
60
  ![](http://davidrenne.com/github/widget_list/ransack1.png)
51
61
 
52
- Searching "name=asdf_18" and "sku<9000"(With ActiveRecord and Ransack hook):
62
+ ###Searching "name=asdf_18" and "sku<9000"(With ActiveRecord and Ransack hook):
63
+
53
64
  ![](http://davidrenne.com/github/widget_list/ransack2.png)
54
65
 
55
- Searching "name=asdf_18" and "sku < 9000" and "price > 67" (With ActiveRecord and Ransack hook):
66
+ ###Searching "name=asdf_18" and "sku < 9000" and "price > 67" (With ActiveRecord and Ransack hook):
67
+
56
68
  ![](http://davidrenne.com/github/widget_list/ransack3.png)
57
69
 
70
+ ###Theme plugins/gem support ([The Blue Sky Basin Theme][2]):
71
+
72
+ ![](http://davidrenne.com/github/widget_list/theme_blue_sky_basin.png)
73
+
58
74
 
59
75
  ****
60
76
 
@@ -1,20 +1,22 @@
1
- <!--WRAP_START-->
2
- <!--HEADER-->
3
- <!--CUSTOM_CONTENT_TOP-->
4
- <div class="<!--CLASS-->" id="<!--NAME-->">
5
- <table class="widget_list <!--TABLE_CLASS-->" style="<!--INLINE_STYLE-->;border:<!--TABLE_BORDER-->;-moz-border-radius-bottomleft:<!--CORNER_RADIUS-->;-webkit-border-bottom-left-radius:<!--CORNER_RADIUS-->;border-bottom-left-radius:<!--CORNER_RADIUS-->;-moz-border-radius-bottomright:<!--CORNER_RADIUS-->;-webkit-border-bottom-right-radius:<!--CORNER_RADIUS-->;border-bottom-right-radius:<!--CORNER_RADIUS-->;-moz-border-radius-topright:<!--CORNER_RADIUS-->;-webkit-border-top-right-radius:<!--CORNER_RADIUS-->;border-top-right-radius:<!--CORNER_RADIUS-->;-moz-border-radius-topleft:<!--CORNER_RADIUS-->;-webkit-border-top-left-radius:<!--CORNER_RADIUS-->;border-top-left-radius:<!--CORNER_RADIUS-->;" width="100%" cellpadding="0" cellspacing="0">
6
- <!--LIST_TITLE-->
7
- <tr class="widget_list_header" style="background-color:<!--HEADER_COLOR-->;color:<!--HEADER_TXT_COLOR-->;-moz-border-radius-topright:<!--CORNER_RADIUS-->;-webkit-border-top-right-radius:<!--CORNER_RADIUS-->;border-top-right-radius:<!--CORNER_RADIUS-->;-moz-border-radius-topleft:<!--CORNER_RADIUS-->;-webkit-border-top-left-radius:<!--CORNER_RADIUS-->;border-top-left-radius:<!--CORNER_RADIUS-->;"><!--HEADERS--></tr>
8
- <!--DATA-->
9
- <tr style="-moz-border-radius-bottomleft:<!--CORNER_RADIUS-->;-webkit-border-bottom-left-radius:<!--CORNER_RADIUS-->;border-bottom-left-radius:<!--CORNER_RADIUS-->;-moz-border-radius-bottomright:<!--CORNER_RADIUS-->;-webkit-border-bottom-right-radius:<!--CORNER_RADIUS-->;border-bottom-right-radius:<!--CORNER_RADIUS-->;">
10
- <td colspan="<!--COLSPAN_FULL-->" align="left" style="padding:0px;margin:0px;text-align:left">
11
- <div style="background-color:<!--FOOTER_COLOR-->;hieght:50px;color:<!--FOOTER_TXT_COLOR-->;-moz-border-radius-bottomleft:<!--CORNER_RADIUS-->;-webkit-border-bottom-left-radius:<!--CORNER_RADIUS-->;border-bottom-left-radius:<!--CORNER_RADIUS-->;-moz-border-radius-bottomright:<!--CORNER_RADIUS-->;-webkit-border-bottom-right-radius:<!--CORNER_RADIUS-->;border-bottom-right-radius:<!--CORNER_RADIUS-->;"><div style="padding:10px"><!--CUSTOM_CONTENT_BOTTOM--></div>
12
- </td>
13
- </tr>
14
- </table>
15
- <div class="pagination" style="float:left;text-align:left;width:100%;margin:0px;padding:0px;"><div style="margin:auto;float:left;margin:0px;padding:0px;"><!--PAGINATION_LIST--></div></div>
16
- <!--FILTER-->
17
- <input type="hidden" name="<!--JUMP_URL_NAME-->" id="<!--JUMP_URL_NAME-->" value="<!--JUMP_URL-->">
18
- <input type="hidden" name="<!--NAME-->_radius" id="<!--NAME-->_radius" value="<!--CORNER_RADIUS-->">
19
- </div>
20
- <!--WRAP_END-->
1
+ <div style='font-family:<!--FONT-->;'>
2
+ <!--WRAP_START-->
3
+ <!--HEADER-->
4
+ <!--CUSTOM_CONTENT_TOP-->
5
+ <div class="<!--CLASS-->" id="<!--NAME-->">
6
+ <table class="widget_list <!--TABLE_CLASS-->" style="<!--INLINE_STYLE-->;<!--BOX_SHADOW--> border:<!--TABLE_BORDER-->;-moz-border-radius-bottomleft:<!--CORNER_RADIUS-->;-webkit-border-bottom-left-radius:<!--CORNER_RADIUS-->;border-bottom-left-radius:<!--CORNER_RADIUS-->;-moz-border-radius-bottomright:<!--CORNER_RADIUS-->;-webkit-border-bottom-right-radius:<!--CORNER_RADIUS-->;border-bottom-right-radius:<!--CORNER_RADIUS-->;-moz-border-radius-topright:<!--CORNER_RADIUS-->;-webkit-border-top-right-radius:<!--CORNER_RADIUS-->;border-top-right-radius:<!--CORNER_RADIUS-->;-moz-border-radius-topleft:<!--CORNER_RADIUS-->;-webkit-border-top-left-radius:<!--CORNER_RADIUS-->;border-top-left-radius:<!--CORNER_RADIUS-->;" width="100%" cellpadding="0" cellspacing="0">
7
+ <!--LIST_TITLE-->
8
+ <tr class="widget_list_header" style="font-size: <!--FONT_HEADER-->; background-color:<!--HEADER_COLOR-->;color:<!--HEADER_TXT_COLOR-->;-moz-border-radius-topright:<!--CORNER_RADIUS-->;-webkit-border-top-right-radius:<!--CORNER_RADIUS-->;border-top-right-radius:<!--CORNER_RADIUS-->;-moz-border-radius-topleft:<!--CORNER_RADIUS-->;-webkit-border-top-left-radius:<!--CORNER_RADIUS-->;border-top-left-radius:<!--CORNER_RADIUS-->;"><!--HEADERS--></tr>
9
+ <!--DATA-->
10
+ <tr style="font-size: <!--FONT_HEADER-->; -moz-border-radius-bottomleft:<!--CORNER_RADIUS-->;-webkit-border-bottom-left-radius:<!--CORNER_RADIUS-->;border-bottom-left-radius:<!--CORNER_RADIUS-->;-moz-border-radius-bottomright:<!--CORNER_RADIUS-->;-webkit-border-bottom-right-radius:<!--CORNER_RADIUS-->;border-bottom-right-radius:<!--CORNER_RADIUS-->;">
11
+ <td colspan="<!--COLSPAN_FULL-->" align="left" style="padding:0px;margin:0px;text-align:left;<!--BORDER_HEAD_FOOT_TOP-->">
12
+ <div style="background-color:<!--FOOTER_COLOR-->;hieght:50px;color:<!--FOOTER_TXT_COLOR-->;-moz-border-radius-bottomleft:<!--CORNER_RADIUS-->;-webkit-border-bottom-left-radius:<!--CORNER_RADIUS-->;border-bottom-left-radius:<!--CORNER_RADIUS-->;-moz-border-radius-bottomright:<!--CORNER_RADIUS-->;-webkit-border-bottom-right-radius:<!--CORNER_RADIUS-->;border-bottom-right-radius:<!--CORNER_RADIUS-->;"><div style="padding:10px"><!--CUSTOM_CONTENT_BOTTOM--></div>
13
+ </td>
14
+ </tr>
15
+ </table>
16
+ <div class="pagination"><div><!--PAGINATION_LIST--></div></div>
17
+ <!--FILTER-->
18
+ <input type="hidden" name="<!--JUMP_URL_NAME-->" id="<!--JUMP_URL_NAME-->" value="<!--JUMP_URL-->">
19
+ <input type="hidden" name="<!--NAME-->_radius" id="<!--NAME-->_radius" value="<!--CORNER_RADIUS-->">
20
+ </div>
21
+ <!--WRAP_END-->
22
+ </div>
data/lib/widget_list.rb CHANGED
@@ -145,7 +145,7 @@ module WidgetList
145
145
  # if no one passed a listSearchForm inject a default one to show the ransack form
146
146
  #
147
147
  fill = {
148
- '<!--BUTTON_SEARCH-->' => WidgetList::Widgets::widget_button('Search', {'onclick' => WidgetList::List::build_search_button_click(@items)}),
148
+ '<!--BUTTON_SEARCH-->' => WidgetList::Widgets::widget_button('Search', {'onclick' => WidgetList::List::build_search_button_click(@items), 'innerClass' => @items['defaultButtonClass'] }),
149
149
  '<!--BUTTON_CLOSE-->' => "HideAdvancedSearch(this)"
150
150
  }
151
151
  @items['listSearchForm'] = WidgetList::Utils::fill( fill , ac.render_to_string(:partial => 'widget_list/ransack_widget_list_advanced_search') )
@@ -153,6 +153,12 @@ module WidgetList
153
153
  end
154
154
  end
155
155
 
156
+ # I have several different styles for borders, but using borders Everywhere will setup everything with one call
157
+ if @items['bordersEverywhere?']
158
+ @items['borderedColumns'] = @items['borderHeadFoot'] = @items['borderedRows'] = true
159
+ @items['borderColumnStyle'] = @items['borderRowStyle'] = @items['headFootBorderStyle'] = @items['tableBorder'] = @items['borderEverywhere']
160
+ end
161
+
156
162
  # current_db is a flag of the last known primary or secondary YML used or defaulted when running a list
157
163
  @current_db_selection = @items['database']
158
164
 
@@ -412,7 +418,7 @@ module WidgetList
412
418
 
413
419
  if ! $_REQUEST.key?('BUTTON_VALUE') && !@items['title'].empty?
414
420
  @items['templateHeader'] = '
415
- <h1 style="font-size:24px;"><!--TITLE--></h1><div class="horizontal_rule"></div>
421
+ <h1 style="font-size:' + get_header_px_value() + ';"><!--TITLE--></h1><div class="horizontal_rule"></div>
416
422
  <!--FILTER_HEADER-->
417
423
  '
418
424
  elsif !$_REQUEST.key?('BUTTON_VALUE')
@@ -606,11 +612,39 @@ module WidgetList
606
612
  'columnNoSort' => {},
607
613
 
608
614
  #
609
- # Column Border (on right)
615
+ # Column Border (on right of each column)
610
616
  #
611
617
  'borderedColumns' => false,
612
618
  'borderColumnStyle' => '1px solid #CCCCCC',
613
619
 
620
+ #
621
+ # Row Border (on top of each row)
622
+ #
623
+ 'borderedRows' => false,
624
+ 'borderRowStyle' => '1px solid #CCCCCC',
625
+
626
+ #
627
+ # Head/Foot border
628
+ #
629
+ 'borderHeadFoot' => false,
630
+ 'headFootBorderStyle' => '1px solid #CCCCCC',
631
+
632
+ 'bordersEverywhere?' => false,
633
+ 'borderEverywhere' => '1px solid #CCCCCC',
634
+
635
+ #
636
+ # Buttons
637
+ #
638
+ 'defaultButtonClass' => 'info',
639
+
640
+ #
641
+ # Font
642
+ #
643
+ 'fontFamily' => '"Times New Roman", Times, serif',
644
+ 'headerFooterFontSize' => '14px',
645
+ 'dataFontSize' => '14px',
646
+ 'titleFontSize' => '24px',
647
+
614
648
  #
615
649
  # Table Colors
616
650
  #
@@ -621,10 +655,16 @@ module WidgetList
621
655
  'tableBorder' => '1',
622
656
  'cornerRadius' => 15,
623
657
 
658
+ 'useBoxShadow' => true,
659
+ 'shadowInset' => 10,
660
+ 'shadowSpread' => 20,
661
+ 'shadowColor' => '#888888',
662
+
624
663
  #
625
664
  # Row specifics
626
665
  #
627
666
  'rowClass' => '',
667
+ 'rowFontColor' => 'black',
628
668
  'rowColorByStatus' => {},
629
669
  'rowStylesByStatus' => {},
630
670
  'rowOffsets' => ['#FFFFFF','#FFFFFF'],
@@ -973,6 +1013,15 @@ module WidgetList
973
1013
  end
974
1014
 
975
1015
  @templateFill['<!--CORNER_RADIUS-->'] = get_radius_value()
1016
+ @templateFill['<!--BOX_SHADOW-->'] = @items['useBoxShadow'] ? 'box-shadow: <!--SHADOW_INSET--> <!--SHADOW_INSET--> <!--SHADOW_SPREAD--> <!--SHADOW_COLOR-->;' : ''
1017
+ @templateFill['<!--SHADOW_INSET-->'] = get_shadow_inset_value()
1018
+ @templateFill['<!--SHADOW_SPREAD-->'] = get_shadow_spread_value()
1019
+ @templateFill['<!--SHADOW_COLOR-->'] = @items['shadowColor']
1020
+ @templateFill['<!--BORDER_HEAD_FOOT_TOP-->'] = @items['borderHeadFoot'] ? 'border-top:' + @items['headFootBorderStyle'] + ';' : ''
1021
+ @templateFill['<!--FONT-->'] = @items['fontFamily']
1022
+ @templateFill['<!--FONT_HEADER-->'] = @items['headerFooterFontSize']
1023
+
1024
+
976
1025
  @templateFill['<!--CUSTOM_CONTENT_BOTTOM-->']= @items['customFooter']
977
1026
  @templateFill['<!--CUSTOM_CONTENT_TOP-->'] = @items['customHeader']
978
1027
  @templateFill['<!--WRAP_START-->'] = ''
@@ -1133,7 +1182,7 @@ module WidgetList
1133
1182
  end
1134
1183
 
1135
1184
  if @items['showExport']
1136
- @headerPieces['exportButton'] = '<span class="' + @items['name'] + '-export">' + WidgetList::Widgets::widget_button(@items['exportButtonTitle'], {'onclick' => 'ListExport(\'' + @items['name'] + '\');'}, true) + '</span>'
1185
+ @headerPieces['exportButton'] = '<span class="' + @items['name'] + '-export">' + WidgetList::Widgets::widget_button(@items['exportButtonTitle'], { 'onclick' => 'ListExport(\'' + @items['name'] + '\');' , 'innerClass' => @items['defaultButtonClass'] }, true) + '</span>'
1137
1186
  @templateFill['<!--FILTER_HEADER-->'] += @headerPieces['exportButton']
1138
1187
  end
1139
1188
 
@@ -1169,6 +1218,18 @@ module WidgetList
1169
1218
  @items['cornerRadius'].to_s.include?('px') ? @items['cornerRadius'].to_s : @items['cornerRadius'].to_s + 'px'
1170
1219
  end
1171
1220
 
1221
+ def get_shadow_inset_value()
1222
+ @items['shadowInset'].to_s.include?('px') ? @items['shadowInset'].to_s : @items['shadowInset'].to_s + 'px'
1223
+ end
1224
+
1225
+ def get_shadow_spread_value()
1226
+ @items['shadowSpread'].to_s.include?('px') ? @items['shadowSpread'].to_s : @items['shadowSpread'].to_s + 'px'
1227
+ end
1228
+
1229
+ def get_header_px_value()
1230
+ @items['titleFontSize'].to_s.include?('px') ? @items['titleFontSize'].to_s : @items['titleFontSize'].to_s + 'px'
1231
+ end
1232
+
1172
1233
  def get_header_pieces()
1173
1234
  @headerPieces
1174
1235
  end
@@ -1427,6 +1488,8 @@ module WidgetList
1427
1488
  colWidthStyle += 'border-right: ' + @items['borderColumnStyle'] + ';'
1428
1489
  end
1429
1490
 
1491
+ colWidthStyle += @items['borderHeadFoot'] ? 'border-bottom:' + @items['headFootBorderStyle'] + ';' : ''
1492
+
1430
1493
  $_SESSION.deep_merge!({'LIST_SEQUENCE' => { @sqlHash => @sequence} })
1431
1494
 
1432
1495
  #Hover Title
@@ -1963,6 +2026,7 @@ module WidgetList
1963
2026
  if (renderButton)
1964
2027
  strCnt += (buttonAttribs['text'].length * 15)
1965
2028
  attributes = buttonAttribs.dup.deep_merge!({'page' => page})
2029
+ attributes['innerClass'] = @items['defaultButtonClass']
1966
2030
  btnOut << WidgetList::Widgets::widget_button(buttonAttribs['text'], attributes , true)
1967
2031
  end
1968
2032
  }
@@ -2043,6 +2107,9 @@ module WidgetList
2043
2107
  #
2044
2108
  # For each column (field) in this row
2045
2109
  #
2110
+
2111
+ changedFontColor = false
2112
+
2046
2113
  @items['fields'].each { |column , fieldTitle|
2047
2114
  column = strip_aliases(column)
2048
2115
 
@@ -2166,6 +2233,9 @@ module WidgetList
2166
2233
  @items['rowStylesByStatus'][column].each { |status,inlineStyle|
2167
2234
  if status === content
2168
2235
  customRowStyle = inlineStyle
2236
+ if inlineStyle.include?('color:') || inlineStyle.include?('color :')
2237
+ changedFontColor = true
2238
+ end
2169
2239
  end
2170
2240
  }
2171
2241
  end
@@ -2181,6 +2251,10 @@ module WidgetList
2181
2251
  colPieces['<!--STYLE-->'] += 'border-right: ' + @items['borderColumnStyle'] + ';'
2182
2252
  end
2183
2253
 
2254
+ if @items['borderedRows']
2255
+ colPieces['<!--STYLE-->'] += 'border-top: ' + @items['borderRowStyle'] + ';'
2256
+ end
2257
+
2184
2258
  colPieces['<!--ONCLICK-->'] = onClick
2185
2259
  colPieces['<!--TITLE-->'] = contentTitle #todo htmlentities needed ?
2186
2260
  colPieces['<!--CONTENT-->'] = content
@@ -2220,6 +2294,12 @@ module WidgetList
2220
2294
  pieces['<!--ROWSTYLE-->'] = !customRowStyle.empty? ? customRowStyle : ''
2221
2295
  pieces['<!--ROWCLASS-->'] = @items['rowClass']
2222
2296
  end
2297
+ pieces['<!--ROWSTYLE-->'] += 'font-size:' + @items['dataFontSize'] + ';'
2298
+
2299
+ if !changedFontColor
2300
+ pieces['<!--ROWSTYLE-->'] += 'color:' + @items['rowFontColor'] + ';'
2301
+ end
2302
+
2223
2303
  rows << WidgetList::Utils::fill(pieces, @items['row'])
2224
2304
 
2225
2305
  end
@@ -1,3 +1,3 @@
1
1
  module WidgetList
2
- VERSION = "1.1.9"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -672,6 +672,23 @@ div.inputOuter .inputInner input.search-ahead-advanced {width: 90% !important;}
672
672
  /*
673
673
  * Pagination
674
674
  */
675
+ .pagination
676
+ {
677
+ float:left;
678
+ text-align:left;
679
+ width:100%;
680
+ margin:0px;
681
+ padding:0px;
682
+ }
683
+
684
+ .pagination div
685
+ {
686
+ margin:auto;
687
+ float:left;
688
+ margin:0px;
689
+ padding:0px;
690
+ }
691
+
675
692
  .page_legacy li
676
693
  {
677
694
  display:inline;
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.9
4
+ version: 1.2.0
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-04-08 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel