kms 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (409) hide show
  1. checksums.yaml +4 -4
  2. data/{vendor/assets/bower_components/Responsive-Dashboard/src/img → app/assets/images}/avatar.jpg +0 -0
  3. data/app/assets/javascripts/kms/application.js +3 -0
  4. data/app/assets/javascripts/kms/application/controllers/assets_controller.coffee.erb +14 -7
  5. data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee.erb +11 -3
  6. data/app/assets/javascripts/kms/application/controllers/snippets_controller.coffee.erb +3 -0
  7. data/app/assets/javascripts/kms/application/controllers/templates_controller.coffee.erb +3 -0
  8. data/app/assets/javascripts/kms/application/controllers/users_controller.coffee +4 -4
  9. data/app/assets/javascripts/kms/application/routes.coffee.erb +1 -1
  10. data/app/assets/javascripts/kms/application/services/transliteration_service.js +160 -0
  11. data/app/assets/javascripts/templates/assets/edit.html.slim +24 -2
  12. data/app/assets/javascripts/templates/assets/form.html.slim +23 -0
  13. data/app/assets/javascripts/templates/assets/index.html.slim +13 -12
  14. data/app/assets/javascripts/templates/assets/new.html.slim +1 -15
  15. data/app/assets/javascripts/templates/help.html.slim +1 -1
  16. data/app/assets/javascripts/templates/pages/index.html.slim +16 -5
  17. data/app/assets/javascripts/templates/snippets/index.html.slim +16 -5
  18. data/app/assets/javascripts/templates/templates/index.html.slim +16 -6
  19. data/app/assets/stylesheets/kms/application.css +2 -2
  20. data/app/assets/stylesheets/kms/custom.css.scss +38 -0
  21. data/app/controllers/kms/assets_controller.rb +8 -9
  22. data/app/controllers/kms/pages_controller.rb +10 -11
  23. data/app/controllers/kms/public/pages_controller.rb +5 -4
  24. data/app/controllers/kms/public/search_controller.rb +2 -0
  25. data/app/controllers/kms/settings_controller.rb +1 -1
  26. data/app/controllers/kms/snippets_controller.rb +2 -1
  27. data/app/controllers/kms/templates_controller.rb +6 -5
  28. data/app/controllers/kms/users_controller.rb +11 -8
  29. data/app/models/ability.rb +1 -0
  30. data/app/models/concerns/kms/permalinkable.rb +1 -1
  31. data/app/models/kms/page.rb +13 -4
  32. data/app/serializers/kms/asset_serializer.rb +6 -0
  33. data/app/serializers/kms/page_serializer.rb +5 -0
  34. data/app/serializers/kms/template_serializer.rb +5 -0
  35. data/app/serializers/kms/user_serializer.rb +5 -0
  36. data/app/services/kms/page_fetcher.rb +30 -0
  37. data/app/services/kms/search_service.rb +28 -3
  38. data/app/services/kms/template_processor.rb +19 -0
  39. data/app/views/devise/passwords/edit.html.erb +1 -1
  40. data/app/views/devise/passwords/new.html.erb +1 -1
  41. data/app/views/devise/registrations/new.html.erb +1 -1
  42. data/app/views/devise/sessions/new.html.erb +1 -1
  43. data/app/views/layouts/kms/devise.html.erb +1 -1
  44. data/app/views/layouts/kms/kms.html.erb +47 -18
  45. data/config/initializers/externals.rb +6 -32
  46. data/config/initializers/search.rb +1 -0
  47. data/config/locales/en.yml +17 -1
  48. data/config/locales/ru.yml +17 -1
  49. data/config/routes.rb +7 -6
  50. data/lib/kms/dependencies.rb +1 -4
  51. data/lib/kms/engine.rb +1 -2
  52. data/lib/kms/search_item.rb +18 -0
  53. data/lib/kms/version.rb +1 -1
  54. data/spec/controllers/kms/assets_controller_spec.rb +51 -0
  55. data/spec/controllers/kms/pages_controller_spec.rb +82 -0
  56. data/spec/controllers/kms/public/pages_controller_spec.rb +30 -0
  57. data/spec/controllers/kms/snippets_controller_spec.rb +61 -47
  58. data/spec/controllers/kms/templates_controller_spec.rb +51 -0
  59. data/spec/controllers/kms/users_controller_spec.rb +56 -0
  60. data/spec/factories/assets.rb +8 -0
  61. data/spec/factories/pages.rb +33 -0
  62. data/spec/factories/templates.rb +20 -0
  63. data/spec/factories/users.rb +9 -4
  64. data/spec/internal/config/routes.rb +12 -1
  65. data/spec/internal/log/test.log +81239 -0
  66. data/spec/internal/public/404.html +67 -0
  67. data/spec/internal/public/avatar.jpg +0 -0
  68. data/spec/internal/public/style.css +1 -0
  69. data/spec/internal/public/uploads/kms/asset/file/1/avatar.jpg +0 -0
  70. data/spec/internal/public/uploads/kms/asset/file/2/avatar.jpg +0 -0
  71. data/spec/internal/public/uploads/kms/asset/file/2/style.css +1 -0
  72. data/spec/internal/public/uploads/kms/asset/file/3/style.css +1 -0
  73. data/spec/internal/public/uploads/kms/asset/file/4/style.css +1 -0
  74. data/spec/internal/public/uploads/tmp/1500976987-41025-0002-0883/style.css +1 -0
  75. data/spec/internal/public/uploads/tmp/1500977082-41195-0002-6495/style.css +1 -0
  76. data/spec/internal/public/uploads/tmp/1500977109-41364-0002-4518/style.css +1 -0
  77. data/spec/internal/public/uploads/tmp/1500977152-41405-0002-2345/style.css +1 -0
  78. data/spec/internal/public/uploads/tmp/1500977327-41694-0002-5448/style.css +1 -0
  79. data/spec/internal/public/uploads/tmp/1500977376-41732-0002-7916/style.css +1 -0
  80. data/spec/internal/public/uploads/tmp/1500977392-41759-0002-7593/style.css +1 -0
  81. data/spec/internal/public/uploads/tmp/1500977410-42259-0002-7527/style.css +1 -0
  82. data/spec/internal/public/uploads/tmp/1500977429-42306-0002-5937/style.css +1 -0
  83. data/spec/internal/public/uploads/tmp/1500977437-42324-0002-5880/style.css +1 -0
  84. data/spec/internal/public/uploads/tmp/1500983228-53594-0002-4559/style.css +1 -0
  85. data/spec/internal/public/uploads/tmp/1500983284-53632-0002-6590/style.css +1 -0
  86. data/spec/internal/public/uploads/tmp/1500983360-53784-0002-7289/style.css +1 -0
  87. data/spec/internal/public/uploads/tmp/1500983469-54321-0002-0386/avatar.jpg +0 -0
  88. data/spec/internal/public/uploads/tmp/1500983469-54321-0004-5691/style.css +1 -0
  89. data/spec/internal/public/uploads/tmp/1500983511-54352-0002-5720/avatar.jpg +0 -0
  90. data/spec/internal/public/uploads/tmp/1500983511-54352-0004-1399/style.css +1 -0
  91. data/spec/internal/public/uploads/tmp/1500983610-54507-0002-4280/avatar.jpg +0 -0
  92. data/spec/internal/public/uploads/tmp/1500983610-54507-0004-9758/style.css +1 -0
  93. data/spec/internal/public/uploads/tmp/1500984466-57012-0002-4146/avatar.jpg +0 -0
  94. data/spec/internal/public/uploads/tmp/1500984466-57012-0004-5895/style.css +1 -0
  95. data/spec/internal/public/uploads/tmp/1500984509-57158-0002-9657/avatar.jpg +0 -0
  96. data/spec/internal/public/uploads/tmp/1500984509-57158-0004-5003/style.css +1 -0
  97. data/spec/internal/public/uploads/tmp/1500984616-57697-0002-7201/avatar.jpg +0 -0
  98. data/spec/internal/public/uploads/tmp/1500984616-57697-0004-6255/style.css +1 -0
  99. data/spec/internal/public/uploads/tmp/1500985257-58947-0002-3629/avatar.jpg +0 -0
  100. data/spec/internal/public/uploads/tmp/1500985257-58947-0004-5338/style.css +1 -0
  101. data/spec/internal/public/uploads/tmp/1500985407-58947-0006-5929/style.css +1 -0
  102. data/spec/internal/public/uploads/tmp/1500985473-59264-0002-0397/avatar.jpg +0 -0
  103. data/spec/internal/public/uploads/tmp/1500985473-59264-0004-6493/style.css +1 -0
  104. data/spec/internal/public/uploads/tmp/1500985475-59264-0007-8674/style.css +1 -0
  105. data/spec/internal/public/uploads/tmp/1500985538-59468-0002-9206/avatar.jpg +0 -0
  106. data/spec/internal/public/uploads/tmp/1500985538-59468-0004-2586/style.css +1 -0
  107. data/spec/internal/public/uploads/tmp/1500985538-59468-0007-6200/style.css +1 -0
  108. data/spec/internal/public/uploads/tmp/1500988358-65877-0002-4528/avatar.jpg +0 -0
  109. data/spec/internal/public/uploads/tmp/1500988358-65877-0004-5904/style.css +1 -0
  110. data/spec/internal/public/uploads/tmp/1500988358-65877-0007-7320/style.css +1 -0
  111. data/spec/internal/public/uploads/tmp/1500988407-65916-0002-3138/avatar.jpg +0 -0
  112. data/spec/internal/public/uploads/tmp/1500988407-65916-0004-5400/style.css +1 -0
  113. data/spec/internal/public/uploads/tmp/1500988407-65916-0007-1655/style.css +1 -0
  114. data/spec/internal/public/uploads/tmp/1500988421-65950-0002-9415/avatar.jpg +0 -0
  115. data/spec/internal/public/uploads/tmp/1500988421-65950-0004-7130/style.css +1 -0
  116. data/spec/internal/public/uploads/tmp/1500988421-65950-0007-9886/style.css +1 -0
  117. data/spec/internal/public/uploads/tmp/1500988435-65981-0002-3228/avatar.jpg +0 -0
  118. data/spec/internal/public/uploads/tmp/1500988435-65981-0004-3682/style.css +1 -0
  119. data/spec/internal/public/uploads/tmp/1500988435-65981-0007-1582/style.css +1 -0
  120. data/spec/internal/public/uploads/tmp/1500988475-66122-0002-9516/avatar.jpg +0 -0
  121. data/spec/internal/public/uploads/tmp/1500988475-66122-0004-5634/style.css +1 -0
  122. data/spec/internal/public/uploads/tmp/1500988530-66122-0007-2272/style.css +1 -0
  123. data/spec/internal/public/uploads/tmp/1500988554-66315-0002-6262/avatar.jpg +0 -0
  124. data/spec/internal/public/uploads/tmp/1500988554-66315-0004-6099/style.css +1 -0
  125. data/spec/internal/public/uploads/tmp/1500988554-66315-0007-1632/style.css +1 -0
  126. data/spec/internal/public/uploads/tmp/1500991751-73722-0002-9937/avatar.jpg +0 -0
  127. data/spec/internal/public/uploads/tmp/1500991751-73722-0004-8034/style.css +1 -0
  128. data/spec/internal/public/uploads/tmp/1500991751-73722-0007-7763/style.css +1 -0
  129. data/spec/internal/public/uploads/tmp/1501233238-34385-0002-3210/avatar.jpg +0 -0
  130. data/spec/internal/public/uploads/tmp/1501233238-34385-0004-5881/style.css +1 -0
  131. data/spec/internal/public/uploads/tmp/1501233238-34385-0007-6280/style.css +1 -0
  132. data/spec/models/kms/page_spec.rb +31 -0
  133. data/spec/models/kms/template_spec.rb +15 -0
  134. data/spec/services/kms/page_fetcher_spec.rb +36 -0
  135. data/spec/services/kms/search_service_spec.rb +53 -0
  136. data/spec/services/kms/template_processor_spec.rb +20 -0
  137. data/spec/support/controller_macros.rb +9 -1
  138. data/vendor/assets/bower.json +3 -2
  139. data/vendor/assets/bower_components/angular-ui-select/CHANGELOG.md +169 -0
  140. data/vendor/assets/bower_components/angular-ui-select/CONTRIBUTING.md +161 -0
  141. data/vendor/assets/bower_components/angular-ui-select/README.md +27 -13
  142. data/vendor/assets/bower_components/angular-ui-select/bower.json +6 -3
  143. data/vendor/assets/bower_components/angular-ui-select/composer.json +29 -0
  144. data/vendor/assets/bower_components/angular-ui-select/deploy-docs.sh +31 -0
  145. data/vendor/assets/bower_components/angular-ui-select/dist/select.css +48 -2
  146. data/vendor/assets/bower_components/angular-ui-select/dist/select.js +454 -111
  147. data/vendor/assets/bower_components/angular-ui-select/dist/select.min.css +2 -2
  148. data/vendor/assets/bower_components/angular-ui-select/dist/select.min.js +2 -2
  149. data/vendor/assets/bower_components/angular-ui-select/docs/assets/app.js +1 -0
  150. data/vendor/assets/bower_components/angular-ui-select/docs/assets/demo.js +461 -0
  151. data/vendor/assets/bower_components/angular-ui-select/docs/assets/docs.css +339 -0
  152. data/vendor/assets/bower_components/angular-ui-select/docs/assets/plunkr.js +110 -0
  153. data/vendor/assets/bower_components/angular-ui-select/docs/index.html +191 -0
  154. data/vendor/assets/bower_components/angular-ui-select/docs/partials/_footer.html +2 -0
  155. data/vendor/assets/bower_components/angular-ui-select/docs/partials/_header.html +64 -0
  156. data/vendor/assets/bower_components/angular-ui-select/index.js +2 -0
  157. data/vendor/assets/bower_components/angular-ui-select/package.json +36 -15
  158. data/vendor/assets/bower_components/bootstrap/CHANGELOG.md +5 -0
  159. data/vendor/assets/bower_components/bootstrap/Gemfile +6 -0
  160. data/vendor/assets/bower_components/bootstrap/Gemfile.lock +43 -0
  161. data/vendor/assets/bower_components/bootstrap/Gruntfile.js +176 -145
  162. data/vendor/assets/bower_components/bootstrap/ISSUE_TEMPLATE.md +22 -0
  163. data/vendor/assets/bower_components/bootstrap/LICENSE +1 -1
  164. data/vendor/assets/bower_components/bootstrap/README.md +55 -40
  165. data/vendor/assets/bower_components/bootstrap/bower.json +5 -9
  166. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.css +204 -59
  167. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.css.map +1 -1
  168. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +4 -3
  169. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.min.css.map +1 -0
  170. data/vendor/assets/bower_components/bootstrap/dist/css/{bootstrap.less → bootstrap.css} +881 -327
  171. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css.map +1 -1
  172. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.min.css +6 -0
  173. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.min.css.map +1 -0
  174. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  175. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +272 -213
  176. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  177. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  178. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
  179. data/vendor/assets/bower_components/bootstrap/dist/js/bootstrap.js +549 -286
  180. data/vendor/assets/bower_components/bootstrap/dist/js/bootstrap.min.js +5 -4
  181. data/vendor/assets/bower_components/bootstrap/dist/js/npm.js +13 -0
  182. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  183. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg +272 -213
  184. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  185. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  186. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  187. data/vendor/assets/bower_components/bootstrap/grunt/bs-commonjs-generator.js +30 -0
  188. data/vendor/assets/bower_components/bootstrap/grunt/bs-glyphicons-data-generator.js +5 -4
  189. data/vendor/assets/bower_components/bootstrap/grunt/bs-lessdoc-parser.js +13 -12
  190. data/vendor/assets/bower_components/bootstrap/grunt/bs-raw-files-generator.js +6 -8
  191. data/vendor/assets/bower_components/bootstrap/grunt/change-version.js +109 -0
  192. data/vendor/assets/bower_components/bootstrap/grunt/configBridge.json +46 -0
  193. data/vendor/assets/bower_components/bootstrap/grunt/npm-shrinkwrap.json +2679 -0
  194. data/vendor/assets/bower_components/bootstrap/grunt/sauce_browsers.yml +5 -5
  195. data/vendor/assets/bower_components/bootstrap/js/affix.js +46 -26
  196. data/vendor/assets/bower_components/bootstrap/js/alert.js +8 -6
  197. data/vendor/assets/bower_components/bootstrap/js/button.js +34 -19
  198. data/vendor/assets/bower_components/bootstrap/js/carousel.js +35 -21
  199. data/vendor/assets/bower_components/bootstrap/js/collapse.js +69 -27
  200. data/vendor/assets/bower_components/bootstrap/js/dropdown.js +55 -41
  201. data/vendor/assets/bower_components/bootstrap/js/modal.js +91 -32
  202. data/vendor/assets/bower_components/bootstrap/js/popover.js +5 -10
  203. data/vendor/assets/bower_components/bootstrap/js/scrollspy.js +28 -26
  204. data/vendor/assets/bower_components/bootstrap/js/tab.js +45 -18
  205. data/vendor/assets/bower_components/bootstrap/js/tooltip.js +117 -54
  206. data/vendor/assets/bower_components/bootstrap/js/transition.js +2 -2
  207. data/vendor/assets/bower_components/bootstrap/less/alerts.less +5 -0
  208. data/vendor/assets/bower_components/bootstrap/less/badges.less +14 -3
  209. data/vendor/assets/bower_components/bootstrap/less/bootstrap.less +6 -0
  210. data/vendor/assets/bower_components/bootstrap/less/button-groups.less +22 -18
  211. data/vendor/assets/bower_components/bootstrap/less/buttons.less +19 -10
  212. data/vendor/assets/bower_components/bootstrap/less/carousel.less +34 -7
  213. data/vendor/assets/bower_components/bootstrap/less/close.less +1 -0
  214. data/vendor/assets/bower_components/bootstrap/less/code.less +1 -0
  215. data/vendor/assets/bower_components/bootstrap/less/component-animations.less +3 -1
  216. data/vendor/assets/bower_components/bootstrap/less/dropdowns.less +9 -8
  217. data/vendor/assets/bower_components/bootstrap/less/forms.less +123 -50
  218. data/vendor/assets/bower_components/bootstrap/less/glyphicons.less +75 -3
  219. data/vendor/assets/bower_components/bootstrap/less/input-groups.less +8 -3
  220. data/vendor/assets/bower_components/bootstrap/less/jumbotron.less +10 -4
  221. data/vendor/assets/bower_components/bootstrap/less/list-group.less +10 -11
  222. data/vendor/assets/bower_components/bootstrap/less/media.less +40 -30
  223. data/vendor/assets/bower_components/bootstrap/less/mixins.less +1 -0
  224. data/vendor/assets/bower_components/bootstrap/less/mixins/background-variant.less +2 -1
  225. data/vendor/assets/bower_components/bootstrap/less/mixins/buttons.less +19 -4
  226. data/vendor/assets/bower_components/bootstrap/less/mixins/forms.less +5 -1
  227. data/vendor/assets/bower_components/bootstrap/less/mixins/grid-framework.less +4 -4
  228. data/vendor/assets/bower_components/bootstrap/less/mixins/grid.less +4 -4
  229. data/vendor/assets/bower_components/bootstrap/less/mixins/hide-text.less +2 -2
  230. data/vendor/assets/bower_components/bootstrap/less/mixins/image.less +0 -1
  231. data/vendor/assets/bower_components/bootstrap/less/mixins/labels.less +1 -1
  232. data/vendor/assets/bower_components/bootstrap/less/mixins/list-group.less +2 -1
  233. data/vendor/assets/bower_components/bootstrap/less/mixins/pagination.less +2 -1
  234. data/vendor/assets/bower_components/bootstrap/less/mixins/reset-text.less +18 -0
  235. data/vendor/assets/bower_components/bootstrap/less/mixins/responsive-visibility.less +1 -1
  236. data/vendor/assets/bower_components/bootstrap/less/mixins/tab-focus.less +3 -3
  237. data/vendor/assets/bower_components/bootstrap/less/mixins/text-emphasis.less +2 -1
  238. data/vendor/assets/bower_components/bootstrap/less/mixins/vendor-prefixes.less +8 -5
  239. data/vendor/assets/bower_components/bootstrap/less/modals.less +3 -3
  240. data/vendor/assets/bower_components/bootstrap/less/navbar.less +30 -25
  241. data/vendor/assets/bower_components/bootstrap/less/navs.less +1 -1
  242. data/vendor/assets/bower_components/bootstrap/less/normalize.less +12 -13
  243. data/vendor/assets/bower_components/bootstrap/less/pager.less +1 -2
  244. data/vendor/assets/bower_components/bootstrap/less/pagination.less +5 -4
  245. data/vendor/assets/bower_components/bootstrap/less/panels.less +33 -5
  246. data/vendor/assets/bower_components/bootstrap/less/popovers.less +5 -7
  247. data/vendor/assets/bower_components/bootstrap/less/print.less +96 -96
  248. data/vendor/assets/bower_components/bootstrap/less/progress-bars.less +1 -19
  249. data/vendor/assets/bower_components/bootstrap/less/responsive-embed.less +10 -9
  250. data/vendor/assets/bower_components/bootstrap/less/scaffolding.less +13 -2
  251. data/vendor/assets/bower_components/bootstrap/less/tables.less +14 -13
  252. data/vendor/assets/bower_components/bootstrap/less/theme.less +49 -16
  253. data/vendor/assets/bower_components/bootstrap/less/thumbnails.less +1 -1
  254. data/vendor/assets/bower_components/bootstrap/less/tooltip.less +13 -7
  255. data/vendor/assets/bower_components/bootstrap/less/type.less +2 -13
  256. data/vendor/assets/bower_components/bootstrap/less/utilities.less +0 -2
  257. data/vendor/assets/bower_components/bootstrap/less/variables.less +45 -22
  258. data/vendor/assets/bower_components/bootstrap/nuget/MyGet.ps1 +8 -0
  259. data/vendor/assets/bower_components/bootstrap/nuget/bootstrap.less.nuspec +28 -0
  260. data/vendor/assets/bower_components/bootstrap/nuget/bootstrap.nuspec +28 -0
  261. data/vendor/assets/bower_components/bootstrap/package.js +32 -0
  262. data/vendor/assets/bower_components/bootstrap/package.json +49 -41
  263. data/vendor/assets/bower_components/flow.js/README.md +79 -64
  264. data/vendor/assets/bower_components/flow.js/bower.json +6 -2
  265. data/vendor/assets/bower_components/flow.js/dist/flow.js +1635 -1532
  266. data/vendor/assets/bower_components/flow.js/dist/flow.min.js +2 -2
  267. data/vendor/assets/bower_components/flow.js/package.js +24 -0
  268. data/vendor/assets/bower_components/flow.js/travis.sh +19 -0
  269. data/vendor/assets/bower_components/font-awesome/scss/_path.scss +5 -5
  270. data/vendor/assets/bower_components/font-awesome/scss/_variables.scss +1 -2
  271. data/vendor/assets/bower_components/ng-flow/bower.json +1 -1
  272. data/vendor/assets/bower_components/ng-flow/dist/ng-flow-standalone.js +1655 -1542
  273. data/vendor/assets/bower_components/ng-flow/dist/ng-flow-standalone.min.js +2 -2
  274. data/vendor/assets/bower_components/ng-flow/dist/ng-flow.js +19 -9
  275. data/vendor/assets/bower_components/ng-flow/dist/ng-flow.min.js +2 -2
  276. data/vendor/assets/bower_components/ng-flow/index.js +3 -0
  277. data/vendor/assets/bower_components/ng-flow/package.js +25 -0
  278. data/vendor/assets/bower_components/ng-flow/src/directives/drag-events.js +2 -1
  279. data/vendor/assets/bower_components/ng-flow/src/directives/events.js +2 -1
  280. data/vendor/assets/bower_components/ng-flow/src/directives/init.js +7 -1
  281. data/vendor/assets/bower_components/ng-flow/travis.sh +19 -0
  282. data/vendor/assets/bower_components/{Responsive-Dashboard → rdash-ui}/LICENSE +21 -21
  283. data/vendor/assets/bower_components/rdash-ui/README.md +55 -0
  284. data/vendor/assets/bower_components/rdash-ui/bower.json +33 -0
  285. data/vendor/assets/bower_components/rdash-ui/dist/css/rdash.min.css +1 -0
  286. data/vendor/assets/bower_components/rdash-ui/dist/css/rdash.scss +489 -0
  287. data/vendor/assets/bower_components/{Responsive-Dashboard/src → rdash-ui/dist}/fonts/montserrat-regular-webfont.eot +0 -0
  288. data/vendor/assets/bower_components/{Responsive-Dashboard/src → rdash-ui/dist}/fonts/montserrat-regular-webfont.svg +1316 -1316
  289. data/vendor/assets/bower_components/{Responsive-Dashboard/src → rdash-ui/dist}/fonts/montserrat-regular-webfont.ttf +0 -0
  290. data/vendor/assets/bower_components/{Responsive-Dashboard/src → rdash-ui/dist}/fonts/montserrat-regular-webfont.woff +0 -0
  291. metadata +227 -180
  292. data/config/initializers/bower_rails.rb +0 -16
  293. data/vendor/assets/bower_components/Responsive-Dashboard/CONTRIBUTING.md +0 -21
  294. data/vendor/assets/bower_components/Responsive-Dashboard/README.md +0 -119
  295. data/vendor/assets/bower_components/Responsive-Dashboard/bower.json +0 -32
  296. data/vendor/assets/bower_components/Responsive-Dashboard/gulpfile.js +0 -81
  297. data/vendor/assets/bower_components/Responsive-Dashboard/package.json +0 -21
  298. data/vendor/assets/bower_components/Responsive-Dashboard/src/index.html +0 -413
  299. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/controllers/alerts-ctrl.js +0 -19
  300. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/controllers/master-ctrl.js +0 -51
  301. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/directives/loading.js +0 -13
  302. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/directives/widget-body.js +0 -16
  303. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/directives/widget-header.js +0 -17
  304. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/directives/widget.js +0 -16
  305. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/module.js +0 -1
  306. data/vendor/assets/bower_components/Responsive-Dashboard/src/js/dashboard/routes.js +0 -22
  307. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/content.less +0 -19
  308. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/hamburg.less +0 -29
  309. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/header.less +0 -92
  310. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/loading.less +0 -40
  311. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/main.less +0 -73
  312. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/mixins.less +0 -5
  313. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/sidebar.less +0 -122
  314. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/variables.less +0 -10
  315. data/vendor/assets/bower_components/Responsive-Dashboard/src/less/dashboard/widgets.less +0 -95
  316. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.min.css.erb +0 -5
  317. data/vendor/assets/bower_components/flow.js/CHANGELOG.md +0 -37
  318. data/vendor/assets/bower_components/flow.js/Gruntfile.js +0 -132
  319. data/vendor/assets/bower_components/flow.js/karma.conf.js +0 -114
  320. data/vendor/assets/bower_components/flow.js/package.json +0 -50
  321. data/vendor/assets/bower_components/flow.js/src/flow.js +0 -1532
  322. data/vendor/assets/bower_components/jquery/MIT-LICENSE.txt +0 -21
  323. data/vendor/assets/bower_components/jquery/bower.json +0 -27
  324. data/vendor/assets/bower_components/jquery/dist/jquery.js +0 -9190
  325. data/vendor/assets/bower_components/jquery/dist/jquery.min.js +0 -5
  326. data/vendor/assets/bower_components/jquery/dist/jquery.min.map +0 -1
  327. data/vendor/assets/bower_components/jquery/src/ajax.js +0 -806
  328. data/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +0 -89
  329. data/vendor/assets/bower_components/jquery/src/ajax/load.js +0 -75
  330. data/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +0 -13
  331. data/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +0 -28
  332. data/vendor/assets/bower_components/jquery/src/ajax/script.js +0 -64
  333. data/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +0 -5
  334. data/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +0 -3
  335. data/vendor/assets/bower_components/jquery/src/ajax/xhr.js +0 -135
  336. data/vendor/assets/bower_components/jquery/src/attributes.js +0 -11
  337. data/vendor/assets/bower_components/jquery/src/attributes/attr.js +0 -143
  338. data/vendor/assets/bower_components/jquery/src/attributes/classes.js +0 -158
  339. data/vendor/assets/bower_components/jquery/src/attributes/prop.js +0 -96
  340. data/vendor/assets/bower_components/jquery/src/attributes/support.js +0 -35
  341. data/vendor/assets/bower_components/jquery/src/attributes/val.js +0 -163
  342. data/vendor/assets/bower_components/jquery/src/callbacks.js +0 -205
  343. data/vendor/assets/bower_components/jquery/src/core.js +0 -498
  344. data/vendor/assets/bower_components/jquery/src/core/access.js +0 -60
  345. data/vendor/assets/bower_components/jquery/src/core/init.js +0 -123
  346. data/vendor/assets/bower_components/jquery/src/core/parseHTML.js +0 -39
  347. data/vendor/assets/bower_components/jquery/src/core/ready.js +0 -97
  348. data/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +0 -4
  349. data/vendor/assets/bower_components/jquery/src/css.js +0 -451
  350. data/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +0 -24
  351. data/vendor/assets/bower_components/jquery/src/css/curCSS.js +0 -57
  352. data/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +0 -70
  353. data/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +0 -15
  354. data/vendor/assets/bower_components/jquery/src/css/support.js +0 -91
  355. data/vendor/assets/bower_components/jquery/src/css/swap.js +0 -28
  356. data/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +0 -3
  357. data/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +0 -5
  358. data/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +0 -13
  359. data/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +0 -3
  360. data/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +0 -5
  361. data/vendor/assets/bower_components/jquery/src/data.js +0 -179
  362. data/vendor/assets/bower_components/jquery/src/data/Data.js +0 -181
  363. data/vendor/assets/bower_components/jquery/src/data/accepts.js +0 -20
  364. data/vendor/assets/bower_components/jquery/src/data/var/data_priv.js +0 -5
  365. data/vendor/assets/bower_components/jquery/src/data/var/data_user.js +0 -5
  366. data/vendor/assets/bower_components/jquery/src/deferred.js +0 -149
  367. data/vendor/assets/bower_components/jquery/src/deprecated.js +0 -13
  368. data/vendor/assets/bower_components/jquery/src/dimensions.js +0 -50
  369. data/vendor/assets/bower_components/jquery/src/effects.js +0 -649
  370. data/vendor/assets/bower_components/jquery/src/effects/Tween.js +0 -114
  371. data/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +0 -13
  372. data/vendor/assets/bower_components/jquery/src/event.js +0 -868
  373. data/vendor/assets/bower_components/jquery/src/event/alias.js +0 -39
  374. data/vendor/assets/bower_components/jquery/src/event/support.js +0 -9
  375. data/vendor/assets/bower_components/jquery/src/exports/amd.js +0 -24
  376. data/vendor/assets/bower_components/jquery/src/exports/global.js +0 -32
  377. data/vendor/assets/bower_components/jquery/src/intro.js +0 -44
  378. data/vendor/assets/bower_components/jquery/src/jquery.js +0 -36
  379. data/vendor/assets/bower_components/jquery/src/manipulation.js +0 -582
  380. data/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +0 -18
  381. data/vendor/assets/bower_components/jquery/src/manipulation/support.js +0 -31
  382. data/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +0 -3
  383. data/vendor/assets/bower_components/jquery/src/offset.js +0 -204
  384. data/vendor/assets/bower_components/jquery/src/outro.js +0 -1
  385. data/vendor/assets/bower_components/jquery/src/queue.js +0 -142
  386. data/vendor/assets/bower_components/jquery/src/queue/delay.js +0 -22
  387. data/vendor/assets/bower_components/jquery/src/selector-native.js +0 -172
  388. data/vendor/assets/bower_components/jquery/src/selector-sizzle.js +0 -14
  389. data/vendor/assets/bower_components/jquery/src/selector.js +0 -1
  390. data/vendor/assets/bower_components/jquery/src/serialize.js +0 -111
  391. data/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.js +0 -2044
  392. data/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
  393. data/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
  394. data/vendor/assets/bower_components/jquery/src/traversing.js +0 -200
  395. data/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +0 -100
  396. data/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +0 -6
  397. data/vendor/assets/bower_components/jquery/src/var/arr.js +0 -3
  398. data/vendor/assets/bower_components/jquery/src/var/class2type.js +0 -4
  399. data/vendor/assets/bower_components/jquery/src/var/concat.js +0 -5
  400. data/vendor/assets/bower_components/jquery/src/var/hasOwn.js +0 -5
  401. data/vendor/assets/bower_components/jquery/src/var/indexOf.js +0 -5
  402. data/vendor/assets/bower_components/jquery/src/var/pnum.js +0 -3
  403. data/vendor/assets/bower_components/jquery/src/var/push.js +0 -5
  404. data/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +0 -3
  405. data/vendor/assets/bower_components/jquery/src/var/slice.js +0 -5
  406. data/vendor/assets/bower_components/jquery/src/var/strundefined.js +0 -3
  407. data/vendor/assets/bower_components/jquery/src/var/support.js +0 -4
  408. data/vendor/assets/bower_components/jquery/src/var/toString.js +0 -5
  409. data/vendor/assets/bower_components/jquery/src/wrap.js +0 -78
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: scrollspy.js v3.2.0
2
+ * Bootstrap: scrollspy.js v3.3.7
3
3
  * http://getbootstrap.com/javascript/#scrollspy
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
5
+ * Copyright 2011-2016 Twitter, Inc.
6
6
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
7
  * ======================================================================== */
