compass-jquery-plugin 0.3.2.3 → 0.3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. data/README.md +54 -37
  2. data/VERSION.yml +1 -1
  3. data/lib/handle_attributes.rb +4 -4
  4. data/lib/handle_js_files.rb +5 -5
  5. data/lib/jqtouch_theme.rb +2 -2
  6. data/lib/jquery/dynatree.rb +2 -2
  7. data/lib/jquery/emulators.rb +1 -1
  8. data/lib/jquery/flash_messages.rb +6 -6
  9. data/lib/jquery/graphics.rb +5 -0
  10. data/lib/jquery/gridify/assertions.rb +1 -1
  11. data/lib/jquery/gridify/grid.rb +76 -59
  12. data/lib/jquery/gridify/grid_column.rb +73 -67
  13. data/lib/jquery/gridify/grid_finder.rb +79 -79
  14. data/lib/jquery/gridify/grid_options.rb +154 -149
  15. data/lib/jquery/gridify/grid_view.rb +143 -143
  16. data/lib/jquery/gridify.rb +25 -25
  17. data/lib/jquery/ical/calendar.rb +2 -2
  18. data/lib/jquery/ical/event.rb +48 -44
  19. data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
  20. data/lib/jquery/jqgrid/jqgrid.rb +58 -58
  21. data/lib/jquery/jqgrid.rb +1 -1
  22. data/lib/jquery/jqtouch.rb +1 -1
  23. data/lib/jquery/jquery.rb +117 -117
  24. data/lib/jquery/jquery_auto_complete.rb +9 -9
  25. data/lib/jquery/jquery_json_response.rb +12 -12
  26. data/lib/jquery/jquery_selector_assertions.rb +55 -53
  27. data/lib/jquery/jstree.rb +2 -2
  28. data/lib/jquery/mobile.rb +1 -1
  29. data/lib/jquery/ribbon.rb +2 -2
  30. data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
  31. data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
  32. data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
  33. data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
  34. data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
  35. data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
  36. data/lib/jquery/secret_sauce.rb +1 -1
  37. data/lib/jquery/tools.rb +1 -1
  38. data/lib/jquery_mobile_theme.rb +2 -2
  39. data/lib/jquery_ui_theme.rb +12 -12
  40. data/templates/dynatree/config/initializers/dynatree.rb +3 -3
  41. data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
  42. data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
  43. data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
  44. data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
  45. data/templates/dynatree/jquery.dynatree.js +2926 -2912
  46. data/templates/emulators/config/initializers/emulators.rb +6 -6
  47. data/templates/graphics/config/initializers/graphics.rb +5 -0
  48. data/templates/graphics/jquery/ganttView.scss +89 -0
  49. data/templates/graphics/jquery.ganttView.js +1669 -0
  50. data/templates/graphics/jquery.ganttView.min.js +70 -0
  51. data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
  52. data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
  53. data/templates/graphics/manifest.rb +9 -0
  54. data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
  55. data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
  56. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
  57. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
  58. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
  59. data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
  60. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
  61. data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
  62. data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
  63. data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
  64. data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
  65. data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
  66. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
  67. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
  68. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
  69. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
  70. data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
  71. data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
  72. data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
  73. data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
  74. data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
  75. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
  76. data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
  77. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
  78. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
  79. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
  80. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
  81. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
  82. data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
  83. data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
  84. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
  85. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
  86. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
  87. data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
  88. data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
  89. data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
  90. data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
  91. data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
  92. data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
  93. data/templates/jquery/config/initializers/jquery.rb +2 -4
  94. data/templates/jquery/history.adapter.jquery.js +71 -0
  95. data/templates/jquery/history.adapter.jquery.min.js +4 -0
  96. data/templates/jquery/history.html4.js +690 -0
  97. data/templates/jquery/history.html4.min.js +21 -0
  98. data/templates/jquery/history.js +1297 -0
  99. data/templates/jquery/history.min.js +29 -0
  100. data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
  101. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
  102. data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
  103. data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
  104. data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
  105. data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
  106. data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
  107. data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
  108. data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
  109. data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
  110. data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
  111. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
  112. data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
  113. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
  114. data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
  115. data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
  116. data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
  117. data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
  118. data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
  119. data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
  120. data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
  121. data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
  122. data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
  123. data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
  124. data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
  125. data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
  126. data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
  127. data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
  128. data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
  129. data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
  130. data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
  131. data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
  132. data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
  133. data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
  134. data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
  135. data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
  136. data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
  137. data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
  138. data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
  139. data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
  140. data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
  141. data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
  142. data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
  143. data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
  144. data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
  145. data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
  146. data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
  147. data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
  148. data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
  149. data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
  150. data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
  151. data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
  152. data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
  153. data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
  154. data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
  155. data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
  156. data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
  157. data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
  158. data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
  159. data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
  160. data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
  161. data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
  162. data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
  163. data/templates/jquery/jquery/ui/_theme.scss +14 -13
  164. data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
  165. data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
  166. data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
  167. data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
  168. data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
  169. data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
  170. data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
  171. data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
  172. data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
  173. data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
  174. data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
  175. data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
  176. data/templates/jquery/jquery-ui.js +11839 -23066
  177. data/templates/jquery/jquery-ui.min.js +401 -795
  178. data/templates/jquery/jquery.bgiframe.js +27 -25
  179. data/templates/jquery/jquery.contextMenu.js +209 -196
  180. data/templates/jquery/jquery.cookie.js +3 -1
  181. data/templates/jquery/jquery.dotimeout.js +236 -228
  182. data/templates/jquery/jquery.dst.js +154 -151
  183. data/templates/jquery/jquery.farbtastic.js +293 -293
  184. data/templates/jquery/jquery.flashMessages.js +26 -0
  185. data/templates/jquery/jquery.flashMessages.min.js +1 -0
  186. data/templates/jquery/jquery.form.js +803 -786
  187. data/templates/jquery/jquery.haml.js +248 -247
  188. data/templates/jquery/jquery.hotkeys.js +89 -89
  189. data/templates/jquery/jquery.js +8141 -8106
  190. data/templates/jquery/jquery.layout.js +2451 -2415
  191. data/templates/jquery/jquery.min.js +167 -166
  192. data/templates/jquery/jquery.mousewheel.js +62 -54
  193. data/templates/jquery/jquery.offline.js +171 -171
  194. data/templates/jquery/jquery.pngFix.js +76 -76
  195. data/templates/jquery/jquery.replacetext.js +83 -83
  196. data/templates/jquery/jquery.themeswitchertool.js +202 -177
  197. data/templates/jquery/jquery.tmpl.js +478 -473
  198. data/templates/jquery/jquery.tmplPlus.js +82 -81
  199. data/templates/jquery/jrails.js +178 -175
  200. data/templates/jquery/json.js +77 -7
  201. data/templates/jquery/json2.js +480 -0
  202. data/templates/jquery/json2.min.js +7 -0
  203. data/templates/jquery/lib/tasks/haml.rake +2 -2
  204. data/templates/jquery/manifest.rb +21 -17
  205. data/templates/jstree/jquery.jstree.js +5967 -4536
  206. data/templates/mobile/config/initializers/mobile.rb +1 -1
  207. data/templates/mobile/jquery/mobile/_base.scss +944 -927
  208. data/templates/mobile/jquery/mobile/default.scss +61 -48
  209. data/templates/mobile/jquery/mobile/valencia.scss +56 -42
  210. data/templates/mobile/jquery.mobile.js +4461 -4347
  211. data/templates/mobile/jquery.mobile.min.js +11 -2
  212. data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
  213. data/templates/ribbon/config/initializers/ribbon.rb +2 -2
  214. data/templates/ribbon/jquery.ribbon.js +50 -29
  215. data/templates/secret_sauce/secret_sauce.js +8 -8
  216. data/templates/tools/flowplayer.js +945 -1
  217. data/templates/tools/jquery.tools.js +4645 -4335
  218. data/templates/tools/jquery.tools.min.js +37 -37
  219. data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
  220. data/templates/tools/swfobject.js +813 -773
  221. metadata +33 -21
  222. data/templates/jquery/haml.js +0 -506
  223. data/templates/jquery/haml.min.js +0 -5
  224. data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
  225. data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
  226. data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
  227. data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
  228. data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
  229. data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
  230. data/templates/jquery/jquery.compat-1.3.js +0 -291
  231. data/templates/jquery/jquery.compat-1.3.min.js +0 -6
  232. data/templates/jquery/jquery.flash_messages.js +0 -5
  233. data/templates/jquery/jquery.flash_messages.min.js +0 -1
  234. data/templates/jquery/jquery.history.js +0 -194
  235. data/templates/jquery/jquery.history.min.js +0 -5
