widget_list 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.idea/workspace.xml CHANGED
@@ -2,15 +2,18 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="0bede1c9-1aed-4d82-8d14-4184b67697c4" name="Default" comment="">
5
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.gitignore" />
6
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Gemfile" />
7
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/LICENSE.txt" />
8
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/README.md" />
9
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Rakefile" />
10
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/widget_list.rb" />
11
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/widget_list/md5.rb" />
12
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/widget_list/version.rb" />
13
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/widget_list.gemspec" />
5
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/.rakeTasks" afterPath="$PROJECT_DIR$/.idea/.rakeTasks" />
6
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/vendor/assets/images/gobblecons/README.rtf" afterPath="$PROJECT_DIR$/vendor/assets/images/gobblecons/README.rtf" />
7
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
8
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list.rb" afterPath="$PROJECT_DIR$/lib/widget_list.rb" />
9
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list/sequel.rb" afterPath="$PROJECT_DIR$/lib/widget_list/sequel.rb" />
10
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list/utils.rb" afterPath="$PROJECT_DIR$/lib/widget_list/utils.rb" />
11
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list/version.rb" afterPath="$PROJECT_DIR$/lib/widget_list/version.rb" />
12
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list/widgets.rb" afterPath="$PROJECT_DIR$/lib/widget_list/widgets.rb" />
13
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/vendor/assets/javascripts/widget_list.js" afterPath="$PROJECT_DIR$/vendor/assets/javascripts/widget_list.js" />
14
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/vendor/assets/stylesheets/widget_list.css" afterPath="$PROJECT_DIR$/vendor/assets/stylesheets/widget_list.css" />
15
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/vendor/assets/stylesheets/widgets.css" afterPath="$PROJECT_DIR$/vendor/assets/stylesheets/widgets.css" />
16
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/widget_list.gemspec" afterPath="$PROJECT_DIR$/widget_list.gemspec" />
14
17
  </list>
15
18
  <ignored path="widget_list.iws" />
16
19
  <ignored path=".idea/workspace.xml" />
@@ -38,10 +41,10 @@
38
41
  </provider>
39
42
  </entry>
40
43
  </file>
41
- <file leaf-file-name="README.md" pinned="false" current="false" current-in-tab="false">
44
+ <file leaf-file-name="README.md" pinned="false" current="true" current-in-tab="true">
42
45
  <entry file="file://$PROJECT_DIR$/README.md">
43
46
  <provider selected="true" editor-type-id="text-editor">
44
- <state line="56" column="18" selection-start="1215" selection-end="1215" vertical-scroll-proportion="0.0">
47
+ <state line="327" column="0" selection-start="11641" selection-end="11641" vertical-scroll-proportion="0.9592391">
45
48
  <folding />
46
49
  </state>
47
50
  </provider>
@@ -59,7 +62,7 @@
59
62
  <file leaf-file-name="utils.rb" pinned="false" current="false" current-in-tab="false">
60
63
  <entry file="file://$PROJECT_DIR$/lib/widget_list/utils.rb">
61
64
  <provider selected="true" editor-type-id="text-editor">
62
- <state line="84" column="3" selection-start="1822" selection-end="1822" vertical-scroll-proportion="0.0">
65
+ <state line="88" column="3" selection-start="1904" selection-end="1904" vertical-scroll-proportion="0.0">
63
66
  <folding />
64
67
  </state>
65
68
  </provider>
@@ -68,7 +71,7 @@
68
71
  <file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
69
72
  <entry file="file://$PROJECT_DIR$/lib/widget_list/version.rb">
70
73
  <provider selected="true" editor-type-id="text-editor">
71
- <state line="3" column="0" selection-start="42" selection-end="42" vertical-scroll-proportion="0.0">
74
+ <state line="3" column="51" selection-start="42" selection-end="42" vertical-scroll-proportion="0.0">
72
75
  <folding />
73
76
  </state>
74
77
  </provider>
@@ -77,7 +80,7 @@
77
80
  <file leaf-file-name="sequel.rb" pinned="false" current="false" current-in-tab="false">
78
81
  <entry file="file://$PROJECT_DIR$/lib/widget_list/sequel.rb">
79
82
  <provider selected="true" editor-type-id="text-editor">
80
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
83
+ <state line="127" column="29" selection-start="3617" selection-end="3617" vertical-scroll-proportion="0.0">
81
84
  <folding />
82
85
  </state>
83
86
  </provider>
@@ -101,10 +104,10 @@
101
104
  </provider>
102
105
  </entry>
103
106
  </file>
104
- <file leaf-file-name="railtie.rb" pinned="false" current="true" current-in-tab="true">
107
+ <file leaf-file-name="railtie.rb" pinned="false" current="false" current-in-tab="false">
105
108
  <entry file="file://$PROJECT_DIR$/lib/widget_list/railtie.rb">
106
109
  <provider selected="true" editor-type-id="text-editor">
107
- <state line="9" column="45" selection-start="408" selection-end="408" vertical-scroll-proportion="0.27272728">
110
+ <state line="17" column="46" selection-start="903" selection-end="903" vertical-scroll-proportion="0.0">
108
111
  <folding />
109
112
  </state>
110
113
  </provider>
@@ -113,7 +116,7 @@
113
116
  <file leaf-file-name="widget_list.rb" pinned="false" current="false" current-in-tab="false">
114
117
  <entry file="file://$PROJECT_DIR$/lib/widget_list.rb">
115
118
  <provider selected="true" editor-type-id="text-editor">
116
- <state line="11" column="20" selection-start="318" selection-end="318" vertical-scroll-proportion="0.0">
119
+ <state line="2082" column="3" selection-start="75983" selection-end="75983" vertical-scroll-proportion="-13.033334">
117
120
  <folding />
118
121
  </state>
119
122
  </provider>
@@ -132,7 +135,6 @@
132
135
  <component name="IdeDocumentHistory">
133
136
  <option name="changedFiles">
