sortable_skima 0.2.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +192 -0
  3. data/app/assets/javascripts/jquery-ui.min.js +12 -0
  4. data/app/assets/javascripts/jquery.ba-bbq.js +1137 -0
  5. data/app/assets/javascripts/skima-sortable-tables_2_0_10.js +450 -0
  6. data/app/assets/stylesheets/images/animated-overlay.gif +0 -0
  7. data/app/assets/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  8. data/app/assets/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  9. data/app/assets/stylesheets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  10. data/app/assets/stylesheets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  11. data/app/assets/stylesheets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  12. data/app/assets/stylesheets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  13. data/app/assets/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  14. data/app/assets/stylesheets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  15. data/app/assets/stylesheets/images/ui-icons_222222_256x240.png +0 -0
  16. data/app/assets/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
  17. data/app/assets/stylesheets/images/ui-icons_454545_256x240.png +0 -0
  18. data/app/assets/stylesheets/images/ui-icons_888888_256x240.png +0 -0
  19. data/app/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
  20. data/app/assets/stylesheets/jquery-ui.css +1183 -0
  21. data/app/controllers/sortables_controller.rb +75 -0
  22. data/app/models/sortable.rb +82 -0
  23. data/config/routes.rb +5 -0
  24. data/doc/Backtrace.html +493 -0
  25. data/doc/README_rdoc.html +329 -0
  26. data/doc/SortableHelper.html +364 -0
  27. data/doc/SortableSkima.html +343 -0
  28. data/doc/SortableSkima/Engine.html +131 -0
  29. data/doc/created.rid +7 -0
  30. data/doc/images/add.png +0 -0
  31. data/doc/images/brick.png +0 -0
  32. data/doc/images/brick_link.png +0 -0
  33. data/doc/images/bug.png +0 -0
  34. data/doc/images/bullet_black.png +0 -0
  35. data/doc/images/bullet_toggle_minus.png +0 -0
  36. data/doc/images/bullet_toggle_plus.png +0 -0
  37. data/doc/images/date.png +0 -0
  38. data/doc/images/delete.png +0 -0
  39. data/doc/images/find.png +0 -0
  40. data/doc/images/loadingAnimation.gif +0 -0
  41. data/doc/images/macFFBgHack.png +0 -0
  42. data/doc/images/package.png +0 -0
  43. data/doc/images/page_green.png +0 -0
  44. data/doc/images/page_white_text.png +0 -0
  45. data/doc/images/page_white_width.png +0 -0
  46. data/doc/images/plugin.png +0 -0
  47. data/doc/images/ruby.png +0 -0
  48. data/doc/images/tag_blue.png +0 -0
  49. data/doc/images/tag_green.png +0 -0
  50. data/doc/images/transparent.png +0 -0
  51. data/doc/images/wrench.png +0 -0
  52. data/doc/images/wrench_orange.png +0 -0
  53. data/doc/images/zoom.png +0 -0
  54. data/doc/index.html +347 -0
  55. data/doc/js/darkfish.js +155 -0
  56. data/doc/js/jquery.js +18 -0
  57. data/doc/js/navigation.js +142 -0
  58. data/doc/js/search.js +94 -0
  59. data/doc/js/search_index.js +1 -0
  60. data/doc/js/searcher.js +228 -0
  61. data/doc/rdoc.css +543 -0
  62. data/doc/sortable_parser.html +78 -0
  63. data/doc/table_of_contents.html +114 -0
  64. data/lib/sortable_skima.rb +122 -0
  65. data/lib/sortable_skima/active_record.rb +36 -0
  66. data/lib/sortable_skima/backtrace.rb +53 -0
  67. data/lib/sortable_skima/engine.rb +63 -0
  68. data/lib/sortable_skima/helpers/sortable_helper.rb +188 -0
  69. metadata +142 -0