@@ -4,172 +4,173 @@ module Gridify
4
4
  # :build_model
5
5
  # :only
6
6
  # :except
7
-
8
- attr_accessor :name, # name of the table (required)
9
- :resource, # based on AR model class (assume tableized, plural, string)
10
- # used as basis for all RESTful requests and data format
11
- # model
12
- :colModel, # incoming: hash of presets (native jqGrid); internally: array of GridColumn objects
13
- # { :body => { "title" => {"width" => 98} }}
14
- :colNames, # Column names
15
- :colInclude, # included submodels
16
- #:widths, # hash of column width (key = data type)
17
- :searchable, # default: true (used in generating columns, changing has no effect on existing cols)
18
- :sortable, # default: true (used in generating columns, changing has no effect on existing cols)
19
- :editable, # default: false (used in generating columns, changing has no effect on existing cols)
7
+
8
+ attr_accessor :name, # name of the table (required)
9
+ :resource, # based on AR model class (assume tableized, plural, string)
10
+ # used as basis for all RESTful requests and data format
11
+ # model
12
+ :colModel, # incoming: hash of presets (native jqGrid); internally: array of GridColumn objects
13
+ # { :body => { "title" => {"width" => 98} }}
14
+ :colNames, # Column names
15
+ :colInclude, # included submodels
16
+ :rowActions, # column for in row actions - values: :client or :server default: :client
17
+ #:widths, # hash of column width (key = data type)
18
+ :searchable, # default: true (used in generating columns, changing has no effect on existing cols)
19
+ :sortable, # default: true (used in generating columns, changing has no effect on existing cols)
20
+ :editable, # default: false (used in generating columns, changing has no effect on existing cols)
20
21
  :inline_edit,
21
22
  :inline_edit_handler,
22
- # grid
23
- :dom_id, # defaults to #{resource}_#{name} eg "notes_grid"
23
+ # grid
24
+ :dom_id, # defaults to #{resource}_#{name} eg "notes_grid"
24
25
  :grid_view,
25
- :jqgrid_options, # hash of additional jqGrid options that override any other settings
26
+ :jqgrid_options, # hash of additional jqGrid options that override any other settings
26
27
  :ajax_grid_options,
27
- #subgrid
28
+ #subgrid
28
29
  :sub_grid,
29
30
  :sub_grid_url,
30
31
  :sub_grid_model,
