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,71 @@
1
+
2
+ <%= tinymce_assets %>
3
+
4
+
5
+ <%= javascript_include_tag "/assets/jquery.sparkline.min.js" %>
6
+
7
+ <%= javascript_include_tag "jquery.tagsinput.js" %>
8
+ <%= javascript_include_tag "mustache.js" %>
9
+ <%= javascript_include_tag "jquery.history.js" %>
10
+ <%= javascript_include_tag "jquery.url-2.0.js" %>
11
+ <%= javascript_include_tag "jquery.cookie.js" %>
12
+
13
+ <%= javascript_include_tag "jquery.fancybox.js" %>
14
+ <%= javascript_include_tag "jquery.blockUI.js" %>
15
+
16
+ <%= javascript_include_tag "excanvas.compiled.js" %>
17
+ <%= javascript_include_tag "bootstrap-transition.js" %>
18
+ <%= javascript_include_tag "bootstrap-alert.js" %>
19
+ <%= javascript_include_tag "bootstrap-modal.js" %>
20
+ <%= javascript_include_tag "bootstrap-dropdown.js" %>
21
+ <%= javascript_include_tag "bootstrap-scrollspy.js" %>
22
+ <%= javascript_include_tag "bootstrap-tab.js" %>
23
+ <%= javascript_include_tag "bootstrap-tooltip.js" %>
24
+ <%= javascript_include_tag "bootstrap-popover.js" %>
25
+ <%= javascript_include_tag "bootstrap-button.js" %>
26
+ <%= javascript_include_tag "bootstrap-collapse.js" %>
27
+ <%= javascript_include_tag "bootstrap-carousel.js" %>
28
+ <%= javascript_include_tag "bootstrap-typeahead.js" %>
29
+
30
+
31
+ <%= javascript_include_tag "fileinput.jquery.js" %>
32
+ <%= javascript_include_tag "jquery-ui-1.8.23.custom.min.js" %>
33
+ <%= javascript_include_tag "jquery.touchdown.js" %>
34
+
35
+
36
+ <%= javascript_include_tag "wysihtml5-0.3.0.min.js" %>
37
+ <%= javascript_include_tag "bootstrap-wysihtml5.js" %>
38
+ <%= javascript_include_tag "jquery.peity.min.js" %>
39
+ <%= javascript_include_tag "jquery.uniform.min.js" %>
40
+ <%= javascript_include_tag "textarea-autogrow.js" %>
41
+ <%= javascript_include_tag "character-limit.js" %>
42
+ <%= javascript_include_tag "jquery.maskedinput-1.3.js" %>
43
+ <%= javascript_include_tag "chosen.jquery.min.js" %>
44
+ <%= javascript_include_tag "jquery.simplemodal-1.4.4.js" %>
45
+
46
+
47
+
48
+ <%= javascript_include_tag "jquery.flot.js" %>
49
+ <%= javascript_include_tag "jquery.flot.stack.js" %>
50
+ <%= javascript_include_tag "jquery.flot.pie.js" %>
51
+ <%= javascript_include_tag "jquery.flot.resize.js" %>
52
+ <%= javascript_include_tag "jquery.peity.min.js" %>
53
+
54
+
55
+ <%= javascript_include_tag "raphael.2.1.0.min.js" %>
56
+ <%= javascript_include_tag "justgage.1.0.1.min.js" %>
57
+
58
+ <%= javascript_include_tag "fullcalendar.js" %>
59
+
60
+ <%= javascript_include_tag "scripts.js" %>
61
+
62
+ <%= javascript_include_tag "jnavigate.jquery.min.js" %>
63
+
64
+ <%= javascript_include_tag "jquery.uploadify-3.1.js" %>
65
+
66
+ <%= javascript_include_tag "jquery.json-2.3.min.js" %>
67
+
68
+ <%= javascript_include_tag "jquery.jeditable.js" %>
69
+
70
+ <%= javascript_include_tag "syntax-highlighter/shCore.js" %>
71
+ <%= javascript_include_tag "syntax-highlighter/shBrushXml.js" %>
@@ -0,0 +1,1099 @@
1
+ <script type='text/javascript'>
2
+
3
+
4
+ // $(window).load(function () {
5
+ // $('#loading').show();
6
+ // });
7
+
8
+ $(document).ready(function () {
9
+
10
+ attachEventsAfterAjax();
11
+
12
+ // $('body').css('display', 'none');
13
+ // $('body').fadeIn(500);
14
+
15
+ //$('body').show();
16
+
17
+
18
+ // $("#logo a, #sidebar_menu a:not(.accordion-toggle), a.ajx").click(function () {
19
+ // event.preventDefault();
20
+ // newLocation = this.href;
21
+ // $('body').fadeOut(500, newpage);
22
+ // });
23
+ // function newpage() {
24
+ // window.location = newLocation;
25
+ //
26
+ //
27
+ // }
28
+
29
+
30
+ // $('#process_bulk_action').click(function () {
31
+ // // getting path in bulk action select
32
+ // path = getSelectedValueForSelect('#bulk_actions_select');
33
+ //
34
+ // if (path == null || path == "" || path == undefined) {
35
+ // showFancyMessage("No Bulk Action Selected.<br/>Please Select Bulk Action");
36
+ // return;
37
+ // }
38
+ // // collect selected ids
39
+ // itemIds = collectCheckedItems('.item_ids', 'id');
40
+ //
41
+ //
42
+ // ProcessMassAction(path, itemIds,
43
+ // {
44
+ // method:'post',
45
+ // dataType:'json',
46
+ // onSuccess:function (data) {
47
+ // items_container = $('#items_containder');
48
+ // result_html = '';
49
+ //
50
+ // $.each(data.items, function (key, value) {
51
+ // result_html += Mustache.to_html(item_template_for_mustache, value);
52
+ // });
53
+ // items_container.html(result_html);
54
+ // }
55
+ // }
56
+ // );
57
+ // });
58
+
59
+
60
+ // var dontSort = [];
61
+ // $('#datatable_example thead th').each(function () {
62
+ // if ($(this).hasClass('no_sort')) {
63
+ // dontSort.push({ "bSortable":false });
64
+ // } else {
65
+ // dontSort.push(null);
66
+ // }
67
+ // });
68
+ // $('#datatable_example').dataTable({
69
+ // "sDom":"<'row table_top_bar'<'row-fluid'>'<'to_hide_phone'>'f'<'>r>t<'row'>",
70
+ // "sDom":"<'row table_top_bar'<'row-fluid'<'to_hide_phone' f>>><'row'>",
71
+ // "aaSorting":[
72
+ // [ 4, "asc" ]
73
+ // ],
74
+ // "bPaginate":false,
75
+ // "bJQueryUI":false,
76
+ // "aoColumns":dontSort
77
+ // });
78
+ // $.extend($.fn.dataTableExt.oStdClasses, {
79
+ // "s`":"dataTables_wrapper form-inline"
80
+ // });
81
+
82
+ });
83
+
84
+
85
+ // $(document).ready(function() {
86
+ // var date = new Date();
87
+ // var d = date.getDate();
88
+ // var m = date.getMonth();
89
+ // var y = date.getFullYear();
90
+ // var calendar = $('#calendar').fullCalendar({
91
+ // header: {
92
+ // left: 'prev,next today',
93
+ // center: 'title',
94
+ // right: 'month,agendaWeek,agendaDay'
95
+ // },
96
+ // selectable: true,
97
+ // selectHelper: true,
98
+ // select: function(start, end, allDay) {
99
+ // var title = prompt('Event Title:');
100
+ // if (title) {
101
+ // calendar.fullCalendar('renderEvent',
102
+ // {
103
+ // title: title,
104
+ // start: start,
105
+ // end: end,
106
+ // allDay: allDay
107
+ // },
108
+ // true // make the event "stick"
109
+ // );
110
+ // }
111
+ // calendar.fullCalendar('unselect');
112
+ // },
113
+ // editable: true,
114
+ // events: [
115
+ // {
116
+ // title: 'All Day Event',
117
+ // start: new Date(y, m, 1)
118
+ // },
119
+ // {
120
+ // title: 'Long Event',
121
+ // start: new Date(y, m, d+5),
122
+ // end: new Date(y, m, d+7)
123
+ // },
124
+ // {
125
+ // id: 999,
126
+ // title: 'Repeating Event',
127
+ // start: new Date(y, m, d-3, 16, 0),
128
+ // allDay: false
129
+ // },
130
+ // {
131
+ // id: 999,
132
+ // title: 'Repeating Event',
133
+ // start: new Date(y, m, d+4, 16, 0),
134
+ // allDay: false
135
+ // },
136
+ // {
137
+ // title: 'Meeting',
138
+ // start: new Date(y, m, d, 10, 30),
139
+ // allDay: false
140
+ // },
141
+ // {
142
+ // title: 'Lunch',
143
+ // start: new Date(y, m, d, 12, 0),
144
+ // end: new Date(y, m, d, 14, 0),
145
+ // allDay: false
146
+ // },
147
+ // {
148
+ // title: 'Birthday Party',
149
+ // start: new Date(y, m, d+1, 19, 0),
150
+ // end: new Date(y, m, d+1, 22, 30),
151
+ // allDay: false
152
+ // },
153
+ // {
154
+ // title: 'Click for PixelGrade',
155
+ // start: new Date(y, m, 28),
156
+ // end: new Date(y, m, 29),
157
+ // url: 'http://pixelgrade.com/'
158
+ // }
159
+ // ]
160
+ // });
161
+ // });
162
+
163
+
164
+ // $(function () {
165
+ //
166
+ // var sin = [], cos = [], tes = [];
167
+ // for (var i = 0; i < 14; i += 1) {
168
+ // sin.push([i, Math.sin(i) * Math.random() * 0.9]);
169
+ // cos.push([i, Math.cos(i) * Math.random() * 1.4]);
170
+ // tes.push([i, Math.cos(i) * Math.random() * 0.4]);
171
+ // }
172
+ // var plot = $.plot($("#placeholder"),
173
+ // [
174
+ // { data:sin, label:"Google+", color:"#ef4723", shadowSize:0 },
175
+ // { data:cos, label:"Envato", color:"#a1d14d", shadowSize:0},
176
+ // { data:tes, label:"Facebook", color:"#4a8cf7", shadowSize:0 }
177
+ // ], {
178
+ // series:{
179
+ // lines:{ show:true, fill:true },
180
+ // points:{ show:true, fill:true }
181
+ // },
182
+ // grid:{ hoverable:true, clickable:true, autoHighlight:false, borderWidth:0, backgroundColor:{ colors:["#fff", "#fbfbfb"] } },
183
+ // yaxis:{ min:-1.5, max:1.5 }
184
+ // });
185
+ //
186
+ // function showTooltip(x, y, contents) {
187
+ // $('<div id="tooltip">' + contents + '</div>').css({
188
+ // position:'absolute',
189
+ // display:'none',
190
+ // top:y + 5,
191
+ // left:x + 5,
192
+ // border:'1px solid #ccc',
193
+ // padding:'2px 6px',
194
+ // 'background-color':'#fff',
195
+ // opacity:0.80
196
+ // }).appendTo("body").fadeIn(200);
197
+ // }
198
+ //
199
+ // var previousPoint = null;
200
+ // $("#placeholder").bind("plothover", function (event, pos, item) {
201
+ // $("#x").text(pos.x.toFixed(2));
202
+ // $("#y").text(pos.y.toFixed(2));
203
+ // if (item) {
204
+ // if (previousPoint != item.dataIndex) {
205
+ // previousPoint = item.dataIndex;
206
+ // $("#tooltip").remove();
207
+ // var x = item.datapoint[0].toFixed(2),
208
+ // y = item.datapoint[1].toFixed(2);
209
+ // showTooltip(item.pageX, item.pageY,
210
+ // item.series.label + " of " + x + " = " + y);
211
+ // }
212
+ // }
213
+ // });
214
+ // });
215
+
216
+
217
+ // $(function () {
218
+ // var data = [];
219
+ // var series = Math.floor(Math.random() * 5) + 1;
220
+ // data[0] = { label:"Google+", data:42, color:"#cb4b4b" };
221
+ // data[1] = { label:"Envato", data:27, color:"#4da74d"};
222
+ // data[2] = { label:"Pinterest", data:9, color:"#edc240"};
223
+ // data[3] = { label:"Facebook", data:22, color:"#5e96ea"};
224
+ // // DONUT
225
+ // $.plot($("#donut"), data,
226
+ // {
227
+ // series:{
228
+ // pie:{
229
+ // show:true,
230
+ // innerRadius:0.42,
231
+ // highlight:{
232
+ // opacity:0.3
233
+ // },
234
+ // radius:1,
235
+ // stroke:{
236
+ // color:'#fff',
237
+ // width:4
238
+ // },
239
+ // startAngle:0,
240
+ // combine:{
241
+ // color:'#353535',
242
+ // threshold:0.05
243
+ // },
244
+ // label:{
245
+ // show:true,
246
+ // radius:1,
247
+ // formatter:function (label, series) {
248
+ // return '<div class="chart-label">' + label + '&nbsp;' + Math.round(series.percent) + '%</div>';
249
+ // }
250
+ // }
251
+ // },
252
+ // grow:{ active:false}
253
+ // },
254
+ // legend:{show:true},
255
+ // grid:{
256
+ // hoverable:true,
257
+ // clickable:true
258
+ // }
259
+ // });
260
+ // });
261
+
262
+
263
+ function getPartialWithAjax(url, method, parameters) {
264
+ makeAjaxCall(url, {
265
+ method: method,
266
+ dataType: 'html',
267
+ data: parameters,
268
+ success: function (data) {
269
+ History.pushState(null, url, url);
270
+ $('#page_data_content').html(data);
271
+ attachEventsAfterAjax();
272
+ scrollTo($('#page_data_content'));
273
+ },
274
+ complete: function (xhr, textStatus) {
275
+ if (xhr.status == 302) {
276
+ getPartialWithAjax(url, method, parameters);
277
+ }
278
+ },
279
+ error: function () {
280
+ showFancyMessage("Error of Loading Edit Page with Ajax");
281
+ }
282
+ });
283
+ }
284
+
285
+
286
+ function attachEventsAfterAjax() {
287
+ $('.to-remove-before-ajax').each(function () {
288
+ $(this).stop();
289
+ $(this).hide();
290
+ $(this).remove();
291
+ });
292
+
293
+ //attachToContentNavLinks(['a.navigate-link', 'div.pagination a']);
294
+ //attachToSubmitForm(['form[ajaxify="true"]']);
295
+ //atachImageSelectDialog('div.image-select-dialog');
296
+
297
+ attachAutocomplete(["input[type='hidden'].autocomplete"]);
298
+ attachDatePicker("input.date-picker");
299
+ attachChosenSelect('select.chzn-select');
300
+
301
+ managementAttachDragables('div.items-management-url', '#items-management-tray', '#items-management-gallery');
302
+
303
+ attachToSortableTray('ul#sorting-management-tray');
304
+
305
+ attachSwitches('.toggle');
306
+
307
+ attachTaggable('.taggable');
308
+
309
+ attachImageUploader();
310
+
311
+ attachImagePicker('.image-picker');
312
+
313
+ myNotificationMessages = ['.notifications-info', '.notifications-warning', '.notifications-error', '.notifications-success'];
314
+
315
+ notifications_hideAllMessages();
316
+ notifications_showInfo();
317
+ notifications_showError();
318
+ notifications_showSuccess();
319
+ notifications_showWarning();
320
+
321
+ }
322
+
323
+ // Used for selectors passed to functions
324
+ // as string or as an array and as result
325
+ // we get an array of selectors even if we passed string
326
+ function normalizeSelectorsToArray(selectors) {
327
+ var normSelectors = [];
328
+
329
+ if ($.isArray(selectors) == false) {
330
+ //console.log('selectors is a string');
331
+ normSelectors.push(selectors);
332
+ }
333
+ else {
334
+ //console.log('selectors is an array')
335
+ $.each(selectors, function (index, value) {
336
+ normSelectors.push(value);
337
+ });
338
+ }
339
+ return normSelectors;
340
+
341
+ }
342
+
343
+
344
+ // Attaching autocomplete_with_id for hidden inputs with selectors
345
+ // control is rendered in ::KirguduBase::FormBuilder
346
+ function attachAutocomplete(selectors) {
347
+ var selsArr = normalizeSelectorsToArray(selectors);
348
+ $.each(selsArr, function (idx1, sel) {
349
+
350
+ // console.log('Selector ' + sel);
351
+ // console.log('Selected Objects ' + $(sel));
352
+
353
+ $(sel).each(function () {
354
+ //console.log('Autocomplete ' + $.toJSON(html_input));
355
+ var ctrlId = $(this).attr('id');
356
+ var dataSourcePath = $(this).attr('path');
357
+ //console.log('Autocomplete ID: ' + autocomplete_object_id + "Path: " + autocomplete_object_path);
358
+ AssignLabeledAutocompleteWithId(ctrlId + '_edit', ctrlId, ctrlId + '_label', dataSourcePath);
359
+ });
360
+
361
+
362
+ });
363
+ }
364
+
365
+
366
+ function attachDatePicker(selectors) {
367
+ var selsArr = normalizeSelectorsToArray(selectors);
368
+ $.each(selsArr, function (idx1, sel) {
369
+
370
+ // console.log('Selector ' + sel);
371
+ // console.log('Selected Objects ' + $(sel));
372
+
373
+
374
+ // console.log("All Links: " + $('a').length);
375
+ // console.log("Selected Objects: " + selected_objects.length);
376
+
377
+ $(sel).each(function () {
378
+ //console.log('Datepicker ID: ' + $(this).attr('id'));
379
+ AssignDatePicker($(this).attr('id'));
380
+ });
381
+ });
382
+ }
383
+
384
+
385
+ function attachImageUploader() {
386
+ <% key = Rails.application.config.session_options[:key] %>
387
+ var uploadify_script_data = {};
388
+ var csrf_param = $('meta[name=csrf-param]').attr('content');
389
+ var csrf_token = $('meta[name=csrf-token]').attr('content');
390
+ uploadify_script_data[csrf_param] = encodeURI(encodeURIComponent(csrf_token));
391
+ uploadify_script_data['<%= key %>'] = '<%= cookies[key] %>';
392
+
393
+ //var uploadify_script_data = {};
394
+ $('#uploadify').uploadify({
395
+ swf: '<%= asset_path("uploadify.swf") %>',
396
+ uploader: '<%= url_for(controller: '/erp_zone/common/images', action: 'create') %>',
397
+ // buttonText : 'Загрузить...',
398
+ buttonCursor: 'hand',
399
+ height: 20,
400
+ auto: true,
401
+ multi: true,
402
+ removeCompleted: true,
403
+ beforeSend: function (xhr) {
404
+ xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))
405
+ },
406
+ onUploadSuccess: function (file, data, response) {
407
+ imageData = jQuery.parseJSON(data);
408
+
409
+ //alert('Image Data:' + imageData.filename.thumb.url );
410
+ var str =
411
+ '<li>' +
412
+ ' <div class="btn-group">' +
413
+ ' <a href="<%= url_for(controller: '/erp_zone/common/images')%>/' + imageData.id + '/edit" rel="tooltip" data-placement="top" data-original-title="Edit Image">' +
414
+ ' <i class="icon-magic"></i>' +
415
+ ' </a>' +
416
+ ' <a href="<%= url_for(controller: '/erp_zone/common/images')%>/' + imageData.id + '" rel="tooltip" data-placement="top" data-original-title="Show Image">' +
417
+ ' <i class=" icon-heart"></i>' +
418
+ ' </a>' +
419
+ ' <a rel="tooltip" data-placement="top" data-original-title="Delete image">' +
420
+ ' <i class=" icon-trash"></i>' +
421
+ ' </a>' +
422
+ ' </div>' +
423
+ ' <a class="thumbnail" data-toggle="modal">' +
424
+ ' <img src="' + imageData.filename.thumb.url + '" alt=""/>' +
425
+ ' </a>' +
426
+ '</li>';
427
+
428
+ $('#uploaded_images_container').append(str);
429
+
430
+
431
+ /* $.ajax({
432
+ url: "
433
+
434
+ <%= url_for(controller: '/erp_zone/common/images', action: 'get_thumb') %>",
435
+ dataType: 'json',
436
+ type: 'get',
437
+ beforeSend: function(xhr) {
438
+ xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))
439
+ },
440
+ data: {file: imageData.filename.thumb},
441
+ complete: function(json) {
442
+ var obj = jQuery.parseJSON(json.responseText);
443
+ var str =
444
+ '<li>' +
445
+ ' <div class="btn-group">' +
446
+ ' <a href="
447
+
448
+ <%= url_for(controller: '/erp_zone/common/images')%>'+ obj.id +' / edit
449
+ " rel="
450
+ tooltip
451
+ " data-placement="
452
+ top
453
+ " data-original-title="
454
+ Edit
455
+ Image
456
+ ">' +
457
+ ' <i class="icon-magic"></i>' +
458
+ ' </a>' +
459
+ ' <a href="
460
+
461
+ <%= url_for(controller: '/erp_zone/common/images')%>'+ obj.id +'
462
+ " rel="
463
+ tooltip
464
+ " data-placement="
465
+ top
466
+ " data-original-title="
467
+ Show
468
+ Image
469
+ ">' +
470
+ ' <i class=" icon-heart"></i>' +
471
+ ' </a>' +
472
+ ' <a rel="tooltip" data-placement="top" data-original-title="Delete image">' +
473
+ ' <i class=" icon-trash"></i>' +
474
+ ' </a>' +
475
+ ' </div>' +
476
+ ' <a class="thumbnail" data-toggle="modal">' +
477
+ ' <img src="' + obj.thumb + '" alt=""/>' +
478
+ ' </a>' +
479
+ '</li>';
480
+
481
+ $('#uploaded_images_container').append(str);
482
+
483
+ // var obj = jQuery.parseJSON(json.responseText);
484
+ // console.log(obj.thumb);
485
+ }
486
+ }); */
487
+ },
488
+ onUploadError: function (file, errorCode, errorMsg, errorString) {
489
+ alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
490
+ },
491
+ formData: uploadify_script_data
492
+ // onUploadComplete : function(file) {
493
+ // alert(file);
494
+ // }
495
+ });
496
+
497
+ }
498
+
499
+ function attachTaggable(selectors) {
500
+ $.each(normalizeSelectorsToArray(selectors), function (idx1, sel) {
501
+
502
+ $(sel).each(function () {
503
+
504
+ var taggable_id = $(this).attr('taggable-id');
505
+ var taggable_type = $(this).attr('taggable-type');
506
+ var add_tag_label = $(this).attr('add-tag-label');
507
+ if (add_tag_label == null || add_tag_label == undefined) {
508
+ add_tag_label = 'add tag';
509
+ }
510
+ var url_to_complete = $(this).attr('autocomplete-url');
511
+
512
+ if (url_to_complete == null || url_to_complete == undefined) {
513
+ $(this).tagsInput({
514
+ height: '100px',
515
+ width: '300px',
516
+ interactive: true,
517
+ defaultText: add_tag_label,
518
+ // onAddTag: function(tag) {
519
+ // alert("Added a tag: " + tag);
520
+ // },
521
+ // onRemoveTag: function(tag) {
522
+ // alert("Removed a tag: " + tag);
523
+ // },
524
+ // onChange: function(input,tag) {
525
+ // alert("Changed a tag: " + tag);
526
+ // },
527
+ removeWithBackspace: true,
528
+ minChars: 0,
529
+ maxChars: 0, //if not provided there is no limit,
530
+ placeholderColor: '#666666'
531
+ });
532
+ }
533
+ else {
534
+ $(this).tagsInput({
535
+ autocomplete_url: url_to_complete,
536
+ height: '100px',
537
+ width: '300px',
538
+ interactive: true,
539
+ defaultText: add_tag_label,
540
+ removeWithBackspace: true,
541
+ minChars: 0,
542
+ maxChars: 0, //if not provided there is no limit,
543
+ placeholderColor: '#666666'
544
+ });
545
+ }
546
+ });
547
+ });
548
+ }
549
+
550
+
551
+ function chosen_select_process_children(parent, children, value) {
552
+ if (value == "") {
553
+
554
+ return;
555
+ }
556
+
557
+ }
558
+
559
+
560
+ // function chosen_select_process_disable_children(parentControl, childControl)
561
+ // {
562
+ // if(parentControl == null || childControl == null) return;
563
+ //
564
+ // //alert("Parent Control: " + parentControl.attr("id"));
565
+ // //alert("Child Control: " + childControl.attr("id"));
566
+ //
567
+ // var value = parentControl.attr('value');
568
+ // //alert("Value in Disable: " + value);
569
+ // if (value == "" || value == null) {
570
+ // //alert("Process Value in Disable: " + value);
571
+ //
572
+ // childControl.attr('disabled', "disabled");
573
+ // $('#' + childControl.attr("id") + ' option:gt(0)').remove();
574
+ // childControl.trigger("liszt:updated");
575
+ //
576
+ // if (childControl.attr("onchange") != null) {
577
+ // var child_actions = jQuery.parseJSON(childControl.attr("onchange"));
578
+ // $.each(child_actions, function (index, chained_action)
579
+ // {
580
+ // var child_of_child = $("#" + chained_action.property_control);
581
+ // //alert("Child of Child: " + child_of_child.attr("id"));
582
+ // chosen_select_process_disable_children(childControl, child_of_child);
583
+ // });
584
+ // }
585
+ // }
586
+ // }
587
+
588
+
589
+ function disableChildrenControls(ctrl) {
590
+ if (ctrl == null) return;
591
+ //alert("In Process of Diabling Children");
592
+ if (ctrl.attr("onchange")) {
593
+ //alert("Onchange found");
594
+ var act2pro = jQuery.parseJSON(ctrl.attr("onchange"));
595
+ //alert("Onchange parsed from json");
596
+ $.each(act2pro, function (index, parent_action) {
597
+
598
+ var childCtrl = $(normalizeIdForCss(parent_action.property_control));
599
+
600
+ if (childCtrl.attr("control_type") == "chosen_select") {
601
+ //alert("Disabling Chosen Select: " + childControl.attr("id"));
602
+ disableChosenSelect(childCtrl);
603
+ }
604
+ else if (childCtrl.attr("control_type") == "autocomplete_wtih_id") {
605
+ //alert("Disabling Autocomplet With ID: " + childControl.attr("id"));
606
+ set_default_autocomplete(childCtrl);
607
+ disableAutoCompleteWithID(childCtrl);
608
+ }
609
+ else if (childCtrl.attr("control_type") == "text_edit") {
610
+ childCtrl.attr("value", null);
611
+ disableTextEdit(childCtrl);
612
+ }
613
+ else if (childCtrl.attr("control_type") == "switcher") {
614
+ disableSwitcher(childCtrl);
615
+ }
616
+ else if (childCtrl.attr("control_type") == "checkbox") {
617
+ disableCheckbox(childCtrl);
618
+ }
619
+
620
+ disableChildrenControls(childCtrl); // disabling children for childCtrl
621
+ });
622
+ }
623
+
624
+
625
+ //alert("Value in Disable: " + value);
626
+
627
+ }
628
+
629
+
630
+ function disableChosenSelect(ctrl) {
631
+ if (ctrl == null) return;
632
+ ctrl.attr('disabled', "disabled");
633
+ $('#' + ctrl.attr("id") + ' option:gt(0)').remove();
634
+ ctrl.trigger("liszt:updated");
635
+ }
636
+ function disableAutoCompleteWithID(ctrl) {
637
+ if (ctrl == null) return;
638
+ ctrl.addClass("disabled");
639
+ var ctrlLabel = $("#" + ctrl.attr('id') + "_label");
640
+ if (ctrlLabel != null) {
641
+ ctrlLabel.addClass("disabled");
642
+ }
643
+ }
644
+ function disableTextEdit(ctrl) {
645
+
646
+ }
647
+ function disableSwitcher(ctrl) {
648
+
649
+ }
650
+ function disableCheckbox(ctrl) {
651
+
652
+ }
653
+
654
+ function set_default_autocomplete(ctrl) {
655
+ if (ctrl == null) return;
656
+ var ctrlLabel = $("#" + ctrl.attr('id') + "_label");
657
+ ctrl.attr("value", null);
658
+ if (ctrlLabel != null) {
659
+ ctrlLabel.text = ctrl.attr("placeholder");
660
+ }
661
+ }
662
+
663
+ function processCtrlValueChanged(ctrl, oldVal, newVal) {
664
+ if (ctrl == null) return; // control is null
665
+ //alert("New Value: " + new_value + "\r\nOld Value: " + old_value);
666
+ if (newVal == null || newVal == "") {
667
+ //alert("Ready to Disable");
668
+ disableChildrenControls(ctrl);
669
+ return;
670
+ }
671
+ //alert("OnChange Found: " + control);
672
+ if (ctrl.attr("onchange") == null) {
673
+ // control dosenot have onchange attribute
674
+ return;
675
+ }
676
+
677
+ // parsing actions from onchange
678
+ var acts2proc = jQuery.parseJSON(ctrl.attr("onchange")); // actions for onchange attribute deserialized from json
679
+ var cur_prop_name = ctrl.attr("property_name"); // property name for current control
680
+
681
+ $.each(acts2proc, function (index, act2pr) {
682
+ //alert("Processing Child Controls: "+ act2pr.property_control);
683
+ var child_prop_name = act2pr.property;
684
+ var childCtrl = $(normalizeIdForCss(act2pr.property_control));
685
+ //alert("Child Control Type: " + childCtrl.attr("control_type"));
686
+ if (childCtrl.attr("control_type") == "chosen_select") {
687
+ //alert("Processing Chosen Select");
688
+ var ajax_options = {};
689
+ ajax_options[cur_prop_name] = newVal;
690
+ //alert("Select Path: " + act2pr.source);
691
+ if (newVal != "" && newVal != null) {
692
+ makeAjaxCall(act2pr.source, {
693
+ method: 'get',
694
+ dataType: getJsonTypeForAjax($(location).attr('href'), act2pr.source),
695
+ data: ajax_options,
696
+ success: function (jsonResult) {
697
+ if (jsonResult.status == "ok") {
698
+ //alert("JSON AJAX is OK");
699
+ childCtrl.removeAttr('disabled');
700
+ $('#' + act2pr.property_control + ' option:gt(0)').remove();
701
+ $.each(jsonResult.data, function (index, entry) {
702
+ childCtrl.append("<option value='" + entry.id + "'>" + entry.name + "</option>");
703
+ });
704
+ childCtrl.trigger("liszt:updated");
705
+ }
706
+ },
707
+ error: function (response) {
708
+ //alert("Response Code: " + response.status);
709
+ showFancyMessage("Failed to Retrieve Data from Source");
710
+ }
711
+
712
+ });
713
+ //alert("Making JSON");
714
+
715
+ //if(currentControlAction.source)
716
+
717
+ // makeJsonCall(currentControlAction.source, {
718
+ // data: ajax_options,
719
+ // success: function (json_result) {
720
+ // //alert("JSON RESUTL: " + json_result);
721
+ // if (json_result.status == "ok") {
722
+ // childControl.removeAttr('disabled');
723
+ // $('#' + currentControlAction.property_control + ' option:gt(0)').remove();
724
+ // $.each(json_result.data, function (index, entry) {
725
+ // childControl.append("<option value='" + entry.id + "'>" + entry.name + "</option>");
726
+ // });
727
+ // childControl.trigger("liszt:updated");
728
+ // }
729
+ // }
730
+ // });
731
+
732
+ }
733
+ disableChildrenControls(childCtrl);
734
+ }
735
+ else if (childCtrl.attr("control_type") == "autocomplete_with_id") {
736
+ set_default_autocomplete(childCtrl);
737
+ disableChildrenControls(childCtrl);
738
+ }
739
+ });
740
+
741
+
742
+ }
743
+
744
+ function attachChosenSelect(selectors) {
745
+ $.each(normalizeSelectorsToArray(selectors), function (idx1, sel) {
746
+
747
+ $(sel).change(function () {
748
+ var new_value = $(this).attr('value');
749
+ processCtrlValueChanged($(this), null, new_value);
750
+ });
751
+
752
+ $(sel).chosen({
753
+ disable_search_threshold: 10,
754
+ allow_single_deselect: true
755
+ });
756
+ });
757
+ }
758
+
759
+
760
+ function attachImagePicker(selectors) {
761
+ $.each(normalizeSelectorsToArray(selectors), function (index, sel) {
762
+ //alert("Image Selector: " + sel);
763
+ $(sel).simpleImagePicker(
764
+ {
765
+ on_select: function (ui, id, thumb_url) {
766
+ console.log(ui);
767
+ var input = ui;
768
+ input.attr('value', id);
769
+ var image = input.next();
770
+ image.attr('src', thumb_url);
771
+ }
772
+ });
773
+ });
774
+ }
775
+
776
+ function attachToContentNavLinks(selectors) {
777
+
778
+ //alert('Hello: Attaching Nav Link Clicks');
779
+
780
+ $.each(normalizeSelectorsToArray(selectors), function (index, sel) {
781
+ $(sel).click(function () {
782
+ //alert('NAv Link Click');
783
+ //alert('Hello from Nav Link Click');
784
+ var request_data = {};
785
+ request_data['layout'] = false;
786
+
787
+ var url = $(this).attr('href');
788
+ var http_method = normalizeHttpMethod($(this).attr('http-method'));
789
+
790
+ var current_uri = $.url();
791
+ var uri = $.url(url);
792
+ var new_page = (uri).param('page');
793
+
794
+ if (new_page == undefined || new_page == null) {
795
+ var current_page = current_uri.param('page');
796
+ if (current_page == undefined || current_page == null) {
797
+
798
+ }
799
+ else {
800
+ request_data['page'] = current_page;
801
+ }
802
+ }
803
+
804
+ var confirm_message = $(this).attr('confirm-message');
805
+
806
+ if (confirm_message == undefined || confirm_message == null) {
807
+ makeNavLinkRequest(url, http_method, request_data);
808
+ }
809
+ else {
810
+ fancyConfirm(confirm_message,
811
+ function (ret) {
812
+ if (ret == true) {
813
+ makeNavLinkRequest(url, http_method, request_data);
814
+ }
815
+ }
816
+ );
817
+ }
818
+ //alert('Edit Button Url: ' + url);
819
+ // makeAjaxCall(url, {
820
+ // method: http_method,
821
+ // dataType: 'html',
822
+ // data: request_data,
823
+ // success: function(data)
824
+ // {
825
+ // if(http_method != 'delete')
826
+ // {
827
+ // History.pushState($(document).html(), url, url);
828
+ // }
829
+ // $('#page_data_content').html(data);
830
+ // attachEventsAfterAjax();
831
+ // scrollTo($('#page_data_content'));
832
+ // },
833
+ // error: function()
834
+ // {
835
+ // showFancyMessage("Error of Loading Edit Page with Ajax");
836
+ // }
837
+ // });
838
+ return false;
839
+ });
840
+ });
841
+ }
842
+
843
+ function makeNavLinkRequest(url, http_method, request_data) {
844
+ makeAjaxCall(url, {
845
+ method: http_method,
846
+ dataType: 'html',
847
+ data: request_data,
848
+ success: function (data) {
849
+ $('#page_data_content').html(data);
850
+ if (http_method != 'delete') {
851
+ History.pushState("", url, url);
852
+ }
853
+ attachEventsAfterAjax();
854
+ scrollTo($('#page_data_content'));
855
+ },
856
+ error: function () {
857
+ showFancyMessage("<%= I18n.t('admin.shared.messages.error_ajax_load') %>");
858
+ }
859
+ });
860
+ }
861
+
862
+ function attachToSubmitForm(selectors) {
863
+ var selsArr = normalizeSelectorsToArray(selectors);
864
+
865
+ $.each(selsArr, function (index, sel) {
866
+ var frm2submit = $(sel);
867
+
868
+ if( frm2submit == null) return;
869
+
870
+ //alert("Form URL: " + url + ", Form Method: " + method);
871
+
872
+ frm2submit.submit(function () {
873
+
874
+ var url = $(this).attr('action');
875
+ var method = $(this).attr('method');
876
+
877
+ if (method == undefined || method == null) {
878
+
879
+ // searching for Rails input with PUT method if exists
880
+ var input_w_method = $(this).find('input[name="_method"]');
881
+
882
+ //alert("Form to Submit: " + form_2_submit);
883
+ //alert("input name='_method': " + input_w_method);
884
+
885
+ if (input_w_method) {
886
+ //alert("Put Method Found");
887
+ method = input_w_method.val();
888
+ }
889
+
890
+ if (method == undefined || method == null) {
891
+ method = "post";
892
+ }
893
+ }
894
+
895
+ //alert('Hello from Submited Form ');
896
+
897
+ //Serializing form to JSON
898
+ var formData = serializeToJson($(this));
899
+ formData['layout'] = false;
900
+
901
+ //alert("Form Serialized Data: " + form_data);
902
+
903
+ //alert('Edit Button Url: ' + url);
904
+ makeAjaxCall(url, {
905
+ method: method,
906
+ dataType: 'html',
907
+ data: formData,
908
+ success: function (data) {
909
+ History.pushState(null, null, url);
910
+ var contentContainer = $('#page_data_content')
911
+ if( contentContainer != null){
912
+ contentContainer .html(data);
913
+ }
914
+ attachEventsAfterAjax();
915
+ scrollTo($('#page_data_content'));
916
+ },
917
+ error: function (response) {
918
+ //alert("Response Code: " + response.status);
919
+ showFancyMessage("<%= I18n.t('admin.shared.messages.error_ajax_load') %>");
920
+ }
921
+
922
+ });
923
+ return false;
924
+ });
925
+ });
926
+ }
927
+
928
+
929
+ function managementAttachDragables(url_css, tray_css, gallery_css) {
930
+ var gallery = $(gallery_css);
931
+ var tray = $(tray_css);
932
+ var management_url_add = $(url_css + "[type='add']").first().attr('href');
933
+ var management_url_remove = $(url_css + "[type='remove']").first().attr('href');
934
+
935
+ //alert("URL ADD CSS: " + url_css+"[type='add']\r\nURL ADD: " + management_url_add + "\r\nURL REMOVE: " + management_url_remove);
936
+
937
+ $("li", gallery).draggable({
938
+ cancel: "a.ui-icon",
939
+ revert: "invalid",
940
+ cursor: "move",
941
+ helper: "clone"
942
+ });
943
+
944
+ tray.droppable({
945
+ accept: gallery_css + " > li",
946
+ drop: function (event, ui) {
947
+ //alert("URL Add: " + management_url_add);
948
+ makeAjaxCall(management_url_add, {
949
+ method: 'post',
950
+ dataType: 'json',
951
+ data: {entry_id: ui.draggable.attr('entry-id')},
952
+ success: function (data) {
953
+ if (data.status == <%= ::SharedZone::SetManagementResult.id_by_tag("management_ok") %>) {
954
+ ui.draggable.fadeOut(function () {
955
+ tray.append(ui.draggable);
956
+ ui.draggable.fadeIn();
957
+ ui.draggable.append(" --- <a href=\"javascript:managementRemoveItem( '" + management_url_remove + "', '" + tray_css + "', " + ui.draggable.attr('entry-id') + " );\"><%= I18n.t("admin.shared.management.remove_button") %></a>");
958
+ });
959
+ }
960
+ else {
961
+ showFancyMessage(data.message);
962
+ }
963
+ },
964
+ error: function () {
965
+ showFancyMessage("<%= I18n.t('admin.shared.messages.error_ajax_load') %>");
966
+ }
967
+ });
968
+ }
969
+ });
970
+ }
971
+
972
+ function managementRemoveItem(url, tray_css, entry_id) {
973
+ makeAjaxCall(url, {
974
+ method: 'post',
975
+ dataType: 'json',
976
+ data: {entry_id: entry_id },
977
+ success: function (data) {
978
+ if (data.status == <%= ::SharedZone::SetManagementResult.id_by_tag("management_ok") %>) {
979
+ var tray = $(tray_css);
980
+ var item_to_remove = tray.find('li[entry-id = ' + entry_id + ']');
981
+ item_to_remove.fadeOut();
982
+ }
983
+ else {
984
+ showFancyMessage(data.message);
985
+ }
986
+ },
987
+ error: function () {
988
+ showFancyMessage("<%= I18n.t('admin.shared.messages.error_ajax_load') %>");
989
+ }
990
+ });
991
+ }
992
+
993
+
994
+ // Initialize sortiable on #sortable div
995
+ function attachToSortableTray(tray_css) {
996
+ var tray = $(tray_css);
997
+ tray.sortable();
998
+ tray.disableSelection();
999
+ }
1000
+
1001
+ function attachSwitches(label_css) {
1002
+ var off = false;
1003
+
1004
+ $(label_css).each(function () {
1005
+ var toggle = $(this);
1006
+
1007
+ toggle.siblings().hide();
1008
+ toggle.show();
1009
+
1010
+ if (toggle.siblings().find('input[checked="checked"]').val() == "1") {
1011
+ //alert('switcher on for ' + toggle.html());
1012
+ toggle.removeClass('off').addClass('on');
1013
+ }
1014
+ else {
1015
+ //alert('switcher off for ' + toggle.html());
1016
+ toggle.removeClass('on').addClass('off');
1017
+ }
1018
+
1019
+ $(this).click(function () {
1020
+ var self = $(this);
1021
+
1022
+ if (self.hasClass('on')) {
1023
+ self.siblings('.off').click();
1024
+ self.removeClass('on').addClass('off');
1025
+ } else {
1026
+ self.siblings('.on').click();
1027
+ self.removeClass('off').addClass('on');
1028
+ }
1029
+ });
1030
+ });
1031
+ }
1032
+
1033
+
1034
+ // Prepare and go-to proper url for updating order of slides.
1035
+ // Called via html anchor tag by user
1036
+ function sortingUpdateItemsOrder(ajax_path, tray_css) {
1037
+
1038
+ var tray = $(tray_css);
1039
+
1040
+ makeAjaxCall(ajax_path, {
1041
+ method: 'post',
1042
+ dataType: 'json',
1043
+ data: {
1044
+ items: tray.sortable("toArray")
1045
+ },
1046
+ success: function (data) {
1047
+ showFancyMessage(data.message);
1048
+ },
1049
+ error: function () {
1050
+ showFancyMessage("<%= I18n.t('admin.shared.messages.error_ajax_load') %>");
1051
+ }
1052
+ });
1053
+ return false;
1054
+ }
1055
+
1056
+ function notifications_hideAllMessages() {
1057
+ var messagesHeights = new Array(); // this array will store height for each
1058
+
1059
+ for (i = 0; i < myNotificationMessages.length; i++) {
1060
+ messagesHeights[i] = $(myNotificationMessages[i]).outerHeight(); // fill array
1061
+ $(myNotificationMessages[i]).css('top', -messagesHeights[i]); //move element outside viewport
1062
+ }
1063
+ }
1064
+
1065
+ function notifications_showMessage(type, html_text) {
1066
+ //hideAllMessages();
1067
+
1068
+ var message_container = $(type);
1069
+ if (message_container) {
1070
+ message_container.remove();
1071
+ if (html_text) {
1072
+ message_container.html(html_text);
1073
+ }
1074
+ message_container.appendTo(document.body);
1075
+ //message_container = $(type);
1076
+ message_container.addClass('to-remove-before-ajax');
1077
+ message_container.animate({top: "0"}, 500);
1078
+ message_container.slideDown(300).delay(3500).slideUp(500, function () {
1079
+ message_container.remove();
1080
+ });
1081
+ }
1082
+ }
1083
+
1084
+ function notifications_showInfo(html_text) {
1085
+ notifications_showMessage('.notifications-info', html_text)
1086
+ }
1087
+ function notifications_showWarning(html_text) {
1088
+ notifications_showMessage('.notifications-warning', html_text)
1089
+ }
1090
+ function notifications_showError(html_text) {
1091
+ notifications_showMessage('.notifications-error', html_text)
1092
+ }
1093
+ function notifications_showSuccess(html_text) {
1094
+ notifications_showMessage('.notifications-success', html_text)
1095
+ }
1096
+
1097
+ </script>
1098
+
1099
+ <%= tinymce %>