neo4j-meta_model 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/javascripts/admin/models.js.coffee +25 -0
  6. data/app/assets/javascripts/meta_model.js.coffee +217 -0
  7. data/app/assets/javascripts/router.js.coffee +5 -0
  8. data/app/assets/javascripts/store.js.coffee +12 -0
  9. data/app/assets/javascripts/templates/application.emblem +3 -0
  10. data/app/assets/javascripts/templates/components/model-list-item.emblem +6 -0
  11. data/app/assets/javascripts/templates/components/model-list.emblem +4 -0
  12. data/app/assets/javascripts/templates/has_associations/index.emblem +25 -0
  13. data/app/assets/javascripts/templates/has_associations/new.emblem +50 -0
  14. data/app/assets/javascripts/templates/index.emblem +6 -0
  15. data/app/assets/javascripts/templates/models/edit.emblem +40 -0
  16. data/app/assets/javascripts/templates/models/hierarchy.emblem +8 -0
  17. data/app/assets/stylesheets/meta_model.css.scss +113 -0
  18. data/app/controllers/meta_model/application_controller.rb +12 -0
  19. data/app/controllers/meta_model/meta/has_associations_controller.rb +44 -0
  20. data/app/controllers/meta_model/meta/models_controller.rb +80 -0
  21. data/app/controllers/meta_model/meta/properties_controller.rb +36 -0
  22. data/app/controllers/meta_model/meta_controller.rb +7 -0
  23. data/app/controllers/meta_model/models_controller.rb +69 -0
  24. data/app/helpers/meta_model/application_helper.rb +10 -0
  25. data/app/helpers/meta_model/model_helper.rb +10 -0
  26. data/app/models/concerns/meta_model/model_base.rb +43 -0
  27. data/app/models/meta_model/has_association.rb +46 -0
  28. data/app/models/meta_model/meta_model_base.rb +7 -0
  29. data/app/models/meta_model/model.rb +51 -0
  30. data/app/models/meta_model/property.rb +11 -0
  31. data/app/serializers/meta_model/has_association_serializer.rb +13 -0
  32. data/app/serializers/meta_model/model_serializer.rb +11 -0
  33. data/app/serializers/meta_model/property_serializer.rb +6 -0
  34. data/app/views/layouts/meta_model.html.slim +28 -0
  35. data/app/views/meta_model/meta/associations/index.html.slim +12 -0
  36. data/app/views/meta_model/meta/index.html.slim +2 -0
  37. data/app/views/meta_model/meta/models/edit.html.slim +39 -0
  38. data/app/views/meta_model/models/_form.html.slim +72 -0
  39. data/app/views/meta_model/models/_has_many_association.html.slim +4 -0
  40. data/app/views/meta_model/models/_record_details.html.slim +13 -0
  41. data/app/views/meta_model/models/edit.html.slim +6 -0
  42. data/app/views/meta_model/models/index.html.slim +14 -0
  43. data/app/views/meta_model/models/meta_index.html.slim +6 -0
  44. data/app/views/meta_model/models/new.html.slim +7 -0
  45. data/app/views/meta_model/models/show.html.slim +18 -0
  46. data/config/initializers/active_model_serializer.rb +6 -0
  47. data/config/routes.rb +19 -0
  48. data/lib/ext/hash.rb +7 -0
  49. data/lib/meta_model/engine.rb +23 -0
  50. data/lib/meta_model/version.rb +3 -0
  51. data/lib/meta_model.rb +4 -0
  52. data/lib/meta_models.rb +70 -0
  53. data/lib/tasks/meta_model_tasks.rake +4 -0
  54. data/test/dummy/README.rdoc +28 -0
  55. data/test/dummy/Rakefile +6 -0
  56. data/test/dummy/app/assets/javascripts/application.js +14 -0
  57. data/test/dummy/app/assets/stylesheets/meta_model.css.scss +55 -0
  58. data/test/dummy/app/controllers/meta_model/application_controller.rb +8 -0
  59. data/test/dummy/app/helpers/application_helper.rb +2 -0
  60. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  61. data/test/dummy/bin/bundle +3 -0
  62. data/test/dummy/bin/rails +4 -0
  63. data/test/dummy/bin/rake +4 -0
  64. data/test/dummy/bin/setup +29 -0
  65. data/test/dummy/config/application.rb +29 -0
  66. data/test/dummy/config/boot.rb +5 -0
  67. data/test/dummy/config/database.yml +25 -0
  68. data/test/dummy/config/environment.rb +5 -0
  69. data/test/dummy/config/environments/development.rb +41 -0
  70. data/test/dummy/config/environments/production.rb +79 -0
  71. data/test/dummy/config/environments/test.rb +42 -0
  72. data/test/dummy/config/initializers/assets.rb +11 -0
  73. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  74. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  75. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  76. data/test/dummy/config/initializers/inflections.rb +16 -0
  77. data/test/dummy/config/initializers/mime_types.rb +4 -0
  78. data/test/dummy/config/initializers/session_store.rb +3 -0
  79. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  80. data/test/dummy/config/locales/en.yml +23 -0
  81. data/test/dummy/config/routes.rb +21 -0
  82. data/test/dummy/config/secrets.yml +22 -0
  83. data/test/dummy/config.ru +4 -0
  84. data/test/dummy/public/404.html +67 -0
  85. data/test/dummy/public/422.html +67 -0
  86. data/test/dummy/public/500.html +66 -0
  87. data/test/dummy/public/favicon.ico +0 -0
  88. data/test/integration/navigation_test.rb +10 -0
  89. data/test/meta_model_test.rb +7 -0
  90. data/test/test_helper.rb +19 -0
  91. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  92. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  93. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  94. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  95. data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  96. data/vendor/assets/javascripts/backbone.js +1608 -0
  97. data/vendor/assets/javascripts/bootstrap/affix.js +162 -0
  98. data/vendor/assets/javascripts/bootstrap/alert.js +94 -0
  99. data/vendor/assets/javascripts/bootstrap/button.js +116 -0
  100. data/vendor/assets/javascripts/bootstrap/carousel.js +240 -0
  101. data/vendor/assets/javascripts/bootstrap/collapse.js +211 -0
  102. data/vendor/assets/javascripts/bootstrap/dropdown.js +161 -0
  103. data/vendor/assets/javascripts/bootstrap/modal.js +324 -0
  104. data/vendor/assets/javascripts/bootstrap/popover.js +119 -0
  105. data/vendor/assets/javascripts/bootstrap/scrollspy.js +175 -0
  106. data/vendor/assets/javascripts/bootstrap/tab.js +153 -0
  107. data/vendor/assets/javascripts/bootstrap/tooltip.js +478 -0
  108. data/vendor/assets/javascripts/bootstrap/transition.js +59 -0
  109. data/vendor/assets/javascripts/bootstrap-sprockets.js +12 -0
  110. data/vendor/assets/javascripts/bootstrap.js +2304 -0
  111. data/vendor/assets/javascripts/lodash.js +6785 -0
  112. data/vendor/assets/javascripts/rivets-backbone.js +97 -0
  113. data/vendor/assets/javascripts/rivets.js +1273 -0
  114. data/vendor/assets/javascripts/sightglass.js +203 -0
  115. data/vendor/assets/stylesheets/_bootstrap-compass.scss +7 -0
  116. data/vendor/assets/stylesheets/_bootstrap-mincer.scss +17 -0
  117. data/vendor/assets/stylesheets/_bootstrap-sprockets.scss +7 -0
  118. data/vendor/assets/stylesheets/_bootstrap.scss +50 -0
  119. data/vendor/assets/stylesheets/bootstrap/_alerts.scss +68 -0
  120. data/vendor/assets/stylesheets/bootstrap/_badges.scss +63 -0
  121. data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
  122. data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
  123. data/vendor/assets/stylesheets/bootstrap/_buttons.scss +160 -0
  124. data/vendor/assets/stylesheets/bootstrap/_carousel.scss +267 -0
  125. data/vendor/assets/stylesheets/bootstrap/_close.scss +35 -0
  126. data/vendor/assets/stylesheets/bootstrap/_code.scss +69 -0
  127. data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
  128. data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +213 -0
  129. data/vendor/assets/stylesheets/bootstrap/_forms.scss +548 -0
  130. data/vendor/assets/stylesheets/bootstrap/_glyphicons.scss +236 -0
  131. data/vendor/assets/stylesheets/bootstrap/_grid.scss +84 -0
  132. data/vendor/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
  133. data/vendor/assets/stylesheets/bootstrap/_jumbotron.scss +49 -0
  134. data/vendor/assets/stylesheets/bootstrap/_labels.scss +66 -0
  135. data/vendor/assets/stylesheets/bootstrap/_list-group.scss +124 -0
  136. data/vendor/assets/stylesheets/bootstrap/_media.scss +47 -0
  137. data/vendor/assets/stylesheets/bootstrap/_mixins.scss +39 -0
  138. data/vendor/assets/stylesheets/bootstrap/_modals.scss +148 -0
  139. data/vendor/assets/stylesheets/bootstrap/_navbar.scss +662 -0
  140. data/vendor/assets/stylesheets/bootstrap/_navs.scss +244 -0
  141. data/vendor/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  142. data/vendor/assets/stylesheets/bootstrap/_pager.scss +54 -0
  143. data/vendor/assets/stylesheets/bootstrap/_pagination.scss +88 -0
  144. data/vendor/assets/stylesheets/bootstrap/_panels.scss +261 -0
  145. data/vendor/assets/stylesheets/bootstrap/_popovers.scss +135 -0
  146. data/vendor/assets/stylesheets/bootstrap/_print.scss +107 -0
  147. data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
  148. data/vendor/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
  149. data/vendor/assets/stylesheets/bootstrap/_responsive-utilities.scss +174 -0
  150. data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
  151. data/vendor/assets/stylesheets/bootstrap/_tables.scss +234 -0
  152. data/vendor/assets/stylesheets/bootstrap/_theme.scss +272 -0
  153. data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
  154. data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +103 -0
  155. data/vendor/assets/stylesheets/bootstrap/_type.scss +298 -0
  156. data/vendor/assets/stylesheets/bootstrap/_utilities.scss +56 -0
  157. data/vendor/assets/stylesheets/bootstrap/_variables.scss +864 -0
  158. data/vendor/assets/stylesheets/bootstrap/_wells.scss +29 -0
  159. data/vendor/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
  160. data/vendor/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
  161. data/vendor/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  162. data/vendor/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
  163. data/vendor/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  164. data/vendor/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  165. data/vendor/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
  166. data/vendor/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
  167. data/vendor/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  168. data/vendor/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  169. data/vendor/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  170. data/vendor/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
  171. data/vendor/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  172. data/vendor/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
  173. data/vendor/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  174. data/vendor/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  175. data/vendor/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
  176. data/vendor/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
  177. data/vendor/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
  178. data/vendor/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
  179. data/vendor/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  180. data/vendor/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  181. data/vendor/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
  182. data/vendor/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
  183. data/vendor/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  184. data/vendor/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  185. data/vendor/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
  186. data/vendor/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  187. data/vendor/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  188. metadata +365 -0