134
137
  <list>
135
- <option value="$PROJECT_DIR$/Gemfile" />
136
138
  <option value="$PROJECT_DIR$/.gemspec" />
137
139
  <option value="$PROJECT_DIR$/rails/generators/widget_list/config/templates/widget-list.yml" />
138
140
  <option value="$PROJECT_DIR$/rails/generators/widget_list/config/config_generator.rb" />
@@ -141,13 +143,14 @@
141
143
  <option value="$PROJECT_DIR$/lib/widget_list/tpl.rb" />
142
144
  <option value="$PROJECT_DIR$/lib/extensions/action_controller_base.rb" />
143
145
  <option value="$PROJECT_DIR$/vendor/assets/javascripts/widget_list.js" />
144
- <option value="$PROJECT_DIR$/lib/widget_list/sequel.rb" />
145
- <option value="$PROJECT_DIR$/lib/widget_list.rb" />
146
146
  <option value="$PROJECT_DIR$/lib/widget_list/widgets.rb" />
147
147
  <option value="$PROJECT_DIR$/lib/widget_list/utils.rb" />
148
148
  <option value="$PROJECT_DIR$/lib/widget_list/string.rb" />
149
- <option value="$PROJECT_DIR$/README.md" />
150
149
  <option value="$PROJECT_DIR$/lib/widget_list/railtie.rb" />
150
+ <option value="$PROJECT_DIR$/lib/widget_list/sequel.rb" />
151
+ <option value="$PROJECT_DIR$/lib/widget_list.rb" />
152
+ <option value="$PROJECT_DIR$/lib/widget_list/version.rb" />
153
+ <option value="$PROJECT_DIR$/README.md" />
151
154
  </list>
152
155
  </option>
153
156
  </component>
@@ -155,7 +158,7 @@
155
158
  <option name="x" value="-5" />
156
159
  <option name="y" value="25" />
157
160
  <option name="width" value="1690" />
158
- <option name="height" value="937" />
161
+ <option name="height" value="889" />
159
162
  </component>
160
163
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
161
164
  <OptionsSetting value="true" id="Add" />
@@ -202,24 +205,6 @@
202
205
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
203
206
  </PATH_ELEMENT>
204
207
  </PATH>
205
- <PATH>
206
- <PATH_ELEMENT>
207
- <option name="myItemId" value="widget_list" />
208
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
209
- </PATH_ELEMENT>
210
- <PATH_ELEMENT>
211
- <option name="myItemId" value="widget_list" />
212
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
213
- </PATH_ELEMENT>
214
- <PATH_ELEMENT>
215
- <option name="myItemId" value="vendor" />
216
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
217
- </PATH_ELEMENT>
218
- <PATH_ELEMENT>
219
- <option name="myItemId" value="assets" />
220
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
221
- </PATH_ELEMENT>
222
- </PATH>
223
208
  <PATH>
224
209
  <PATH_ELEMENT>
225
210
  <option name="myItemId" value="widget_list" />
@@ -389,15 +374,15 @@
389
374
  <servers />
390
375
  </component>
391
376
  <component name="ToolWindowManager">
392
- <frame x="-5" y="25" width="1690" height="937" extended-state="6" />
377
+ <frame x="-5" y="25" width="1690" height="889" extended-state="6" />
393
378
  <editor active="true" />
394
379
  <layout>
395
380
  <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
396
381
  <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
397
382
  <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
398
383
  <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
399
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25887394" sideWeight="0.5763547" order="0" side_tool="false" content_ui="combo" />
400
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.42364532" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
384
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1988984" sideWeight="0.5763547" order="0" side_tool="false" content_ui="combo" />
385
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.56913185" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
401
386
  <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
402
387
  <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
403
388
  <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@@ -476,32 +461,22 @@
476
461
  </entry>
477
462
  <entry file="file://$PROJECT_DIR$/lib/widget_list/md5.rb">
478
463
  <provider selected="true" editor-type-id="text-editor">
479
- <state line="12" column="3" selection-start="125" selection-end="125" vertical-scroll-proportion="0.0">
480
- <folding />
481
- </state>
464
+ <state line="12" column="3" selection-start="125" selection-end="125" vertical-scroll-proportion="0.0" />
482
465
  </provider>
483
466
  </entry>
484
467
  <entry file="file://$PROJECT_DIR$/lib/extensions/action_controller_base.rb">
485
468
  <provider selected="true" editor-type-id="text-editor">
486
- <state line="15" column="197" selection-start="537" selection-end="537" vertical-scroll-proportion="-3.2333333">
487
- <folding />
488
- </state>
469
+ <state line="15" column="197" selection-start="537" selection-end="537" vertical-scroll-proportion="-3.2333333" />
489
470
  </provider>
490
471
  </entry>
491
472
  <entry file="file://$PROJECT_DIR$/vendor/assets/javascripts/widget_list.js">
492
473
  <provider selected="true" editor-type-id="text-editor">
493
- <state line="230" column="17" selection-start="4843" selection-end="4843" vertical-scroll-proportion="-3.0333333">
494
- <folding>
495
- <marker date="1356033703000" expanded="false" signature="-1:-1" placeholder="..." />
496
- </folding>
497
- </state>
474
+ <state line="230" column="17" selection-start="4843" selection-end="4843" vertical-scroll-proportion="-3.0333333" />
498
475
  </provider>
499
476
  </entry>
500
477
  <entry file="file://$PROJECT_DIR$/lib/widget_list/engine.rb">
501
478
  <provider selected="true" editor-type-id="text-editor">
502
- <state line="8" column="0" selection-start="211" selection-end="211" vertical-scroll-proportion="0.0">
503
- <folding />
504
- </state>
479
+ <state line="8" column="0" selection-start="211" selection-end="211" vertical-scroll-proportion="0.0" />
505
480
  </provider>
506
481
  </entry>
507
482
  <entry file="file://$PROJECT_DIR$/lib/widget_list/hash.rb">