31
-
32
- #treegrid
33
- :tree_grid, # default is false
34
- :nodeid, # Node to expand
35
- :n_level, # Node level
36
- :n_left, # for nested treegrid only
37
- :n_right, # for nested treegrid only#
38
-
39
- # grid layout options
40
- :width, # in pixels, or nil (nil means calculated based on overflow setting)
41
- :width_fit, # :fluid, :scroll, or :visible
42
- # :fluid will always fit container (presently ignores width option)
43
- # :scroll uses horizontal scrollbars
44
- # :fitted scales columns to fit in width, not fluid
45
- :height, # in pixels, '100%', or :auto (150)
46
- # :auto means makes it as tall as needed per number of rows
47
- :resizable, # allow gride resize with mouse, (true) (or {}) for default options;
48
- # nil or false for disabled; or hash of jqUI options
49
- # see http://jqueryui.com/demos/resizable/
50
- # defaults (differ from jqUI ones) "minWidth" => 150, "minHeight" => 80
51
- # when overflow is fluid, "handles" => 's', otherwise 'e, s, se'
52
- :arranger, # :sortable, :hide_show, :chooser, or nil for none (nil) ,
53
- # can combine with array of options
54
- # or can be a hash with options
55
- # see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:show_hide_columns
56
- # rows
57
- :alt_rows, # true for odd/even row classes, or odd row style name string (nil)
58
- :row_numbers, # true to display row numbers in left column; or numeric width in pixels (nil)
59
- :select_rows, # true for rows are selectable (eg for pager buttons); or js function when row is selected, false disables hover (true if pager buttons else false)
32
+
33
+ #treegrid
34
+ :tree_grid, # default is false
35
+ :nodeid, # Node to expand
36
+ :n_level, # Node level
37
+ :n_left, # for nested treegrid only
38
+ :n_right, # for nested treegrid only#
39
+
40
+ # grid layout options
41
+ :width, # in pixels, or nil (nil means calculated based on overflow setting)
42
+ :width_fit, # :fluid, :scroll, or :visible
43
+ # :fluid will always fit container (presently ignores width option)
44
+ # :scroll uses horizontal scrollbars
45
+ # :fitted scales columns to fit in width, not fluid
46
+ :height, # in pixels, '100%', or :auto (150)
47
+ # :auto means makes it as tall as needed per number of rows
48
+ :resizable, # allow gride resize with mouse, (true) (or {}) for default options;
49
+ # nil or false for disabled; or hash of jqUI options
50
+ # see http://jqueryui.com/demos/resizable/
51
+ # defaults (differ from jqUI ones) "minWidth" => 150, "minHeight" => 80
52
+ # when overflow is fluid, "handles" => 's', otherwise 'e, s, se'
53
+ :arranger, # :sortable, :hide_show, :chooser, or nil for none (nil) ,
54
+ # can combine with array of options
55
+ # or can be a hash with options
56
+ # see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:show_hide_columns
57
+ # rows
58
+ :alt_rows, # true for odd/even row classes, or odd row style name string (nil)
59
+ :row_numbers, # true to display row numbers in left column; or numeric width in pixels (nil)
60
+ :select_rows, # true for rows are selectable (eg for pager buttons); or js function when row is selected, false disables hover (true if pager buttons else false)
60
61
  :multi_select,
61
62
  :sortable_rows,
62
- # header layer
63
- :title, # title string (aka caption), or true for resource.titleize, nil for no title (nil)
64
- :collapsible, # when true generates collapse icon (false)
65
- :collapsed, # when true initial state is collapsed (false)
66
-
67
- # pager layer
68
- :pager, # id of the pager, or true => dom_id+"_pager", false or nil for no pager (nil)
69
- :paging_controls, # false to disable all (true); or hash with native jqGrid options
70
- :paging_choices, # array of rows_per_page choices ([10,25,50,100])
71
- # nav buttons
72
- :view_button, # true, or hash of native jqGrid parameters and events for the action
63
+ # header layer
64
+ :title, # title string (aka caption), or true for resource.titleize, nil for no title (nil)
65
+ :collapsible, # when true generates collapse icon (false)
66
+ :collapsed, # when true initial state is collapsed (false)
67
+
68
+ # pager layer
69
+ :pager, # id of the pager, or true => dom_id+"_pager", false or nil for no pager (nil)
70
+ :paging_controls, # false to disable all (true); or hash with native jqGrid options
71
+ :paging_choices, # array of rows_per_page choices ([10,25,50,100])
72
+ # nav buttons
73
+ :view_button, # true, or hash of native jqGrid parameters and events for the action
73
74
  :add_button,
74
75
  :edit_button,
75
- :delete_button,
76
- :search_button, # enable search button and dialog
77
- :search_advanced, # instead of search_button
78
- :search_toolbar, # toggleable search bar, true or :visible, :hidden (other options?) (nil)
76
+ :delete_button,
77
+ :search_button, # enable search button and dialog
78
+ :search_advanced, # instead of search_button
79
+ :search_toolbar, # toggleable search bar, true or :visible, :hidden (other options?) (nil)
79
80
  :refresh_button,
80
- :jqgrid_nav_options, # native jqGrid button options (added to 2nd arg in navGrid method)
81
- # data
82
- :restful, # use restful url and mtype (true) for all actions
83
- :finder, # default: :find
84
- :url, # request url (required unless table_to_grid or derived from resource)
85
- # if nil, uses "/#{resource}" eg "/notes"
86
- # note, to force "editurl" use jqgrid_options
87
-
88
- :data_type, # :xml, :json, and other defined in jqGrid options doc (xml)
89
- :data_format, # (defaults to rails conventin based on resource) <chickens><chicken><title><body> format
90
- # set false for jqGrid default <rows><records><row><cell> format
91
- :sort_by, # name of sort column of next request
92
- :sort_order, # sort direction of next request, 'asc' or 'desc' ('asc')
93
- :case_sensitive, # sort and search are case sensitive (false)
94
- :current_page, # current page requested
95
- :rows_per_page, # number of items to be requested in the next request (paging_choices.first or -1 if pager false)
96
- :total_rows, # number of rows to read
97
- :table_to_grid, # when true generates tableToGrid (false) from html table, then use as local data
98
- # note, we assume table rows are not selectable.
99
- # (tableToGrid sets multiselect when first col has checkboxes or radio buttons,
100
- # we dont know to preserve this so you also need to set in options)
101
- :load_once, # true to use local data after first load (false)
102
- :error_handler, # javacript: method for crud error handling (default to "after_submit")
103
- :error_container, # selector for posting error/flash messages (.errorExplanation)
104
- # events
81
+ :jqgrid_nav_options, # native jqGrid button options (added to 2nd arg in navGrid method)
82
+ # data
83
+ :restful, # use restful url and mtype (true) for all actions
84
+ :finder, # default: :find
85
+ :url, # request url (required unless table_to_grid or derived from resource)
86
+ # if nil, uses "/#{resource}" eg "/notes"
87
+ # note, to force "editurl" use jqgrid_options
88
+
89
+ :data_type, # :xml, :json, and other defined in jqGrid options doc (xml)
90
+ :data_format, # (defaults to rails conventin based on resource) <chickens><chicken><title><body> format
91
+ # set false for jqGrid default <rows><records><row><cell> format
92
+ :sort_by, # name of sort column of next request
93
+ :sort_order, # sort direction of next request, 'asc' or 'desc' ('asc')
94
+ :case_sensitive, # sort and search are case sensitive (false)
95
+ :current_page, # current page requested
96
+ :rows_per_page, # number of items to be requested in the next request (paging_choices.first or -1 if pager false)
97
+ :total_rows, # number of rows to read
98
+ :table_to_grid, # when true generates tableToGrid (false) from html table, then use as local data
99
+ # note, we assume table rows are not selectable.
100
+ # (tableToGrid sets multiselect when first col has checkboxes or radio buttons,
101
+ # we dont know to preserve this so you also need to set in options)
102
+ :load_once, # true to use local data after first load (false)
103
+ :error_handler, # javacript: method for crud error handling (default to "after_submit")
104
+ :error_container, # selector for posting error/flash messages (.errorExplanation)
105
+ # events
105
106
  #:on_dbl_click_row,
106
107
  #:on_sort_col,
107
108
  #:serialize_grid_data,
108
-
109
- :z
109
+
110
+ :z
110
111
 
111
112
  # ----------------------
112
113
  # attribute defaults and special value handling
113
114
  # (sure it'd be easier to initialize defaults using a hash but we want nil to mean the jqGrid default - might be true - and not pass a value at all)
114
-
115
+
115
116
  def inline_edit
116
- @inline_edit==true ? true : false
117
+ @inline_edit==true ? true : false
117
118
  end
118
-
119
+
119
120
  def inline_edit_handler
120
- @inline_edit_handler || 'null'
121
- end
122
-
121
+ @inline_edit_handler || 'null'
122
+ end
123
+
123
124
  def finder
124
125
  @finder || :find
125
126
  end
126
-
127
+
127
128
  def searchable
128
129
  @searchable==false ? false : true
129
130
  end
130
-
131
+
131
132
  def sortable
132
133
  @sortable==false ? false : true
133
- end
134
-
134
+ end
135
+
135
136
  def sortable_rows
136
- @sortable_rows==true ? true : false
137
+ @sortable_rows==true ? true : false
137
138
  end
138
-
139
+
139
140
  def dom_id
140
141
  @dom_id || "#{resource}_#{name}"
141
- end
142
-
142
+ end
143
+
143
144
  def grid_view
144
145
  @grid_view==false ? false : true
145
146
  end
146
-
147
+
147
148
  def jqgrid_options
148
149
  @jqgrid_options || {}
149
150
  end
150
-
151
+
151
152
  # TreeGrid
152
-
153
+
153
154
  def tree_grid
154
155
  @tree_grid || false
155
156
  end
156
-
157
+
157
158
  def ajax_grid_options
158
159
  @ajax_grid_options || {}
159
160
  end
160
-
161
+
161
162
  def width_fit
162
163
  @width_fit || :fluid
163
164
  end
164
-
165
+
165
166
  def resizable
166
167
  return false if @resizable == false
167
- rs = { "minWidth" => 150, "minHeight" => 80 }
168
- rs.merge!({ "handles" => 's' }) if width_fit == :fluid
169
- rs.merge!( @resizable ) if @resizable.is_a?(Hash)
168
+ rs = {"minWidth" => 150, "minHeight" => 80}
169
+ rs.merge!({"handles" => 's'}) if width_fit == :fluid
170
+ rs.merge!(@resizable) if @resizable.is_a?(Hash)
170
171
  rs
171
172
  end
172
-
173
+
173
174
  def arranger_type #read-only
174
175
  if arranger.is_a?(Hash)
175
176
  arranger.keys
@@ -177,11 +178,11 @@ module Gridify
177
178
  Array(arranger)
178
179
  end
179
180
  end
180
-
181
+
181
182
  def arranger_options(type) #read-only
182
183
  (arranger[type] if arranger.is_a?(Hash)) || {}
183
184
  end
184
-
185
+
185
186
  def select_rows
186
187
  if @select_rows
187
188
  @select_rows
@@ -189,46 +190,50 @@ module Gridify
189
190
  pager && (view_button || edit_button || delete_button)
190
191
  end
191
192
  end
192
-
193
+
193
194
  # header layer
194
195
  def title
195
196
  case @title
196
- when String: @title
197
- when true: resource.titleize
198
- else
199
- ('&nbsp;' if collapsible || collapsed) #show header with blank title
197
+ when String :
198
+ @title
199
+ when true :
200
+ resource.titleize
201
+ else
202
+ ('&nbsp;' if collapsible || collapsed) #show header with blank title
200
203
  end
201
204
  end
202
205
 
203
206
  def collapsible
204
207
  @collapsible || @collapsed
205
208
  end
206
-
209
+
207
210
  # pager layer
208
211
  def pager
209
212
  case @pager
210
- when String: @pager
211
- when true: dom_id+'_pager'
213
+ when String :
214
+ @pager
215
+ when true :
216
+ dom_id+'_pager'
212
217
  end
213
- end
214
-
218
+ end
219
+
215
220
  def paging_controls
216
221
  @paging_controls.nil? ? true : @paging_controls
217
222
  end
218
-
223
+
219
224
  def paging_choices
220
- @paging_choices || [10,25,50,100]
225
+ @paging_choices || [10, 25, 50, 100]
221
226
  end
222
-
227
+
223
228
  def restful
224
229
  @restful==false ? false : true
225
230
  end
226
-
231
+
227
232
  # data
228
233
  def url
229
234
  @url || "/#{resource}"
230
235
  end
231
-
236
+
232
237
  def rows_per_page
233
238
  #debugger
234
239
  # all rows when pager controls or rows per page are off
@@ -240,7 +245,7 @@ module Gridify
240
245
  @rows_per_page
241
246
  end
242
247
  end
243
-
248
+
244
249
  def data_type
245
250
  @data_type || :json
246
251
  end
@@ -250,41 +255,41 @@ module Gridify
250
255
  @data_format
251
256
  elsif resource && data_type == :xml
252
257
  {
253
- :root => resource,
254
- :page => resource+'>page',
255
- :total => resource+'>total',
256
- :records => resource+'>records',
257
- :row => resource.singularize,
258
- :repeatitems => false,
259
- :id => :id
258
+ :root => resource,
259
+ :page => resource+'>page',
260
+ :total => resource+'>total',
261
+ :records => resource+'>records',
262
+ :row => resource.singularize,
263
+ :repeatitems => false,
264
+ :id => :id
260
265
  }
261
266
  elsif resource && data_type == :json
262
267
  {
263
- :root => resource,
264
- :page => 'page',
265
- :total => 'total',
266
- :records => 'records',
267
- :row => resource.singularize,
268
- :repeatitems => false,
269
- :id => :id
268
+ :root => resource,
269
+ :page => 'page',
270
+ :total => 'total',
271
+ :records => 'records',
272
+ :row => resource.singularize,
273
+ :repeatitems => false,
274
+ :id => :id
270
275
  }
271
276
  end
272
277
  end
273
-
278
+
274
279
  # events
275
-
280
+
276
281
  # def serialize_grid_data
277
282
  # @serialize_grid_data || {}
278
283
  # end
279
-
284
+
280
285
  def error_handler
281
286
  @error_handler || 'gridify_action_error_handler'
282
287
  end
283
-
288
+
284
289
  def error_handler_return_value
285
290
  error_handler ? error_handler : 'true;'
286
291
  end
287
-
292
+
288
293
  def error_container
289
294
  @error_container || '.errorExplanation'
290
295
  end
@@ -2,21 +2,21 @@
2
2
 
3
3
  module Gridify
4
4
  class Grid
5
-
5
+
6
6
  # ----------------------
7
7
  # generate the grid javascript for a view
8
8
  # options:
9
9
  # :script => true generates <script> tag (true)
10
10
  # :ready => true generates jquery ready function (true)
11
- def to_javascript( options={} )
12
- options = { :script => true, :ready => true }.merge(options)
13
-
11
+ def to_javascript(options={})
12
+ options = {:script => true, :ready => true}.merge(options)
13
+
14
14
  s = ''
15
15
  if options[:script]
16
16
  s << %Q^
17
17
  <script type="text/javascript">
18
18
  var lastsel_#{dom_id};
19
- ^
19
+ ^
20
20
  end
21
21
 
22
22
  s << js_helpers
@@ -26,208 +26,208 @@ module Gridify
26
26
  $(document).ready(function(){
27
27
  ^
28
28
  end
29
-
29
+
30
30
  s << jqgrid_javascript(options)
31
-
31
+
32
32
  if options[:ready]
33
33
  s << %Q^
34
34
  });
35
- ^
35
+ ^
36
36
  end
37
37
  if options[:script]
38
38
  s << %Q^
39
39
  </script>
40
40
  ^
41
41
  end
42
- s
42
+ s
43
43
  end
44
-
44
+
45
45
  def to_json
46
46
  jqgrid_properties.to_json_with_js
47
47
  end
48
-
48
+
49
49
  # alias :to_s, :to_javascript
50
- def to_s( options={} )
51
- to_javascript( options )
50
+ def to_s(options={})
51
+ to_javascript(options)
52
52
  end
53
-
53
+
54
54
  # ------------------
55
55
  protected
56
56
  # ------------------
57
-
57
+
58
58
  # //{ url: '/notes/{id}', mtype: 'PUT', reloadAfterSubmit: false, closeAfterEdit: true }, // edit settings
59
59
  # //{ url: '/notes', mtype: 'POST', reloadAfterSubmit: false, closeAfterEdit: true }, // add settings
60
60
  # //{ url: '/notes/{id}', mtype: 'DELETE', reloadAfterSubmit: false }, // delete settings
61
-
61
+
62
62
  # get the button options
63
63
  def edit_button_options
64
64
  # 'url' => '/notes/{id}', 'mtype' => 'PUT'
65
65
  # {afterSubmit:function(r,data){return #{options[:error_handler_return_value]}(r,data,'edit');}},
66
-
66
+
67
67
  # note, closeAfterEdit will not close if response returns a non-empty string (even if "success" message)
68
- merge_options_defaults( edit_button || inline_edit,
69
- 'reloadAfterSubmit' => true,
70
- 'closeAfterEdit' => true,
71
- 'afterSubmit' => "javascript: function(r,data){return #{error_handler_return_value}(r,data,'edit');}"
68
+ merge_options_defaults(edit_button || inline_edit,
69
+ 'reloadAfterSubmit' => true,
70
+ 'closeAfterEdit' => true,
71
+ 'afterSubmit' => "javascript: function(r,data){return #{error_handler_return_value}(r,data,'edit');}"
72
72
  )
73
73
  end
74
-
74
+
75
75
  def add_button_options
76
76
  # 'url' => '/notes', 'mtype' => 'POST'
77
- merge_options_defaults( add_button,
78
- 'reloadAfterSubmit' => true,
79
- 'closeAfterAdd' => true,
80
- 'afterSubmit' => "javascript: function(r,data){return #{error_handler_return_value}(r,data,'add');}"
77
+ merge_options_defaults(add_button,
78
+ 'reloadAfterSubmit' => true,
79
+ 'closeAfterAdd' => true,
80
+ 'afterSubmit' => "javascript: function(r,data){return #{error_handler_return_value}(r,data,'add');}"
81
81
  )
82
82
  end
83
-
83
+
84
84
  def delete_button_options
85
85
  # 'url' => '/notes/{id}', 'mtype' => 'DELETE'
86
- merge_options_defaults( delete_button,
87
- 'reloadAfterSubmit' => true,
88
- 'afterSubmit' => "javascript: function(r,data){return #{error_handler_return_value}(r,data,'delete');}"
86
+ merge_options_defaults(delete_button,
87
+ 'reloadAfterSubmit' => true,
88
+ 'afterSubmit' => "javascript: function(r,data){return #{error_handler_return_value}(r,data,'delete');}"
89
89
  )
90
90
  end
91
-
91
+
92
92
  def search_button_options
93
93
  if search_advanced
94
- merge_options_defaults( search_advanced, 'multipleSearch' => true)
94
+ merge_options_defaults(search_advanced, 'multipleSearch' => true)
95
95
  else
96
- merge_options_defaults( search_button)
96
+ merge_options_defaults(search_button)
97
97
  end
98
98
  end
99
-
99
+
100
100
  def view_button_options
101
- merge_options_defaults( view_button)
101
+ merge_options_defaults(view_button)
102
102
  end
103
-
103
+
104
104
  # generate the jqGrid initial values in json
105
105
  # maps our attributes to jqGrid options; omit values when same as jqGrid defaults
106
106
  def jqgrid_properties
107
- vals = {}
108
- vals[:ajaxGridOptions] = ajax_grid_options if ajax_grid_options
109
-
107
+ vals = {}
108
+ vals[:ajaxGridOptions] = ajax_grid_options if ajax_grid_options
109
+
110
110
  # data and request options
111
- vals[:url] = url if url
112
- vals[:editurl] = url if editable
113
- vals[:restful] = true if restful
114
- vals[:inline_edit] = inline_edit if inline_edit.present?
115
- vals[:postData] = { :grid => name, :datatype => data_type } #identify which grid making the request
116
- vals[:colNames] = colNames if colNames.present?
117
- vals[:colModel] = column_model if colModel.present?
118
- vals[:datatype] = data_type if data_type
111
+ vals[:url] = url if url
112
+ vals[:editurl] = url if editable
113
+ vals[:restful] = true if restful
114
+ vals[:inline_edit] = inline_edit if inline_edit.present?
115
+ vals[:postData] = {:grid => name, :datatype => data_type} #identify which grid making the request
116
+ vals[:colNames] = colNames if colNames.present?
117
+ vals[:colModel] = column_model if colModel.present?
118
+ vals[:datatype] = data_type if data_type
119
119
  if data_format.present?
120
120
  case data_type
121
121
  when :xml
122
- vals[:xmlReader] = data_format
122
+ vals[:xmlReader] = data_format
123
123
  when :json
124
- vals[:jsonReader] = data_format
124
+ vals[:jsonReader] = data_format
125
125
  end
126
126
  end
127
-
128
- vals[:loadonce] = load_once if load_once
129
127
 
130
- vals[:sortname] = sort_by if sort_by
131
- vals[:sortorder] = sort_order if sort_order && sort_by
132
- vals[:rowNum] = rows_per_page if rows_per_page
133
- vals[:rowTotal] = total_rows if total_rows
134
- vals[:page] = current_page if current_page
128
+ vals[:loadonce] = load_once if load_once
129
+
130
+ vals[:sortname] = sort_by if sort_by
131
+ vals[:sortorder] = sort_order if sort_order && sort_by
132
+ vals[:rowNum] = rows_per_page if rows_per_page
133
+ vals[:rowTotal] = total_rows if total_rows
134
+ vals[:page] = current_page if current_page
135
135
 
136
136
  # grid options
137
- vals[:height] = height if height
138
- vals[:gridview] = grid_view # faster views, NOTE theres cases when this needs to be disabled
139
-
137
+ vals[:height] = height if height
138
+ vals[:gridview] = grid_view # faster views, NOTE theres cases when this needs to be disabled
139
+
140
140
  case width_fit
141
141
  when :fitted
142
142
  #vals[:autowidth] = false #default
143
143
  #vals[:shrinkToFit] = true #default
144
- vals[:forceFit] = true
145
- vals[:width] = width if width
146
-
144
+ vals[:forceFit] = true
145
+ vals[:width] = width if width
146
+
147
147
  when :scroll
148
148
  #vals[:autowidth] = false #default
149
- vals[:shrinkToFit] = false
149
+ vals[:shrinkToFit] = false
150
150
  #vals[:forceFit] = #ignored by jqGrid
151
- vals[:width] = width if width
152
-
151
+ vals[:width] = width if width
152
+
153
153
  else #when :fluid
154
- vals[:autowidth] = true
154
+ vals[:autowidth] = true
155
155
  #vals[:shrinkToFit] = true #default
156
- vals[:forceFit] = true
156
+ vals[:forceFit] = true
157
157
  #vals[:width] = is ignored
158
- vals[:resizeStop] = 'javascript: gridify_fluid_recalc_width'
158
+ vals[:resizeStop] = 'javascript: gridify_fluid_recalc_width'
159
159
  end
160
-
161
- vals[:sortable] = true if arranger_type.include?(:sortable)
162
-
160
+
161
+ vals[:sortable] = true if arranger_type.include?(:sortable)
162
+
163
163
  # header layer
164
- vals[:caption] = title if title
165
- vals[:hidegrid] = false unless collapsible
166
- vals[:hiddengrid] = true if collapsed
167
-
164
+ vals[:caption] = title if title
165
+ vals[:hidegrid] = false unless collapsible
166
+ vals[:hiddengrid] = true if collapsed
167
+
168
168
  # row formatting
169
- vals[:altrows] = true if alt_rows
170
- vals[:altclass] = alt_rows if alt_rows.is_a?(String)
171
-
172
- vals[:rownumbers] = true if row_numbers
173
- vals[:rownumWidth] = row_numbers if row_numbers.is_a?(Numeric)
174
-
175
- if inline_edit
176
- vals[:scrollrows] = true
177
- vals[:multiselect] = true if multi_select
178
- vals[:onSelectRow] = "javascript: function(id, status) { if(id && id!==lastsel_#{dom_id}) { jQuery('##{dom_id}').jqGrid('restoreRow', lastsel_#{dom_id}); jQuery('##{dom_id}').jqGrid('editRow', id, true, #{inline_edit_handler}, #{error_handler}); lastsel_#{dom_id}=id}}"
169
+ vals[:altrows] = true if alt_rows
170
+ vals[:altclass] = alt_rows if alt_rows.is_a?(String)
171
+
172
+ vals[:rownumbers] = true if row_numbers
173
+ vals[:rownumWidth] = row_numbers if row_numbers.is_a?(Numeric)
174
+
175
+ if inline_edit
176
+ vals[:scrollrows] = true
177
+ vals[:multiselect] = true if multi_select
178
+ vals[:onSelectRow] = "javascript: function(id, status) { if(id && id!==lastsel_#{dom_id}) { jQuery('##{dom_id}').jqGrid('restoreRow', lastsel_#{dom_id}); jQuery('##{dom_id}').jqGrid('editRow', id, true, #{inline_edit_handler}, #{error_handler}); lastsel_#{dom_id}=id}}"
179
179
  elsif select_rows #.present?
180
- vals[:scrollrows] = true
181
- vals[:onSelectRow] = select_rows
182
- vals[:multiselect] = true if multi_select
180
+ vals[:scrollrows] = true
181
+ vals[:onSelectRow] = select_rows
182
+ vals[:multiselect] = true if multi_select
183
183
  else
184
- vals[:hoverrows] = false
184
+ vals[:hoverrows] = false
185
185
  vals[:beforeSelectRow] = "javascript: function(){ false; }"
186
186
  end
187
-
187
+
188
188
  # pager layer
189
189
  if pager
190
- vals[:pager] = "##{pager}"
191
- vals[:viewrecords] = true # display total records in the query (eg "1 - 10 of 25")
192
- vals[:rowList] = paging_choices
190
+ vals[:pager] = "##{pager}"
191
+ vals[:viewrecords] = true # display total records in the query (eg "1 - 10 of 25")
192
+ vals[:rowList] = paging_choices
193
193
  if paging_controls.is_a?(Hash)
194
194
  # allow override of jqGrid pager options
195
195
  vals.merge!(paging_controls)
196
196
  elsif !paging_controls
197
- vals[:rowList] = []
198
- vals[:pgbuttons] = false
199
- vals[:pginput] = false
200
- vals[:recordtext] = "{2} records"
197
+ vals[:rowList] = []
198
+ vals[:pgbuttons] = false
199
+ vals[:pginput] = false
200
+ vals[:recordtext] = "{2} records"
201
201
  end
202
202
  end
203
-
203
+
204
204
  if tree_grid
205
- vals[:treeGrid] = tree_grid
206
- vals[:gridview] = false
207
- vals[:sortable] = false
205
+ vals[:treeGrid] = tree_grid
206
+ vals[:gridview] = false
207
+ vals[:sortable] = false
208
208
  end
209
-
209
+
210
210
  #subgrid
211
211
  if sub_grid
212
- vals[:subGrid] = sub_grid
213
- vals[:subGridUrl] = sub_grid_url
212
+ vals[:subGrid] = sub_grid
213
+ vals[:subGridUrl] = sub_grid_url
214
214
  vals[:subGridModel] = sub_grid_model
215
- vals[:gridview] = false
215
+ vals[:gridview] = false
216
216
  end
217
-
217
+
218
218
  #events
219
219
  #vals[:serializeGridData] = serialize_grid_data if serialize_grid_data
220
-
221
- vals[:loadonce] = load_once if load_once
222
-
220
+
221
+ vals[:loadonce] = load_once if load_once
222
+
223
223
  # allow override of native jqGrid options
224
224
  vals.merge(jqgrid_options)
225
-
226
-
225
+
226
+
227
227
  end
228
-
228
+
229
229
  # -----------------
230
- def jqgrid_javascript( options={} )
230
+ def jqgrid_javascript(options={})
231
231
  s = ''
232
232
 
233
233
  if table_to_grid
@@ -236,20 +236,20 @@ module Gridify
236
236
  ^
237
237
  s << %Q^
238
238
  grid_#{dom_id} = jQuery("##{dom_id}")
239
- ^
239
+ ^
240
240
  else
241
241
  s << %Q^
242
242
  grid_#{dom_id} = jQuery("##{dom_id}").jqGrid(#{to_json})
243
243
  ^
244
244
  end
245
-
245
+
246
246
  s << ';'
247
247
 
248
248
  # tag the grid as fluid so we can find it on resize events
249
- if width_fit == :fluid
249
+ if width_fit == :fluid
250
250
  s << %Q^
251
251
  jQuery("##{dom_id}").addClass("fluid");
252
- ^
252
+ ^
253
253
  end
254
254
 
255
255
  # override tableToGrid colmodel options as needed (sortable)
@@ -259,20 +259,20 @@ module Gridify
259
259
  if resizable
260
260
  s << %Q^
261
261
  jQuery("##{dom_id}").jqGrid('gridResize', #{resizable.to_json});
262
- ^
262
+ ^
263
263
  end
264
264
 
265
265
  # pager buttons (navGrid)
266
266
  if pager
267
- nav_params = {
268
- 'edit' => edit_button.present?,
269
- 'add' => add_button.present?,
270
- 'del' => delete_button.present?,
271
- 'search' => search_button.present? || search_advanced.present?,
272
- 'view' => view_button.present?,
273
- 'refresh' => refresh_button.present?
267
+ nav_params = {
268
+ 'edit' => edit_button.present?,
269
+ 'add' => add_button.present?,
270
+ 'del' => delete_button.present?,
271
+ 'search' => search_button.present? || search_advanced.present?,
272
+ 'view' => view_button.present?,
273
+ 'refresh' => refresh_button.present?
274
274
  }.merge(jqgrid_nav_options||{})
275
-
275
+
276
276
  s << %Q^
277
277
  jQuery("##{dom_id}").jqGrid('navGrid', '##{pager}',
278
278
  #{nav_params.to_json},
@@ -284,7 +284,7 @@ module Gridify
284
284
  );
285
285
  ^
286
286
  end
287
-
287
+
288
288
  if arranger_type.include?(:hide_show)
289
289
  s << %Q^
290
290
  jQuery("##{dom_id}").jqGrid('navButtonAdd','##{pager}',{
@@ -307,15 +307,15 @@ module Gridify
307
307
  }
308
308
  } })}^
309
309
  chooser_opts = {
310
- 'caption' => 'Columns',
311
- 'title' => 'Arrange Columns',
312
- 'onClickButton' => 'chooser_code'
310
+ 'caption' => 'Columns',
311
+ 'title' => 'Arrange Columns',
312
+ 'onClickButton' => 'chooser_code'
313
313
  }.merge(arranger_options(:chooser))
314
314
  s << %Q^
315
315
  jQuery("##{dom_id}").jqGrid('navButtonAdd','##{pager}', #{chooser_opts.to_json.gsub('"chooser_code"', chooser_code)} );
316
316
  ^
317
317
  end
318
-
318
+
319
319
  if search_toolbar
320
320
  # I wish we could put this in the header rather than the pager
321
321
  s << %Q^
@@ -324,18 +324,18 @@ module Gridify
324
324
  jQuery("##{dom_id}").jqGrid('filterToolbar');
325
325
  ^
326
326
  end
327
-
327
+
328
328
  if sortable_rows
329
329
  # I wish we could put this in the header rather than the pager
330
330
  s << %Q^
331
331
  jQuery("##{dom_id}").jqGrid('sortableRows');
332
332
  ^
333
333
  end
334
-
334
+
335
335
  # TODO: built in event handlers, eg
336
336
  # loadError
337
337
  # onSelectRow, onDblClickRow, onRightClickRow etc
338
-
338
+
339
339
  #unless search_toolbar == :visible
340
340
  # s << %Q^
341
341
  # grid_#{dom_id}[0].toggleToolbar();
@@ -344,8 +344,8 @@ module Gridify
344
344
 
345
345
  # # keep page controls centered (jqgrid bug) [eg appears when :width_fit => :scroll]
346
346
  # s << %Q^ $("##{pager}_left").css("width", "auto"); ^
347
-
348
- s
347
+
348
+ s
349
349
  end
350
350
 
351
351
  # ------------------
@@ -355,9 +355,9 @@ module Gridify
355
355
  # gridify_fluid_recalc_width: allow grid resize on window resize events
356
356
  # recalculate width of grid based on parent container; handles multiple grids
357
357
  # ref: http://www.trirand.com/blog/?page_id=393/feature-request/Resizable%20grid/
358
-
358
+
359
359
  # afterSubmit: display error message in response
360
-
360
+
361
361
  %Q^
362
362
  function gridify_fluid_recalc_width(){
363
363
  if (grids = jQuery('.fluid.ui-jqgrid-btable:visible')) {
@@ -390,23 +390,23 @@ module Gridify
390
390
  # return false;
391
391
  # }
392
392
  # return true;
393
-
393
+
394
394
  # lets options be true or a hash, merges into defaults and returns a hash
395
- def merge_options_defaults( options, defaults={} )
395
+ def merge_options_defaults(options, defaults={})
396
396
  if options
397
- defaults.merge( options==true ? {} : options)
397
+ defaults.merge(options==true ? {} : options)
398
398
  else
399
399
  {}
400
400
  end
401
401
  end
402
-
402
+
403
403
  end
404
404
  end
405
405
 
406
406
  class Hash
407
407
  # replace embedded '"javascript: foo"' with 'foo'
408
408
  def to_json_with_js
409
- self.to_json.gsub(/\"javascript: ([^"]*)\"/) {|string| string[1..-2].gsub('javascript:','') }
409
+ self.to_json.gsub(/\"javascript: ([^"]*)\"/) { |string| string[1..-2].gsub('javascript:', '') }
410
410
  end
411
411
  end
412
412