8
8
 
@@ -14,10 +14,8 @@
14
14
  // ==========================
15
15
 
16
16
  function ScrollSpy(element, options) {
17
- var process = $.proxy(this.process, this)
18
-
19
- this.$body = $('body')
20
- this.$scrollElement = $(element).is('body') ? $(window) : $(element)
17
+ this.$body = $(document.body)
18
+ this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
21
19
  this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
22
20
  this.selector = (this.options.target || '') + ' .nav li > a'
23
21
  this.offsets = []
@@ -25,12 +23,12 @@
25
23
  this.activeTarget = null
26
24
  this.scrollHeight = 0
27
25
 
28
- this.$scrollElement.on('scroll.bs.scrollspy', process)
26
+ this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
29
27
  this.refresh()
30
28
  this.process()
31
29
  }
32
30
 
33
- ScrollSpy.VERSION = '3.2.0'
31
+ ScrollSpy.VERSION = '3.3.7'
34
32
 
35
33
  ScrollSpy.DEFAULTS = {
36
34
  offset: 10
@@ -41,20 +39,19 @@
41
39
  }
42
40
 
43
41
  ScrollSpy.prototype.refresh = function () {
44
- var offsetMethod = 'offset'
45
- var offsetBase = 0
42
+ var that = this
43
+ var offsetMethod = 'offset'
44
+ var offsetBase = 0
45
+
46
+ this.offsets = []
47
+ this.targets = []
48
+ this.scrollHeight = this.getScrollHeight()
46
49
 
47
50
  if (!$.isWindow(this.$scrollElement[0])) {
48
51
  offsetMethod = 'position'
49
52
  offsetBase = this.$scrollElement.scrollTop()
50
53
  }
51
54
 
52
- this.offsets = []
53
- this.targets = []
54
- this.scrollHeight = this.getScrollHeight()
55
-
56
- var self = this
57
-
58
55
  this.$body
59
56
  .find(this.selector)
60
57
  .map(function () {
@@ -69,8 +66,8 @@
69
66
  })
70
67
  .sort(function (a, b) { return a[0] - b[0] })
71
68
  .each(function () {
72
- self.offsets.push(this[0])
73
- self.targets.push(this[1])
69
+ that.offsets.push(this[0])
70
+ that.targets.push(this[1])
74
71
  })
75
72
  }
76
73
 
@@ -91,14 +88,15 @@
91
88
  return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
92
89
  }
93
90
 
94
- if (activeTarget && scrollTop <= offsets[0]) {
95
- return activeTarget != (i = targets[0]) && this.activate(i)
91
+ if (activeTarget && scrollTop < offsets[0]) {
92
+ this.activeTarget = null
93
+ return this.clear()
96
94
  }
97
95
 
98
96
  for (i = offsets.length; i--;) {
99
97
  activeTarget != targets[i]
100
98
  && scrollTop >= offsets[i]
101
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
99
+ && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
102
100
  && this.activate(targets[i])
103
101
  }
104
102
  }
@@ -106,13 +104,11 @@
106
104
  ScrollSpy.prototype.activate = function (target) {
107
105
  this.activeTarget = target
108
106
 
109
- $(this.selector)
110
- .parentsUntil(this.options.target, '.active')
111
- .removeClass('active')
107
+ this.clear()
112
108
 
113
109
  var selector = this.selector +
114
- '[data-target="' + target + '"],' +
115
- this.selector + '[href="' + target + '"]'
110
+ '[data-target="' + target + '"],' +
111
+ this.selector + '[href="' + target + '"]'
116
112
 
117
113
  var active = $(selector)
118
114
  .parents('li')
@@ -127,6 +123,12 @@
127
123
  active.trigger('activate.bs.scrollspy')
128
124
  }
129
125
 
126
+ ScrollSpy.prototype.clear = function () {
127
+ $(this.selector)
128
+ .parentsUntil(this.options.target, '.active')
129
+ .removeClass('active')
130
+ }
131
+
130
132
 
131
133
  // SCROLLSPY PLUGIN DEFINITION
132
134
  // ===========================
@@ -1,8 +1,8 @@
1
1
  /* ========================================================================
2
- * Bootstrap: tab.js v3.2.0
2
+ * Bootstrap: tab.js v3.3.7
3
3
  * http://getbootstrap.com/javascript/#tabs
4
4
  * ========================================================================
5
- * Copyright 2011-2014 Twitter, Inc.
5
+ * Copyright 2011-2016 Twitter, Inc.
6
6
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
7
  * ======================================================================== */
8
8
 
@@ -14,10 +14,14 @@
14
14
  // ====================
15
15
 
16
16
  var Tab = function (element) {
17
+ // jscs:disable requireDollarBeforejQueryAssignment
17
18
  this.element = $(element)
19
+ // jscs:enable requireDollarBeforejQueryAssignment
18
20
  }
19
21
 
20
- Tab.VERSION = '3.2.0'
22
+ Tab.VERSION = '3.3.7'
23
+
24
+ Tab.TRANSITION_DURATION = 150
21
25
 
22
26
  Tab.prototype.show = function () {
23
27
  var $this = this.element
@@ -31,22 +35,30 @@
31
35
 
32
36
  if ($this.parent('li').hasClass('active')) return
33
37
 
34
- var previous = $ul.find('.active:last a')[0]
35
- var e = $.Event('show.bs.tab', {
36
- relatedTarget: previous
38
+ var $previous = $ul.find('.active:last a')
39
+ var hideEvent = $.Event('hide.bs.tab', {
40
+ relatedTarget: $this[0]
41
+ })
42
+ var showEvent = $.Event('show.bs.tab', {
43
+ relatedTarget: $previous[0]
37
44
  })
38
45
 
39
- $this.trigger(e)
46
+ $previous.trigger(hideEvent)
47
+ $this.trigger(showEvent)
40
48
 
41
- if (e.isDefaultPrevented()) return
49
+ if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
42
50
 
43
51
  var $target = $(selector)
44
52
 
45
53
  this.activate($this.closest('li'), $ul)
46
54
  this.activate($target, $target.parent(), function () {
55
+ $previous.trigger({
56
+ type: 'hidden.bs.tab',
57
+ relatedTarget: $this[0]
58
+ })
47
59
  $this.trigger({
48
60
  type: 'shown.bs.tab',
49
- relatedTarget: previous
61
+ relatedTarget: $previous[0]
50
62
  })
51
63
  })
52
64
  }
@@ -55,15 +67,21 @@
55
67
  var $active = container.find('> .active')
56
68
  var transition = callback
57
69
  && $.support.transition
58
- && $active.hasClass('fade')
70
+ && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
59
71
 
60
72
  function next() {
61
73
  $active
62
74
  .removeClass('active')
63
75
  .find('> .dropdown-menu > .active')
64
- .removeClass('active')
76
+ .removeClass('active')
77
+ .end()
78
+ .find('[data-toggle="tab"]')
79
+ .attr('aria-expanded', false)
65
80
 
66
- element.addClass('active')
81
+ element
82
+ .addClass('active')
83
+ .find('[data-toggle="tab"]')
84
+ .attr('aria-expanded', true)
67
85
 
68
86
  if (transition) {
69
87
  element[0].offsetWidth // reflow for transition
@@ -72,17 +90,22 @@
72
90
  element.removeClass('fade')
73
91
  }
74
92
 
75
- if (element.parent('.dropdown-menu')) {
76
- element.closest('li.dropdown').addClass('active')
93
+ if (element.parent('.dropdown-menu').length) {
94
+ element
95
+ .closest('li.dropdown')
96
+ .addClass('active')
97
+ .end()
98
+ .find('[data-toggle="tab"]')
99
+ .attr('aria-expanded', true)
77
100
  }
78
101
 
79
102
  callback && callback()
80
103
  }
81
104
 
82
- transition ?
105
+ $active.length && transition ?
83
106
  $active
84
107
  .one('bsTransitionEnd', next)
85
- .emulateTransitionEnd(150) :
108
+ .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
86
109
  next()
87
110
 
88
111
  $active.removeClass('in')
@@ -120,9 +143,13 @@
120
143
  // TAB DATA-API
121
144
  // ============
122
145
 
123
- $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
146
+ var clickHandler = function (e) {
124
147
  e.preventDefault()
125
148
  Plugin.call($(this), 'show')
126
- })
149
+ }
150
+
151
+ $(document)
152
+ .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
153
+ .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
127
154
 
128
155
  }(jQuery);
@@ -1,9 +1,9 @@
1
1
  /* ========================================================================
2
- * Bootstrap: tooltip.js v3.2.0
2
+ * Bootstrap: tooltip.js v3.3.7
3
3
  * http://getbootstrap.com/javascript/#tooltip
4
4
  * Inspired by the original jQuery.tipsy by Jason Frame
5
5
  * ========================================================================
6
- * Copyright 2011-2014 Twitter, Inc.
6
+ * Copyright 2011-2016 Twitter, Inc.
7
7
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
8
8
  * ======================================================================== */
9
9
 
@@ -15,17 +15,20 @@
15
15
  // ===============================
16
16
 
17
17
  var Tooltip = function (element, options) {
18
- this.type =
19
- this.options =
20
- this.enabled =
21
- this.timeout =
22
- this.hoverState =
18
+ this.type = null
19
+ this.options = null
20
+ this.enabled = null
21
+ this.timeout = null
22
+ this.hoverState = null
23
23
  this.$element = null
24
+ this.inState = null
24
25
 
25
26
  this.init('tooltip', element, options)
26
27
  }
27
28
 
28
- Tooltip.VERSION = '3.2.0'
29
+ Tooltip.VERSION = '3.3.7'
30
+
31
+ Tooltip.TRANSITION_DURATION = 150
29
32
 