@@ -518,58 +493,58 @@
518
493
  </state>
519
494
  </provider>
520
495
  </entry>
521
- <entry file="file://$PROJECT_DIR$/lib/widget_list/version.rb">
496
+ <entry file="file://$PROJECT_DIR$/lib/widget_list/widgets.rb">
522
497
  <provider selected="true" editor-type-id="text-editor">
523
- <state line="3" column="0" selection-start="42" selection-end="42" vertical-scroll-proportion="0.0">
498
+ <state line="731" column="3" selection-start="26450" selection-end="26450" vertical-scroll-proportion="0.0">
524
499
  <folding />
525
500
  </state>
526
501
  </provider>
527
502
  </entry>
528
- <entry file="file://$PROJECT_DIR$/lib/widget_list/sequel.rb">
503
+ <entry file="file://$PROJECT_DIR$/lib/widget_list/utils.rb">
529
504
  <provider selected="true" editor-type-id="text-editor">
530
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
505
+ <state line="88" column="3" selection-start="1904" selection-end="1904" vertical-scroll-proportion="0.0">
531
506
  <folding />
532
507
  </state>
533
508
  </provider>
534
509
  </entry>
535
- <entry file="file://$PROJECT_DIR$/lib/widget_list.rb">
510
+ <entry file="file://$PROJECT_DIR$/lib/widget_list/string.rb">
536
511
  <provider selected="true" editor-type-id="text-editor">
537
- <state line="11" column="20" selection-start="318" selection-end="318" vertical-scroll-proportion="0.0">
512
+ <state line="41" column="3" selection-start="568" selection-end="568" vertical-scroll-proportion="0.0">
538
513
  <folding />
539
514
  </state>
540
515
  </provider>
541
516
  </entry>
542
- <entry file="file://$PROJECT_DIR$/lib/widget_list/widgets.rb">
517
+ <entry file="file://$PROJECT_DIR$/lib/widget_list/railtie.rb">
543
518
  <provider selected="true" editor-type-id="text-editor">
544
- <state line="731" column="3" selection-start="26450" selection-end="26450" vertical-scroll-proportion="0.0">
519
+ <state line="17" column="46" selection-start="903" selection-end="903" vertical-scroll-proportion="0.0">
545
520
  <folding />
546
521
  </state>
547
522
  </provider>
548
523
  </entry>
549
- <entry file="file://$PROJECT_DIR$/lib/widget_list/utils.rb">
524
+ <entry file="file://$PROJECT_DIR$/lib/widget_list/sequel.rb">
550
525
  <provider selected="true" editor-type-id="text-editor">
551
- <state line="84" column="3" selection-start="1822" selection-end="1822" vertical-scroll-proportion="0.0">
526
+ <state line="127" column="29" selection-start="3617" selection-end="3617" vertical-scroll-proportion="0.0">
552
527
  <folding />
553
528
  </state>
554
529
  </provider>
555
530
  </entry>
556
- <entry file="file://$PROJECT_DIR$/lib/widget_list/string.rb">
531
+ <entry file="file://$PROJECT_DIR$/lib/widget_list.rb">
557
532
  <provider selected="true" editor-type-id="text-editor">
558
- <state line="41" column="3" selection-start="568" selection-end="568" vertical-scroll-proportion="0.0">
533
+ <state line="2082" column="3" selection-start="75983" selection-end="75983" vertical-scroll-proportion="-13.033334">
559
534
  <folding />
560
535
  </state>
561
536
  </provider>
562
537
  </entry>
563
- <entry file="file://$PROJECT_DIR$/README.md">
538
+ <entry file="file://$PROJECT_DIR$/lib/widget_list/version.rb">
564
539
  <provider selected="true" editor-type-id="text-editor">
565
- <state line="56" column="18" selection-start="1215" selection-end="1215" vertical-scroll-proportion="0.0">
540
+ <state line="3" column="51" selection-start="42" selection-end="42" vertical-scroll-proportion="0.0">
566
541
  <folding />
567
542
  </state>
568
543
  </provider>
569
544
  </entry>
570
- <entry file="file://$PROJECT_DIR$/lib/widget_list/railtie.rb">
545
+ <entry file="file://$PROJECT_DIR$/README.md">
571
546
  <provider selected="true" editor-type-id="text-editor">
572
- <state line="9" column="45" selection-start="408" selection-end="408" vertical-scroll-proportion="0.27272728">
547
+ <state line="327" column="0" selection-start="11641" selection-end="11641" vertical-scroll-proportion="0.9592391">
573
548
  <folding />
574
549
  </state>
575
550
  </provider>
data/README.md CHANGED
@@ -10,7 +10,7 @@ I feel like there are not very good lists in ruby/rails and/or dont care to find
10
10
  In rails you have will_paginate and other ones like it using the ActiveRecord approach, but widget_list adds some awesome treats to standard boring pagers:
11
11
 
12
12
  * A sleek ajaxified list
