kirgudu_base 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/kirgudu_base/404-fry.png +0 -0
  6. data/app/assets/images/kirgudu_base/Documents.gif +0 -0
  7. data/app/assets/images/kirgudu_base/Meetings.gif +0 -0
  8. data/app/assets/images/kirgudu_base/Repair.gif +0 -0
  9. data/app/assets/images/kirgudu_base/ajax-loader.gif +0 -0
  10. data/app/assets/images/kirgudu_base/alpha.png +0 -0
  11. data/app/assets/images/kirgudu_base/alpha2.png +0 -0
  12. data/app/assets/images/kirgudu_base/arrow.png +0 -0
  13. data/app/assets/images/kirgudu_base/box.gif +0 -0
  14. data/app/assets/images/kirgudu_base/chosen-sprite.png +0 -0
  15. data/app/assets/images/kirgudu_base/company_pxg.png +0 -0
  16. data/app/assets/images/kirgudu_base/datatables/back_disabled.png +0 -0
  17. data/app/assets/images/kirgudu_base/datatables/back_enabled.png +0 -0
  18. data/app/assets/images/kirgudu_base/datatables/back_enabled_hover.png +0 -0
  19. data/app/assets/images/kirgudu_base/datatables/forward_disabled.png +0 -0
  20. data/app/assets/images/kirgudu_base/datatables/forward_enabled.png +0 -0
  21. data/app/assets/images/kirgudu_base/datatables/forward_enabled_hover.png +0 -0
  22. data/app/assets/images/kirgudu_base/datatables/sort_asc.png +0 -0
  23. data/app/assets/images/kirgudu_base/datatables/sort_asc_disabled.png +0 -0
  24. data/app/assets/images/kirgudu_base/datatables/sort_both.png +0 -0
  25. data/app/assets/images/kirgudu_base/datatables/sort_desc.png +0 -0
  26. data/app/assets/images/kirgudu_base/datatables/sort_desc_disabled.png +0 -0
  27. data/app/assets/images/kirgudu_base/fancybox/blank.gif +0 -0
  28. data/app/assets/images/kirgudu_base/fancybox/fancybox_buttons.png +0 -0
  29. data/app/assets/images/kirgudu_base/fancybox/fancybox_loading.gif +0 -0
  30. data/app/assets/images/kirgudu_base/fancybox/fancybox_overlay.png +0 -0
  31. data/app/assets/images/kirgudu_base/fancybox/fancybox_sprite.png +0 -0
  32. data/app/assets/images/kirgudu_base/favicon.png +0 -0
  33. data/app/assets/images/kirgudu_base/general/clock.png +0 -0
  34. data/app/assets/images/kirgudu_base/general/clock2.png +0 -0
  35. data/app/assets/images/kirgudu_base/general/coffee.png +0 -0
  36. data/app/assets/images/kirgudu_base/general/coffee2.png +0 -0
  37. data/app/assets/images/kirgudu_base/general/flipchart.png +0 -0
  38. data/app/assets/images/kirgudu_base/general/flipchart2.png +0 -0
  39. data/app/assets/images/kirgudu_base/general/sun.png +0 -0
  40. data/app/assets/images/kirgudu_base/general/sun2.png +0 -0
  41. data/app/assets/images/kirgudu_base/glyphicons-halflings-white.png +0 -0
  42. data/app/assets/images/kirgudu_base/glyphicons-halflings.png +0 -0
  43. data/app/assets/images/kirgudu_base/gradient1.png +0 -0
  44. data/app/assets/images/kirgudu_base/hue2.png +0 -0
  45. data/app/assets/images/kirgudu_base/ico_16_4_d.gif +0 -0
  46. data/app/assets/images/kirgudu_base/ico_18_1010.gif +0 -0
  47. data/app/assets/images/kirgudu_base/ico_18_112.gif +0 -0
  48. data/app/assets/images/kirgudu_base/ico_18_2020.gif +0 -0
  49. data/app/assets/images/kirgudu_base/icon-contacts.gif +0 -0
  50. data/app/assets/images/kirgudu_base/icon-employees.gif +0 -0
  51. data/app/assets/images/kirgudu_base/icon-list.gif +0 -0
  52. data/app/assets/images/kirgudu_base/icon-orders-green.gif +0 -0
  53. data/app/assets/images/kirgudu_base/icon-orders.gif +0 -0
  54. data/app/assets/images/kirgudu_base/icon-tenders.gif +0 -0
  55. data/app/assets/images/kirgudu_base/icons-sa7c41345d9.png +0 -0
  56. data/app/assets/images/kirgudu_base/login-corner.png +0 -0
  57. data/app/assets/images/kirgudu_base/login-corner2.png +0 -0
  58. data/app/assets/images/kirgudu_base/logo.png +0 -0
  59. data/app/assets/images/kirgudu_base/maps/m1.png +0 -0
  60. data/app/assets/images/kirgudu_base/maps/m2.png +0 -0
  61. data/app/assets/images/kirgudu_base/maps/m3.png +0 -0
  62. data/app/assets/images/kirgudu_base/meeting-schedule.gif +0 -0
  63. data/app/assets/images/kirgudu_base/menu_icons/calendar.png +0 -0
  64. data/app/assets/images/kirgudu_base/menu_icons/dashboard.png +0 -0
  65. data/app/assets/images/kirgudu_base/menu_icons/forms.png +0 -0
  66. data/app/assets/images/kirgudu_base/menu_icons/gallery.png +0 -0
  67. data/app/assets/images/kirgudu_base/menu_icons/grid.png +0 -0
  68. data/app/assets/images/kirgudu_base/menu_icons/maps.png +0 -0
  69. data/app/assets/images/kirgudu_base/menu_icons/others.png +0 -0
  70. data/app/assets/images/kirgudu_base/menu_icons/statistics.png +0 -0
  71. data/app/assets/images/kirgudu_base/menu_icons/tables.png +0 -0
  72. data/app/assets/images/kirgudu_base/menu_icons/widgets.png +0 -0
  73. data/app/assets/images/kirgudu_base/menu_top/profile-avatar.png +0 -0
  74. data/app/assets/images/kirgudu_base/menu_top/profile-messages.png +0 -0
  75. data/app/assets/images/kirgudu_base/message_avatar1.png +0 -0
  76. data/app/assets/images/kirgudu_base/message_avatar2.png +0 -0
  77. data/app/assets/images/kirgudu_base/message_avatar3.png +0 -0
  78. data/app/assets/images/kirgudu_base/message_avatar4.png +0 -0
  79. data/app/assets/images/kirgudu_base/message_avatar5.png +0 -0
  80. data/app/assets/images/kirgudu_base/message_avatar6.png +0 -0
  81. data/app/assets/images/kirgudu_base/message_avatar7.png +0 -0
  82. data/app/assets/images/kirgudu_base/news-icon-16.gif +0 -0
  83. data/app/assets/images/kirgudu_base/operator-def.png +0 -0
  84. data/app/assets/images/kirgudu_base/patterns/bg_dark.png +0 -0
  85. data/app/assets/images/kirgudu_base/patterns/bg_dark2.png +0 -0
  86. data/app/assets/images/kirgudu_base/patterns/bg_dark3.png +0 -0
  87. data/app/assets/images/kirgudu_base/patterns/whitey.png +0 -0
  88. data/app/assets/images/kirgudu_base/people-16-16-256.gif +0 -0
  89. data/app/assets/images/kirgudu_base/sales_24x24 (1).gif +0 -0
  90. data/app/assets/images/kirgudu_base/sample_avatar_big.jpg +0 -0
  91. data/app/assets/images/kirgudu_base/saturation2.png +0 -0
  92. data/app/assets/images/kirgudu_base/search.png +0 -0
  93. data/app/assets/images/kirgudu_base/toggle.png +0 -0
  94. data/app/assets/images/kirgudu_base/ui-bg_fine-grain_10_e7e7e7_60x60.png +0 -0
  95. data/app/assets/images/kirgudu_base/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  96. data/app/assets/images/kirgudu_base/ui-bg_flat_0_ef4622_40x100.png +0 -0
  97. data/app/assets/images/kirgudu_base/ui-bg_glass_65_ffffff_1x400.png +0 -0
  98. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_100_e1e1e1_1x100.png +0 -0
  99. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_100_eeeeee_1x100.png +0 -0
  100. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_75_dddddd_1x100.png +0 -0
  101. data/app/assets/images/kirgudu_base/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  102. data/app/assets/images/kirgudu_base/ui-icons_454545_256x240.png +0 -0
  103. data/app/assets/images/kirgudu_base/ui-icons_525d66_256x240.png +0 -0
  104. data/app/assets/images/kirgudu_base/ui-icons_cd0a0a_256x240.png +0 -0
  105. data/app/assets/images/kirgudu_base/ui-icons_ffffff_256x240.png +0 -0
  106. data/app/assets/images/kirgudu_base/uploadify-cancel.png +0 -0
  107. data/app/assets/javascripts/kirgudu_base/ajax_form.js +52 -0
  108. data/app/assets/javascripts/kirgudu_base/application.js +15 -0
  109. data/app/assets/javascripts/kirgudu_base/avgrund.js +85 -0
  110. data/app/assets/javascripts/kirgudu_base/bootstrap-alert.js +90 -0
  111. data/app/assets/javascripts/kirgudu_base/bootstrap-button.js +96 -0
  112. data/app/assets/javascripts/kirgudu_base/bootstrap-carousel.js +176 -0
  113. data/app/assets/javascripts/kirgudu_base/bootstrap-collapse.js +158 -0
  114. data/app/assets/javascripts/kirgudu_base/bootstrap-colorpicker.js +520 -0
  115. data/app/assets/javascripts/kirgudu_base/bootstrap-datepicker.js +401 -0
  116. data/app/assets/javascripts/kirgudu_base/bootstrap-dropdown.js +150 -0
  117. data/app/assets/javascripts/kirgudu_base/bootstrap-modal.js +239 -0
  118. data/app/assets/javascripts/kirgudu_base/bootstrap-popover.js +103 -0
  119. data/app/assets/javascripts/kirgudu_base/bootstrap-scrollspy.js +151 -0
  120. data/app/assets/javascripts/kirgudu_base/bootstrap-tab.js +135 -0
  121. data/app/assets/javascripts/kirgudu_base/bootstrap-tooltip.js +275 -0
  122. data/app/assets/javascripts/kirgudu_base/bootstrap-transition.js +60 -0
  123. data/app/assets/javascripts/kirgudu_base/bootstrap-typeahead.js +300 -0
  124. data/app/assets/javascripts/kirgudu_base/bootstrap-wysihtml5.js +458 -0
  125. data/app/assets/javascripts/kirgudu_base/bootstrap.js +6 -0
  126. data/app/assets/javascripts/kirgudu_base/character-limit.js +18 -0
  127. data/app/assets/javascripts/kirgudu_base/chosen.jquery.min.js +10 -0
  128. data/app/assets/javascripts/kirgudu_base/client_main.js +1017 -0
  129. data/app/assets/javascripts/kirgudu_base/delete.js +67 -0
  130. data/app/assets/javascripts/kirgudu_base/excanvas.compiled.js +35 -0
  131. data/app/assets/javascripts/kirgudu_base/fileinput.jquery.js +98 -0
  132. data/app/assets/javascripts/kirgudu_base/fullcalendar.js +5220 -0
  133. data/app/assets/javascripts/kirgudu_base/gmap3.min.js +39 -0
  134. data/app/assets/javascripts/kirgudu_base/highcharts.js +246 -0
  135. data/app/assets/javascripts/kirgudu_base/jdpicker.js +555 -0
  136. data/app/assets/javascripts/kirgudu_base/jnavigate.jquery.min.js +2 -0
  137. data/app/assets/javascripts/kirgudu_base/jquery-ui-1.8.23.custom.min.js +125 -0
  138. data/app/assets/javascripts/kirgudu_base/jquery-ui-1.8.23.custom.min_d9931121.js +125 -0
  139. data/app/assets/javascripts/kirgudu_base/jquery.blockUI.js +534 -0
  140. data/app/assets/javascripts/kirgudu_base/jquery.bookblock.js +533 -0
  141. data/app/assets/javascripts/kirgudu_base/jquery.cookie.js +94 -0
  142. data/app/assets/javascripts/kirgudu_base/jquery.dataTables.js +12092 -0
  143. data/app/assets/javascripts/kirgudu_base/jquery.endless-scroll.js +343 -0
  144. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-buttons.js +121 -0
  145. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-media.js +196 -0
  146. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-thumbs.js +162 -0
  147. data/app/assets/javascripts/kirgudu_base/jquery.fancybox.js +1985 -0
  148. data/app/assets/javascripts/kirgudu_base/jquery.flot.crosshair.js +167 -0
  149. data/app/assets/javascripts/kirgudu_base/jquery.flot.js +2599 -0
  150. data/app/assets/javascripts/kirgudu_base/jquery.flot.pie.js +751 -0
  151. data/app/assets/javascripts/kirgudu_base/jquery.flot.resize.js +60 -0
  152. data/app/assets/javascripts/kirgudu_base/jquery.flot.spider.js +314 -0
  153. data/app/assets/javascripts/kirgudu_base/jquery.flot.stack.js +184 -0
  154. data/app/assets/javascripts/kirgudu_base/jquery.history.js +1 -0
  155. data/app/assets/javascripts/kirgudu_base/jquery.jcarousel.min.js +16 -0
  156. data/app/assets/javascripts/kirgudu_base/jquery.jeditable.js +543 -0
  157. data/app/assets/javascripts/kirgudu_base/jquery.js +2 -0
  158. data/app/assets/javascripts/kirgudu_base/jquery.json-2.3.min.js +23 -0
  159. data/app/assets/javascripts/kirgudu_base/jquery.maskedinput-1.3.js +258 -0
  160. data/app/assets/javascripts/kirgudu_base/jquery.mousewheel-min.js +12 -0
  161. data/app/assets/javascripts/kirgudu_base/jquery.peity.min.js +11 -0
  162. data/app/assets/javascripts/kirgudu_base/jquery.simplemodal-1.4.4.js +716 -0
  163. data/app/assets/javascripts/kirgudu_base/jquery.slides.min.js +7 -0
  164. data/app/assets/javascripts/kirgudu_base/jquery.sparkline.min.js +5 -0
  165. data/app/assets/javascripts/kirgudu_base/jquery.tagsinput.js +354 -0
  166. data/app/assets/javascripts/kirgudu_base/jquery.tools.min.js +17 -0
  167. data/app/assets/javascripts/kirgudu_base/jquery.touchdown.js +54 -0
  168. data/app/assets/javascripts/kirgudu_base/jquery.uniform.min.js +17 -0
  169. data/app/assets/javascripts/kirgudu_base/jquery.uploadify-3.1.js +975 -0
  170. data/app/assets/javascripts/kirgudu_base/jquery.uploadify.min.js +16 -0
  171. data/app/assets/javascripts/kirgudu_base/jquery.url-2.0.js +174 -0
  172. data/app/assets/javascripts/kirgudu_base/jquery.validate.min.js +4 -0
  173. data/app/assets/javascripts/kirgudu_base/jquerypp.custom.js +301 -0
  174. data/app/assets/javascripts/kirgudu_base/justgage.1.0.1.min.js +12 -0
  175. data/app/assets/javascripts/kirgudu_base/main.js +157 -0
  176. data/app/assets/javascripts/kirgudu_base/modernizr.custom.32549.js +815 -0
  177. data/app/assets/javascripts/kirgudu_base/mustache.js +532 -0
  178. data/app/assets/javascripts/kirgudu_base/popbox.js +57 -0
  179. data/app/assets/javascripts/kirgudu_base/raphael.2.1.0.min.js +10 -0
  180. data/app/assets/javascripts/kirgudu_base/scripts.js +1277 -0
  181. data/app/assets/javascripts/kirgudu_base/scripts_OLD.js +204 -0
  182. data/app/assets/javascripts/kirgudu_base/sub_select.js +50 -0
  183. data/app/assets/javascripts/kirgudu_base/swfobject.js +5 -0
  184. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shAutoloader.js +17 -0
  185. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushAS3.js +59 -0
  186. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushAppleScript.js +75 -0
  187. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushBash.js +59 -0
  188. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCSharp.js +65 -0
  189. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushColdFusion.js +100 -0
  190. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCpp.js +97 -0
  191. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCss.js +91 -0
  192. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushDelphi.js +55 -0
  193. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushDiff.js +41 -0
  194. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushErlang.js +52 -0
  195. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushGroovy.js +67 -0
  196. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJScript.js +52 -0
  197. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJava.js +57 -0
  198. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJavaFX.js +58 -0
  199. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPerl.js +72 -0
  200. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPhp.js +88 -0
  201. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPlain.js +33 -0
  202. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPowerShell.js +74 -0
  203. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPython.js +64 -0
  204. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushRuby.js +55 -0
  205. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushSass.js +94 -0
  206. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushScala.js +51 -0
  207. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushSql.js +66 -0
  208. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushVb.js +56 -0
  209. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushXml.js +69 -0
  210. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shCore.js +17 -0
  211. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shLegacy.js +17 -0
  212. data/app/assets/javascripts/kirgudu_base/textarea-autogrow.js +55 -0
  213. data/app/assets/javascripts/kirgudu_base/tiny_mce.js +1 -0
  214. data/app/assets/javascripts/kirgudu_base/watch.js +81 -0
  215. data/app/assets/javascripts/kirgudu_base/web/inputPlaceholder.js +82 -0
  216. data/app/assets/javascripts/kirgudu_base/web/js.js +91 -0
  217. data/app/assets/javascripts/kirgudu_base/web/navigate.js +20 -0
  218. data/app/assets/javascripts/kirgudu_base/web/watch.js +1706 -0
  219. data/app/assets/javascripts/kirgudu_base/wysihtml5-0.3.0.min.js +261 -0
  220. data/app/assets/stylesheets/kirgudu_base/bootstrap.css +4551 -0
  221. data/app/assets/stylesheets/kirgudu_base/chosen.css +397 -0
  222. data/app/assets/stylesheets/kirgudu_base/fullcalendar.css +655 -0
  223. data/app/assets/stylesheets/kirgudu_base/info-message.css +79 -0
  224. data/app/assets/stylesheets/kirgudu_base/jdpicker.css +200 -0
  225. data/app/assets/stylesheets/kirgudu_base/jquery-ui-1.8.23.custom.css +1235 -0
  226. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox-buttons.css +96 -0
  227. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox-thumbs.css +54 -0
  228. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox.css +249 -0
  229. data/app/assets/stylesheets/kirgudu_base/jquery.tagsinput.css +7 -0
  230. data/app/assets/stylesheets/kirgudu_base/main.css +1368 -0
  231. data/app/assets/stylesheets/kirgudu_base/menu.css +159 -0
  232. data/app/assets/stylesheets/kirgudu_base/popbox.css +58 -0
  233. data/app/assets/stylesheets/kirgudu_base/responsive.css +2249 -0
  234. data/app/assets/stylesheets/kirgudu_base/switcher.css +80 -0
  235. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCore.css +226 -0
  236. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreDefault.css +328 -0
  237. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreDjango.css +331 -0
  238. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreEclipse.css +339 -0
  239. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreEmacs.css +324 -0
  240. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreFadeToGrey.css +328 -0
  241. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreMDUltra.css +324 -0
  242. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreMidnight.css +324 -0
  243. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreRDark.css +324 -0
  244. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeDefault.css +117 -0
  245. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeDjango.css +120 -0
  246. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeEclipse.css +128 -0
  247. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeEmacs.css +113 -0
  248. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeFadeToGrey.css +117 -0
  249. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeMDUltra.css +113 -0
  250. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeMidnight.css +113 -0
  251. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeRDark.css +113 -0
  252. data/app/assets/stylesheets/kirgudu_base/uploadify.css +92 -0
  253. data/app/controllers/kirgudu_base/admin_controller.rb +91 -0
  254. data/app/controllers/kirgudu_base/application_controller.rb +676 -0
  255. data/app/controllers/kirgudu_base/cabinet_controller.rb +93 -0
  256. data/app/controllers/kirgudu_base/facade_controller.rb +82 -0
  257. data/app/helpers/kirgudu_base/application_helper.rb +486 -0
  258. data/app/helpers/kirgudu_base/breadcrumbs_helper.rb +27 -0
  259. data/app/helpers/kirgudu_base/class_helper.rb +32 -0
  260. data/app/helpers/kirgudu_base/controllers/basic_actions.rb +625 -0
  261. data/app/helpers/kirgudu_base/controllers/container_items_management_actions.rb +118 -0
  262. data/app/helpers/kirgudu_base/controllers/container_items_sorting_actions.rb +64 -0
  263. data/app/helpers/kirgudu_base/controllers/dynamic_pages.rb +30 -0
  264. data/app/helpers/kirgudu_base/controllers/obligatory_filters.rb +29 -0
  265. data/app/helpers/kirgudu_base/controllers/transaction_wrapper.rb +138 -0
  266. data/app/helpers/kirgudu_base/form_builder.rb +474 -0
  267. data/app/helpers/kirgudu_base/gui_helper.rb +443 -0
  268. data/app/helpers/kirgudu_base/models/basic_management_urls.rb +104 -0
  269. data/app/helpers/kirgudu_base/models/data_filter.rb +236 -0
  270. data/app/helpers/kirgudu_base/models/exports.rb +167 -0
  271. data/app/helpers/kirgudu_base/models/filters.rb +32 -0
  272. data/app/helpers/kirgudu_base/models/form_properties.rb +108 -0
  273. data/app/helpers/kirgudu_base/models/form_property.rb +335 -0
  274. data/app/helpers/kirgudu_base/models/methods.rb +64 -0
  275. data/app/helpers/kirgudu_base/models/scopes.rb +157 -0
  276. data/app/helpers/kirgudu_base/models/sorting.rb +99 -0
  277. data/app/helpers/kirgudu_base/models/standard_actions.rb +50 -0
  278. data/app/helpers/kirgudu_base/models/uncloneable_properties.rb +21 -0
  279. data/app/helpers/kirgudu_base/old_form_builder.rb +340 -0
  280. data/app/helpers/kirgudu_base/url_helper.rb +18 -0
  281. data/app/models/kirgudu_base/base_model.rb +293 -0
  282. data/app/models/kirgudu_base/dynamic_pages/action_for.rb +78 -0
  283. data/app/models/kirgudu_base/dynamic_pages/action_for_builder.rb +46 -0
  284. data/app/models/kirgudu_base/dynamic_pages/data_source.rb +111 -0
  285. data/app/models/kirgudu_base/dynamic_pages/data_source_builder.rb +79 -0
  286. data/app/models/kirgudu_base/dynamic_pages/form.rb +99 -0
  287. data/app/models/kirgudu_base/dynamic_pages/form_builder.rb +85 -0
  288. data/app/models/kirgudu_base/dynamic_pages/input_type.rb +17 -0
  289. data/app/models/kirgudu_base/dynamic_pages/on_change.rb +40 -0
  290. data/app/models/kirgudu_base/dynamic_pages/on_change_builder.rb +38 -0
  291. data/app/models/kirgudu_base/dynamic_pages/page.rb +55 -0
  292. data/app/models/kirgudu_base/dynamic_pages/page_builder.rb +63 -0
  293. data/app/models/kirgudu_base/dynamic_pages/property.rb +185 -0
  294. data/app/models/kirgudu_base/dynamic_pages/property_builder.rb +123 -0
  295. data/app/models/kirgudu_base/template.rb +6 -0
  296. data/app/models/kirgudu_base/template_element.rb +6 -0
  297. data/app/views/layouts/kirgudu_base/application.html.erb +141 -0
  298. data/app/views/shared/kirgudu_base/_body_javascripts_files.html.erb +71 -0
  299. data/app/views/shared/kirgudu_base/_body_javascripts_scripts.html.erb +1099 -0
  300. data/app/views/shared/kirgudu_base/_breadcrumbs.html.erb +36 -0
  301. data/app/views/shared/kirgudu_base/_head_javascripts.html.erb +21 -0
  302. data/app/views/shared/kirgudu_base/_head_stylesheets.html.erb +21 -0
  303. data/app/views/shared/kirgudu_base/_index_page_filter.html.erb +43 -0
  304. data/app/views/shared/kirgudu_base/_left_menu_standard_actions.html.erb +57 -0
  305. data/app/views/shared/kirgudu_base/_services_top_line.html.erb +5 -0
  306. data/app/views/shared/kirgudu_base/_top_nav_bar.html.erb +58 -0
  307. data/app/views/shared/kirgudu_base/entry_edit_form_renderer.html.erb +70 -0
  308. data/app/views/shared/kirgudu_base/entry_index_renderer.html.erb +98 -0
  309. data/app/views/shared/kirgudu_base/entry_new_form_renderer.html.erb +68 -0
  310. data/app/views/shared/kirgudu_base/entry_not_found_renderer.html.erb +15 -0
  311. data/app/views/shared/kirgudu_base/entry_show_renderer.html.erb +28 -0
  312. data/app/views/shared/kirgudu_base/manage_images/managing_items_index.html.erb +34 -0
  313. data/app/views/shared/kirgudu_base/manage_images/managing_items_manage.html.erb +72 -0
  314. data/app/views/shared/kirgudu_base/manage_images/managing_items_sort_index.html.erb +33 -0
  315. data/app/views/shared/kirgudu_base/manage_items/managing_items_index.html.erb +42 -0
  316. data/app/views/shared/kirgudu_base/manage_items/managing_items_manage.html.erb +66 -0
  317. data/app/views/shared/kirgudu_base/manage_items/managing_items_sort_index.html.erb +33 -0
  318. data/config/routes.rb +3 -0
  319. data/db/migrate/20131114161828_create_kirgudu_base_templates.rb +17 -0
  320. data/db/migrate/20131114165013_create_kirgudu_base_template_elements.rb +18 -0
  321. data/lib/kirgudu_base/engine.rb +6 -0
  322. data/lib/kirgudu_base/version.rb +4 -0
  323. data/lib/kirgudu_base.rb +5 -0
  324. data/lib/tasks/kirgudu_base_tasks.rake +4 -0
  325. data/test/dummy/README.rdoc +261 -0
  326. data/test/dummy/Rakefile +7 -0
  327. data/test/dummy/app/assets/javascripts/application.js +15 -0
  328. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  329. data/test/dummy/app/controllers/application_controller.rb +4 -0
  330. data/test/dummy/app/helpers/application_helper.rb +3 -0
  331. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  332. data/test/dummy/config/application.rb +60 -0
  333. data/test/dummy/config/boot.rb +11 -0
  334. data/test/dummy/config/database.yml +25 -0
  335. data/test/dummy/config/environment.rb +6 -0
  336. data/test/dummy/config/environments/development.rb +38 -0
  337. data/test/dummy/config/environments/production.rb +68 -0
  338. data/test/dummy/config/environments/test.rb +38 -0
  339. data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
  340. data/test/dummy/config/initializers/inflections.rb +16 -0
  341. data/test/dummy/config/initializers/mime_types.rb +6 -0
  342. data/test/dummy/config/initializers/secret_token.rb +8 -0
  343. data/test/dummy/config/initializers/session_store.rb +9 -0
  344. data/test/dummy/config/initializers/wrap_parameters.rb +15 -0
  345. data/test/dummy/config/locales/en.yml +5 -0
  346. data/test/dummy/config/routes.rb +5 -0
  347. data/test/dummy/config.ru +4 -0
  348. data/test/dummy/public/404.html +26 -0
  349. data/test/dummy/public/422.html +26 -0
  350. data/test/dummy/public/500.html +25 -0
  351. data/test/dummy/public/favicon.ico +0 -0
  352. data/test/dummy/script/rails +6 -0
  353. data/test/fixtures/kirgudu_base/template_elements.yml +17 -0
  354. data/test/fixtures/kirgudu_base/templates.yml +15 -0
  355. data/test/integration/navigation_test.rb +11 -0
  356. data/test/kirgudu_base_test.rb +8 -0
  357. data/test/test_helper.rb +16 -0
  358. data/test/unit/kirgudu_base/template_element_test.rb +10 -0
  359. data/test/unit/kirgudu_base/template_test.rb +10 -0
  360. metadata +492 -0
@@ -0,0 +1,118 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module KirguduBase
4
+ module Controllers
5
+ module ContainerItemsManagementActions
6
+
7
+
8
+ def self.included(base)
9
+ base.class_eval do
10
+ include InstanceMethods
11
+ end
12
+ end
13
+
14
+
15
+ module InstanceMethods
16
+ def managing_items_index
17
+ @container = get_managing_container_class.find(params[get_managing_parent_id_key])
18
+ @items = get_managing_item_class.where(container_id: @container).order(:sort_position).page(params[:page_id])
19
+
20
+ @managing_item_class = get_managing_item_class.to_s
21
+ @managing_container_class = get_managing_container_class.to_s
22
+
23
+ views_path = get_managing_views_path if self.respond_to?(:get_managing_views_path)
24
+ views_path = "/shared/manage_items/" unless views_path
25
+
26
+ respond_to do |format|
27
+ format.html { render_html1("#{views_path}managing_items_index") }
28
+ format.json { render json: @container }
29
+ end
30
+ end
31
+
32
+ def managing_items_manage
33
+ @container = get_managing_container_class.find(params[get_managing_parent_id_key])
34
+ @items = get_managing_item_class.where(container_id: @container).order(:sort_position).page(params[:cpage])
35
+
36
+ @managing_item_class = get_managing_item_class.to_s
37
+ @managing_container_class = get_managing_container_class.to_s
38
+
39
+
40
+ container_all_items_ids = Array.new
41
+
42
+ get_managing_item_class.where(container_id: @container.id).map { |u| container_all_items_ids.push(u.entry_id) }
43
+
44
+
45
+ entries_order_by = get_managing_entries_order_by if self.respond_to?(:get_managing_entries_order_by)
46
+ entries_order_by = "name asc" unless entries_order_by
47
+
48
+ @entries = get_managing_entry_class.where { -(id.in container_all_items_ids) }.page(params[:ppage]).order(entries_order_by)
49
+
50
+
51
+ views_path = get_managing_views_path if self.respond_to?(:get_managing_views_path)
52
+ views_path = "/shared/manage_items/" unless views_path
53
+
54
+ respond_to do |format|
55
+ format.html { render_html1("#{views_path}managing_items_manage") }
56
+ format.json { render json: @entries }
57
+ end
58
+ end
59
+
60
+ def managing_items_add
61
+ container = get_managing_container_class.where(id: params[get_managing_parent_id_key]).first
62
+ entry = get_managing_entry_class.where(id: params[:entry_id]).first
63
+
64
+
65
+ unless container
66
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('set_not_found'), message: I18n.t("#{self.to_i18n}.management.messages.set_not_found", id: params[:id])}
67
+ return
68
+ end
69
+ unless entry
70
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('entry_not_found'), message: I18n.t("#{self.to_i18n}.management.messages.entry_not_found", entry_id: params[:entry_id])}
71
+ return
72
+ end
73
+
74
+ item = get_managing_item_class.where(container_id: container.id, entry_id: entry).first
75
+
76
+ unless item
77
+ item = get_managing_item_class.new
78
+ item.container_id = container.id
79
+ item.entry_id = entry.id
80
+ max_sort_position = get_managing_item_class.where(container_id: container.id).maximum(:sort_position)
81
+ item.sort_position = max_sort_position ? max_sort_position + 1 : 1
82
+
83
+ if item.save
84
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('management_ok'), message: I18n.t("#{self.to_i18n}.management.messages.add_management_ok")}
85
+ else
86
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('management_error'), message: I18n.t("#{self.to_i18n}.management.messages.add_management_error")}
87
+ end
88
+ else
89
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('entry_already_in_set'), message: I18n.t("#{self.to_i18n}.management.messages.entry_already_in_set")}
90
+ end
91
+ end
92
+
93
+ def managing_items_remove
94
+ container = get_managing_container_class.where(id: params[:id]).first
95
+
96
+
97
+ unless container
98
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('set_not_found'), message: I18n.t("#{self.to_i18n}.management.messages.set_not_found", id: params[:id])}
99
+ return
100
+ end
101
+
102
+ item = get_managing_item_class.where(container_id: container.id, entry_id: params[:entry_id]).first
103
+ unless item
104
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('item_not_found'), message: I18n.t("#{self.to_i18n}.management.messages.item_not_found", entry_id: params[:entry_id])}
105
+ return
106
+ end
107
+
108
+ if item.destroy
109
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('management_ok'), message: I18n.t("#{self.to_i18n}.management.messages.remove_management_ok")}
110
+ else
111
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('management_error'), message: I18n.t("#{self.to_i18n}.management.messages.remove_management_error")}
112
+ end
113
+ end
114
+ end
115
+
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,64 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module KirguduBase
4
+ module Controllers
5
+ module ContainerItemsSortingActions
6
+
7
+ def self.included(base)
8
+ base.class_eval do
9
+ include InstanceMethods
10
+ end
11
+ end
12
+
13
+ module InstanceMethods
14
+ def managing_items_sort_index
15
+ @container= get_managing_container_class.find(params[get_managing_parent_id_key])
16
+ @items = get_managing_item_class.where(container_id: @container.id).order(:sort_position)
17
+
18
+
19
+ views_path = get_managing_views_path if self.respond_to?(:get_managing_views_path)
20
+ unless views_path
21
+ views_path = "/shared/manage_items/"
22
+ end
23
+
24
+ respond_to do |format|
25
+ format.html { render_html1("#{views_path}managing_items_sort_index") }
26
+ format.json { render json: @products }
27
+ end
28
+ end
29
+
30
+ def managing_items_sort_process
31
+ container = get_managing_container_class.find(params[get_managing_parent_id_key])
32
+ unless container
33
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('set_not_found'), message: I18n.t("#{self.to_i18n}.sorting.messages.set_not_found", id: params[:id])}
34
+ return
35
+ end
36
+
37
+ result_is_ok = false
38
+ if params[:items]
39
+ begin
40
+ ActiveRecord::Base.transaction do
41
+ params[:items].each_with_index do |id, index|
42
+ item = get_managing_item_class.where(container_id: container.id, entry_id: id).first
43
+ if item
44
+ item.sort_position = index + 1
45
+ if item.respond_to?(:updated_by)
46
+ item.updated_by = @current_user.id
47
+ end
48
+ item.save
49
+ end
50
+ end
51
+ result_is_ok = true
52
+ end
53
+ end
54
+ end
55
+ if result_is_ok == true
56
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('management_ok'), message: I18n.t("#{self.to_i18n}.sorting.messages.management_ok")}
57
+ else
58
+ render json: {status: ::ChupakabraTools::SetManagementResult.id_by_tag('management_error'), message: I18n.t("#{self.to_i18n}.sorting.messages.management_error")}
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,30 @@
1
+ module ::KirguduBase::Controllers::DynamicPages
2
+ #def kb_page(&block)
3
+ # @kirgudu_base_pages = {} unless @kirgudu_base_pages
4
+ #
5
+ # page = ::KirguduBase::DynamicPages::PageBuilder.new(&block).to_page
6
+ #
7
+ # @kirgudu_base_pages[page.name] = page
8
+ # #raise "Error"
9
+ #end
10
+
11
+
12
+ def kb_page(name, &block)
13
+
14
+ #raise "Page Name: #{name}"
15
+
16
+ @kirgudu_base_pages = {} unless @kirgudu_base_pages
17
+
18
+ pages = ::KirguduBase::DynamicPages::PageBuilder.new(name, &block).to_pages
19
+
20
+ pages.each do |item|
21
+ @kirgudu_base_pages[item.name] = item
22
+ end
23
+
24
+
25
+ end
26
+
27
+ def get_kb_page(name)
28
+ @kirgudu_base_pages[name] if @kirgudu_base_pages
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ #stale
4
+ module KirguduBase
5
+ module Controllers
6
+ module ObligatoryFilters
7
+ module ClassMethods
8
+ def obligatory_filter(name, options = {})
9
+ options ||= {}
10
+ raise "Filter Property must be defined #{options.to_json}" if name.nil?
11
+
12
+ opts = {}.merge(options)
13
+
14
+ opts[:name] = name
15
+ obligatory_filters_set.push(opts)
16
+ end
17
+
18
+
19
+ def obligatory_filters_set
20
+ if defined?(@obligatory_filters_set) == false || @obligatory_filters_set.nil? || !@obligatory_filters_set.is_a?(Array)
21
+ @obligatory_filters_set = []
22
+ end
23
+ @obligatory_filters_set
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,138 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module KirguduBase
4
+ module Controllers
5
+ module TransactionWrapper
6
+ module ClassMethods
7
+ def in_transaction_before_create(method, options = {})
8
+ in_transaction_set_filter(:before_create, method, options)
9
+ end
10
+
11
+ def in_transaction_after_create(method, options = {})
12
+ in_transaction_set_filter(:after_create, method, options)
13
+ end
14
+
15
+
16
+ def in_transaction_before_update(method, options = {})
17
+ in_transaction_set_filter(:before_update, method, options)
18
+ end
19
+
20
+
21
+ def in_transaction_after_update(method, options = {})
22
+ in_transaction_set_filter(:after_update, method, options)
23
+ end
24
+
25
+
26
+ def in_transaction_before_delete(method, options = {})
27
+ in_transaction_set_filter(:before_delete, method, options)
28
+ end
29
+
30
+
31
+ def in_transaction_after_delete(method, options = {})
32
+ in_transaction_set_filter(:after_delete, method, options)
33
+ end
34
+
35
+
36
+ def in_transaction_before_purge(method, options = {})
37
+ in_transaction_set_filter(:before_purge, method, options)
38
+ end
39
+
40
+
41
+ def in_transaction_after_purge(method, options = {})
42
+ in_transaction_set_filter(:after_purge, method, options)
43
+ end
44
+
45
+
46
+ def in_transaction_filters_collection(name)
47
+ if defined?(@in_transaction_filters_collection) == false || @in_transaction_filters_collection.nil? || !@in_transaction_filters_collection.is_a?(Hash)
48
+ @in_transaction_filters_collection = {}
49
+ end
50
+ found_filters = @in_transaction_filters_collection[name]
51
+ unless found_filters && found_filters.is_a?(Array)
52
+ found_filters = []
53
+ @in_transaction_filters_collection[name] = found_filters
54
+ end
55
+ found_filters
56
+ end
57
+
58
+
59
+ def out_transaction_before_create(method, options = {})
60
+ out_transaction_set_filter(:before_create, method, options)
61
+ end
62
+
63
+ def out_transaction_after_create(method, options = {})
64
+ out_transaction_set_filter(:after_create, method, options)
65
+ end
66
+
67
+
68
+ def out_transaction_before_update(method, options = {})
69
+ out_transaction_set_filter(:before_update, method, options)
70
+ end
71
+
72
+
73
+ def out_transaction_after_update(method, options = {})
74
+ out_transaction_set_filter(:after_update, method, options)
75
+ end
76
+
77
+
78
+ def out_transaction_before_delete(method, options = {})
79
+ out_transaction_set_filter(:before_delete, method, options)
80
+ end
81
+
82
+
83
+ def out_transaction_after_delete(method, options = {})
84
+ out_transaction_set_filter(:after_delete, method, options)
85
+ end
86
+
87
+
88
+ def out_transaction_before_purge(method, options = {})
89
+ out_transaction_set_filter(:before_purge, method, options)
90
+ end
91
+
92
+
93
+ def out_transaction_after_purge(method, options = {})
94
+ out_transaction_set_filter(:after_purge, method, options)
95
+ end
96
+
97
+
98
+ def out_transaction_filters_collection(name)
99
+ if defined?(@out_transaction_filters_collection) == false || @out_transaction_filters_collection.nil? || !@out_transaction_filters_collection.is_a?(Hash)
100
+ @out_transaction_filters_collection = {}
101
+ end
102
+ found_filters = @out_transaction_filters_collection[name]
103
+ unless found_filters && found_filters.is_a?(Array)
104
+ found_filters = []
105
+ @out_transaction_filters_collection[name] = found_filters
106
+ end
107
+ found_filters
108
+ end
109
+
110
+
111
+ private
112
+ def in_transaction_set_filter(filter_name, method, options)
113
+ raise "#{method} must be a symbol" unless method && method.is_a?(Symbol)
114
+ #raise "Method #{method} not found in class #{self}" unless respond_to?(method)
115
+
116
+
117
+ options ||= {}
118
+ opts = {}.merge(options)
119
+ opts[:method] = method
120
+ in_transaction_filters_collection(filter_name).push(opts)
121
+ end
122
+
123
+
124
+ def out_transaction_set_filter(filter_name, method, options)
125
+ raise "#{method} must be a symbol" unless method && method.is_a?(Symbol)
126
+ #raise "Method #{method} not found in class #{self}" unless respond_to?(method)
127
+
128
+
129
+ options ||= {}
130
+ opts = {}.merge(options)
131
+ opts[:method] = method
132
+ out_transaction_filters_collection(filter_name).push(opts)
133
+ end
134
+ end
135
+
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,474 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module KirguduBase
4
+
5
+ class FormBuilder < ActionView::Helpers::FormBuilder
6
+
7
+ include ActionView::Helpers::AssetTagHelper
8
+ include ActionView::Helpers::TagHelper
9
+
10
+ include ::KirguduBase::GuiHelper
11
+
12
+
13
+ def control(property, html_options = {})
14
+ if property.input_type == :chosen_select
15
+ chosen_select(property, html_options)
16
+
17
+ elsif property.input_type == :autocomplete_with_id
18
+ autocomplete_with_id(property, html_options)
19
+
20
+ elsif property.input_type == :autocomplete
21
+ #autocomplete(property, html_options)
22
+
23
+
24
+ elsif property.input_type == :switcher
25
+ switcher(property, html_options)
26
+
27
+ elsif property.input_type == :date_picker
28
+ date_picker(property, html_options)
29
+
30
+ elsif property.input_type == :time_picker
31
+ time_picker(property, html_options)
32
+
33
+ elsif property.input_type == :image_selector
34
+ image_selector(property, html_options)
35
+
36
+ elsif property.input_type == :check_box
37
+ check_box(property, html_options)
38
+
39
+ elsif property.input_type == :radio_button
40
+ #radio_button(property, html_options)
41
+
42
+ elsif property.input_type == :link
43
+ link(property, html_options)
44
+
45
+ elsif property.input_type == :elastic_text_area
46
+ elastic_textarea(property, html_options)
47
+
48
+ elsif property.input_type == :password
49
+ elastic_textarea(property, html_options)
50
+
51
+ elsif property.input_type == :text_area
52
+ text_area(property, html_options)
53
+
54
+ elsif property.input_type == :file_input
55
+ #file_input(property, html_options)
56
+
57
+ elsif property.input_type == :select
58
+ #file_input(property, html_options)
59
+
60
+ elsif property.input_type == :chosen_select
61
+ chosen_select(property, html_options)
62
+
63
+ else
64
+ text_edit(property, html_options)
65
+ end
66
+ end
67
+
68
+
69
+ def error_label(label, *args)
70
+ options = args.extract_options!
71
+ options.merge!(class: "error", generated: "true", style: "display: block")
72
+ errors_in_html = ""
73
+ if @object.errors[label].present?
74
+ @object.errors[label].each do |error_message|
75
+ errors_in_html += @template.content_tag("label", error_message.capitalize.html_safe, options)
76
+ end
77
+ end
78
+ errors_in_html.html_safe
79
+ end
80
+
81
+ def label_with_hint(label, hint, *args)
82
+ @template.content_tag("label", (@object.class.human_attribute_name(label) + @template.content_tag("span", hint, class: 'help-block')).html_safe, *args)
83
+ end
84
+
85
+ def label(label, *args)
86
+ @template.content_tag("label", *args) do
87
+ @object.class.human_attribute_name(label)
88
+ end
89
+ end
90
+
91
+
92
+ def text_field(property, *args)
93
+ label = property.name.to_sym
94
+ options = args.extract_options!
95
+
96
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
97
+ classes.push ("error") if @object.errors[label].present? && !classes.include?("error")
98
+ options[:class] = classes.join(" ")
99
+
100
+ options[:id] = "#{@object_name}_#{label}"
101
+ options[:name] = "#{@object_name}[#{label}]"
102
+
103
+ super(label, options)
104
+ end
105
+
106
+ def text_edit(property, *args)
107
+ label = property.name.to_sym
108
+ options = args.extract_options!
109
+
110
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
111
+ classes.push ("error") if @object.errors[label].present? && !classes.include?("error")
112
+ options[:class] = classes.join(" ")
113
+
114
+ options[:id] = "#{@object_name}_#{label}"
115
+ options[:name] = "#{@object_name}[#{label}]"
116
+
117
+ edit_tag(@object[label], options)
118
+ end
119
+
120
+ def text_area(property, *args)
121
+ label = property.name.to_sym
122
+ options = args.extract_options!
123
+
124
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
125
+ classes.push ("error") if @object.errors[label].present? && !classes.include?("error")
126
+ options[:class] = classes.join(" ")
127
+
128
+ options.merge!(rows: '5') unless options.include?(:rows)
129
+
130
+ super(label, options)
131
+ end
132
+
133
+
134
+ def password_field(property, *args)
135
+ label = property.name.to_sym
136
+ options = args.extract_options!
137
+
138
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
139
+ classes.push ("error") if @object.errors[label].present? && !classes.include?("error")
140
+ options[:class] = classes.join(" ")
141
+
142
+ super(label, options)
143
+ end
144
+
145
+ def autocomplete_field(property, *args)
146
+ label = property.name.to_sym
147
+ options = args.extract_options!
148
+
149
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
150
+ classes.push ("error") if @object.errors[label].present? && !classes.include?("error")
151
+ options[:class] = classes.join(" ")
152
+ end
153
+
154
+
155
+ def autocomplete_with_id(property, *args)
156
+ label = property.name.to_sym
157
+ options ||= {}
158
+
159
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
160
+ classes.push ("error") if @object.errors[label].present? && !classes.include?("error")
161
+ options[:class] = classes.join(" ")
162
+
163
+ options[:id] = "#{@object_name}_#{label}"
164
+ options[:name] = "#{@object_name}[#{label}]"
165
+ options[:property_name] = label
166
+
167
+ if options[:parent]
168
+ options[:parent_control_id] = "#{@object_name}_#{options[:parent]}"
169
+ options[:parent] = nil
170
+ end
171
+
172
+ if options[:onchange]
173
+
174
+ onchange_actions = []
175
+
176
+ if options[:onchange].is_a?(Hash)
177
+ onchange_actions.push(options[:onchange])
178
+ elsif options[:onchange].is_a?(Array)
179
+ options[:onchange].each do |a|
180
+ onchange_actions.push(a)
181
+ end
182
+ end
183
+
184
+ onchange_actions.each do |o|
185
+ o[:property_control] = "#{@object_name}_#{o[:property]}"
186
+ end
187
+
188
+ options[:onchange] = onchange_actions
189
+ end
190
+
191
+ autocomplete_with_id_tag(@object[label], text_value, path, options)
192
+ end
193
+
194
+
195
+ def date_picker(property, *args)
196
+ label = property.name.to_sym
197
+ options = args.extract_options!
198
+
199
+ #raise options.to_json
200
+
201
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
202
+ classes.push ("error") if @object.errors[label].present?
203
+ options[:class] = classes.join(' ')
204
+
205
+ options[:id] = "#{@object_name}_#{label}"
206
+ options[:name] = "#{@object_name}[#{label}]"
207
+ options[:value] = @object[label]
208
+
209
+ date_picker_tag(options)
210
+ end
211
+
212
+ #def date_picker_with_icon(label, *args)
213
+ #
214
+ # options = args.extract_options!
215
+ # classes = Array.new
216
+ # classes.push ("row-fluid")
217
+ # classes.push ("input-append")
218
+ # classes.push ("date")
219
+ # classes.push ("error") if @object.errors[label].present?
220
+ # options.merge!(class: classes.join(" "))
221
+ # options.merge!(id: "datepicker_#{@object_name}_#{label}")
222
+ # options.merge!("data-date" => @object.instance_values[label])
223
+ # options.merge!("data-date-format" => "dd-mm-yyyy")
224
+ #
225
+ # result = @template.content_tag("div", options) do
226
+ # text_field(label, class: 'row-fluid') +
227
+ # @template.content_tag('span', class: 'add-on') do
228
+ # @template.content_tag('i', class: 'icon-th') do
229
+ # end
230
+ # end
231
+ # end
232
+ # js="<script type=\"text/javascript\">
233
+ # $(document).ready(function(){
234
+ # $('#datepicker_#{@object_name}_#{label}').datepicker();
235
+ # });
236
+ # </script>"
237
+ # result + js.html_safe
238
+ #
239
+ #end
240
+
241
+ def elastic_textarea(property, *args)
242
+ label = property.name.to_sym
243
+ options = args.extract_options!
244
+
245
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
246
+ classes.push ("autogrow") if !classes.include?("autogrow")
247
+ classes.push ("error") if @object.errors[label].present?
248
+ options[:class] = classes.join(" ")
249
+
250
+ text_area(label, options)
251
+ end
252
+
253
+
254
+ def color_picker(label, *args)
255
+ options = args.extract_options!
256
+
257
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
258
+ classes.push ("color-picker") if !classes.include?("color-picker")
259
+ classes.push ("error") if @object.errors[label].present?
260
+ options[:class] = classes.join(" ")
261
+
262
+ text_field(label, args)
263
+ end
264
+
265
+ def masked_field(property, *args)
266
+ label = property.name.to_sym
267
+ options = args.extract_options!
268
+
269
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
270
+ classes.push ("error") if @object.errors[label].present?
271
+ options[:class] = classes.join(" ")
272
+
273
+ #TODO: Add Mask Implementation for Control
274
+
275
+ text_field(label, args)
276
+
277
+ end
278
+
279
+
280
+ def select(property, *args)
281
+ label = property.name.to_sym
282
+ options = args.extract_options!
283
+
284
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
285
+ classes.push ("error") if @object.errors[label].present?
286
+ options[:class] = classes.join(' ')
287
+
288
+ options[:id] = "#{@object_name}_#{label}"
289
+ options[:name] = "#{@object_name}[#{label}]"
290
+ options[:value] = @object[label]
291
+ options[:property_name] = label
292
+
293
+
294
+ if options[:onchange]
295
+ onchange_actions = []
296
+ if options[:onchange].is_a?(Hash)
297
+ onchange_actions.push(options[:onchange])
298
+ elsif options[:onchange].is_a?(Array)
299
+ options[:onchange].each do |a|
300
+ onchange_actions.push(a)
301
+ end
302
+ end
303
+
304
+ onchange_actions.each do |o|
305
+ o[:property_control] = "#{@object_name}_#{o[:property]}"
306
+
307
+ if o[:source] && o[:source].is_a?(Hash)
308
+ o[:source] = Rails.application.routes.url_helpers.url_for(o[:source])
309
+ end
310
+ end
311
+
312
+ options[:onchange] = onchange_actions
313
+ end
314
+
315
+ if options[:parent]
316
+ options[:parent_value] = @object[options[:parent]]
317
+ end
318
+
319
+ select_tag(options[:choices], options)
320
+ end
321
+
322
+
323
+ def chosen_select(property, *args)
324
+ label = property.name.to_sym
325
+ options = args.extract_options!
326
+
327
+ classes = options[:class] ? options[:class].to_s.split(' ') : []
328
+ classes.push ("error") if @object.errors[label].present?
329
+ classes.push ("chosen")
330
+ options[:class] = classes.join(' ')
331
+
332
+ options[:id] = "#{@object_name}_#{label}"
333
+ options[:name] = "#{@object_name}[#{label}]"
334
+ options[:value] = @object[label]
335
+ options[:property_name] = label
336
+
337
+
338
+ if options[:onchange]
339
+ onchange_actions = []
340
+ if options[:onchange].is_a?(Hash)
341
+ onchange_actions.push(options[:onchange])
342
+ elsif options[:onchange].is_a?(Array)
343
+ options[:onchange].each do |a|
344
+ onchange_actions.push(a)
345
+ end
346
+ end
347
+
348
+ onchange_actions.each do |o|
349
+ o[:property_control] = "#{@object_name}_#{o[:property]}"
350
+
351
+ if o[:source] && o[:source].is_a?(Hash)
352
+ o[:source] = Rails.application.routes.url_helpers.url_for(o[:source])
353
+ end
354
+ end
355
+
356
+ options[:onchange] = onchange_actions
357
+ end
358
+
359
+ if options[:parent]
360
+ options[:parent_value] = @object[options[:parent]]
361
+ end
362
+
363
+ chosen_select_tag(options[:choices], options)
364
+
365
+ end
366
+
367
+
368
+ def choose_image(property, *args)
369
+ label = property.name.to_sym
370
+ options = args.extract_options!
371
+
372
+
373
+ image_options =
374
+ {
375
+ src: thumb_url,
376
+ id: "#{@object_name}_#{label}_selected_image"
377
+ }
378
+ image_options[:style] ='display: none' unless @object[label]
379
+
380
+ control_html = @template.content_tag('img', '', image_options) + '<br/>'.html_safe
381
+
382
+ select_image_options =
383
+ {
384
+ href: "javascript:showImageSelectDialog('##{@object_name}_#{label}_imagesModal'); return false;"
385
+ }
386
+
387
+ control_html += @template.content_tag('a', select_image_options) do
388
+ "Select Image"
389
+ end
390
+
391
+ hidden_options = {
392
+ type: 'hidden',
393
+ id: "#{@object_name}_#{label}",
394
+ name: "#{@object_name}[#{label}]"
395
+ }
396
+
397
+ hidden_options[:value] = @object[label].to_s if @object[label]
398
+
399
+ control_html += @template.content_tag('input', '', hidden_options)
400
+
401
+ control_html
402
+ end
403
+
404
+
405
+ def radio_group(label, values, *args)
406
+ label = property.name.to_sym
407
+ options = args.extract_options!
408
+
409
+ control_html = ""
410
+ values.each do |value_pair|
411
+ control_html +=
412
+ @template.content_tag('label', class: "radio") do
413
+ @template.content_tag('div', class: "radio") do
414
+ @template.content_tag('span', class: '') do
415
+ @template.tag('input', type: 'radio', name: "#{@object_name}[#{label}]", id: "#{@object_name}_#{label}", value: value_pair[1], style: 'opacity: 0;')
416
+ end
417
+ end +
418
+ value_pair[0]
419
+ end
420
+ end
421
+ control_html.html_safe
422
+ end
423
+
424
+
425
+ def switcher(property, *args)
426
+ label = property.name.to_sym
427
+ options = args.extract_options!
428
+ options ||= {}
429
+ options.stringify_keys!
430
+
431
+ value_off = options['value-off'] || "0"
432
+ value_on = options['value-on'] || "1"
433
+
434
+ off_input_options = {type: "radio", name: "#{@object_name}[#{label}]", id: "#{@object_name}-#{label}-off", value: value_off}
435
+ on_input_options = {type: "radio", name: "#{@object_name}[#{label}]", id: "#{@object_name}-#{label}-on", value: value_on}
436
+
437
+ if @object[label] == true
438
+ on_input_options['checked'] = true
439
+ else
440
+ off_input_options['checked'] = true
441
+ end
442
+
443
+ toggle_options = {}
444
+
445
+ toggle_options[:class] = "toggle" + (@object[label] == value_on ? ' on' : ' off')
446
+ toggle_options[:class] = "toggle on"
447
+
448
+
449
+ control_html =
450
+ @template.content_tag('div', class: "row-fluid") do
451
+ @template.content_tag('div', class: "pull-left") do
452
+ @template.content_tag('label', class: 'radio off') do
453
+ @template.tag('input', off_input_options)
454
+
455
+ end +
456
+ @template.content_tag('label', class: 'radio on') do
457
+ @template.tag('input', on_input_options)
458
+ end +
459
+ @template.content_tag('div', toggle_options) do
460
+ @template.content_tag('div', class: "yes") do
461
+ options['label-on'] || 'ON'
462
+ end +
463
+ @template.content_tag('div', class: "switch") do
464
+ end +
465
+ @template.content_tag('div', class: "no") do
466
+ options['label-off'] || 'OFF'
467
+ end
468
+ end
469
+ end
470
+ end
471
+ control_html
472
+ end
473
+ end
474
+ end