compass-jquery-plugin 0.3.0.0 → 0.3.1.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. data/README.textile +69 -13
  2. data/Rakefile +1 -1
  3. data/VERSION.yml +2 -2
  4. data/gem_tasks/jqgrid.rake +119 -0
  5. data/gem_tasks/jrails.rake +78 -77
  6. data/gem_tasks/mobile.rake +156 -0
  7. data/gem_tasks/rubygems.rake +5 -1
  8. data/gem_tasks/secret_sauce.rake +64 -0
  9. data/lib/jquery/gridify.rb +42 -0
  10. data/lib/jquery/gridify/assertions.rb +37 -0
  11. data/lib/jquery/gridify/grid.rb +210 -0
  12. data/lib/jquery/gridify/grid_column.rb +134 -0
  13. data/lib/jquery/gridify/grid_finder.rb +223 -0
  14. data/lib/jquery/gridify/grid_options.rb +279 -0
  15. data/lib/jquery/gridify/grid_view.rb +435 -0
  16. data/lib/jquery/jqgrid.rb +5 -0
  17. data/lib/jquery/jqgrid/jqgrid.rb +438 -0
  18. data/lib/jquery/mobile.rb +3 -0
  19. data/lib/jquery/secret_sauce.rb +9 -0
  20. data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +14 -0
  21. data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +18 -0
  22. data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +6 -0
  23. data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +118 -0
  24. data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +226 -0
  25. data/lib/jquery/secret_sauce/model/find_for_grid.rb +42 -0
  26. data/templates/dynatree/jquery.dynatree.js +258 -147
  27. data/templates/dynatree/jquery.dynatree.min.js +81 -79
  28. data/templates/dynatree/jquery/dynatree/aero.scss +35 -18
  29. data/templates/dynatree/jquery/dynatree/aero/drop_sibling_here.png +0 -0
  30. data/templates/dynatree/jquery/dynatree/aqua.scss +36 -19
  31. data/templates/dynatree/jquery/dynatree/aqua/drop_sibling_here.png +0 -0
  32. data/templates/dynatree/jquery/dynatree/crystal.scss +38 -21
  33. data/templates/dynatree/jquery/dynatree/crystal/drop_sibling_here.png +0 -0
  34. data/templates/dynatree/jquery/dynatree/xp.scss +59 -42
  35. data/templates/dynatree/jquery/dynatree/xp/drop_sibling_here.png +0 -0
  36. data/templates/dynatree/manifest.rb +4 -0
  37. data/templates/jqgrid/config/initializers/jqgrid.rb +4 -0
  38. data/templates/jqgrid/config/locales/jquery/jqgrid/de.yml +7 -0
  39. data/templates/jqgrid/config/locales/jquery/jqgrid/en.yml +7 -0
  40. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +132 -0
  41. data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +6 -0
  42. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +132 -0
  43. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +6 -0
  44. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -0
  45. data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +6 -0
  46. data/templates/jqgrid/i18n/jqgrid/locale-cn.js +132 -0
  47. data/templates/jqgrid/i18n/jqgrid/locale-cn.min.js +5 -0
  48. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +128 -0
  49. data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +6 -0
  50. data/templates/jqgrid/i18n/jqgrid/locale-da.js +128 -0
  51. data/templates/jqgrid/i18n/jqgrid/locale-da.min.js +6 -0
  52. data/templates/jqgrid/i18n/jqgrid/locale-de.js +133 -0
  53. data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +7 -0
  54. data/templates/jqgrid/i18n/jqgrid/locale-el.js +126 -0
  55. data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +7 -0
  56. data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -0
  57. data/templates/jqgrid/i18n/jqgrid/locale-en.min.js +6 -0
  58. data/templates/jqgrid/i18n/jqgrid/locale-es.js +128 -0
  59. data/templates/jqgrid/i18n/jqgrid/locale-es.min.js +7 -0
  60. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +125 -0
  61. data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +6 -0
  62. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +130 -0
  63. data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +6 -0
  64. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +126 -0
  65. data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +7 -0
  66. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +126 -0
  67. data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +7 -0
  68. data/templates/jqgrid/i18n/jqgrid/locale-he.js +127 -0
  69. data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +6 -0
  70. data/templates/jqgrid/i18n/jqgrid/locale-hu.js +129 -0
  71. data/templates/jqgrid/i18n/jqgrid/locale-hu.min.js +6 -0
  72. data/templates/jqgrid/i18n/jqgrid/locale-is.js +126 -0
  73. data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +6 -0
  74. data/templates/jqgrid/i18n/jqgrid/locale-it.js +1 -0
  75. data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +7 -0
  76. data/templates/jqgrid/i18n/jqgrid/locale-ja.js +155 -0
  77. data/templates/jqgrid/i18n/jqgrid/locale-ja.min.js +5 -0
  78. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +149 -0
  79. data/templates/jqgrid/i18n/jqgrid/locale-nl.min.js +6 -0
  80. data/templates/jqgrid/i18n/jqgrid/locale-no.js +1 -0
  81. data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +6 -0
  82. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +127 -0
  83. data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +6 -0
  84. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +127 -0
  85. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +6 -0
  86. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +125 -0
  87. data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +6 -0
  88. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +139 -0
  89. data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +7 -0
  90. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +127 -0
  91. data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +7 -0
  92. data/templates/jqgrid/i18n/jqgrid/locale-sk.js +127 -0
  93. data/templates/jqgrid/i18n/jqgrid/locale-sk.min.js +6 -0
  94. data/templates/jqgrid/i18n/jqgrid/locale-sr.js +128 -0
  95. data/templates/jqgrid/i18n/jqgrid/locale-sr.min.js +6 -0
  96. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +127 -0
  97. data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +6 -0
  98. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +126 -0
  99. data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +6 -0
  100. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +127 -0
  101. data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +7 -0
  102. data/templates/jqgrid/jquery.jqGrid.js +11604 -0
  103. data/templates/jqgrid/jquery.jqGrid.min.js +472 -0
  104. data/templates/jqgrid/jquery/jqGrid.scss +692 -0
  105. data/templates/jqgrid/manifest.rb +72 -0
  106. data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +13 -0
  107. data/templates/jqtouch/jquery/touch/apple.scss +5 -5
  108. data/templates/jqtouch/jquery/touch/default.scss +5 -5
  109. data/templates/jqtouch/jquery/touch/jqt.scss +5 -5
  110. data/templates/jrails/config/initializers/jrails.rb +3 -0
  111. data/templates/jrails/jquery-ui.js +45 -62
  112. data/templates/jrails/jquery-ui.min.js +22 -22
  113. data/templates/jrails/jquery.js +340 -206
  114. data/templates/jrails/jquery.min.js +152 -151
  115. data/templates/jrails/jquery.tmpl.js +489 -0
  116. data/templates/jrails/jquery.tmpl.min.js +12 -0
  117. data/templates/jrails/jquery.tmplPlus.js +98 -0
  118. data/templates/jrails/jquery.tmplPlus.min.js +3 -0
  119. data/templates/jrails/jquery/ui/_theme.scss +3 -1
  120. data/templates/jrails/manifest.rb +4 -0
  121. data/templates/jstree/jquery.jstree.js +4479 -4468
  122. data/templates/jstree/jquery.jstree.min.js +4 -3
  123. data/templates/mobile/config/initializers/mobile.rb +6 -0
  124. data/templates/mobile/glyphish/Read me first - license.txt +14 -0
  125. data/templates/mobile/glyphish/icons-black/01-refresh.png +0 -0
  126. data/templates/mobile/glyphish/icons-black/02-redo.png +0 -0
  127. data/templates/mobile/glyphish/icons-black/03-loopback.png +0 -0
  128. data/templates/mobile/glyphish/icons-black/04-squiggle.png +0 -0
  129. data/templates/mobile/glyphish/icons-black/05-shuffle.png +0 -0
  130. data/templates/mobile/glyphish/icons-black/06-magnifying-glass.png +0 -0
  131. data/templates/mobile/glyphish/icons-black/07-map-marker.png +0 -0
  132. data/templates/mobile/glyphish/icons-black/08-chat.png +0 -0
  133. data/templates/mobile/glyphish/icons-black/09-chat2.png +0 -0
  134. data/templates/mobile/glyphish/icons-black/10-medical.png +0 -0
  135. data/templates/mobile/glyphish/icons-black/100-coffee.png +0 -0
  136. data/templates/mobile/glyphish/icons-black/101-gameplan.png +0 -0
  137. data/templates/mobile/glyphish/icons-black/102-walk.png +0 -0
  138. data/templates/mobile/glyphish/icons-black/103-map.png +0 -0
  139. data/templates/mobile/glyphish/icons-black/104-index-cards.png +0 -0
  140. data/templates/mobile/glyphish/icons-black/105-piano.png +0 -0
  141. data/templates/mobile/glyphish/icons-black/106-sliders.png +0 -0
  142. data/templates/mobile/glyphish/icons-black/107-widescreen.png +0 -0
  143. data/templates/mobile/glyphish/icons-black/108-badge.png +0 -0
  144. data/templates/mobile/glyphish/icons-black/109-chicken.png +0 -0
  145. data/templates/mobile/glyphish/icons-black/11-clock.png +0 -0
  146. data/templates/mobile/glyphish/icons-black/110-bug.png +0 -0
  147. data/templates/mobile/glyphish/icons-black/111-user.png +0 -0
  148. data/templates/mobile/glyphish/icons-black/112-group.png +0 -0
  149. data/templates/mobile/glyphish/icons-black/113-navigation.png +0 -0
  150. data/templates/mobile/glyphish/icons-black/114-balloon.png +0 -0
  151. data/templates/mobile/glyphish/icons-black/115-bow-and-arrow.png +0 -0
  152. data/templates/mobile/glyphish/icons-black/116-controller.png +0 -0
  153. data/templates/mobile/glyphish/icons-black/117-todo.png +0 -0
  154. data/templates/mobile/glyphish/icons-black/118-coathanger.png +0 -0
  155. data/templates/mobile/glyphish/icons-black/119-piggybank.png +0 -0
  156. data/templates/mobile/glyphish/icons-black/12-eye.png +0 -0
  157. data/templates/mobile/glyphish/icons-black/120-headphones.png +0 -0
  158. data/templates/mobile/glyphish/icons-black/121-lanscape.png +0 -0
  159. data/templates/mobile/glyphish/icons-black/122-stats.png +0 -0
  160. data/templates/mobile/glyphish/icons-black/123-id-card.png +0 -0
  161. data/templates/mobile/glyphish/icons-black/124-bullhorn.png +0 -0
  162. data/templates/mobile/glyphish/icons-black/125-food.png +0 -0
  163. data/templates/mobile/glyphish/icons-black/126-moon.png +0 -0
  164. data/templates/mobile/glyphish/icons-black/127-sock.png +0 -0
  165. data/templates/mobile/glyphish/icons-black/128-bone.png +0 -0
  166. data/templates/mobile/glyphish/icons-black/129-golf.png +0 -0
  167. data/templates/mobile/glyphish/icons-black/13-target.png +0 -0
  168. data/templates/mobile/glyphish/icons-black/130-dice.png +0 -0
  169. data/templates/mobile/glyphish/icons-black/14-tag.png +0 -0
  170. data/templates/mobile/glyphish/icons-black/15-tags.png +0 -0
  171. data/templates/mobile/glyphish/icons-black/16-line-chart.png +0 -0
  172. data/templates/mobile/glyphish/icons-black/17-bar-chart.png +0 -0
  173. data/templates/mobile/glyphish/icons-black/18-envelope.png +0 -0
  174. data/templates/mobile/glyphish/icons-black/19-gear.png +0 -0
  175. data/templates/mobile/glyphish/icons-black/20-gear2.png +0 -0
  176. data/templates/mobile/glyphish/icons-black/21-skull.png +0 -0
  177. data/templates/mobile/glyphish/icons-black/22-skull-n-crossbones.png +0 -0
  178. data/templates/mobile/glyphish/icons-black/23-bird.png +0 -0
  179. data/templates/mobile/glyphish/icons-black/24-gift.png +0 -0
  180. data/templates/mobile/glyphish/icons-black/25-weather.png +0 -0
  181. data/templates/mobile/glyphish/icons-black/26-bandaid.png +0 -0
  182. data/templates/mobile/glyphish/icons-black/27-planet.png +0 -0
  183. data/templates/mobile/glyphish/icons-black/28-star.png +0 -0
  184. data/templates/mobile/glyphish/icons-black/29-heart.png +0 -0
  185. data/templates/mobile/glyphish/icons-black/30-key.png +0 -0
  186. data/templates/mobile/glyphish/icons-black/31-ipod.png +0 -0
  187. data/templates/mobile/glyphish/icons-black/32-iphone.png +0 -0
  188. data/templates/mobile/glyphish/icons-black/33-cabinet.png +0 -0
  189. data/templates/mobile/glyphish/icons-black/34-coffee.png +0 -0
  190. data/templates/mobile/glyphish/icons-black/35-shopping-bag.png +0 -0
  191. data/templates/mobile/glyphish/icons-black/36-toolbox.png +0 -0
  192. data/templates/mobile/glyphish/icons-black/37-suitcase.png +0 -0
  193. data/templates/mobile/glyphish/icons-black/38-airplane.png +0 -0
  194. data/templates/mobile/glyphish/icons-black/39-spraycan.png +0 -0
  195. data/templates/mobile/glyphish/icons-black/40-inbox.png +0 -0
  196. data/templates/mobile/glyphish/icons-black/41-picture-frame.png +0 -0
  197. data/templates/mobile/glyphish/icons-black/42-photos.png +0 -0
  198. data/templates/mobile/glyphish/icons-black/43-film-roll.png +0 -0
  199. data/templates/mobile/glyphish/icons-black/44-shoebox.png +0 -0
  200. data/templates/mobile/glyphish/icons-black/45-movie1.png +0 -0
  201. data/templates/mobile/glyphish/icons-black/46-movie2.png +0 -0
  202. data/templates/mobile/glyphish/icons-black/47-fuel.png +0 -0
  203. data/templates/mobile/glyphish/icons-black/48-fork-and-knife.png +0 -0
  204. data/templates/mobile/glyphish/icons-black/49-battery.png +0 -0
  205. data/templates/mobile/glyphish/icons-black/50-beaker.png +0 -0
  206. data/templates/mobile/glyphish/icons-black/51-outlet.png +0 -0
  207. data/templates/mobile/glyphish/icons-black/52-pinetree.png +0 -0
  208. data/templates/mobile/glyphish/icons-black/53-house.png +0 -0
  209. data/templates/mobile/glyphish/icons-black/54-lock.png +0 -0
  210. data/templates/mobile/glyphish/icons-black/55-network.png +0 -0
  211. data/templates/mobile/glyphish/icons-black/56-cloud.png +0 -0
  212. data/templates/mobile/glyphish/icons-black/57-download.png +0 -0
  213. data/templates/mobile/glyphish/icons-black/58-bookmark.png +0 -0
  214. data/templates/mobile/glyphish/icons-black/59-flag.png +0 -0
  215. data/templates/mobile/glyphish/icons-black/60-signpost.png +0 -0
  216. data/templates/mobile/glyphish/icons-black/61-brightness.png +0 -0
  217. data/templates/mobile/glyphish/icons-black/62-contrast.png +0 -0
  218. data/templates/mobile/glyphish/icons-black/63-runner.png +0 -0
  219. data/templates/mobile/glyphish/icons-black/64-zap.png +0 -0
  220. data/templates/mobile/glyphish/icons-black/65-note.png +0 -0
  221. data/templates/mobile/glyphish/icons-black/66-microphone.png +0 -0
  222. data/templates/mobile/glyphish/icons-black/67-tshirt.png +0 -0
  223. data/templates/mobile/glyphish/icons-black/68-paperclip.png +0 -0
  224. data/templates/mobile/glyphish/icons-black/69-display.png +0 -0
  225. data/templates/mobile/glyphish/icons-black/70-tv.png +0 -0
  226. data/templates/mobile/glyphish/icons-black/71-compass.png +0 -0
  227. data/templates/mobile/glyphish/icons-black/72-pin.png +0 -0
  228. data/templates/mobile/glyphish/icons-black/73-radar.png +0 -0
  229. data/templates/mobile/glyphish/icons-black/74-location.png +0 -0
  230. data/templates/mobile/glyphish/icons-black/75-phone.png +0 -0
  231. data/templates/mobile/glyphish/icons-black/76-baby.png +0 -0
  232. data/templates/mobile/glyphish/icons-black/77-ekg.png +0 -0
  233. data/templates/mobile/glyphish/icons-black/78-stopwatch.png +0 -0
  234. data/templates/mobile/glyphish/icons-black/79-medical-bag.png +0 -0
  235. data/templates/mobile/glyphish/icons-black/80-shopping-cart.png +0 -0
  236. data/templates/mobile/glyphish/icons-black/81-dashboard.png +0 -0
  237. data/templates/mobile/glyphish/icons-black/82-dogpaw.png +0 -0
  238. data/templates/mobile/glyphish/icons-black/83-calendar.png +0 -0
  239. data/templates/mobile/glyphish/icons-black/84-lightbulb.png +0 -0
  240. data/templates/mobile/glyphish/icons-black/85-trophy.png +0 -0
  241. data/templates/mobile/glyphish/icons-black/86-camera.png +0 -0
  242. data/templates/mobile/glyphish/icons-black/87-wineglass.png +0 -0
  243. data/templates/mobile/glyphish/icons-black/88-beermug.png +0 -0
  244. data/templates/mobile/glyphish/icons-black/89-dumbbell.png +0 -0
  245. data/templates/mobile/glyphish/icons-black/90-lifebuoy.png +0 -0
  246. data/templates/mobile/glyphish/icons-black/91-beaker2.png +0 -0
  247. data/templates/mobile/glyphish/icons-black/92-testtube.png +0 -0
  248. data/templates/mobile/glyphish/icons-black/93-thermometer.png +0 -0
  249. data/templates/mobile/glyphish/icons-black/94-pill.png +0 -0
  250. data/templates/mobile/glyphish/icons-black/95-equalizer.png +0 -0
  251. data/templates/mobile/glyphish/icons-black/96-book.png +0 -0
  252. data/templates/mobile/glyphish/icons-black/97-puzzle.png +0 -0
  253. data/templates/mobile/glyphish/icons-black/98-palette.png +0 -0
  254. data/templates/mobile/glyphish/icons-black/99-umbrella.png +0 -0
  255. data/templates/mobile/glyphish/icons-white/09-chat2.png +0 -0
  256. data/templates/mobile/glyphish/icons-white/100-coffee.png +0 -0
  257. data/templates/mobile/glyphish/icons-white/18-envelope.png +0 -0
  258. data/templates/mobile/glyphish/icons-white/19-gear.png +0 -0
  259. data/templates/mobile/glyphish/icons-white/21-skull.png +0 -0
  260. data/templates/mobile/glyphish/icons-white/30-key.png +0 -0
  261. data/templates/mobile/glyphish/icons-white/34-coffee.png +0 -0
  262. data/templates/mobile/glyphish/icons-white/88-beermug.png +0 -0
  263. data/templates/mobile/glyphish/mini-icons-black/band-aid.png +0 -0
  264. data/templates/mobile/glyphish/mini-icons-black/chat.png +0 -0
  265. data/templates/mobile/glyphish/mini-icons-black/clock.png +0 -0
  266. data/templates/mobile/glyphish/mini-icons-black/eye.png +0 -0
  267. data/templates/mobile/glyphish/mini-icons-black/flag.png +0 -0
  268. data/templates/mobile/glyphish/mini-icons-black/fork-and-knife.png +0 -0
  269. data/templates/mobile/glyphish/mini-icons-black/gear.png +0 -0
  270. data/templates/mobile/glyphish/mini-icons-black/heart.png +0 -0
  271. data/templates/mobile/glyphish/mini-icons-black/lightning-bolt.png +0 -0
  272. data/templates/mobile/glyphish/mini-icons-black/magnifying-glass.png +0 -0
  273. data/templates/mobile/glyphish/mini-icons-black/map-marker.png +0 -0
  274. data/templates/mobile/glyphish/mini-icons-black/map-pin.png +0 -0
  275. data/templates/mobile/glyphish/mini-icons-black/microphone.png +0 -0
  276. data/templates/mobile/glyphish/mini-icons-black/music-note.png +0 -0
  277. data/templates/mobile/glyphish/mini-icons-black/paw.png +0 -0
  278. data/templates/mobile/glyphish/mini-icons-black/plus.png +0 -0
  279. data/templates/mobile/glyphish/mini-icons-black/puzzle.png +0 -0
  280. data/templates/mobile/glyphish/mini-icons-black/star.png +0 -0
  281. data/templates/mobile/glyphish/mini-icons-black/tag.png +0 -0
  282. data/templates/mobile/glyphish/mini-icons-black/tshirt.png +0 -0
  283. data/templates/mobile/jquery.mobile.js +3995 -0
  284. data/templates/mobile/jquery.mobile.min.js +28 -0
  285. data/templates/mobile/jquery/mobile/_base.scss +1344 -0
  286. data/templates/mobile/jquery/mobile/default.scss +745 -0
  287. data/templates/mobile/jquery/mobile/default/ajax-loader.png +0 -0
  288. data/templates/mobile/jquery/mobile/default/form-check-off.png +0 -0
  289. data/templates/mobile/jquery/mobile/default/form-check-on.png +0 -0
  290. data/templates/mobile/jquery/mobile/default/form-radio-off.png +0 -0
  291. data/templates/mobile/jquery/mobile/default/form-radio-on.png +0 -0
  292. data/templates/mobile/jquery/mobile/default/icon-search-black.png +0 -0
  293. data/templates/mobile/jquery/mobile/default/icons-18-black.png +0 -0
  294. data/templates/mobile/jquery/mobile/default/icons-18-white.png +0 -0
  295. data/templates/mobile/jquery/mobile/default/icons-36-black.png +0 -0
  296. data/templates/mobile/jquery/mobile/default/icons-36-white.png +0 -0
  297. data/templates/mobile/jquery/mobile/valencia.scss +807 -0
  298. data/templates/mobile/jquery/mobile/valencia/ajax-loader.png +0 -0
  299. data/templates/mobile/jquery/mobile/valencia/form-check-off.png +0 -0
  300. data/templates/mobile/jquery/mobile/valencia/form-check-on.png +0 -0
  301. data/templates/mobile/jquery/mobile/valencia/form-radio-off.png +0 -0
  302. data/templates/mobile/jquery/mobile/valencia/form-radio-on.png +0 -0
  303. data/templates/mobile/jquery/mobile/valencia/icon-search-black.png +0 -0
  304. data/templates/mobile/jquery/mobile/valencia/icons-18-black.png +0 -0
  305. data/templates/mobile/jquery/mobile/valencia/icons-18-white.png +0 -0
  306. data/templates/mobile/jquery/mobile/valencia/icons-36-black.png +0 -0
  307. data/templates/mobile/jquery/mobile/valencia/icons-36-white.png +0 -0
  308. data/templates/mobile/jquery/mobile/valencia/texture_05.png +0 -0
  309. data/templates/mobile/jquery/mobile/valencia/texture_075.png +0 -0
  310. data/templates/mobile/lib/tasks/jquery.mobile.rake +106 -0
  311. data/templates/mobile/manifest.rb +191 -0
  312. data/templates/secret_sauce/app/views/shared/_ui_form_error_messages.html.haml +6 -0
  313. data/templates/secret_sauce/app/views/shared/_ui_grid_for_without_block.js.haml +144 -0
  314. data/templates/secret_sauce/app/views/shared/_ui_static_dialog.html.haml +6 -0
  315. data/templates/secret_sauce/config/initializers/secret_sauce.rb +8 -0
  316. data/templates/secret_sauce/jquery/secret_sauce.scss +33 -0
  317. data/templates/secret_sauce/manifest.rb +10 -0
  318. data/templates/secret_sauce/secret_sauce.js +12 -0
  319. data/templates/secret_sauce/secret_sauce.min.js +1 -0
  320. metadata +313 -17
  321. data/.gitignore +0 -22
  322. data/compass-jquery-plugin.gemspec +0 -1064
@@ -0,0 +1,156 @@
1
+ require 'fileutils'
2
+ require 'lib/handle_js_files'
3
+ require 'lib/jquery_mobile_theme'
4
+
5
+ MOBILE_SRC = File.join(GEM_ROOT, 'src', 'mobile')
6
+ MOBILE_SRC_IMAGES = File.join(MOBILE_SRC, 'images')
7
+ MOBILE_SRC_THEMES = File.join(MOBILE_SRC, 'themes')
8
+
9
+ MOBILE_DEST_TEMPLATES = File.join(GEM_ROOT, 'templates', 'mobile')
10
+ MOBILE_DEST_THEMES = File.join(MOBILE_DEST_TEMPLATES, 'jquery', 'mobile')
11
+ MOBILE_DEST_IMAGES = File.join(MOBILE_DEST_THEMES)
12
+
13
+ all_scripts = [
14
+ 'js/jquery.ui.widget.js',
15
+ 'js/jquery.mobile.widget.js',
16
+ 'js/jquery.mobile.media.js',
17
+ 'js/jquery.mobile.support.js',
18
+ 'js/jquery.mobile.event.js',
19
+ 'js/jquery.mobile.hashchange.js',
20
+ 'js/jquery.mobile.core.js',
21
+ 'js/jquery.mobile.navigation.js',
22
+ 'js/jquery.mobile.page.js',
23
+ 'js/jquery.ui.position.js',
24
+ 'js/jquery.mobile.fixHeaderFooter.js',
25
+ 'js/jquery.mobile.forms.checkboxradio.js',
26
+ 'js/jquery.mobile.forms.textinput.js',
27
+ 'js/jquery.mobile.forms.select.js',
28
+ 'js/jquery.mobile.buttonMarkup.js',
29
+ 'js/jquery.mobile.forms.button.js',
30
+ 'js/jquery.mobile.forms.slider.js',
31
+ 'js/jquery.mobile.collapsible.js',
32
+ 'js/jquery.mobile.controlGroup.js',
33
+ 'js/jquery.mobile.fieldContain.js',
34
+ 'js/jquery.mobile.listview.js',
35
+ 'js/jquery.mobile.listview.filter.js',
36
+ 'js/jquery.mobile.dialog.js',
37
+ 'js/jquery.mobile.navbar.js',
38
+ 'js/jquery.mobile.grid.js',
39
+ 'js/jquery.mobile.themeswitcher.js'
40
+ ].collect {|filename| File.read(File.join(MOBILE_SRC, filename))}.join "\n\n"
41
+
42
+ namespace :build do
43
+ desc 'Build the stylesheets and templates for jquery.mobile.'
44
+ task :mobile do
45
+
46
+ FileUtils.remove_dir MOBILE_DEST_TEMPLATES if File.exists? MOBILE_DEST_TEMPLATES
47
+ FileUtils.mkdir_p(File.join(MOBILE_DEST_TEMPLATES, 'config', 'initializers'))
48
+ FileUtils.mkdir_p(File.join(MOBILE_DEST_TEMPLATES, 'lib', 'tasks'))
49
+
50
+ open File.join(MOBILE_DEST_TEMPLATES, 'manifest.rb'), 'w' do |manifest|
51
+ manifest.print MOBILE_MESSAGE1
52
+
53
+ open File.join(MOBILE_DEST_TEMPLATES, 'config', 'initializers', 'mobile.rb'), 'w' do |f|
54
+ f.print(File.read(File.join(MOBILE_SRC, 'config', 'initializers', 'mobile.rb')))
55
+ end
56
+ manifest.print "file 'config/initializers/mobile.rb'\n"
57
+
58
+ open File.join(MOBILE_DEST_TEMPLATES, 'lib', 'tasks', 'jquery.mobile.rake'), 'w' do |f|
59
+ f.print(File.read(File.join(MOBILE_SRC, 'lib', 'tasks', 'jquery.mobile.rake')))
60
+ end
61
+ manifest.print "file 'lib/tasks/jquery.mobile.rake'\n"
62
+
63
+ #JavaScripts
64
+
65
+ open File.join(MOBILE_DEST_TEMPLATES, 'jquery.mobile.js'), 'w' do |f|
66
+ f.print concat_files(all_scripts)
67
+ end
68
+ manifest.print "javascript 'jquery.mobile.js'\n"
69
+
70
+ open File.join(MOBILE_DEST_TEMPLATES, 'jquery.mobile.min.js'), 'w' do |f|
71
+ f.print compress_js(all_scripts, "yui")
72
+ end
73
+ manifest.print "javascript 'jquery.mobile.min.js'\n"
74
+
75
+ # jQuery Mobile Themes
76
+ mobile = JqueryMobileTheme.new(File.join(MOBILE_SRC_THEMES, 'default'))
77
+
78
+ base_stylesheets = [
79
+ 'jquery.mobile.core.css',
80
+ 'jquery.mobile.button.css',
81
+ 'jquery.mobile.collapsible.css',
82
+ 'jquery.mobile.controlgroup.css',
83
+ 'jquery.mobile.dialog.css',
84
+ 'jquery.mobile.forms.checkboxradio.css',
85
+ 'jquery.mobile.forms.fieldcontain.css',
86
+ 'jquery.mobile.forms.select.css',
87
+ 'jquery.mobile.forms.slider.css',
88
+ 'jquery.mobile.forms.textinput.css',
89
+ 'jquery.mobile.grids.css',
90
+ 'jquery.mobile.headerfooter.css',
91
+ 'jquery.mobile.listview.css',
92
+ 'jquery.mobile.navbar.css',
93
+ 'jquery.mobile.transitions.css'
94
+ ].collect {|filename| File.read(File.join(MOBILE_SRC_THEMES, 'default', filename))}.join "\n\n"
95
+
96
+ FileUtils.mkdir_p(MOBILE_DEST_THEMES)
97
+ open File.join(MOBILE_DEST_THEMES, '_base.scss'), 'w' do |f|
98
+ sass = MOBILE_MESSAGE2
99
+ IO.popen("sass-convert -F css -T scss", 'r+') { |ff| ff.print(base_stylesheets); ff.close_write; sass += ff.read }
100
+ f.print sass
101
+ end
102
+ manifest.print "stylesheet 'jquery/mobile/_base.scss'\n"
103
+
104
+ Dir.foreach MOBILE_SRC_THEMES do |theme|
105
+ next if /^\./ =~ theme
106
+ mobile.convert_theme(theme, File.join(MOBILE_SRC_THEMES, theme), File.join(MOBILE_DEST_THEMES))
107
+ manifest.print "stylesheet 'jquery/mobile/#{theme}.scss'\n"
108
+
109
+ # Copy the theme images directory
110
+ src_dir = File.join(MOBILE_SRC_THEMES, theme, 'images')
111
+ dest_dir = File.join(MOBILE_DEST_IMAGES, theme)
112
+ FileUtils.mkdir_p dest_dir
113
+
114
+ Dir.foreach(src_dir) do |image|
115
+ next if /^\./ =~ image
116
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
117
+ manifest.print "image 'jquery/mobile/#{theme}/#{image}'\n"
118
+ end
119
+ end
120
+
121
+ # glyphish Images
122
+ FileUtils.mkdir_p(File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'icons-black'))
123
+ src_dir = File.join(MOBILE_SRC_IMAGES, 'glyphish', 'icons-black')
124
+ dest_dir = File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'icons-black')
125
+ Dir.foreach(src_dir) do |image|
126
+ next if /^\./ =~ image
127
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
128
+ manifest.print "image 'glyphish/icons-black/#{image}'\n"
129
+ end
130
+
131
+ FileUtils.mkdir_p(File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'icons-white'))
132
+ src_dir = File.join(MOBILE_SRC_IMAGES, 'glyphish', 'icons-white')
133
+ dest_dir = File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'icons-white')
134
+ Dir.foreach(src_dir) do |image|
135
+ next if /^\./ =~ image
136
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
137
+ manifest.print "image 'glyphish/icons-white/#{image}'\n"
138
+ end
139
+
140
+ FileUtils.mkdir_p(File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'mini-icons-black'))
141
+ src_dir = File.join(MOBILE_SRC_IMAGES, 'glyphish', 'mini-icons-black')
142
+ dest_dir = File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'mini-icons-black')
143
+ Dir.foreach(src_dir) do |image|
144
+ next if /^\./ =~ image
145
+ FileUtils.cp(File.join(src_dir, image), dest_dir)
146
+ manifest.print "image 'glyphish/mini-icons-black/#{image}'\n"
147
+ end
148
+
149
+ open File.join(MOBILE_DEST_TEMPLATES, 'glyphish', 'Read me first - license.txt'), 'w' do |f|
150
+ f.print(File.read(File.join(MOBILE_SRC_IMAGES, 'glyphish', 'Read me first - license.txt')))
151
+ end
152
+ manifest.print "image 'glyphish/Read me first - license.txt'\n"
153
+
154
+ end
155
+ end
156
+ end
@@ -6,9 +6,13 @@ namespace :build do
6
6
  "build:tools",