@@ -0,0 +1,119 @@
1
+ /* ========================================================================
2
+ * Bootstrap: popover.js v3.3.1
3
+ * http://getbootstrap.com/javascript/#popovers
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // POPOVER PUBLIC CLASS DEFINITION
14
+ // ===============================
15
+
16
+ var Popover = function (element, options) {
17
+ this.init('popover', element, options)
18
+ }
19
+
20
+ if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
21
+
22
+ Popover.VERSION = '3.3.1'
23
+
24
+ Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
25
+ placement: 'right',
26
+ trigger: 'click',
27
+ content: '',
28
+ template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
29
+ })
30
+
31
+
32
+ // NOTE: POPOVER EXTENDS tooltip.js
33
+ // ================================
34
+
35
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
36
+
37
+ Popover.prototype.constructor = Popover
38
+
39
+ Popover.prototype.getDefaults = function () {
40
+ return Popover.DEFAULTS
41
+ }
42
+
43
+ Popover.prototype.setContent = function () {
44
+ var $tip = this.tip()
45
+ var title = this.getTitle()
46
+ var content = this.getContent()
47
+
48
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
49
+ $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
50
+ this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
51
+ ](content)
52
+
53
+ $tip.removeClass('fade top bottom left right in')
54
+
55
+ // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
56
+ // this manually by checking the contents.
57
+ if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
58
+ }
59
+
60
+ Popover.prototype.hasContent = function () {
61
+ return this.getTitle() || this.getContent()
62
+ }
63
+
64
+ Popover.prototype.getContent = function () {
65
+ var $e = this.$element
66
+ var o = this.options
67
+
68
+ return $e.attr('data-content')
69
+ || (typeof o.content == 'function' ?
70
+ o.content.call($e[0]) :
71
+ o.content)
72
+ }
73
+
74
+ Popover.prototype.arrow = function () {
75
+ return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
76
+ }
77
+
78
+ Popover.prototype.tip = function () {
79
+ if (!this.$tip) this.$tip = $(this.options.template)
80
+ return this.$tip
81
+ }
82
+
83
+
84
+ // POPOVER PLUGIN DEFINITION
85
+ // =========================
86
+
87
+ function Plugin(option) {
88
+ return this.each(function () {
89
+ var $this = $(this)
90
+ var data = $this.data('bs.popover')
91
+ var options = typeof option == 'object' && option
92
+ var selector = options && options.selector
93
+
94
+ if (!data && option == 'destroy') return
95
+ if (selector) {
96
+ if (!data) $this.data('bs.popover', (data = {}))
97
+ if (!data[selector]) data[selector] = new Popover(this, options)
98
+ } else {
99
+ if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
100
+ }
101
+ if (typeof option == 'string') data[option]()
102
+ })
103
+ }
104
+
105
+ var old = $.fn.popover
106
+
107
+ $.fn.popover = Plugin
108
+ $.fn.popover.Constructor = Popover
109
+
110
+
111
+ // POPOVER NO CONFLICT
112
+ // ===================
113
+
114
+ $.fn.popover.noConflict = function () {
115
+ $.fn.popover = old
116
+ return this
117
+ }
118
+
119
+ }(jQuery);
@@ -0,0 +1,175 @@
1
+ /* ========================================================================
2
+ * Bootstrap: scrollspy.js v3.3.1
3
+ * http://getbootstrap.com/javascript/#scrollspy
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // SCROLLSPY CLASS DEFINITION
14
+ // ==========================
15
+
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)
21
+ this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
22
+ this.selector = (this.options.target || '') + ' .nav li > a'
23
+ this.offsets = []
24
+ this.targets = []
25
+ this.activeTarget = null
26
+ this.scrollHeight = 0
27
+
28
+ this.$scrollElement.on('scroll.bs.scrollspy', process)
29
+ this.refresh()
30
+ this.process()
31
+ }
32
+
33
+ ScrollSpy.VERSION = '3.3.1'
34
+
35
+ ScrollSpy.DEFAULTS = {
36
+ offset: 10
37
+ }
38
+
39
+ ScrollSpy.prototype.getScrollHeight = function () {
40
+ return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
41
+ }
42
+
43
+ ScrollSpy.prototype.refresh = function () {
44
+ var offsetMethod = 'offset'
45
+ var offsetBase = 0
46
+
47
+ if (!$.isWindow(this.$scrollElement[0])) {
48
+ offsetMethod = 'position'
49
+ offsetBase = this.$scrollElement.scrollTop()
50
+ }
51
+
52
+ this.offsets = []
53
+ this.targets = []
54
+ this.scrollHeight = this.getScrollHeight()
55
+
56
+ var self = this
57
+
58
+ this.$body
59
+ .find(this.selector)
60
+ .map(function () {
61
+ var $el = $(this)
62
+ var href = $el.data('target') || $el.attr('href')
63
+ var $href = /^#./.test(href) && $(href)
64
+
65
+ return ($href
66
+ && $href.length
67
+ && $href.is(':visible')
68
+ && [[$href[offsetMethod]().top + offsetBase, href]]) || null
69
+ })
70
+ .sort(function (a, b) { return a[0] - b[0] })
71
+ .each(function () {
72
+ self.offsets.push(this[0])
73
+ self.targets.push(this[1])
74
+ })
75
+ }
76
+
77
+ ScrollSpy.prototype.process = function () {
78
+ var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
79
+ var scrollHeight = this.getScrollHeight()
80
+ var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
81
+ var offsets = this.offsets
82
+ var targets = this.targets
83
+ var activeTarget = this.activeTarget
84
+ var i
85
+
86
+ if (this.scrollHeight != scrollHeight) {
87
+ this.refresh()
88
+ }
89
+
90
+ if (scrollTop >= maxScroll) {
91
+ return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
92
+ }
93
+
94
+ if (activeTarget && scrollTop < offsets[0]) {
95
+ this.activeTarget = null
96
+ return this.clear()
97
+ }
98
+
99
+ for (i = offsets.length; i--;) {
100
+ activeTarget != targets[i]
101
+ && scrollTop >= offsets[i]
102
+ && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
103
+ && this.activate(targets[i])
104
+ }
105
+ }
106
+
107
+ ScrollSpy.prototype.activate = function (target) {
108
+ this.activeTarget = target
109
+
110
+ this.clear()
111
+
112
+ var selector = this.selector +
113
+ '[data-target="' + target + '"],' +
114
+ this.selector + '[href="' + target + '"]'
115
+
116
+ var active = $(selector)
117
+ .parents('li')
118
+ .addClass('active')
119
+
120
+ if (active.parent('.dropdown-menu').length) {
121
+ active = active
122
+ .closest('li.dropdown')
123
+ .addClass('active')
124
+ }
125
+
126
+ active.trigger('activate.bs.scrollspy')
127
+ }
128
+
129
+ ScrollSpy.prototype.clear = function () {
130
+ $(this.selector)
131
+ .parentsUntil(this.options.target, '.active')
132
+ .removeClass('active')
133
+ }
134
+
135
+
136
+ // SCROLLSPY PLUGIN DEFINITION
137
+ // ===========================
138
+
139
+ function Plugin(option) {
140
+ return this.each(function () {
141
+ var $this = $(this)
142
+ var data = $this.data('bs.scrollspy')
143
+ var options = typeof option == 'object' && option
144
+
145
+ if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
146
+ if (typeof option == 'string') data[option]()
147
+ })
148
+ }
149
+
150
+ var old = $.fn.scrollspy
151
+
152
+ $.fn.scrollspy = Plugin
153
+ $.fn.scrollspy.Constructor = ScrollSpy
154
+
155
+
156
+ // SCROLLSPY NO CONFLICT
157
+ // =====================
158
+
159
+ $.fn.scrollspy.noConflict = function () {
160
+ $.fn.scrollspy = old
161
+ return this
162
+ }
163
+
164
+
165
+ // SCROLLSPY DATA-API
166
+ // ==================
167
+
168
+ $(window).on('load.bs.scrollspy.data-api', function () {
169
+ $('[data-spy="scroll"]').each(function () {
170
+ var $spy = $(this)
171
+ Plugin.call($spy, $spy.data())
172
+ })
173
+ })
174
+
175
+ }(jQuery);
@@ -0,0 +1,153 @@
1
+ /* ========================================================================
2
+ * Bootstrap: tab.js v3.3.1
3
+ * http://getbootstrap.com/javascript/#tabs
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // TAB CLASS DEFINITION
14
+ // ====================
15
+
16
+ var Tab = function (element) {
17
+ this.element = $(element)
18
+ }
19
+
20
+ Tab.VERSION = '3.3.1'
21
+
22
+ Tab.TRANSITION_DURATION = 150
23
+
24
+ Tab.prototype.show = function () {
25
+ var $this = this.element
26
+ var $ul = $this.closest('ul:not(.dropdown-menu)')
27
+ var selector = $this.data('target')
28
+
29
+ if (!selector) {
30
+ selector = $this.attr('href')
31
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
32
+ }
33
+
34
+ if ($this.parent('li').hasClass('active')) return
35
+
36
+ var $previous = $ul.find('.active:last a')
37
+ var hideEvent = $.Event('hide.bs.tab', {
38
+ relatedTarget: $this[0]
39
+ })
40
+ var showEvent = $.Event('show.bs.tab', {
41
+ relatedTarget: $previous[0]
42
+ })
43
+
44
+ $previous.trigger(hideEvent)
45
+ $this.trigger(showEvent)
46
+
47
+ if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
48
+
49
+ var $target = $(selector)
50
+
51
+ this.activate($this.closest('li'), $ul)
52
+ this.activate($target, $target.parent(), function () {
53
+ $previous.trigger({
54
+ type: 'hidden.bs.tab',
55
+ relatedTarget: $this[0]
56
+ })
57
+ $this.trigger({
58
+ type: 'shown.bs.tab',
59
+ relatedTarget: $previous[0]
60
+ })
61
+ })
62
+ }
63
+
64
+ Tab.prototype.activate = function (element, container, callback) {
65
+ var $active = container.find('> .active')
66
+ var transition = callback
67
+ && $.support.transition
68
+ && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
69
+
70
+ function next() {
71
+ $active
72
+ .removeClass('active')
73
+ .find('> .dropdown-menu > .active')
74
+ .removeClass('active')
75
+ .end()
76
+ .find('[data-toggle="tab"]')
77
+ .attr('aria-expanded', false)
78
+
79
+ element
80
+ .addClass('active')
81
+ .find('[data-toggle="tab"]')
82
+ .attr('aria-expanded', true)
83
+
84
+ if (transition) {
85
+ element[0].offsetWidth // reflow for transition
86
+ element.addClass('in')
87
+ } else {
88
+ element.removeClass('fade')
89
+ }
90
+
91
+ if (element.parent('.dropdown-menu')) {
92
+ element
93
+ .closest('li.dropdown')
94
+ .addClass('active')
95
+ .end()
96
+ .find('[data-toggle="tab"]')
97
+ .attr('aria-expanded', true)
98
+ }
99
+
100
+ callback && callback()
101
+ }
102
+
103
+ $active.length && transition ?
104
+ $active
105
+ .one('bsTransitionEnd', next)
106
+ .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
107
+ next()
108
+
109
+ $active.removeClass('in')
110
+ }
111
+
112
+
113
+ // TAB PLUGIN DEFINITION
114
+ // =====================
115
+
116
+ function Plugin(option) {
117
+ return this.each(function () {
118
+ var $this = $(this)
119
+ var data = $this.data('bs.tab')
120
+
121
+ if (!data) $this.data('bs.tab', (data = new Tab(this)))
122
+ if (typeof option == 'string') data[option]()
123
+ })
124
+ }
125
+
126
+ var old = $.fn.tab
127
+
128
+ $.fn.tab = Plugin
129
+ $.fn.tab.Constructor = Tab
130
+
131
+
132
+ // TAB NO CONFLICT
133
+ // ===============
134
+
135
+ $.fn.tab.noConflict = function () {
136
+ $.fn.tab = old
137
+ return this
138
+ }
139
+
140
+
141
+ // TAB DATA-API
142
+ // ============
143
+
144
+ var clickHandler = function (e) {
145
+ e.preventDefault()
146
+ Plugin.call($(this), 'show')
147
+ }
148
+
149
+ $(document)
150
+ .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
151
+ .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
152
+
153
+ }(jQuery);