13
- * Supports *ALL Databases (Haven't tested everything yet though, I am sure there are tweaks for each DB)
13
+ * Supports *ALL Databases (Haven't tested everything yet though, I am sure there are tweaks for each DB). mysql, postgres, oracle and sqllite tested (basic example)
14
14
  * Full sorting ASC/DESC of list via ajax
15
15
  * Easily add row level buttons for each row
16
16
  * Custom tags to pass to be replaced by actual data from each column/value
@@ -21,6 +21,17 @@ In rails you have will_paginate and other ones like it using the ActiveRecord ap
21
21
  * Ability to set a cool custom HTML arrow which draws a hidden DIV intended for someone to put custom widgets inside of to pass new filters to the list before it executes
22
22
  * Buttons for each row and areas on the bottom of the grid where you can add "Action buttons"
23
23
 
24
+ ## Screenshots
25
+
26
+ Main Example Loaded:
27
+ ![](http://davidrenne.com/github/widget_list/main.png)
28
+
29
+ Filter Drop Downs:
30
+ ![](http://davidrenne.com/github/widget_list/filtered.png)
31
+
32
+ Searching a row:
33
+ ![](http://davidrenne.com/github/widget_list/search.png)
34
+
24
35
 
25
36
  ## Installation
26
37
 
@@ -36,7 +47,9 @@ Or install it yourself as:
36
47
 
37
48
  $ gem install widget_list
38
49
 
39
- ## Usage
50
+ ## Usage/Examples
51
+
52
+ You can either follow the below instructions or take a look at the changes here https://github.com/davidrenne/widget_list_example/commit/e4e8ab54edcf8bc4538b1850ee762c13bc6f5316
40
53
 
41
54
  ### #1 - Add widget_list CSS and JS to your application css and js
42
55
 
@@ -49,34 +62,47 @@ Or install it yourself as:
49
62
 
50
63
  //= require widget_list
51
64
 
52
- ### #2 - Run bundle exec rails s to have widget_list create config/widget-list.yml
65
+ ### #2 - Run `bundle exec rails s` to have widget_list create config/widget-list.yml (by default a sqlite3 memory database is created)
53
66
 
54
67
  Configure your connection settings for your primary or secondary widget_list connections.
55
68
 
56
69
  http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
57
70
 
58
- ### Example Calling Page That Sets up Config and calls WidgetList.render
71
+ ### #3 - If you wish to integrate into an existing rails application create a new controller
72
+
73
+ rails generate controller WidgetListExamples ruby_items
74
+
75
+ Then modify app/views/widget_list_examples/ruby_items.html.erb and add
76
+ <div style="margin:50px;">
77
+ <%=raw @output%>
78
+ </div>
79
+
80
+ Add config/routes.rb if it is not in there:
81
+ match ':controller(/:action)'
82
+
83
+ Add the example shown below to app/controllers/widget_list_examples_controller.rb#ruby_items
84
+
85
+ Go To http://localhost:3000/widget_list_examples/ruby_items
59
86
 
60
- #
61
- # Load Sample "items" Data. Comment out in your first time executing a widgetlist to create the items table
62
- #
87
+ ### Example Calling Page That Sets up Config and calls WidgetList.render
63
88
 
64
- # no table - create it and load it with 5K records
89
+
65
90
  WidgetList::List.get_database.create_table :items do
66
91
  primary_key :id
67
92
  String :name
68
93
  Float :price
94
+ Int :sku
95
+ Date :date_added
69
96
  end
70
97
  items = WidgetList::List.get_database[:items]
71
98
  100.times {
72
- items.insert(:name => 'abc', :price => rand * 100)
73
- items.insert(:name => '123', :price => rand * 100)
74
- items.insert(:name => 'asdf', :price => rand * 100)
75
- items.insert(:name => 'qwerty', :price => rand * 100)
76
- items.insert(:name => 'poop', :price => rand * 100)
77
- }
78
-
79
-
99
+ items.insert(:name => 'abc', :price => rand * 100, :date_added => '2008-02-01', :sku => 12345)
100
+ items.insert(:name => '123', :price => rand * 100, :date_added => '2008-02-02', :sku => 54321)
101
+ items.insert(:name => 'asdf', :price => rand * 100, :date_added => '2008-02-03', :sku => 67895)
102
+ items.insert(:name => 'qwerty', :price => rand * 100, :date_added => '2008-02-04', :sku => 66666)
103
+ items.insert(:name => 'poop', :price => rand * 100, :date_added => '2008-02-05', :sku => 77777)
104
+ }
105
+
80
106
  #
81
107
  # Setup your first widget_list
82
108
  #
@@ -94,8 +120,9 @@ Or install it yourself as:
94
120
  # Give it a name, some SQL to feed widget_list and set a noDataMessage
95
121
  #
96
122
  list_parms['name'] = 'ruby_items_yum'
123
+ list_parms['searchIdCol'] = ['id','sku']
97
124
  list_parms['view'] = '(SELECT \'\' as checkbox,a.* FROM items a ) a'
98
- list_parms['noDataMessage'] = 'No Tables Found'
125
+ list_parms['noDataMessage'] = 'No Ruby Items Found'
99
126
  list_parms['title'] = 'Ruby Items!!!'
100
127
 
101
128
  #
@@ -104,18 +131,21 @@ Or install it yourself as:
104
131
 
105
132
  mini_buttons = {}
106
133
  mini_buttons['button_edit'] = {'page' => '/edit',
107
- 'text' => 'Edit',
108
- 'function' => 'Redirect',
109
- #pass tags to pull from each column when building the URL
110
- 'tags' => {'my_key_name' => 'name','value_from_database'=>'price'}}
134
+ 'text' => 'Edit',
135
+ 'function' => 'Redirect',
136
+ #pass tags to pull from each column when building the URL
137
+ 'tags' => {'my_key_name' => 'name','value_from_database'=>'price'}}
111
138
 
112
139
  mini_buttons['button_delete'] = {'page' => '/delete',
113
- 'text' => 'Delete',
114
- 'function' => 'alert',
115
- 'innerClass' => 'danger'}
140
+ 'text' => 'Delete',
141
+ 'function' => 'alert',
142
+ 'innerClass' => 'danger'}
116
143
  list_parms['buttons'] = {button_column_name => mini_buttons}
117
- list_parms['function'] = {button_column_name => "'' " + button_column_name }
118
- list_parms['groupByItems']= ['All Records','Another Grouping Item']
144
+ list_parms['fieldFunction'] = {
145
+ button_column_name => "''",
146
+ 'date_added' => ['postgres','oracle'].include?(WidgetList::List.get_database.db_type) ? "TO_CHAR(date_added, 'MM/DD/YYYY')" : "date_added"
147
+ }
148
+ list_parms['groupByItems'] = ['All Records','Item Name']
119
149
 
120
150
  #
121
151
  # Generate a template for the DOWN ARROW for CUSTOM FILTER
@@ -150,21 +180,58 @@ Or install it yourself as:
150
180
  </ul>
151
181
  <br/>
152
182
  <div style="text-align:right;width:100%;height:30px;" class="advanced-search-container-buttons"><!--BUTTON_RESET--><!--BUTTON_SEARCH--></div>
153
- </div>')
183
+ </div>')
154
184
 
155
185
  #
156
- # Setup a custom field for checkboxes stored into the session and reloaded when refresh occurs
186
+ # Map out the visible fields
157
187
  #
158
188
 
159
189
  list_parms.deep_merge!({'fields' =>
160
190
  {
161
191
  'checkbox'=> 'checkbox_header',
192
+ }
193
+ })
194
+
195
+ list_parms.deep_merge!({'fields' =>
196
+ {
162
197
  'id'=> 'Item Id',
198
+ }
199
+ })
200
+
201
+ list_parms.deep_merge!({'fields' =>
202
+ {
163
203
  'name'=> 'Name',
204
+ }
205
+ })
206
+
207
+ list_parms.deep_merge!({'fields' =>
208
+ {
164
209
  'price'=> 'Price of Item',
210
+ }
211
+ })
212
+
213
+
214
+ list_parms.deep_merge!({'fields' =>
215
+ {
216
+ 'sku'=> 'Sku #',
217
+ }
218
+ })
219
+
220
+ list_parms.deep_merge!({'fields' =>
221
+ {
222
+ 'date_added'=> 'Date Added',
223
+ }
224
+ })
225
+
226
+ list_parms.deep_merge!({'fields' =>
227
+ {
165
228
  button_column_name => button_column_name.capitalize,
166
229
  }
167
230
  })
231
+
232
+ #
233
+ # Setup a custom field for checkboxes stored into the session and reloaded when refresh occurs
234
+ #
168
235
 
169
236
  list_parms.deep_merge!({'inputs' =>
170
237
  {'checkbox'=>
@@ -219,7 +286,7 @@ Or install it yourself as:
219
286
  #
220
287
  # Else assign to variable for view
221
288
  #
222
- @output = WidgetList::Utils::fill({ '<!--CUSTOM_CONTENT-->' => action_buttons } , list.render() )
289
+ @output = WidgetList::Utils::fill({ '<!--CUSTOM_CONTENT-->' => action_buttons } , list.render() )
223
290
  end
224
291
 
225
292
  ## Contributing
@@ -9,6 +9,9 @@ module Sequel
9
9
  @last_error = ''
10
10
  attr_accessor :last_error
11
11
 
12
+ @db_type = ''
13
+ attr_accessor :db_type
14
+
12
15
  @final_count = 0
13
16
  attr_accessor :final_count
14
17
 
@@ -6,6 +6,10 @@ module WidgetList
6
6
  true if Float(object) rescue false
7
7
  end
8
8
 
9
+ def self.date?(object)
10
+ true if Date.parse(object) rescue false
11
+ end
12
+
9
13
  #JsonEncode
10
14
  def self.json_encode(arr,return_string = false)
11
15
  if return_string
@@ -1,3 +1,3 @@
1
1
  module WidgetList
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -604,7 +604,7 @@ module WidgetList
604
604
  'submit' => '',
605
605
  'args' => {},
606
606
  'class' => 'btn', #Always stays the same
607
- 'innerClass' => 'success', #.primary(blue) .info(light-blue) .success(green) .danger(red) .disabled(light grey) .default(grey)
607
+ 'innerClass' => 'info', #.primary(blue) .info(light-blue) .success(green) .danger(red) .disabled(light grey) .default(grey)
608
608
  'passive' => false,
609
609
  'function' => 'ButtonLinkPost',
610
610
  'onclick' => '',
data/lib/widget_list.rb CHANGED
@@ -26,18 +26,38 @@ module WidgetList
26
26
 
27
27
  include ActionView::Helpers::SanitizeHelper
28
28
 
29
+ def self.determine_db_type(db_type)
30
+ the_type, void = db_type.split("://")
31
+ return the_type.downcase
32
+ end
33
+
29
34
  def self.connect
30
35
 
31
- if Rails.root.join("config", "widget-list.yml").file?
32
- config = YAML.load(ERB.new(File.new(Rails.root.join("config", "widget-list.yml")).read).result)[Rails.env]
33
- @primary_conn = config[:primary]
34
- @secondary_conn = config[:secondary]
35
- else
36
- throw 'widget-list.yml not found'
37
- end
36
+ begin
37
+ if Rails.root.join("config", "widget-list.yml").file?
38
+ config = YAML.load(ERB.new(File.new(Rails.root.join("config", "widget-list.yml")).read).result)[Rails.env]
39
+ if config.nil?
40
+ throw 'Configuration file widget-list.yml has no data. Check that (' + Rails.env + ') Rails.env matches the pointers in the file'
41
+ end
42
+ @primary_conn = config[:primary]
43
+ @secondary_conn = config[:secondary]
44
+ else
45
+ throw 'widget-list.yml not found'
46
+ end
47
+
48
+ $DATABASE = Sequel.connect(@primary_conn) if @primary_conn != 'false' and @primary_conn != false
49
+ $DATABASE2 = Sequel.connect(@secondary_conn) if @secondary_conn != 'false' and @secondary_conn != false
38
50
 
39
- $DATABASE = Sequel.connect(@primary_conn) if @primary_conn.class.name == 'String'
40
- $DATABASE2 = Sequel.connect(@secondary_conn) if @secondary_conn.class.name == 'String'
51
+ if @primary_conn.class.name != 'false' and @primary_conn != false
52
+ $DATABASE.db_type = determine_db_type(@primary_conn)
53
+ end
54
+
55
+ if @primary_conn.class.name != 'false' and @secondary_conn != false
56
+ $DATABASE2.db_type = determine_db_type(@secondary_conn)
57
+ end
58
+ rescue Exception => e
59
+ p "widget-list.yml and connection to \$DATABASE failed. Please fix and try again (" + e.to_s + ")"
60
+ end
41
61
 
42
62
  end
43
63
 
@@ -76,7 +96,7 @@ module WidgetList
76
96
  'results' => {},
77
97
  'buttons' => {},
78
98
  'inputs' => {},
79
- 'filter' => '',
99
+ 'filter' => [],
80
100
  'rowStart' => 0,
81
101
  'rowLimit' => 10,
82
102
  'orderBy' => '',
@@ -161,7 +181,7 @@ module WidgetList
161
181
  'useSort' => true,
162
182
  'headerClass' => {},
163
183
  'groupBy' => '',
164
- 'function' => {},
184
+ 'fieldFunction' => {},
165
185
  'buttonVal' => 'templateListJump',
166
186
  'linkFunction' => 'ButtonLinkPost',
167
187
  'template' => '',
@@ -271,16 +291,6 @@ module WidgetList
271
291
  }
272
292
  })
273
293
 
274
- @items.deep_merge!({'statement' =>
275
- {'select'=>
276
- {'sql' =>
277
- '
278
- SELECT <!--FIELDS--> FROM (<!--SQL-->) a <!--WHERE--> <!--GROUPBY--> <!--ORDERBY--> <!--LIMIT-->
279
- '
280
- }
281
- }
282
- })
283
-
284
294
  @items.deep_merge!({'statement' =>
285
295
  {'count'=>
286
296
  {'view' =>
@@ -291,26 +301,6 @@ module WidgetList
291
301
  }
292
302
  })
293
303
 
294
- @items.deep_merge!({'statement' =>
295
- {'count'=>
296
- {'sql' =>
297
- '
298
- SELECT count(1) total FROM (<!--SQL-->) s <!--WHERE-->
299
- '
300
- }
301
- }
302
- })
303
-
304
- @items.deep_merge!({'statement' =>
305
- {'count'=>
306
- {'table' =>
307
- '
308
- SELECT count(1) total FROM <!--TABLE--> <!--WHERE-->
309
- '
310
- }
311
- }
312
- })
313
-
314
304
  #Pagintion
315
305
  #
316
306
 
@@ -364,6 +354,21 @@ module WidgetList
364
354
 
365
355
  @items = WidgetList::Widgets::populate_items(list,@items)
366
356
 
357
+ # current_db is a flag of the last known primary or secondary YML used or defaulted when running a list
358
+ $current_db_selection = @items['database']
359
+
360
+ if WidgetList::List.get_database.db_type == 'oracle'
361
+ @items.deep_merge!({'statement' =>
362
+ {'select'=>
363
+ {'view' =>
364
+ '
365
+ SELECT <!--FIELDS-->, rn FROM ( SELECT ' + ( (!@items['view'].include?('(')) ? '<!--SOURCE-->' : @items['view'].strip.split(" ").last ) + '.*, rank() over (<!--ORDERBY-->) rn FROM <!--SOURCE--> ) a <!--WHERE--> <!--GROUPBY--> <!--ORDERBY--> <!--LIMIT-->
366
+ '
367
+ }
368
+ }
369
+ })
370
+
371
+ end
367
372
 
368
373
  begin
369
374
  @isJumpingList = false
@@ -409,9 +414,6 @@ module WidgetList
409
414
 
410
415
  end
411
416
 
412
- # current_db is a flag of the last known primary or secondary YML used or defaulted when running a list
413
- $current_db_selection = @items['database']
414
-
415
417
  @items['groupByClick'] = "ListChangeGrouping('" + @items['name'] + "')"
416
418
 
417
419
  =begin
@@ -423,6 +425,7 @@ module WidgetList
423
425
  #
424
426
  if (@items['sql'])
425
427
  {
428
+ #tick_field()....
426
429
  preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", @items['sql'], $match);
427
430
  $viewName = $match[1];
428
431
  }
@@ -524,10 +527,11 @@ module WidgetList
524
527
  }
525
528
 
526
529
  if isNumeric
530
+ numericSearch = true
527
531
  if @items['searchIdCol'].class.name == 'Array'
528
532
  @items['searchIdCol'].each { |searchIdCol|
529
533
  if(fieldsToSearch.key?(searchIdCol))
530
- searchSQL << "`" + searchIdCol + "` IN(" + searchFilter + ")"
534
+ searchSQL << tick_field() + searchIdCol + tick_field() + " IN(" + searchFilter + ")"
531
535
  end
532
536
  }
533
537
 
@@ -539,14 +543,15 @@ module WidgetList
539
543
  end
540
544
  elsif @items['fields'].key?(@items['searchIdCol'])
541
545
  numericSearch = true
542
- @items['filter'] << "`#{@items['searchIdCol']}` IN(" + criteriaTmp.join(',') + ")"
546
+ @items['filter'] << tick_field() + "#{@items['searchIdCol']}" + tick_field() + " IN(" + criteriaTmp.join(',') + ")"
543
547
  end
544
548
  end
545
549
  elsif @items['searchIdCol'].class.name == 'Array'
546
550
  if WidgetList::Utils::numeric?(searchFilter) && ! searchFilter.include?('.')
551
+ numericSearch = true
547
552
  @items['searchIdCol'].each { |searchIdCol|
548
553
  if fieldsToSearch.key?(searchIdCol)
549
- searchSQL << "`#{searchIdCol}` IN(#{searchFilter})"
554
+ searchSQL << tick_field() + "#{searchIdCol}" + tick_field() + " IN(#{searchFilter})"
550
555
  end
551
556
  }
552
557
 
@@ -557,28 +562,37 @@ module WidgetList
557
562
  @items['filter'] << "(" + searchSQL.join(' OR ') + ")"
558
563
  end
559
564
  end
560
- #elsif WidgetList::Utils::numeric?(searchFilter) && ! searchFilter.include?('.') && @items['fields'].key?(@items['searchIdCol'])
561
- # #19.95 is numeric, but people might be searching for dollar amounts which should be string based search
562
- # numericSearch = true
563
- #
564
- # @items['filter'] << "`#{@items['searchIdCol']}` IN(" + searchFilter + ")"
565
+ elsif WidgetList::Utils::numeric?(searchFilter) && ! searchFilter.include?('.') && @items['fields'].key?(@items['searchIdCol'])
566
+ numericSearch = true
567
+ @items['filter'] << tick_field() + "#{@items['searchIdCol']}" + tick_field() + " IN(" + searchFilter + ")"
565
568
  end
566
569
 
567
570
  # If it is not an id or a list of ids then it is assumed a string search
568
571
  if !numericSearch
569
- ii = 0
572
+
570
573
  fieldsToSearch.each { |fieldName,fieldTitle|
571
574
 
572
- # new lodgette. if function exists, find all matches and skip them
575
+ # new lodgette. if fieldFunction exists, find all matches and skip them
573
576
  skip = false
574
- (@items['function']||{}).each { |k,v|
577
+
578
+ if @items['fieldFunction'].key?(fieldName)
579
+ theField = @items['fieldFunction'][fieldName] + cast_col()
580
+ else
581
+ theField = tick_field() + "#{fieldName}" + cast_col() + tick_field()
582
+ end
583
+
584
+ (@items['inputs']||{}).each { |k,v|
575
585
  if fieldName == k
576
586
  skip = true
577
587
  end
578
588
  }
579
589
 
590
+ if @items['buttons'].key?(fieldName)
591
+ skip = true
592
+ end
593
+
580
594
  #buttons must ALWAYS BE ON THE RIGHT SIDE IN ORDER FOR THIS NOT TO SEARCH A NON-EXISTENT COLUMN (used to be hard coded to 'features' as a column to remove)
581
- if (!@items['buttons'].empty? && ii == (fieldsToSearch.length - 1)) || skip
595
+ if skip
582
596
  next
583
597
  end
584
598
 
@@ -598,8 +612,7 @@ module WidgetList
598
612
  end
599
613
 
600
614
  #todo - escape bind variables using Sequel
601
- searchSQL << "`#{fieldName}` LIKE '%" + searchCriteria + "%'"
602
- ii = ii + 1
615
+ searchSQL << theField + " LIKE '%" + searchCriteria + "%'"
603
616
  }
604
617
 
605
618
  #
@@ -685,6 +698,25 @@ module WidgetList
685
698
  end
686
699
  end
687
700
 
701
+ def tick_field()
702
+ case WidgetList::List.get_database.db_type
703
+ when 'postgres'
704
+ when 'oracle'
705
+ ''
706
+ else
707
+ '`'
708
+ end
709
+ end
710
+
711
+ def cast_col()
712
+ case WidgetList::List.get_database.db_type
713
+ when 'postgres'
714
+ '::char(1000)'
715
+ else
716
+ ''
717
+ end
718
+ end
719
+
688
720
  def ajax_maintain_checks()
689
721
 
690
722
  #
@@ -809,7 +841,15 @@ module WidgetList
809
841
  @items['bindVarsLegacy']['HIGH'] = @items['rowLimit']
810
842
 
811
843
  if @sequence.to_i > 1 && ! @items['NEW_SEARCH']
812
- @items['bindVarsLegacy']['LOW'] = (((@sequence * @items['rowLimit']) - @items['rowLimit']))
844
+ subtractLimit = 0
845
+ if WidgetList::List.get_database.db_type != 'oracle'
846
+ subtractLimit = @items['rowLimit']
847
+ end
848
+ @items['bindVarsLegacy']['LOW'] = (((@sequence * @items['rowLimit']) - subtractLimit))
849
+ if WidgetList::List.get_database.db_type == 'oracle'
850
+ @items['bindVarsLegacy']['HIGH'] = ((((@sequence + 1) * @items['rowLimit'])))
851
+ end
852
+
813
853
  end
814
854
  end
815
855
 
@@ -1892,59 +1932,28 @@ module WidgetList
1892
1932
  '<!--ORDERBY-->' => '',
1893
1933
  '<!--LIMIT-->' => ''}
1894
1934
 
1895
- if !@items['sql'].empty? || !@items['force_query_sql'].empty?
1896
- if !@items['fieldNames'].empty?
1897
- @items['fieldNames'].each { |column|
1898
- tick = '`'
1899
- if(isset(@items['function'][column]))
1900
- tick = ''
1901
- column = @items['function'][column]
1902
- end
1903
- @fieldList << "#{tick}#{column}#{tick}"
1904
- }
1905
- fields = @fieldList.join(',')
1906
-
1907
-
1908
- else
1909
- fields = "*";
1910
- end
1911
-
1912
-
1913
- sqlPieces = {};
1914
- sqlPieces['<!--FIELDS-->'] = fields;
1915
- sqlPieces['<!--SQL-->'] = @items['sql'];
1916
-
1917
- if !@items['force_query_sql'].empty?
1918
- statement = @items['force_query_sql']
1919
- else
1920
- statement = @items['statement']['select']['sql']
1935
+ #Build out a list of columns to select from
1936
+ #
1937
+ @items['fields'].each { |column, fieldTitle|
1938
+ if @items['fieldFunction'].key?(column) && !@items['fieldFunction'][column].empty?
1939
+ # fieldFunction's should not have an alias, just the database functions
1940
+ column = @items['fieldFunction'][column] + " " + column
1921
1941
  end
1922
1942
 
1923
- statement = WidgetList::Utils::fill(sqlPieces, @items['statement']['count']['table'])
1924
-
1925
- elsif !@items['view'].empty?
1926
- #Build out a list of columns to select from
1927
- #
1928
- @items['fields'].each { |column, fieldTitle|
1929
- if @items['function'].key?(column) && !@items['function'][column].empty?
1930
- column = @items['function'][column]
1931
- end
1943
+ @fieldList << column
1944
+ }
1932
1945
 
1933
- @fieldList << column
1934
- }
1946
+ #Add any columns without corresponding header titles
1947
+ #
1948
+ @items['columns'].each { |column|
1949
+ @fieldList << column
1950
+ }
1935
1951
 
1936
- #Add any columns without corresponding header titles
1937
- #
1938
- @items['columns'].each { |column|
1939
- @fieldList << column
1940
- }
1952
+ viewPieces = {}
1953
+ viewPieces['<!--FIELDS-->'] = @fieldList.join(',')
1954
+ viewPieces['<!--SOURCE-->'] = @items['view']
1941
1955
 
1942
- viewPieces = {}
1943
- viewPieces['<!--FIELDS-->'] = @fieldList.join(',')
1944
- viewPieces['<!--SOURCE-->'] = @items['view']
1945
-
1946
- statement = WidgetList::Utils::fill(viewPieces, @items['statement']['select']['view'])
1947
- end
1956
+ statement = WidgetList::Utils::fill(viewPieces, @items['statement']['select']['view'])
1948
1957
 
1949
1958
  @sqlHash = Digest::SHA2.hexdigest( WidgetList::Utils::fill(pieces, statement) )
1950
1959
 
@@ -1958,8 +1967,7 @@ module WidgetList
1958
1967
  end
1959
1968
 
1960
1969
  if !@filter.empty?
1961
- where = ' WHERE '
1962
- pieces['<!--WHERE-->'] = where + @filter
1970
+ pieces['<!--WHERE-->'] = ' WHERE ' + @filter
1963
1971
  end
1964
1972
 
1965
1973
  if !@items['groupBy'].empty?
@@ -1968,10 +1976,10 @@ module WidgetList
1968
1976
 
1969
1977
  if !@items['LIST_COL_SORT'].empty? || $_SESSION.key?('LIST_COL_SORT') && $_SESSION['LIST_COL_SORT'].class.name == 'Hash' && $_SESSION['LIST_COL_SORT'].key?(@sqlHash)
1970
1978
  if ! @items['LIST_COL_SORT'].empty?
1971
- pieces['<!--ORDERBY-->'] += ' ORDER BY `' + @items['LIST_COL_SORT'] + "` " + @items['LIST_COL_SORT_ORDER']
1979
+ pieces['<!--ORDERBY-->'] += ' ORDER BY ' + tick_field() + @items['LIST_COL_SORT'] + tick_field() + " " + @items['LIST_COL_SORT_ORDER']
1972
1980
  else
1973
1981
  $_SESSION['LIST_COL_SORT'][@sqlHash].each_with_index { |order,void|
1974
- pieces['<!--ORDERBY-->'] += ' ORDER BY `' + order[0] + "` " + order[1]
1982
+ pieces['<!--ORDERBY-->'] += ' ORDER BY ' + tick_field() + order[0] + tick_field() + " " + order[1]
1975
1983
  } if $_SESSION.key?('LIST_COL_SORT') && $_SESSION['LIST_COL_SORT'].class.name == 'Hash' && $_SESSION['LIST_COL_SORT'].key?(@sqlHash)
1976
1984
  end
1977
1985
 
@@ -1984,7 +1992,34 @@ module WidgetList
1984
1992
  pieces['<!--ORDERBY-->'] += ' ORDER BY ' + @items['orderBy']
1985
1993
  end
1986
1994
 
1987
- pieces['<!--LIMIT-->'] = ' LIMIT :LOW, :HIGH'
1995
+ if WidgetList::List.get_database.db_type == 'oracle' && pieces['<!--ORDERBY-->'].empty?
1996
+ keys = @items['fields'].keys
1997
+ pieces['<!--ORDERBY-->'] += ' ORDER BY ' + keys.first + ' ASC'
1998
+ end
1999
+
2000
+ case WidgetList::List.get_database.db_type
2001
+ when 'postgres'
2002
+ pieces['<!--LIMIT-->'] = ' LIMIT :HIGH OFFSET :LOW'
2003
+ when 'oracle'
2004
+ pieces['<!--LIMIT-->'] = ''
2005
+
2006
+ if !@filter.empty?
2007
+ and_where = ' AND '
2008
+ else
2009
+ and_where = ' WHERE '
2010
+ end
2011
+ pieces['<!--WHERE-->'] += and_where +
2012
+ '
2013
+ (
2014
+ a.rn >= :LOW
2015
+ AND
2016
+ a.rn <= :HIGH
2017
+ )
2018
+ '
2019
+ else
2020
+ pieces['<!--LIMIT-->'] = ' LIMIT :LOW, :HIGH'
2021
+ end
2022
+
1988
2023
 
1989
2024
  statement = WidgetList::Utils::fill(pieces, statement)
1990
2025
 
@@ -2009,10 +2044,6 @@ module WidgetList
2009
2044
 
2010
2045
  if !@items['force_count_sql'].empty?
2011
2046
  sql = @items['force_count_sql']
2012
- elsif !@items['table'].empty?
2013
- sql = WidgetList::Utils::fill({'<!--TABLE-->' => @items['table']}, @items['statement']['count']['table'])
2014
- elsif !@items['sql'].empty?
2015
- sql = WidgetList::Utils::fill({'<!--SQL-->' => @items['sql']}, @items['statement']['count']['sql'])
2016
2047
  elsif !@items['view'].empty?
2017
2048
  sql = WidgetList::Utils::fill({'<!--VIEW-->' => @items['view']}, @items['statement']['count']['view'])
2018
2049
  end
@@ -2049,6 +2080,4 @@ module WidgetList
2049
2080
 
2050
2081
  end
2051
2082
 
2052
- end
2053
-
2054
-
2083
+ end
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.0.2
4
+ version: 1.0.3
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: 2012-12-21 00:00:00.000000000 Z
12
+ date: 2012-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel