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,401 @@
1
+ /* =========================================================
2
+ * bootstrap-datepicker.js
3
+ * http://www.eyecon.ro/bootstrap-datepicker
4
+ * =========================================================
5
+ * Copyright 2012 Stefan Petre
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================= */
19
+
20
+ !function( $ ) {
21
+
22
+ // Picker object
23
+
24
+ var Datepicker = function(element, options){
25
+ this.element = $(element);
26
+ this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
27
+ this.picker = $(DPGlobal.template)
28
+ .appendTo('body')
29
+ .on({
30
+ click: $.proxy(this.click, this),
31
+ mousedown: $.proxy(this.mousedown, this)
32
+ });
33
+ this.isInput = this.element.is('input');
34
+ this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
35
+
36
+ if (this.isInput) {
37
+ this.element.on({
38
+ focus: $.proxy(this.show, this),
39
+ blur: $.proxy(this.hide, this),
40
+ keyup: $.proxy(this.update, this)
41
+ });
42
+ } else {
43
+ if (this.component){
44
+ this.component.on('click', $.proxy(this.show, this));
45
+ } else {
46
+ this.element.on('click', $.proxy(this.show, this));
47
+ }
48
+ }
49
+
50
+ this.viewMode = 0;
51
+ this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
52
+ this.weekEnd = this.weekStart == 0 ? 6 : this.weekStart - 1;
53
+ this.fillDow();
54
+ this.fillMonths();
55
+ this.update();
56
+ this.showMode();
57
+ };
58
+
59
+ Datepicker.prototype = {
60
+ constructor: Datepicker,
61
+
62
+ show: function(e) {
63
+ this.picker.show();
64
+ this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
65
+ this.place();
66
+ $(window).on('resize', $.proxy(this.place, this));
67
+ if (e ) {
68
+ e.stopPropagation();
69
+ e.preventDefault();
70
+ }
71
+ if (!this.isInput) {
72
+ $(document).on('mousedown', $.proxy(this.hide, this));
73
+ }
74
+ this.element.trigger({
75
+ type: 'show',
76
+ date: this.date
77
+ });
78
+ },
79
+
80
+ hide: function(){
81
+ this.picker.hide();
82
+ $(window).off('resize', this.place);
83
+ this.viewMode = 0;
84
+ this.showMode();
85
+ if (!this.isInput) {
86
+ $(document).off('mousedown', this.hide);
87
+ }
88
+ this.setValue();
89
+ this.element.trigger({
90
+ type: 'hide',
91
+ date: this.date
92
+ });
93
+ },
94
+
95
+ setValue: function() {
96
+ var formated = DPGlobal.formatDate(this.date, this.format);
97
+ if (!this.isInput) {
98
+ if (this.component){
99
+ this.element.find('input').prop('value', formated);
100
+ }
101
+ this.element.data('date', formated);
102
+ } else {
103
+ this.element.prop('value', formated);
104
+ }
105
+ },
106
+
107
+ place: function(){
108
+ var offset = this.component ? this.component.offset() : this.element.offset();
109
+ this.picker.css({
110
+ top: offset.top + this.height,
111
+ left: offset.left
112
+ });
113
+ },
114
+
115
+ update: function(){
116
+ this.date = DPGlobal.parseDate(
117
+ this.isInput ? this.element.prop('value') : this.element.data('date'),
118
+ this.format
119
+ );
120
+ this.viewDate = new Date(this.date);
121
+ this.fill();
122
+ },
123
+
124
+ fillDow: function(){
125
+ var dowCnt = this.weekStart;
126
+ var html = '<tr>';
127
+ while (dowCnt < this.weekStart + 7) {
128
+ html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
129
+ }
130
+ html += '</tr>';
131
+ this.picker.find('.datepicker-days thead').append(html);
132
+ },
133
+
134
+ fillMonths: function(){
135
+ var html = '';
136
+ var i = 0
137
+ while (i < 12) {
138
+ html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
139
+ }
140
+ this.picker.find('.datepicker-months td').append(html);
141
+ },
142
+
143
+ fill: function() {
144
+ var d = new Date(this.viewDate),
145
+ year = d.getFullYear(),
146
+ month = d.getMonth(),
147
+ currentDate = this.date.valueOf();
148
+ this.picker.find('.datepicker-days th:eq(1)')
149
+ .text(DPGlobal.dates.months[month]+' '+year);
150
+ var prevMonth = new Date(year, month-1, 28,0,0,0,0),
151
+ day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
152
+ prevMonth.setDate(day);
153
+ prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
154
+ var nextMonth = new Date(prevMonth);
155
+ nextMonth.setDate(nextMonth.getDate() + 42);
156
+ nextMonth = nextMonth.valueOf();
157
+ html = [];
158
+ var clsName;
159
+ while(prevMonth.valueOf() < nextMonth) {
160
+ if (prevMonth.getDay() == this.weekStart) {
161
+ html.push('<tr>');
162
+ }
163
+ clsName = '';
164
+ if (prevMonth.getMonth() < month) {
165
+ clsName += ' old';
166
+ } else if (prevMonth.getMonth() > month) {
167
+ clsName += ' new';
168
+ }
169
+ if (prevMonth.valueOf() == currentDate) {
170
+ clsName += ' active';
171
+ }
172
+ html.push('<td class="day'+clsName+'">'+prevMonth.getDate() + '</td>');
173
+ if (prevMonth.getDay() == this.weekEnd) {
174
+ html.push('</tr>');
175
+ }
176
+ prevMonth.setDate(prevMonth.getDate()+1);
177
+ }
178
+ this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
179
+ var currentYear = this.date.getFullYear();
180
+
181
+ var months = this.picker.find('.datepicker-months')
182
+ .find('th:eq(1)')
183
+ .text(year)
184
+ .end()
185
+ .find('span').removeClass('active');
186
+ if (currentYear == year) {
187
+ months.eq(this.date.getMonth()).addClass('active');
188
+ }
189
+
190
+ html = '';
191
+ year = parseInt(year/10, 10) * 10;
192
+ var yearCont = this.picker.find('.datepicker-years')
193
+ .find('th:eq(1)')
194
+ .text(year + '-' + (year + 9))
195
+ .end()
196
+ .find('td');
197
+ year -= 1;
198
+ for (var i = -1; i < 11; i++) {
199
+ html += '<span class="year'+(i == -1 || i == 10 ? ' old' : '')+(currentYear == year ? ' active' : '')+'">'+year+'</span>';
200
+ year += 1;
201
+ }
202
+ yearCont.html(html);
203
+ },
204
+
205
+ click: function(e) {
206
+ e.stopPropagation();
207
+ e.preventDefault();
208
+ var target = $(e.target).closest('span, td, th');
209
+ if (target.length == 1) {
210
+ switch(target[0].nodeName.toLowerCase()) {
211
+ case 'th':
212
+ switch(target[0].className) {
213
+ case 'switch':
214
+ this.showMode(1);
215
+ break;
216
+ case 'prev':
217
+ case 'next':
218
+ this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
219
+ this.viewDate,
220
+ this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
221
+ DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1)
222
+ );
223
+ this.fill();
224
+ break;
225
+ }
226
+ break;
227
+ case 'span':
228
+ if (target.is('.month')) {
229
+ var month = target.parent().find('span').index(target);
230
+ this.viewDate.setMonth(month);
231
+ } else {
232
+ var year = parseInt(target.text(), 10)||0;
233
+ this.viewDate.setFullYear(year);
234
+ }
235
+ this.showMode(-1);
236
+ this.fill();
237
+ break;
238
+ case 'td':
239
+ if (target.is('.day')){
240
+ var day = parseInt(target.text(), 10)||1;
241
+ var month = this.viewDate.getMonth();
242
+ if (target.is('.old')) {
243
+ month -= 1;
244
+ } else if (target.is('.new')) {
245
+ month += 1;
246
+ }
247
+ var year = this.viewDate.getFullYear();
248
+ this.date = new Date(year, month, day,0,0,0,0);
249
+ this.viewDate = new Date(year, month, day,0,0,0,0);
250
+ this.fill();
251
+ this.setValue();
252
+ this.element.trigger({
253
+ type: 'changeDate',
254
+ date: this.date
255
+ });
256
+ }
257
+ break;
258
+ }
259
+ }
260
+ },
261
+
262
+ mousedown: function(e){
263
+ e.stopPropagation();
264
+ e.preventDefault();
265
+ },
266
+
267
+ showMode: function(dir) {
268
+ if (dir) {
269
+ this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir));
270
+ }
271
+ this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
272
+ }
273
+ };
274
+
275
+ $.fn.datepicker = function ( option ) {
276
+ return this.each(function () {
277
+ var $this = $(this),
278
+ data = $this.data('datepicker'),
279
+ options = typeof option == 'object' && option;
280
+ if (!data) {
281
+ $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
282
+ }
283
+ if (typeof option == 'string') data[option]();
284
+ });
285
+ };
286
+
287
+ $.fn.datepicker.defaults = {
288
+ };
289
+ $.fn.datepicker.Constructor = Datepicker;
290
+
291
+ var DPGlobal = {
292
+ modes: [
293
+ {
294
+ clsName: 'days',
295
+ navFnc: 'Month',
296
+ navStep: 1
297
+ },
298
+ {
299
+ clsName: 'months',
300
+ navFnc: 'FullYear',
301
+ navStep: 1
302
+ },
303
+ {
304
+ clsName: 'years',
305
+ navFnc: 'FullYear',
306
+ navStep: 10
307
+ }],
308
+ dates:{
309
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
310
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
311
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
312
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
313
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
314
+ },
315
+ isLeapYear: function (year) {
316
+ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
317
+ },
318
+ getDaysInMonth: function (year, month) {
319
+ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
320
+ },
321
+ parseFormat: function(format){
322
+ var separator = format.match(/[.\/-].*?/),
323
+ parts = format.split(/\W+/);
324
+ if (!separator || !parts || parts.length == 0){
325
+ throw new Error("Invalid date format.");
326
+ }
327
+ return {separator: separator, parts: parts};
328
+ },
329
+ parseDate: function(date, format) {
330
+ var parts = date.split(format.separator),
331
+ date = new Date(1970, 1, 1, 0, 0, 0),
332
+ val;
333
+ if (parts.length == format.parts.length) {
334
+ for (var i=0, cnt = format.parts.length; i < cnt; i++) {
335
+ val = parseInt(parts[i], 10)||1;
336
+ switch(format.parts[i]) {
337
+ case 'dd':
338
+ case 'd':
339
+ date.setDate(val);
340
+ break;
341
+ case 'mm':
342
+ case 'm':
343
+ date.setMonth(val - 1);
344
+ break;
345
+ case 'yy':
346
+ date.setFullYear(2000 + val);
347
+ break;
348
+ case 'yyyy':
349
+ date.setFullYear(val);
350
+ break;
351
+ }
352
+ }
353
+ }
354
+ return date;
355
+ },
356
+ formatDate: function(date, format){
357
+ var val = {
358
+ d: date.getDate(),
359
+ m: date.getMonth() + 1,
360
+ yy: date.getFullYear().toString().substring(2),
361
+ yyyy: date.getFullYear()
362
+ };
363
+ val.dd = (val.d < 10 ? '0' : '') + val.d;
364
+ val.mm = (val.m < 10 ? '0' : '') + val.m;
365
+ var date = [];
366
+ for (var i=0, cnt = format.parts.length; i < cnt; i++) {
367
+ date.push(val[format.parts[i]]);
368
+ }
369
+ return date.join(format.separator);
370
+ },
371
+ headTemplate: '<thead>'+
372
+ '<tr>'+
373
+ '<th class="prev"><i class="icon-arrow-left"/></th>'+
374
+ '<th colspan="5" class="switch"></th>'+
375
+ '<th class="next"><i class="icon-arrow-right"/></th>'+
376
+ '</tr>'+
377
+ '</thead>',
378
+ contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
379
+ };
380
+ DPGlobal.template = '<div class="datepicker dropdown-menu">'+
381
+ '<div class="datepicker-days">'+
382
+ '<table class="table-condensed">'+
383
+ DPGlobal.headTemplate+
384
+ '<tbody></tbody>'+
385
+ '</table>'+
386
+ '</div>'+
387
+ '<div class="datepicker-months">'+
388
+ '<table class="table-condensed">'+
389
+ DPGlobal.headTemplate+
390
+ DPGlobal.contTemplate+
391
+ '</table>'+
392
+ '</div>'+
393
+ '<div class="datepicker-years">'+
394
+ '<table class="table-condensed">'+
395
+ DPGlobal.headTemplate+
396
+ DPGlobal.contTemplate+
397
+ '</table>'+
398
+ '</div>'+
399
+ '</div>';
400
+
401
+ }( window.jQuery )
@@ -0,0 +1,150 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v2.1.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4
+ * ============================================================
5
+ * Copyright 2012 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* DROPDOWN CLASS DEFINITION
27
+ * ========================= */
28
+
29
+ var toggle = '[data-toggle=dropdown]'
30
+ , Dropdown = function (element) {
31
+ var $el = $(element).on('click.dropdown.data-api', this.toggle)
32
+ $('html').on('click.dropdown.data-api', function () {
33
+ $el.parent().removeClass('open')
34
+ })
35
+ }
36
+
37
+ Dropdown.prototype = {
38
+
39
+ constructor: Dropdown
40
+
41
+ , toggle: function (e) {
42
+ var $this = $(this)
43
+ , $parent
44
+ , isActive
45
+
46
+ if ($this.is('.disabled, :disabled')) return
47
+
48
+ $parent = getParent($this)
49
+
50
+ isActive = $parent.hasClass('open')
51
+
52
+ clearMenus()
53
+
54
+ if (!isActive) {
55
+ $parent.toggleClass('open')
56
+ $this.focus()
57
+ }
58
+
59
+ return false
60
+ }
61
+
62
+ , keydown: function (e) {
63
+ var $this
64
+ , $items
65
+ , $active
66
+ , $parent
67
+ , isActive
68
+ , index
69
+
70
+ if (!/(38|40|27)/.test(e.keyCode)) return
71
+
72
+ $this = $(this)
73
+
74
+ e.preventDefault()
75
+ e.stopPropagation()
76
+
77
+ if ($this.is('.disabled, :disabled')) return
78
+
79
+ $parent = getParent($this)
80
+
81
+ isActive = $parent.hasClass('open')
82
+
83
+ if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
84
+
85
+ $items = $('[role=menu] li:not(.divider) a', $parent)
86
+
87
+ if (!$items.length) return
88
+
89
+ index = $items.index($items.filter(':focus'))
90
+
91
+ if (e.keyCode == 38 && index > 0) index-- // up
92
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
93
+ if (!~index) index = 0
94
+
95
+ $items
96
+ .eq(index)
97
+ .focus()
98
+ }
99
+
100
+ }
101
+
102
+ function clearMenus() {
103
+ getParent($(toggle))
104
+ .removeClass('open')
105
+ }
106
+
107
+ function getParent($this) {
108
+ var selector = $this.attr('data-target')
109
+ , $parent
110
+
111
+ if (!selector) {
112
+ selector = $this.attr('href')
113
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
114
+ }
115
+
116
+ $parent = $(selector)
117
+ $parent.length || ($parent = $this.parent())
118
+
119
+ return $parent
120
+ }
121
+
122
+
123
+ /* DROPDOWN PLUGIN DEFINITION
124
+ * ========================== */
125
+
126
+ $.fn.dropdown = function (option) {
127
+ return this.each(function () {
128
+ var $this = $(this)
129
+ , data = $this.data('dropdown')
130
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
131
+ if (typeof option == 'string') data[option].call($this)
132
+ })
133
+ }
134
+
135
+ $.fn.dropdown.Constructor = Dropdown
136
+
137
+
138
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
139
+ * =================================== */
140
+
141
+ $(function () {
142
+ $('html')
143
+ .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
144
+ $('body')
145
+ .on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
146
+ .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
147
+ .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
148
+ })
149
+
150
+ }(window.jQuery);