30
33
  Tooltip.DEFAULTS = {
31
34
  animation: true,
@@ -48,7 +51,12 @@
48
51
  this.type = type
49
52
  this.$element = $(element)
50
53
  this.options = this.getOptions(options)
51
- this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
54
+ this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
55
+ this.inState = { click: false, hover: false, focus: false }
56
+
57
+ if (this.$element[0] instanceof document.constructor && !this.options.selector) {
58
+ throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
59
+ }
52
60
 
53
61
  var triggers = this.options.trigger.split(' ')
54
62
 
@@ -108,6 +116,15 @@
108
116
  $(obj.currentTarget).data('bs.' + this.type, self)
109
117
  }
110
118
 
119
+ if (obj instanceof $.Event) {
120
+ self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
121
+ }
122
+
123
+ if (self.tip().hasClass('in') || self.hoverState == 'in') {
124
+ self.hoverState = 'in'
125
+ return
126
+ }
127
+
111
128
  clearTimeout(self.timeout)
112
129
 
113
130
  self.hoverState = 'in'
@@ -119,6 +136,14 @@
119
136
  }, self.options.delay.show)
120
137
  }
121
138
 
139
+ Tooltip.prototype.isInStateTrue = function () {
140
+ for (var key in this.inState) {
141
+ if (this.inState[key]) return true
142
+ }
143
+
144
+ return false
145
+ }
146
+
122
147
  Tooltip.prototype.leave = function (obj) {
123
148
  var self = obj instanceof this.constructor ?
124
149
  obj : $(obj.currentTarget).data('bs.' + this.type)
@@ -128,6 +153,12 @@
128
153
  $(obj.currentTarget).data('bs.' + this.type, self)
129
154
  }
130
155
 
156
+ if (obj instanceof $.Event) {
157
+ self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
158
+ }
159
+
160
+ if (self.isInStateTrue()) return
161
+
131
162
  clearTimeout(self.timeout)
132
163
 
133
164
  self.hoverState = 'out'
@@ -145,7 +176,7 @@
145
176
  if (this.hasContent() && this.enabled) {
146
177
  this.$element.trigger(e)
147
178
 
148
- var inDom = $.contains(document.documentElement, this.$element[0])
179
+ var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
149
180
  if (e.isDefaultPrevented() || !inDom) return
150
181
  var that = this
151
182
 
@@ -174,6 +205,7 @@
174
205
  .data('bs.' + this.type, this)
175
206
 
176
207
  this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
208
+ this.$element.trigger('inserted.bs.' + this.type)
177
209
 
178
210
  var pos = this.getPosition()
179
211
  var actualWidth = $tip[0].offsetWidth
@@ -181,13 +213,12 @@
181
213
 
182
214
  if (autoPlace) {
183
215
  var orgPlacement = placement
184
- var $parent = this.$element.parent()
185
- var parentDim = this.getPosition($parent)
216
+ var viewportDim = this.getPosition(this.$viewport)
186
217
 
187
- placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
188
- placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
189
- placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
190
- placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
218
+ placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
219
+ placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
220
+ placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
221
+ placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
191
222
  placement
192
223
 
193
224
  $tip
@@ -200,14 +231,17 @@
200
231
  this.applyPlacement(calculatedOffset, placement)
201
232
 
202
233
  var complete = function () {
234
+ var prevHoverState = that.hoverState
203
235
  that.$element.trigger('shown.bs.' + that.type)
204
236
  that.hoverState = null
237
+
238
+ if (prevHoverState == 'out') that.leave(that)
205
239
  }
206
240
 
207
241
  $.support.transition && this.$tip.hasClass('fade') ?
208
242
  $tip
209
243
  .one('bsTransitionEnd', complete)
210
- .emulateTransitionEnd(150) :
244
+ .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
211
245
  complete()
212
246
  }
213
247
  }