7
7
  "build:dynatree",
8
8
  "build:jstree",
9
+ "build:jqgrid",
10
+ "build:secret_sauce",
9
11
  "build:ribbon",
10
12
  "build:ical",
11
13
  "build:jqtouch",
12
- "build:emulators"] do
14
+ "build:mobile",
15
+ "build:emulators"
16
+ ] do
13
17
  end
14
18
  end
@@ -0,0 +1,64 @@
1
+ require 'fileutils'
2
+ require 'lib/handle_js_files'
3
+
4
+ # Compass generator for jqGrid 3.5+
5
+ SECRET_SAUCE_SRC = File.join(GEM_ROOT, 'src', 'secret_sauce')
6
+ SECRET_SAUCE_SRC_SCRIPTS = SECRET_SAUCE_SRC + "/*.js"
7
+
8
+ SECRET_SAUCE_DEST_TEMPLATES = File.join(GEM_ROOT, 'templates', 'secret_sauce')
9
+ SECRET_SAUCE_DEST_STYLESHEETS = File.join(SECRET_SAUCE_DEST_TEMPLATES, 'jquery')
10
+ SECRET_SAUCE_DEST_CONFIG = File.join(SECRET_SAUCE_DEST_TEMPLATES, 'config', 'initializers')
11
+ SECRET_SAUCE_DEST_VIEWS = File.join(SECRET_SAUCE_DEST_TEMPLATES, 'app', 'views', 'shared')
12
+
13
+ SECRET_SAUCE_MESSAGE1 = "# Generated by compass-jquery-plugin/gem-tasks/secret_sauce.rake\n# Install with: compass install jquery/secret_sauce\n\n"
14
+ SECRET_SAUCE_MESSAGE2 = "// Generated by compass-jquery-pluginy/gem-tasks/secret_sauce.rake\n\n"
15
+
16
+ namespace :build do
17
+ desc 'Build the stylesheets and templates for jqGrid.'
18
+ task :secret_sauce do
19
+
20
+ FileUtils.remove_dir(SECRET_SAUCE_DEST_TEMPLATES) if File.exists? SECRET_SAUCE_DEST_TEMPLATES
21
+ FileUtils.mkdir_p(SECRET_SAUCE_DEST_CONFIG)
22
+ FileUtils.mkdir_p(SECRET_SAUCE_DEST_VIEWS)
23
+
24
+ open File.join(SECRET_SAUCE_DEST_TEMPLATES, 'manifest.rb'), 'w' do |manifest|
25
+ manifest.print SECRET_SAUCE_MESSAGE1
26
+
27
+ Dir.foreach File.join(SECRET_SAUCE_SRC, 'app', 'views', 'shared') do |file|
28
+ next unless /\.haml$/ =~ file
29
+ html = File.read File.join(SECRET_SAUCE_SRC, 'app', 'views', 'shared', file)
30
+ open File.join(SECRET_SAUCE_DEST_VIEWS, file), 'w' do |f|
31
+ f.print(html)
32
+ end
33
+ manifest.print "file 'app/views/shared/#{file}'\n"
34
+ end
35
+
36
+ open File.join(SECRET_SAUCE_DEST_TEMPLATES, 'config', 'initializers', 'secret_sauce.rb'), 'w' do |f|
37
+ f.print(File.read(File.join(SECRET_SAUCE_SRC, 'config', 'initializers', 'secret_sauce.rb')))
38
+ end
39
+ manifest.print "file 'config/initializers/secret_sauce.rb'\n"
40
+
41
+ open File.join(SECRET_SAUCE_DEST_TEMPLATES, 'secret_sauce.js'), 'w' do |f|
42
+ f.print concat_files(all_files(SECRET_SAUCE_SRC_SCRIPTS))
43
+ end
44
+ manifest.print "javascript 'secret_sauce.js'\n"
45
+
46
+ open File.join(SECRET_SAUCE_DEST_TEMPLATES, 'secret_sauce.min.js'), 'w' do |f|
47
+ f.print compress_js(all_files(SECRET_SAUCE_SRC_SCRIPTS), "google")
48
+ end
49
+ manifest.print "javascript 'secret_sauce.min.js'\n"
50
+
51
+ FileUtils.mkdir_p(SECRET_SAUCE_DEST_STYLESHEETS)
52
+ Dir.foreach File.join(SECRET_SAUCE_SRC, 'css') do |file|
53
+ next unless /\.css$/ =~ file
54
+ css = File.read File.join(SECRET_SAUCE_SRC, 'css', file)
55
+ sass = ''
56
+ IO.popen("sass-convert -F css -T scss", 'r+') { |f| f.print(css); f.close_write; sass = f.read }
57
+ open(File.join(SECRET_SAUCE_DEST_STYLESHEETS, file.gsub(/\.css$/,'.scss')), 'w') do |f|
58
+ f.write SECRET_SAUCE_MESSAGE2 + sass
59
+ end
60
+ manifest.print "stylesheet 'jquery/#{file.gsub(/\.css$/,'.scss')}'\n"
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,42 @@
1
+ require 'jquery/gridify/grid'
2
+
3
+ module Gridify
4
+
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+ attr_accessor :grids
11
+
12
+ def gridify(*args, &block)
13
+ # debugger
14
+ grid = Gridify::Grid.new( self, *args, &block)
15
+ @grids ||= {}
16
+ @grids[grid.name.to_sym] = grid
17
+
18
+ unless self.respond_to?(:find_for_grid)
19
+ class_eval <<-EOV
20
+ named_scope :find_for_grid, lambda {|name, params|
21
+ grid = grids[name]
22
+ grid.update_from_params( params )
23
+ grid.current_scope
24
+ }
25
+ EOV
26
+ end
27
+ end
28
+
29
+ def grids
30
+ @grids || {}
31
+ end
32
+
33
+ def grid(name=nil)
34
+ name ? grids[name] : grids[:grid]
35
+ end
36
+ end
37
+ end
38
+
39
+ class ActiveRecord::Base
40
+ include Gridify
41
+ end
42
+
@@ -0,0 +1,37 @@
1
+ # lifted from state_machine plugin
2
+ module Gridify
3
+ # Provides a set of helper methods for making assertions about the content
4
+ # of various objects
5
+ module Assertions
6
+ # Validates that the given hash *only* includes the specified valid keys.
7
+ # If any invalid keys are found, an ArgumentError will be raised.
8
+ #
9
+ # == Examples
10
+ #
11
+ # options = {:name => 'John Smith', :age => 30}
12
+ #
13
+ # assert_valid_keys(options, :name) # => ArgumentError: Invalid key(s): age
14
+ # assert_valid_keys(options, 'name', 'age') # => ArgumentError: Invalid key(s): age, name
15
+ # assert_valid_keys(options, :name, :age) # => nil
16
+ def assert_valid_keys(hash, *valid_keys)
17
+ invalid_keys = hash.keys - valid_keys
18
+ raise ArgumentError, "Invalid key(s): #{invalid_keys.join(', ')}" unless invalid_keys.empty?
19
+ end
20
+
21
+ # Validates that the given hash only includes at *most* one of a set of
22
+ # exclusive keys. If more than one key is found, an ArgumentError will be
23
+ # raised.
24
+ #
25
+ # == Examples
26
+ #
27
+ # options = {:only => :on, :except => :off}
28
+ # assert_exclusive_keys(options, :only) # => nil
29
+ # assert_exclusive_keys(options, :except) # => nil
30
+ # assert_exclusive_keys(options, :only, :except) # => ArgumentError: Conflicting keys: only, except
31
+ # assert_exclusive_keys(options, :only, :except, :with) # => ArgumentError: Conflicting keys: only, except
32
+ def assert_exclusive_keys(hash, *exclusive_keys)
33
+ conflicting_keys = exclusive_keys & hash.keys
34
+ raise ArgumentError, "Conflicting keys: #{conflicting_keys.join(', ')}" unless conflicting_keys.length <= 1
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,210 @@
1
+ require 'jquery/gridify/assertions'
2
+ require 'jquery/gridify/grid_options'
3
+ require 'jquery/gridify/grid_view'
4
+ require 'jquery/gridify/grid_column'
5
+ require 'jquery/gridify/grid_finder'
6
+
7
+ # NOTE: for readablity/clarity, native jqGrid options should be string; Ruby ones as syms
8
+
9
+ module Gridify
10
+ class Grid
11
+ include Assertions
12
+
13
+ # todo: change this so klass is optional, decouple from active record
14
+ def initialize( klass, *args, &block )
15
+ #debugger
16
+ options = args.extract_options! # => args.last.is_a?(Hash) ? args.pop : {}
17
+ assert_exclusive_keys( options, :only, :except)
18
+
19
+ @resource = klass.to_s.tableize.pluralize
20
+ @name = args.first || :grid
21
+
22
+ # non-persistent options
23
+ # generate model unless explicitly say no
24
+ build_model = options.delete(:build_model) == false ? false : true
25
+ only = options.delete(:only)
26
+ except = options.delete(:except)
27
+ col_presets = options.delete(:colModel)
28
+ col_include = options[:colInclude]
29
+
30
+ # assign options
31
+ update options
32
+
33
+ # build columns from ActiveRecord model (klass)
34
+ if klass.present? && build_model
35
+ @model = build_columns(klass, only, except, col_presets, col_include)
36
+ end
37
+
38
+ instance_eval(&block) if block
39
+ #(note instance_eval cannot access things outside its scope; otherwise do this:
40
+ #yield self if block_given?
41
+ end
42
+
43
+ def update( options )
44
+ options.each {|atr, val| send( "#{atr}=", val )}
45
+ # exception "invalid option..."
46
+ end
47
+
48
+ def column( name, options={} )
49
+ name = name.to_s
50
+ klass = resource.classify.constantize
51
+ # TODO: set edit options based on ar_column
52
+ # TODO: edit
53
+ # TODO: handle file input types
54
+ # TODO: custom input types
55
+ if col = columns_hash[name]
56
+ # update an existing column
57
+ col.update options
58
+
59
+ elsif ar = klass.columns.detect {|c| c.name==name}
60
+ #debugger
61
+ # create column from database schema
62
+ edit = editable &&
63
+ # only edit accessible attributes
64
+ (klass.accessible_attributes.nil? || klass.accessible_attributes.include?(ar.name))
65
+ args = {
66
+ :ar_column => ar,
67
+ :name => ar.name,
68
+ :value_type => ar.type,
69
+ :searchable => searchable,
70
+ :sortable => sortable,
71
+ :editable => edit
72
+ }.merge(options)
73
+ colModel << GridColumn.new( args)
74
+
75
+ else
76
+ # create column from scratch
77
+ args = {
78
+ :name => name,
79
+ :value_type => :string,
80
+ :searchable => searchable,
81
+ :sortable => sortable,
82
+ :editable => edit
83
+ }.merge(options)
84
+ colModel << GridColumn.new( args)
85
+ end
86
+ end
87
+
88
+ def column_names
89
+ colModel.collect {|col| col.name.titleize }
90
+ end
91
+
92
+ def column_model
93
+ colModel.collect {|col| col.properties }
94
+ end
95
+
96
+ # normally we need to keep columns an ordered array, sometimes its convenient to have a hash
97
+ def columns_hash
98
+ colModel.inject({}) {|h, col| h[col.name] = col; h }
99
+ end
100
+
101
+ protected
102
+
103
+ # # isnt there something in rails to do this already?
104
+ # def parse_options( keys, options )
105
+ # ops = keys.inject({}) do |h, k|
106
+ # val = options.delete(k)
107
+ # h[k] = val unless val.nil?
108
+ # h
109
+ # end
110
+ # ops || {}
111
+ # end
112
+
113
+ # generate list of columns based on AR model
114
+ # option: :only or :except
115
+ # :col_options hash of hash of preset values for columns (eg from cookie) { :title => {:width => 98}}
116
+ def build_columns( klass, only, except, presets, col_include )
117
+ #debugger
118
+ # stringify
119
+ only = Array(only).map {|s| s.to_s }
120
+ except = Array(except).map {|s| s.to_s }
121
+ presets ||= []
122
+
123
+ if presets.length > 0
124
+ hashed_defs = {}
125
+
126
+ klass.columns.collect do |ar|
127
+ #debugger
128
+ next if only.present? && !only.include?(ar.name)
129
+ next if except.present? && except.include?(ar.name)
130
+ hashed_defs[ar.name] = strct2args(klass, ar)
131
+ end.compact
132
+
133
+ if col_include
134
+ col_include.each do |sub_model|
135
+ my_model = sub_model.to_s
136
+ if klass.inheritable_attributes[:reflections][sub_model].options[:class_name]
137
+ my_class = klass.inheritable_attributes[:reflections][sub_model].options[:class_name].to_s
138
+ model = klass.inheritable_attributes[:reflections][sub_model].options[:class_name].to_s
139
+ else
140
+ my_class = my_model
141
+ end
142
+ Object.const_get(my_class.capitalize).columns.collect do |ar|
143
+ #debugger
144
+ next if only.present? && !only.include?("#{my_model}.#{ar.name}")
145
+ next if except.present? && except.include?("#{my_model}.#{ar.name}")
146
+ hashed_defs["#{my_model}.#{ar.name}"] = strct2args(klass, ar)
147
+ end
148
+ end
149
+ end
150
+
151
+ # Take sequence from colModel
152
+ self.colModel = []
153
+ presets.each do |col|
154
+ # create column with default args merged with options given for this column
155
+ willi = hashed_defs[col[:name]]
156
+ self.colModel << GridColumn.new(hashed_defs[col[:name]].merge(col))
157
+ end
158
+ else
159
+ # Take sequence from database definition
160
+ self.colModel = klass.columns.collect do |ar|
161
+ #debugger
162
+ next if only.present? && !only.include?(ar.name)
163
+ next if except.present? && except.include?(ar.name)
164
+ args = strct2args(klass, ar)
165
+ # create column with default args merged with options given for this column
166
+ GridColumn.new(args)
167
+ end.compact
168
+
169
+ if col_include
170
+ col_include.each do |sub_model|
171
+ my_model = sub_model.to_s
172
+ if klass.inheritable_attributes[:reflections][sub_model].options[:class_name]
173
+ my_class = klass.inheritable_attributes[:reflections][sub_model].options[:class_name].to_s
174
+ model = klass.inheritable_attributes[:reflections][sub_model].options[:class_name].to_s
175
+ else
176
+ my_class = my_model
177
+ end
178
+ Object.const_get(my_class.capitalize).columns.collect do |ar|
179
+ #debugger
180
+ next if only.present? && !only.include?("#{my_model}.#{ar.name}")
181
+ next if except.present? && except.include?("#{my_model}.#{ar.name}")
182
+ args = strct2args(klass, ar, "#{my_model}.")
183
+ # create column with default args merged with options given for this column
184
+ self.colModel << GridColumn.new(args)
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+
191
+ private
192
+
193
+ def strct2args(my_class, record, prefix="")
194
+ is_key = (record.name=='id')
195
+ edit = editable && !is_key &&
196
+ # only edit accessible attributes
197
+ (my_class.accessible_attributes.nil? || my_class.accessible_attributes.include?(record.name))
198
+ args = {
199
+ :ar_column => record,
200
+ :name => "#{prefix}#{record.name}",
201
+ :value_type => record.type,
202
+ :key => is_key,
203
+ #:hidden => is_key,
204
+ :searchable => searchable,
205
+ :sortable => sortable,
206
+ :editable => edit
207
+ }
208
+ end
209
+ end
210
+ end