widget_list 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -16
- data/lib/widget_list.rb +14 -36
- data/lib/widget_list/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -38,16 +38,17 @@ Searching a row:
|
|
38
38
|
|
39
39
|
Add this line to your application's Gemfile:
|
40
40
|
|
41
|
+
```ruby
|
41
42
|
gem 'widget_list'
|
42
|
-
|
43
|
+
```
|
43
44
|
And then execute:
|
44
|
-
|
45
|
+
```ruby
|
45
46
|
$ bundle
|
46
|
-
|
47
|
+
```
|
47
48
|
Or install it yourself as:
|
48
|
-
|
49
|
+
```ruby
|
49
50
|
$ gem install widget_list
|
50
|
-
|
51
|
+
```
|
51
52
|
## Usage/Examples
|
52
53
|
|
53
54
|
You can either follow the below instructions or take a look at the changes here https://github.com/davidrenne/widget_list_example/commit/e4e8ab54edcf8bc4538b1850ee762c13bc6f5316
|
@@ -209,14 +210,14 @@ Style a row based on the value of the column.
|
|
209
210
|
### #1 - Add widget_list CSS and JS to your application css and js
|
210
211
|
|
211
212
|
Change application.css to:
|
212
|
-
|
213
|
+
```ruby
|
213
214
|
*= require widget_list
|
214
215
|
*= require widgets
|
215
|
-
|
216
|
+
```
|
216
217
|
Change application.js to:
|
217
|
-
|
218
|
+
```ruby
|
218
219
|
//= require widget_list
|
219
|
-
|
220
|
+
```
|
220
221
|
### #2 - Run `bundle exec rails s` to have widget_list create config/widget-list.yml (by default a sqlite3 memory database is created)
|
221
222
|
|
222
223
|
Configure your connection settings for your primary or secondary widget_list connections.
|
@@ -228,16 +229,19 @@ Style a row based on the value of the column.
|
|
228
229
|
rails generate controller WidgetListExamples ruby_items
|
229
230
|
|
230
231
|
Then modify app/views/widget_list_examples/ruby_items.html.erb and add
|
231
|
-
|
232
|
+
```ruby
|
233
|
+
<div style="margin:50px;">
|
232
234
|
<%=raw @output%>
|
233
235
|
</div>
|
234
|
-
|
236
|
+
```
|
235
237
|
Add config/routes.rb if it is not in there:
|
236
|
-
|
237
|
-
|
238
|
+
```ruby
|
239
|
+
match ':controller(/:action)'
|
240
|
+
```
|
238
241
|
Ensure that sessions are loaded into active record because widget_list keeps track of several settings on each list for each session
|
239
|
-
|
240
|
-
|
242
|
+
```ruby
|
243
|
+
config.session_store :active_record_store
|
244
|
+
```
|
241
245
|
Add the example shown below to app/controllers/widget_list_examples_controller.rb#ruby_items
|
242
246
|
|
243
247
|
Go To http://localhost:3000/widget_list_examples/ruby_items
|
@@ -245,7 +249,7 @@ Style a row based on the value of the column.
|
|
245
249
|
### Example Calling Page That Sets up Config and calls WidgetList.render
|
246
250
|
|
247
251
|
|
248
|
-
|
252
|
+
```ruby
|
249
253
|
#
|
250
254
|
# Load Sample "items" Data. Comment out in your first time executing a widgetlist to create the items table
|
251
255
|
#
|
@@ -541,6 +545,7 @@ Style a row based on the value of the column.
|
|
541
545
|
end
|
542
546
|
|
543
547
|
end
|
548
|
+
```
|
544
549
|
|
545
550
|
## Contributing
|
546
551
|
|
data/lib/widget_list.rb
CHANGED
@@ -149,25 +149,25 @@ module WidgetList
|
|
149
149
|
|
150
150
|
@items.deep_merge!({'template_pagination_next_active' =>
|
151
151
|
"
|
152
|
-
<li><span onclick=\"<!--FUNCTION-->('<!--NEXT_URL-->','<!--LIST_NAME-->');<!--FUNCTION_ALL-->\" style=\"cursor:pointer;background: transparent url(
|
152
|
+
<li><span id=\"<!--LIST_NAME-->_next\" onclick=\"<!--FUNCTION-->('<!--NEXT_URL-->','<!--LIST_NAME-->');<!--FUNCTION_ALL-->\" style=\"cursor:pointer;background: transparent url(/assets/images/page-next.gif) no-repeat\"> </span></li>
|
153
153
|
"
|
154
154
|
})
|
155
155
|
|
156
156
|
@items.deep_merge!({'template_pagination_next_disabled' =>
|
157
157
|
"
|
158
|
-
<li><span style=\"opacity:0.4;filter:alpha(opacity=40);background: transparent url(
|
158
|
+
<li><span id=\"<!--LIST_NAME-->_next\" style=\"opacity:0.4;filter:alpha(opacity=40);background: transparent url(/assets/images/page-next.gif) no-repeat\"> </span></li>
|
159
159
|
"
|
160
160
|
})
|
161
161
|
|
162
162
|
@items.deep_merge!({'template_pagination_previous_active' =>
|
163
163
|
"
|
164
|
-
<li><span onclick=\"<!--FUNCTION-->('<!--PREVIOUS_URL-->','<!--LIST_NAME-->');<!--FUNCTION_ALL-->\" style=\"cursor:pointer;background: transparent url(
|
164
|
+
<li><span id=\"<!--LIST_NAME-->_previous\" onclick=\"<!--FUNCTION-->('<!--PREVIOUS_URL-->','<!--LIST_NAME-->');<!--FUNCTION_ALL-->\" style=\"cursor:pointer;background: transparent url(/assets/images/page-back.gif) no-repeat\"> </span></li>
|
165
165
|
"
|
166
166
|
})
|
167
167
|
|
168
168
|
@items.deep_merge!({'template_pagination_previous_disabled' =>
|
169
169
|
"
|
170
|
-
<li><span style=\"opacity:0.4;filter:alpha(opacity=40);background: transparent url(
|
170
|
+
<li><span id=\"<!--LIST_NAME-->_previous\" style=\"opacity:0.4;filter:alpha(opacity=40);background: transparent url(/assets/images/page-back.gif) no-repeat\"> </span></li>
|
171
171
|
"
|
172
172
|
})
|
173
173
|
|
@@ -1264,7 +1264,6 @@ module WidgetList
|
|
1264
1264
|
pieces = {
|
1265
1265
|
'<!--NEXT_URL-->' => nextUrl,
|
1266
1266
|
'<!--LIST_NAME-->' => @items['name'],
|
1267
|
-
'<!--HTTP_SERVER-->' => $_SERVER['rack.url_scheme'] + '://' + $_SERVER['HTTP_HOST'] + '/assets/',
|
1268
1267
|
'<!--PREVIOUS_URL-->' => prevUrl,
|
1269
1268
|
'<!--FUNCTION-->' => @items['ajaxFunction'],
|
1270
1269
|
'<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll'],
|
@@ -1312,7 +1311,7 @@ module WidgetList
|
|
1312
1311
|
|
1313
1312
|
# WidgetSelect( todo)
|
1314
1313
|
pageSelect = <<-EOD
|
1315
|
-
<select onchange="#{@items['ajaxFunction']}(this.value,'#{@items['name']}');#{@items['ajaxFunctionAll']}" style="width:58px">
|
1314
|
+
<select id="<!--LIST_NAME-->_per_page" onchange="#{@items['ajaxFunction']}(this.value,'#{@items['name']}');#{@items['ajaxFunctionAll']}" style="width:58px">
|
1316
1315
|
#{options}
|
1317
1316
|
</select>
|
1318
1317
|
EOD
|
@@ -1857,48 +1856,27 @@ module WidgetList
|
|
1857
1856
|
link = %[q'[<a style='cursor:pointer;color:#{items[:link_color]};' class='#{items[:column_alias]}_drill#{items[:column_class]}' onclick='#{items[:js_function_name]}("#{items[:drill_down_name]}", ListDrillDownGetRowValue(this) ,"#{items[:list_id]}"#{items[:extra_js_func_params]});#{items[:extra_function]}'>]' #{WidgetList::List::concat_string(items[:primary_database])}#{items[:column_to_show]}#{WidgetList::List::concat_string(items[:primary_database])}q'[</a><script class='val-db' type='text'>]' #{WidgetList::List::concat_string(items[:primary_database])} #{items[:data_to_pass_from_view]} #{WidgetList::List::concat_string(items[:primary_database])} q'[</script>]' #{WidgetList::List::concat_outer(items[:primary_database])} #{WidgetList::List::is_sequel(items[:primary_database]) ? " as #{items[:column_alias]} " : ""}]
|
1858
1857
|
end
|
1859
1858
|
else
|
1860
|
-
if
|
1861
|
-
link = "#{items[:column_to_show]} #{WidgetList::List::is_sequel(items[:primary_database]) ? " as #{items[:column_alias]} " : ""}
|
1859
|
+
if WidgetList::List.get_db_type(items[:primary_database]) == 'postgres'
|
1860
|
+
link = %['<a style="cursor:pointer;color:#{items[:link_color]};" class="#{items[:column_alias]}_drill#{items[:column_class]}" onclick="#{items[:js_function_name]}(''#{items[:drill_down_name]}'', ListDrillDownGetRowValue(this) ,''#{items[:list_id]}''#{items[:extra_js_func_params]});#{items[:extra_function]}">"' #{WidgetList::List::concat_string(items[:primary_database])}#{items[:column_to_show]}#{WidgetList::List::concat_string(items[:primary_database])}'</a><script class="val-db" type="text">' #{WidgetList::List::concat_string(items[:primary_database])} #{items[:data_to_pass_from_view]} #{WidgetList::List::concat_string(items[:primary_database])}'</script>' #{WidgetList::List::is_sequel(items[:primary_database]) ? " as #{items[:column_alias]} " : ""}]
|
1862
1861
|
else
|
1863
1862
|
link = %[#{WidgetList::List::concat_inner(items[:primary_database])}"<a style='cursor:pointer;color:#{items[:link_color]};' class='#{items[:column_alias]}_drill#{items[:column_class]}' onclick='#{items[:js_function_name]}(#{WidgetList::List::double_quote(items[:primary_database])}#{items[:drill_down_name]}#{WidgetList::List::double_quote(items[:primary_database])}, ListDrillDownGetRowValue(this) ,#{WidgetList::List::double_quote(items[:primary_database])}#{items[:list_id]}#{WidgetList::List::double_quote(items[:primary_database])}#{items[:extra_js_func_params]});#{items[:extra_function]}'>"#{WidgetList::List::concat_string(items[:primary_database])}#{items[:column_to_show]}#{WidgetList::List::concat_string(items[:primary_database])}"</a><script class='val-db' type='text'>"#{WidgetList::List::concat_string(items[:primary_database])} #{items[:data_to_pass_from_view]} #{WidgetList::List::concat_string(items[:primary_database])}"</script>"#{WidgetList::List::concat_outer(items[:primary_database])} #{WidgetList::List::is_sequel(items[:primary_database]) ? " as #{items[:column_alias]} " : ""}]
|
1864
1863
|
end
|
1865
1864
|
end
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
def self.build_drill_down_link(listId,drillDownName,dataToPassFromView,columnToShow,columnAlias='',extraFunction='',functionName='ListDrillDown',columnClass='',color='blue',extraJSFunctionParams='',primary=true)
|
1871
|
-
ActiveSupport::Deprecation.warn "`build_drill_down_link` is deprecated. Use `build_drill_down` instead."
|
1872
|
-
if columnAlias.empty?
|
1873
|
-
columnAlias = columnToShow
|
1874
|
-
end
|
1875
|
-
|
1876
|
-
if !columnClass.empty?
|
1877
|
-
columnClass = ' "' + WidgetList::List::concat_string(primary) + columnClass + WidgetList::List::concat_string(primary) + '"'
|
1878
|
-
end
|
1879
|
-
|
1880
|
-
if WidgetList::List.get_db_type(primary) == 'oracle'
|
1881
|
-
if $_REQUEST.key?('export_widget_list')
|
1882
|
-
link = "#{columnToShow} #{WidgetList::List::is_sequel(primary) ? " as #{columnAlias} " : ""}"
|
1883
|
-
else
|
1884
|
-
link = %[q'[<a style='cursor:pointer;color:#{color};' class='#{columnAlias}_drill#{columnClass}' onclick='#{functionName}("#{drillDownName}", ListDrillDownGetRowValue(this) ,"#{listId}"#{extraJSFunctionParams});#{extraFunction}'>]' #{WidgetList::List::concat_string(primary)}#{columnToShow}#{WidgetList::List::concat_string(primary)}q'[</a><script class='val-db' type='text'>]' #{WidgetList::List::concat_string(primary)} #{dataToPassFromView} #{WidgetList::List::concat_string(primary)} q'[</script>]' #{WidgetList::List::concat_outer(primary)} #{WidgetList::List::is_sequel(primary) ? " as #{columnAlias} " : ""}]
|
1885
|
-
end
|
1886
|
-
else
|
1887
|
-
if $_REQUEST.key?('export_widget_list')
|
1888
|
-
link = "#{columnToShow} #{WidgetList::List::is_sequel(primary) ? " as #{columnAlias} " : ""}"
|
1889
|
-
else
|
1890
|
-
link = %[#{WidgetList::List::concat_inner(primary)}"<a style='cursor:pointer;color:#{color};' class='#{columnAlias}_drill#{columnClass}' onclick='#{functionName}(#{WidgetList::List::double_quote(primary)}#{drillDownName}#{WidgetList::List::double_quote(primary)}, ListDrillDownGetRowValue(this) ,#{WidgetList::List::double_quote(primary)}#{listId}#{WidgetList::List::double_quote(primary)}#{extraJSFunctionParams});#{extraFunction}'>"#{WidgetList::List::concat_string(primary)}#{columnToShow}#{WidgetList::List::concat_string(primary)}"</a><script class='val-db' type='text'>"#{WidgetList::List::concat_string(primary)} #{dataToPassFromView} #{WidgetList::List::concat_string(primary)}"</script>"#{WidgetList::List::concat_outer(primary)} #{WidgetList::List::is_sequel(primary) ? " as #{columnAlias} " : ""}]
|
1891
|
-
end
|
1865
|
+
|
1866
|
+
if $_REQUEST.key?('export_widget_list')
|
1867
|
+
link = "#{items[:column_to_show]} #{WidgetList::List::is_sequel(items[:primary_database]) ? " as #{items[:column_alias]} " : ""}"
|
1892
1868
|
end
|
1869
|
+
|
1893
1870
|
return link
|
1894
|
-
end
|
1895
1871
|
|
1872
|
+
end
|
1873
|
+
|
1896
1874
|
def self.concat_string(primary)
|
1897
1875
|
|
1898
1876
|
case WidgetList::List.get_db_type(primary)
|
1899
1877
|
when 'mysql'
|
1900
1878
|
' , '
|
1901
|
-
when 'oracle','sqlite'
|
1879
|
+
when 'oracle','sqlite','postgres'
|
1902
1880
|
' || '
|
1903
1881
|
else
|
1904
1882
|
','
|
data/lib/widget_list/version.rb
CHANGED
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
|
+
version: 1.1.6
|
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-
|
12
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|