@@ -225,8 +259,8 @@
225
259
  if (isNaN(marginTop)) marginTop = 0
226
260
  if (isNaN(marginLeft)) marginLeft = 0
227
261
 
228
- offset.top = offset.top + marginTop
229
- offset.left = offset.left + marginLeft
262
+ offset.top += marginTop
263
+ offset.left += marginLeft
230
264
 
231
265
  // $.fn.offset doesn't round pixel values
232
266
  // so we use setOffset directly with our own function B-0
@@ -254,16 +288,18 @@
254
288
  if (delta.left) offset.left += delta.left
255
289
  else offset.top += delta.top
256
290
 
257
- var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
258
- var arrowPosition = delta.left ? 'left' : 'top'
259
- var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
291
+ var isVertical = /top|bottom/.test(placement)
292
+ var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
293
+ var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
260
294
 
261
295
  $tip.offset(offset)
262
- this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
296
+ this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
263
297
  }
264
298
 
265
- Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
266
- this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
299
+ Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
300
+ this.arrow()
301
+ .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
302
+ .css(isVertical ? 'top' : 'left', '')
267
303
  }
268
304
 
269
305
  Tooltip.prototype.setContent = function () {
@@ -274,16 +310,19 @@
274
310
  $tip.removeClass('fade in top bottom left right')
275
311
  }
276
312
 
277
- Tooltip.prototype.hide = function () {
313
+ Tooltip.prototype.hide = function (callback) {
278
314
  var that = this
279
- var $tip = this.tip()
315
+ var $tip = $(this.$tip)
280
316
  var e = $.Event('hide.bs.' + this.type)
281
317
 
282
- this.$element.removeAttr('aria-describedby')
283
-
284
318
  function complete() {
285
319
  if (that.hoverState != 'in') $tip.detach()
286
- that.$element.trigger('hidden.bs.' + that.type)
320
+ if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
321
+ that.$element
322
+ .removeAttr('aria-describedby')
323
+ .trigger('hidden.bs.' + that.type)
324
+ }
325
+ callback && callback()
287
326
  }
288
327
 
289
328
  this.$element.trigger(e)
@@ -292,10 +331,10 @@
292
331
 
293
332
  $tip.removeClass('in')
294
333
 
295
- $.support.transition && this.$tip.hasClass('fade') ?
334
+ $.support.transition && $tip.hasClass('fade') ?
296
335
  $tip
297
336
  .one('bsTransitionEnd', complete)
298
- .emulateTransitionEnd(150) :
337
+ .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
299
338
  complete()
300
339
 
301
340
  this.hoverState = null
@@ -305,7 +344,7 @@
305
344
 
306
345
  Tooltip.prototype.fixTitle = function () {
307
346
  var $e = this.$element
308
- if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
347
+ if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
309
348
  $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
310
349
  }
311
350
  }
@@ -316,20 +355,30 @@
316
355
 
317
356
  Tooltip.prototype.getPosition = function ($element) {
318
357
  $element = $element || this.$element
358
+
319
359
  var el = $element[0]
320
360
  var isBody = el.tagName == 'BODY'
321
- return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
322
- scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
323
- width: isBody ? $(window).width() : $element.outerWidth(),
324
- height: isBody ? $(window).height() : $element.outerHeight()
325
- }, isBody ? { top: 0, left: 0 } : $element.offset())
361
+
362
+ var elRect = el.getBoundingClientRect()
363
+ if (elRect.width == null) {
364
+ // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
365
+ elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
366
+ }
367
+ var isSvg = window.SVGElement && el instanceof window.SVGElement
368
+ // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
369
+ // See https://github.com/twbs/bootstrap/issues/20280
370
+ var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
371
+ var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
372
+ var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
373
+
374
+ return $.extend({}, elRect, scroll, outerDims, elOffset)
326
375
  }
327
376
 
328
377
  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
329
- return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
330
- placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
378
+ return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
379
+ placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
331
380
  placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
332
- /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
381
+ /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
333
382
 
334
383
  }
335
384
 
@@ -353,7 +402,7 @@
353
402
  var rightEdgeOffset = pos.left + viewportPadding + actualWidth
354
403
  if (leftEdgeOffset < viewportDimensions.left) { // left overflow
355
404
  delta.left = viewportDimensions.left - leftEdgeOffset
356
- } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
405
+ } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
357
406
  delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
358
407
  }
359
408
  }
@@ -379,21 +428,19 @@
379
428
  }
380
429
 
381
430
  Tooltip.prototype.tip = function () {
382
- return (this.$tip = this.$tip || $(this.options.template))
431
+ if (!this.$tip) {
432
+ this.$tip = $(this.options.template)
433
+ if (this.$tip.length != 1) {
434
+ throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
435
+ }
436
+ }
437
+ return this.$tip
383
438
  }
384
439
 
385
440
  Tooltip.prototype.arrow = function () {
386
441
  return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
387
442
  }
388
443
 
389
- Tooltip.prototype.validate = function () {
390
- if (!this.$element[0].parentNode) {
391
- this.hide()
392
- this.$element = null
393
- this.options = null
394
- }
395
- }
396
-
397
444
  Tooltip.prototype.enable = function () {
398
445
  this.enabled = true
399
446
  }
@@ -416,12 +463,28 @@
416
463
  }
417
464
  }
418
465
 
419
- self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
466
+ if (e) {
467
+ self.inState.click = !self.inState.click
468
+ if (self.isInStateTrue()) self.enter(self)
469
+ else self.leave(self)
470
+ } else {
471
+ self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
472
+ }
420
473
  }
421
474
 
422
475
  Tooltip.prototype.destroy = function () {
476
+ var that = this
423
477
  clearTimeout(this.timeout)
424
- this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
478
+ this.hide(function () {
479
+ that.$element.off('.' + that.type).removeData('bs.' + that.type)
480
+ if (that.$tip) {
481
+ that.$tip.detach()
482
+ }
483
+ that.$tip = null
484
+ that.$arrow = null
485
+ that.$viewport = null
486
+ that.$element = null
487
+ })
425
488
  }
426
489
 
427
490
 
@@ -434,7 +497,7 @@
434
497
  var data = $this.data('bs.tooltip')
435
498
  var options = typeof option == 'object' && option
436
499
 
437
- if (!data && option == 'destroy') return
500
+ if (!data && /destroy|hide/.test(option)) return
438
501
  if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
439
502
  if (typeof option == 'string') data[option]()
440
503
  })