@@ -0,0 +1,7 @@
1
+ Fri, 26 Jun 2015 16:05:47 +0100
2
+ lib/sortable_skima.rb Mon, 15 Jun 2015 18:33:28 +0100
3
+ lib/sortable_skima/helpers/sortable_helper.rb Fri, 26 Jun 2015 12:37:57 +0100
4
+ lib/sortable_skima/engine.rb Mon, 15 Jun 2015 23:31:26 +0100
5
+ README.rdoc Fri, 26 Jun 2015 16:05:43 +0100
6
+ lib/sortable_skima/backtrace.rb Mon, 15 Jun 2015 14:47:52 +0100
7
+ lib/sortable_skima/active_record.rb Mon, 15 Jun 2015 11:56:25 +0100
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,347 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body>
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./README_rdoc.html">README</a>
53
+
54
+ </ul>
55
+ </nav>
56
+
57
+ <nav id="classindex-section" class="section project-section">
58
+ <h3 class="section-header">Class and Module Index</h3>
59
+
60
+ <ul class="link-list">
61
+
62
+ <li><a href="./SortableSkima.html">SortableSkima</a>
63
+
64
+ <li><a href="./SortableSkima/Engine.html">SortableSkima::Engine</a>
65
+
66
+ <li><a href="./Backtrace.html">Backtrace</a>
67
+
68
+ <li><a href="./SortableHelper.html">SortableHelper</a>
69
+
70
+ </ul>
71
+ </nav>
72
+
73
+ </div>
74
+ </nav>
75
+
76
+ <div id="documentation" class="description">
77
+
78
+ <h1 id="label-SortableSkima"><a href="SortableSkima.html">SortableSkima</a></h1>
79
+
80
+ <h2 id="label-Description">Description</h2>
81
+
82
+ <p>This gem aids in building sortable and filtrable tables with both local or
83
+ remote sources.</p>
84
+
85
+ <p>Table contents are loaded by ajax.</p>
86
+
87
+ <h2 id="label-Installation">Installation</h2>
88
+
89
+ <p>Add this line to your application’s Gemfile:</p>
90
+
91
+ <pre>source 'http://whatever:skimaisdabomb@gems.skima.net' do
92
+ gem &quot;sortable_skima&quot;
93
+ end</pre>
94
+
95
+ <p>Run:</p>
96
+
97
+ <pre>$ bundle</pre>
98
+
99
+ <p>Create both backtraces and sortables migrations if you dont have them
100
+ already in your db</p>
101
+
102
+ <pre class="ruby"><span class="ruby-identifier">create_table</span> :<span class="ruby-identifier">sortables</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
103
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">text</span> :<span class="ruby-identifier">query</span>
104
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">timestamps</span>
105
+ <span class="ruby-keyword">end</span>
106
+ <span class="ruby-identifier">create_table</span> :<span class="ruby-identifier">backtraces</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
107
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">integer</span> :<span class="ruby-identifier">user_id</span>
108
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">string</span> :<span class="ruby-identifier">action</span>
109
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">string</span> :<span class="ruby-identifier">value</span>
110
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">timestamps</span>
111
+ <span class="ruby-keyword">end</span>
112
+ </pre>
113
+ <hr style="height: 1px">
114
+
115
+ <h1 id="label-Tables">Tables</h1>
116
+
117
+ <h2 id="label-Example+usage">Example usage</h2>
118
+
119
+ <pre>&lt;%= sortable_table_tag 'Project.select(&quot;projects.*, COUNT(warnings.id) as warnings_count&quot;).joins(&quot;LEFT JOIN users ON users.id = projects.manager_id '+
120
+ 'LEFT JOIN divisions ON divisions.id = projects.division_id '+
121
+ 'LEFT JOIN budgets ON budgets.project_id = projects.id AND budgets.active '+
122
+ 'LEFT JOIN budget_stats ON budget_stats.budget_id = budgets.id '+
123
+ 'LEFT JOIN project_types ON project_types.id = projects.project_type_id '+
124
+ 'LEFT JOIN warnings ON warnings.warnable_type = \'Project\' AND warnings.warnable_id = projects.id&quot;)'+
125
+ '.joins( :project_stats).group(&quot;projects.id&quot;)',[
126
+ {:sort_field=&gt;'projects.id',:title=&gt;'Name',:display_method=&gt;&quot;summary&quot;,:path_method=&gt;&quot;project_path(model)&quot;,:td_class=&gt;'align_center', :style=&gt;'width: 200px;'},
127
+ {:sort_field=&gt;'manager_id',:title=&gt;'Manager',:display_method=&gt;&quot;manager.nil? ? '---' : manager.username&quot;,:path_method=&gt;&quot;model.manager.nil? ? nil : user_path(model.manager)&quot;,:td_class=&gt;'align_center', :style=&gt;'width: 70px;'},
128
+ {:sort_field=&gt;'divisions.name',:title=&gt;'Unit',:display_method=&gt;'division.name rescue &quot;---&quot;',:td_class=&gt;'align_center',:style=&gt;'width: 100px;'},
129
+ {:sort_field=&gt;'nature',:title=&gt;'Nature',:display_method=&gt;'nature',:td_class=&gt;'align_center',:style=&gt;'width: 70px;'},
130
+ {:sort_field=&gt;'project_types.name',:title=&gt;'Type',:display_method=&gt;'project_type.name',:td_class=&gt;'align_center',:style=&gt;'width: 70px;'},
131
+ {:sort_field=&gt;'status',:title=&gt;'Status',:display_method=&gt;'get_status',:td_class=&gt;'align_center',:style=&gt;'width: 70px;'},
132
+ {:sort_field=&gt;'warnings_count',:title=&gt;'Alarms',:display_method=&gt;&quot;warnings_count&quot;,:td_class=&gt;'align_center',:style=&gt;'width: 70px;'},
133
+ {:sort_field=&gt;'price',:title=&gt;'Price',:display_method=&gt;&quot;price&quot;,:td_class=&gt;'align_center',:style=&gt;'width: 70px;'},
134
+ {:sort_field=&gt;'budget_stats.estimated_costs',:title=&gt;'Est. Cost',:display_method=&gt;&quot;active_budget.budget_stats.estimated_costs rescue '---'&quot;,:td_class=&gt;'align_center',:style=&gt;'width: 70px;'},
135
+ {:sort_field=&gt;'project_stats.actual_cost',:title=&gt;'Actual Cost',:display_method=&gt;&quot;project_stats.actual_cost&quot;,:style=&gt;'width: 90px;'},
136
+ {:sort_field=&gt;'progress',:title=&gt;'&lt;small&gt;Prog&lt;sup&gt;3&lt;/sup&gt;&lt;/small&gt;',:display_method=&gt;&quot;100 * project_stats.progress.round(2) if !project_stats.progress.nil?&quot;,:style=&gt;'width: 70px;'}
137
+ ],:items_per_page=&gt;12,
138
+ :class=&gt;'fixed_columns alternatingRows',
139
+ :style =&gt; &quot;padding-top:10px; padding-bottom:10px;&quot; %&gt;</pre>
140
+
141
+ <p>This will render a sortable table. with the given settings.</p>
142
+
143
+ <h3 id="label-Method+sortable_table_tag%28+base_query%2C+columns%3D%5B%5D%2C+opts%3D%7B%7D+%29">Method sortable_table_tag( base_query, columns=[], opts={} )</h3>
144
+ <dl class="rdoc-list label-list"><dt>Arguments
145
+ <dd><dl class="rdoc-list label-list"><dt>base_query
146
+ <dd>
147
+ <p>A string containing a set of rails commands that must return an
148
+ ActiveRecord::Relation.</p>
149
+
150
+ <p>The query must contain a reference to any tables that will be used in
151
+ either sorting or filtering either through a join() or an include().</p>
152
+
153
+ <p>NOTICE: a simple ‘join()’ will result in an INNER JOIN exluding any
154
+ unpaired results.</p>
155
+ </dd><dt>columns
156
+ <dd>
157
+ <p>An array of hashes representing each column in the table</p>
158
+
159
+ <p>The arguments for each column are:</p>
160
+ <dl class="rdoc-list label-list"><dt>:sort_field
161
+ <dd>
162
+ <p>The SQL field wich will be used for sorting this will be placed in the DB
163
+ query</p>
164
+ </dd><dt>:title
165
+ <dd>
166
+ <p>The title for the html table header, can contain html, if blank the
167
+ sort_field will be used</p>
168
+ </dd><dt>:display_method
169
+ <dd>
170
+ <p>The method to generate the content of each cell in the column, this is run
171
+ in each model instance, and has controller_context and view_context
172
+ available if needed</p>
173
+ </dd><dt>:path_method
174
+ <dd>
175
+ <p>The method used to generate an url which is then used to convert the cell
176
+ into an hyperlink, run in the controller context with the variable
177
+ ‘model’ available containing the model instance for each row</p>
178
+ </dd><dt>:no_display
179
+ <dd>
180
+ <p>This field wont be parsed to html.</p>
181
+
182
+ <p>Useful for when extra data is needed for JS or to pass specific CSS for
183
+ each row.</p>
184
+
185
+ <p>NOTICE: Possible bug if the no_display columns are not added after
186
+ displayed columns, untested.</p>
187
+ </dd><dt>:disabled
188
+ <dd>
189
+ <p>Boolean. Disables ordering on this column.</p>
190
+ </dd></dl>
191
+ </dd><dt>options
192
+ <dd><dl class="rdoc-list label-list"><dt>:default_order
193
+ <dd>
194
+ <p>Order to be used in case there is no order selected.</p>
195
+ </dd><dt>:items_per_page
196
+ <dd>
197
+ <p>For paginate. Defaults to 10.</p>
198
+ </dd><dt>:disable_backtrace
199
+ <dd>
200
+ <p>Boolean. Disables caching of the selected order and filters. Unstable.</p>
201
+ </dd><dt>:paginate
202
+ <dd>
203
+ <p>Boolean, default true. Enable pagination.</p>
204
+ </dd><dt>:group
205
+ <dd>
206
+ <p>String. ID of the table and filters group. For when there is more than one
207
+ sortable in the same page.</p>
208
+ </dd><dt>OTHER OPTIONS
209
+ <dd>
210
+ <p>All options accepted for a ‘content_tag’ helper. EX: :class, :style ,
211
+ :some_attribute</p>
212
+ </dd></dl>
213
+ </dd></dl>
214
+ </dd></dl>
215
+ <hr style="height: 1px">
216
+
217
+ <h1 id="label-Filters">Filters</h1>
218
+
219
+ <h2 id="label-Example">Example</h2>
220
+
221
+ <pre>Unit: &lt;%= sortable_filter_tag &quot;division_id&quot;, ['All']+Division.all.map{|x|[ x.name, x.id]}, :style =&gt; &quot;width:90px&quot;%&gt;
222
+ Status: &lt;%= sortable_filter_tag &quot;status&quot;, ['All']+Project::STATUSES, :style =&gt; &quot;width:90px&quot;%&gt;
223
+ Nature: &lt;%= sortable_filter_tag &quot;nature&quot;, ['All']+Project::TYPES, :style =&gt; &quot;width:90px;&quot;%&gt;
224
+ Type: &lt;%= sortable_filter_tag &quot;project_type_id&quot;, ['All']+ProjectType.all.map{|x|[ x.name, x.id]}, :style =&gt; &quot;width:90px&quot;%&gt;
225
+ Manager: &lt;%=sortable_filter_tag(&quot;manager_id&quot;, users, :style =&gt; &quot;width:90px&quot;) %&gt;</pre>
226
+
227
+ <h3 id="label-Method+sortable_filter_tag%28column_name%2C+options_list%2C++opts+%3D+%7B%7D%29">Method sortable_filter_tag(column_name, options_list, opts = {})</h3>
228
+ <dl class="rdoc-list label-list"><dt>Arguments
229
+ <dd><dl class="rdoc-list label-list"><dt>column_name
230
+ <dd>
231
+ <p>String with the SQL column to be used for filtering. (Discarded if :raw_sql
232
+ is true)</p>
233
+ </dd><dt>options_list
234
+ <dd>
235
+ <p>An array with 1 or 2 dimensions .</p>
236
+
237
+ <p>The first element ( <a href="http://i">ar</a>[0] ) is displayed the second
238
+ ( <a href="http://i">ar</a>[1] ) is the actual value to be matched. (
239
+ some_query.where(column_name =&gt; option_value) )</p>
240
+
241
+ <p>If it has only one dimension both values are the same.</p>
242
+
243
+ <p>If :raw_sql is true then the second element should contain a valid WHERE
244
+ condition. EX: ‘users.login_attempts &gt; 5’</p>
245
+ </dd><dt>opts
246
+ <dd><dl class="rdoc-list label-list"><dt>:raw_sql
247
+ <dd>
248
+ <p>Boolean. Defaults to false.</p>
249
+
250
+ <p>If true the value in the options list will be used literaly in the query (
251
+ some_query.where(option_value) )</p>
252
+ </dd><dt>:group
253
+ <dd>
254
+ <p>ID to match the one in the sortable table that is related to this filter.
255
+ For when there is more than one sortable in the same page.</p>
256
+ </dd><dt>:selected
257
+ <dd>
258
+ <p>The selected option. Must be the same as the option value.</p>
259
+ </dd><dt>OTHER OPTIONS
260
+ <dd>
261
+ <p>All options that are valid for a ‘select_tag’ helper</p>
262
+ </dd></dl>
263
+ </dd></dl>
264
+ </dd></dl>
265
+ <hr style="height: 1px">
266
+
267
+ <h2 id="label-Frontend">Frontend</h2>
268
+
269
+ <p>This gem has Javascript and CSS files included to make the tables work on
270
+ the browser</p>
271
+
272
+ <p>*These files are added automatically to config.default_js *</p>
273
+
274
+ <p>*These files must be present in your views for the frontend to work*</p>
275
+
276
+ <p>&gt; skima-sortable-tables.js &gt; ,jquery.ba.bbq.js &gt; ,jquery-ui.min.js
277
+ &gt; ,jquery-ui.css</p>
278
+ <dl class="rdoc-list label-list"><dt>Events
279
+ <dd><dl class="rdoc-list label-list"><dt>sortable.loaded
280
+ <dd>
281
+ <p>Fired after the table data has been loaded and rendered</p>
282
+
283
+ <p>Arguments passed with event</p>
284
+
285
+ <p>data: The data received for the table</p>
286
+
287
+ <p>$table: The table element Jquery reference</p>
288
+
289
+ <p>queryID: Unique identifier for the sortable query on the server</p>
290
+ </dd></dl>
291
+ </dd></dl>
292
+
293
+ <h2 id="label-Re-using+sortable+filters+and+orders">Re-using sortable filters and orders</h2>
294
+
295
+ <p>Catch the data loaded event in javascript</p>
296
+
297
+ <pre>$('your sortable table or document or whatever').on('sortable.loaded',someFunction);
298
+ function someFunction(evt, data, $tableElement, queryID){
299
+ //Send the reference to the query to the server
300
+ $.ajax({
301
+ url:'some_path'
302
+ data:{sortable_id:queryID}
303
+ })
304
+ }</pre>
305
+
306
+ <p>Then use the sortable filters in your controller</p>
307
+
308
+ <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">some_action</span>
309
+ <span class="ruby-identifier">my_base_query</span> = <span class="ruby-constant">User</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'some_rule'</span>)<span class="ruby-comment"># or User or User.order_by() or SomeModel.join() or whatever</span>
310
+ <span class="ruby-identifier">include_order</span> = <span class="ruby-keyword">false</span>
311
+ <span class="ruby-identifier">users</span> = <span class="ruby-constant">SortableSkima</span>.<span class="ruby-identifier">attach_sortables</span>( <span class="ruby-identifier">my_base_query</span>, <span class="ruby-identifier">params</span>[<span class="ruby-string">'sortable_id'</span>], <span class="ruby-identifier">cur_user_or_admin</span>, <span class="ruby-identifier">include_order</span>)
312
+
313
+ <span class="ruby-comment">#...do what you want with your results</span>
314
+ <span class="ruby-keyword">end</span>
315
+
316
+ <span class="ruby-operator">-</span><span class="ruby-operator">-</span><span class="ruby-operator">-</span>
317
+ </pre>
318
+
319
+ <h1 id="label-EXTRA%3A+How+to+generate+a+gem+for+www.gems.skima.net">EXTRA: How to generate a gem for <a href="http://www.gems.skima.net">www.gems.skima.net</a></h1>
320
+
321
+ <p>In console:</p>
322
+
323
+ <pre>$ gem install geminabox-release</pre>
324
+
325
+ <p>Add these lines to ‘Rakefile’:</p>
326
+
327
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'geminabox-release'</span>
328
+ <span class="ruby-constant">GeminaboxRelease</span>.<span class="ruby-identifier">patch</span>(:<span class="ruby-identifier">host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;http://whatever:skimaisdabomb@gems.skima.net&quot;</span>)
329
+ </pre>
330
+
331
+ <p>In console each time you want to publish the gem:</p>
332
+
333
+ <pre>$rake inabox:push</pre>
334
+
335
+ <p>Or to overwrite a previous gem version</p>
336
+
337
+ <pre>$rake inabox:forcepush</pre>
338
+
339
+ </div>
340
+
341
+
342
+ <footer id="validator-badges">
343
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
344
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
345
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
346
+ </footer>
347
+
@@ -0,0 +1,155 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
31
+ function showSource( e ) {
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
55
+ function hookTableOfContentsToggle() {
56
+ $('.indexpage li .toc-toggle').each( function() {
57
+ $(this).click( function() {
58
+ $(this).toggleClass('open');
59
+ });
60
+
61
+ var section = $(this).next();
62
+
63
+ $(this).click( function() {
64
+ section.slideToggle();
65
+ });
66
+ });
67
+ }
68
+
69
+ function hookSearch() {
70
+ var input = $('#search-field').eq(0);
71
+ var result = $('#search-results').eq(0);
72
+ $(result).show();
73
+
74
+ var search_section = $('#search-section').get(0);
75
+ $(search_section).show();
76
+
77
+ var search = new Search(search_data, input, result);
78
+
79
+ search.renderItem = function(result) {
80
+ var li = document.createElement('li');
81
+ var html = '';
82
+
83
+ // TODO add relative path to <script> per-page
84
+ html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
85
+ if (result.params)
86
+ html += '<span class="params">' + result.params + '</span>';
87
+ html += '</a>';
88
+
89
+
90
+ if (result.namespace)
91
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
92
+
93
+ if (result.snippet)
94
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
95
+
96
+ li.innerHTML = html;
97
+
98
+ return li;
99
+ }
100
+
101
+ search.select = function(result) {
102
+ var result_element = result.get(0);
103
+ window.location.href = result_element.firstChild.firstChild.href;
104
+ }
105
+
106
+ search.scrollIntoView = search.scrollInWindow;
107
+ };
108
+
109
+ function highlightTarget( anchor ) {
110
+ console.debug( "Highlighting target '%s'.", anchor );
111
+
112
+ $("a[name]").each( function() {
113
+ if ( $(this).attr("name") == anchor ) {
114
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
115
+ console.debug( "Wrapping the target-section" );
116
+ $('div.method-detail').unwrap( 'div.target-section' );
117
+ $(this).parent().wrap( '<div class="target-section"></div>' );
118
+ } else {
119
+ console.debug( "Already wrapped." );
120
+ }
121
+ }
122
+ });
123
+ };
124
+
125
+ function highlightLocationTarget() {
126
+ console.debug( "Location hash: %s", window.location.hash );
127
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
128
+
129
+ var anchor = window.location.hash.substring(1);
130
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
131
+
132
+ highlightTarget( anchor );
133
+ };
134
+
135
+ function highlightClickTarget( event ) {
136
+ console.debug( "Highlighting click target for event %o", event.target );
137
+ try {
138
+ var anchor = $(event.target).attr( 'href' ).substring(1);
139
+ console.debug( "Found target anchor: %s", anchor );
140
+ highlightTarget( anchor );
141
+ } catch ( err ) {
142
+ console.error( "Exception while highlighting: %o", err );
143
+ };
144
+ };
145
+
146
+
147
+ $(document).ready( function() {
148
+ hookSourceViews();
149
+ hookDebuggingToggle();
150
+ hookSearch();
151
+ highlightLocationTarget();
152
+ hookTableOfContentsToggle();
153
+
154
+ $('ul.link-list a').bind( "click", highlightClickTarget );
155
+ });