padrino-admin 0.10.7 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +22 -1
  3. data/lib/padrino-admin.rb +8 -1
  4. data/lib/padrino-admin/access_control.rb +6 -4
  5. data/lib/padrino-admin/bootstrap-less/accordion.less +34 -0
  6. data/lib/padrino-admin/bootstrap-less/alerts.less +98 -0
  7. data/lib/padrino-admin/bootstrap-less/badges.less +58 -0
  8. data/lib/padrino-admin/bootstrap-less/bootstrap.less +62 -0
  9. data/lib/padrino-admin/bootstrap-less/breadcrumbs.less +25 -0
  10. data/lib/padrino-admin/bootstrap-less/button-groups.less +166 -0
  11. data/lib/padrino-admin/bootstrap-less/buttons.less +175 -0
  12. data/lib/padrino-admin/bootstrap-less/carousel.less +192 -0
  13. data/lib/padrino-admin/bootstrap-less/close.less +32 -0
  14. data/lib/padrino-admin/bootstrap-less/code.less +61 -0
  15. data/lib/padrino-admin/bootstrap-less/component-animations.less +32 -0
  16. data/lib/padrino-admin/bootstrap-less/dropdowns.less +223 -0
  17. data/lib/padrino-admin/bootstrap-less/font-awesome-ie7.less +350 -0
  18. data/lib/padrino-admin/bootstrap-less/font-awesome.less +537 -0
  19. data/lib/padrino-admin/bootstrap-less/forms.less +543 -0
  20. data/lib/padrino-admin/bootstrap-less/glyphicons.less +200 -0
  21. data/lib/padrino-admin/bootstrap-less/grid.less +49 -0
  22. data/lib/padrino-admin/bootstrap-less/jumbotron.less +32 -0
  23. data/lib/padrino-admin/bootstrap-less/labels.less +46 -0
  24. data/lib/padrino-admin/bootstrap-less/media.less +54 -0
  25. data/lib/padrino-admin/bootstrap-less/mixins.less +530 -0
  26. data/lib/padrino-admin/bootstrap-less/modals.less +136 -0
  27. data/lib/padrino-admin/bootstrap-less/navbar.less +379 -0
  28. data/lib/padrino-admin/bootstrap-less/navs.less +277 -0
  29. data/lib/padrino-admin/bootstrap-less/normalize.less +396 -0
  30. data/lib/padrino-admin/bootstrap-less/padrino-admin.less +16 -0
  31. data/lib/padrino-admin/bootstrap-less/pager.less +43 -0
  32. data/lib/padrino-admin/bootstrap-less/pagination.less +100 -0
  33. data/lib/padrino-admin/bootstrap-less/popovers.less +133 -0
  34. data/lib/padrino-admin/bootstrap-less/print.less +74 -0
  35. data/lib/padrino-admin/bootstrap-less/progress-bars.less +118 -0
  36. data/lib/padrino-admin/bootstrap-less/responsive-utilities.less +59 -0
  37. data/lib/padrino-admin/bootstrap-less/scaffolding.less +90 -0
  38. data/lib/padrino-admin/bootstrap-less/tables.less +231 -0
  39. data/lib/padrino-admin/bootstrap-less/thumbnails.less +42 -0
  40. data/lib/padrino-admin/bootstrap-less/tooltip.less +71 -0
  41. data/lib/padrino-admin/bootstrap-less/type.less +252 -0
  42. data/lib/padrino-admin/bootstrap-less/utilities.less +42 -0
  43. data/lib/padrino-admin/bootstrap-less/variables.less +316 -0
  44. data/lib/padrino-admin/bootstrap-less/wells.less +29 -0
  45. data/lib/padrino-admin/generators/actions.rb +18 -2
  46. data/lib/padrino-admin/generators/admin_app.rb +38 -26
  47. data/lib/padrino-admin/generators/admin_page.rb +8 -1
  48. data/lib/padrino-admin/generators/orm.rb +58 -11
  49. data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +1 -1
  50. data/lib/padrino-admin/generators/templates/account/{mini_record.rb.tt → minirecord.rb.tt} +0 -0
  51. data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +1 -1
  52. data/lib/padrino-admin/generators/templates/account/ohm.rb.tt +61 -0
  53. data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +1 -1
  54. data/lib/padrino-admin/generators/templates/app.rb.tt +36 -29
  55. data/lib/padrino-admin/generators/templates/app/controllers/{base.rb → base.rb.tt} +1 -2
  56. data/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt +6 -3
  57. data/lib/padrino-admin/generators/templates/assets/images/favicon.ico +0 -0
  58. data/lib/padrino-admin/generators/templates/assets/images/font/FontAwesome.otf +0 -0
  59. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.eot +0 -0
  60. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.svg +284 -0
  61. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.ttf +0 -0
  62. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.woff +0 -0
  63. data/lib/padrino-admin/generators/templates/assets/images/logo.png +0 -0
  64. data/lib/padrino-admin/generators/templates/assets/javascripts/application.js +117 -0
  65. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-affix.js +117 -0
  66. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-alert.js +99 -0
  67. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-button.js +105 -0
  68. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-carousel.js +207 -0
  69. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-collapse.js +167 -0
  70. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-dropdown.js +165 -0
  71. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-modal.js +251 -0
  72. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-popover.js +114 -0
  73. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-scrollspy.js +162 -0
  74. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tab.js +144 -0
  75. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tooltip.js +361 -0
  76. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-transition.js +60 -0
  77. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-typeahead.js +335 -0
  78. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap.min.js +6 -0
  79. data/lib/padrino-admin/generators/templates/assets/javascripts/jquery-1.9.0.min.js +4 -0
  80. data/lib/padrino-admin/generators/templates/assets/stylesheets/application.css +346 -0
  81. data/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap.css +952 -0
  82. data/lib/padrino-admin/generators/templates/erb/app/base/index.erb.tt +13 -15
  83. data/lib/padrino-admin/generators/templates/erb/app/errors/403.erb.tt +3 -0
  84. data/lib/padrino-admin/generators/templates/erb/app/errors/404.erb.tt +3 -0
  85. data/lib/padrino-admin/generators/templates/erb/app/errors/500.erb.tt +3 -0
  86. data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +59 -39
  87. data/lib/padrino-admin/generators/templates/erb/app/layouts/error.erb.tt +23 -0
  88. data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +41 -53
  89. data/lib/padrino-admin/generators/templates/erb/page/_form.erb.tt +16 -9
  90. data/lib/padrino-admin/generators/templates/erb/page/edit.erb.tt +9 -17
  91. data/lib/padrino-admin/generators/templates/erb/page/index.erb.tt +73 -31
  92. data/lib/padrino-admin/generators/templates/erb/page/new.erb.tt +8 -16
  93. data/lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt +11 -24
  94. data/lib/padrino-admin/generators/templates/haml/app/errors/403.haml.tt +3 -0
  95. data/lib/padrino-admin/generators/templates/haml/app/errors/404.haml.tt +3 -0
  96. data/lib/padrino-admin/generators/templates/haml/app/errors/500.haml.tt +3 -0
  97. data/lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt +47 -29
  98. data/lib/padrino-admin/generators/templates/haml/app/layouts/error.haml.tt +18 -0
  99. data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +33 -28
  100. data/lib/padrino-admin/generators/templates/haml/page/_form.haml.tt +13 -9
  101. data/lib/padrino-admin/generators/templates/haml/page/edit.haml.tt +7 -14
  102. data/lib/padrino-admin/generators/templates/haml/page/index.haml.tt +56 -27
  103. data/lib/padrino-admin/generators/templates/haml/page/new.haml.tt +6 -13
  104. data/lib/padrino-admin/generators/templates/page/controller.rb.tt +57 -12
  105. data/lib/padrino-admin/generators/templates/slim/app/base/index.slim.tt +11 -24
  106. data/lib/padrino-admin/generators/templates/slim/app/errors/403.slim.tt +3 -0
  107. data/lib/padrino-admin/generators/templates/slim/app/errors/404.slim.tt +3 -0
  108. data/lib/padrino-admin/generators/templates/slim/app/errors/500.slim.tt +3 -0
  109. data/lib/padrino-admin/generators/templates/slim/app/layouts/application.slim.tt +43 -26
  110. data/lib/padrino-admin/generators/templates/slim/app/layouts/error.slim.tt +19 -0
  111. data/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt +31 -27
  112. data/lib/padrino-admin/generators/templates/slim/page/_form.slim.tt +13 -11
  113. data/lib/padrino-admin/generators/templates/slim/page/edit.slim.tt +7 -15
  114. data/lib/padrino-admin/generators/templates/slim/page/index.slim.tt +54 -28
  115. data/lib/padrino-admin/generators/templates/slim/page/new.slim.tt +6 -14
  116. data/lib/padrino-admin/helpers/authentication_helpers.rb +6 -4
  117. data/lib/padrino-admin/helpers/view_helpers.rb +27 -5
  118. data/lib/padrino-admin/locale/admin/cs.yml +53 -13
  119. data/lib/padrino-admin/locale/admin/da.yml +53 -13
  120. data/lib/padrino-admin/locale/admin/de.yml +53 -13
  121. data/lib/padrino-admin/locale/admin/en.yml +53 -13
  122. data/lib/padrino-admin/locale/admin/es.yml +53 -13
  123. data/lib/padrino-admin/locale/admin/fr.yml +53 -13
  124. data/lib/padrino-admin/locale/admin/hu.yml +53 -13
  125. data/lib/padrino-admin/locale/admin/it.yml +53 -13
  126. data/lib/padrino-admin/locale/admin/ja.yml +54 -13
  127. data/lib/padrino-admin/locale/admin/lv.yml +53 -13
  128. data/lib/padrino-admin/locale/admin/nl.yml +53 -13
  129. data/lib/padrino-admin/locale/admin/no.yml +53 -13
  130. data/lib/padrino-admin/locale/admin/pl.yml +53 -13
  131. data/lib/padrino-admin/locale/admin/pt_br.yml +53 -13
  132. data/lib/padrino-admin/locale/admin/ro.yml +53 -13
  133. data/lib/padrino-admin/locale/admin/ru.yml +54 -13
  134. data/lib/padrino-admin/locale/admin/sv.yml +53 -13
  135. data/lib/padrino-admin/locale/admin/tr.yml +53 -13
  136. data/lib/padrino-admin/locale/admin/uk.yml +53 -13
  137. data/lib/padrino-admin/locale/admin/zh_cn.yml +53 -13
  138. data/lib/padrino-admin/locale/admin/zh_tw.yml +53 -13
  139. data/lib/padrino-admin/locale/orm/fr.yml +8 -8
  140. data/padrino-admin.gemspec +2 -0
  141. data/test/fixtures/data_mapper.rb +0 -4
  142. data/test/generators/test_account_model_generator.rb +88 -18
  143. data/test/generators/test_admin_app_generator.rb +120 -165
  144. data/test/generators/test_admin_page_generator.rb +53 -56
  145. data/test/helper.rb +4 -0
  146. data/test/test_admin_application.rb +5 -5
  147. data/test/test_locale.rb +3 -3
  148. metadata +119 -35
  149. data/lib/padrino-admin/generators/templates/assets/stylesheets/base.css +0 -95
  150. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/amro/style.css +0 -364
  151. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec-green/style.css +0 -290
  152. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec/style.css +0 -301
  153. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/blue/style.css +0 -287
  154. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/default/style.css +0 -373
  155. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css +0 -305
  156. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/kathleene/style.css +0 -279
  157. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/olive/style.css +0 -345
  158. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/orange/style.css +0 -269
  159. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/reidb-greenish/style.css +0 -302
  160. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/ruby/style.css +0 -281
  161. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/warehouse/style.css +0 -391
  162. data/lib/padrino-admin/generators/templates/erb/app/base/_sidebar.erb.tt +0 -13
  163. data/lib/padrino-admin/generators/templates/haml/app/base/_sidebar.haml.tt +0 -11
  164. data/lib/padrino-admin/generators/templates/slim/app/base/_sidebar.slim.tt +0 -11
@@ -0,0 +1,167 @@
1
+ /* =============================================================
2
+ * bootstrap-collapse.js v3.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#collapse
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
+ /* COLLAPSE PUBLIC CLASS DEFINITION
27
+ * ================================ */
28
+
29
+ var Collapse = function (element, options) {
30
+ this.$element = $(element)
31
+ this.options = $.extend({}, $.fn.collapse.defaults, options)
32
+
33
+ if (this.options.parent) {
34
+ this.$parent = $(this.options.parent)
35
+ }
36
+
37
+ this.options.toggle && this.toggle()
38
+ }
39
+
40
+ Collapse.prototype = {
41
+
42
+ constructor: Collapse
43
+
44
+ , dimension: function () {
45
+ var hasWidth = this.$element.hasClass('width')
46
+ return hasWidth ? 'width' : 'height'
47
+ }
48
+
49
+ , show: function () {
50
+ var dimension
51
+ , scroll
52
+ , actives
53
+ , hasData
54
+
55
+ if (this.transitioning || this.$element.hasClass('in')) return
56
+
57
+ dimension = this.dimension()
58
+ scroll = $.camelCase(['scroll', dimension].join('-'))
59
+ actives = this.$parent && this.$parent.find('> .accordion-group > .in')
60
+
61
+ if (actives && actives.length) {
62
+ hasData = actives.data('collapse')
63
+ if (hasData && hasData.transitioning) return
64
+ actives.collapse('hide')
65
+ hasData || actives.data('collapse', null)
66
+ }
67
+
68
+ this.$element[dimension](0)
69
+ this.transition('addClass', $.Event('show'), 'shown')
70
+ $.support.transition && this.$element[dimension](this.$element[0][scroll])
71
+ }
72
+
73
+ , hide: function () {
74
+ var dimension
75
+ if (this.transitioning || !this.$element.hasClass('in')) return
76
+ dimension = this.dimension()
77
+ this.reset(this.$element[dimension]())
78
+ this.transition('removeClass', $.Event('hide'), 'hidden')
79
+ this.$element[dimension](0)
80
+ }
81
+
82
+ , reset: function (size) {
83
+ var dimension = this.dimension()
84
+
85
+ this.$element
86
+ .removeClass('collapse')
87
+ [dimension](size || 'auto')
88
+ [0].offsetWidth
89
+
90
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
91
+
92
+ return this
93
+ }
94
+
95
+ , transition: function (method, startEvent, completeEvent) {
96
+ var that = this
97
+ , complete = function () {
98
+ if (startEvent.type == 'show') that.reset()
99
+ that.transitioning = 0
100
+ that.$element.trigger(completeEvent)
101
+ }
102
+
103
+ this.$element.trigger(startEvent)
104
+
105
+ if (startEvent.isDefaultPrevented()) return
106
+
107
+ this.transitioning = 1
108
+
109
+ this.$element[method]('in')
110
+
111
+ $.support.transition && this.$element.hasClass('collapse') ?
112
+ this.$element.one($.support.transition.end, complete) :
113
+ complete()
114
+ }
115
+
116
+ , toggle: function () {
117
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
118
+ }
119
+
120
+ }
121
+
122
+
123
+ /* COLLAPSE PLUGIN DEFINITION
124
+ * ========================== */
125
+
126
+ var old = $.fn.collapse
127
+
128
+ $.fn.collapse = function (option) {
129
+ return this.each(function () {
130
+ var $this = $(this)
131
+ , data = $this.data('collapse')
132
+ , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
133
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
134
+ if (typeof option == 'string') data[option]()
135
+ })
136
+ }
137
+
138
+ $.fn.collapse.defaults = {
139
+ toggle: true
140
+ }
141
+
142
+ $.fn.collapse.Constructor = Collapse
143
+
144
+
145
+ /* COLLAPSE NO CONFLICT
146
+ * ==================== */
147
+
148
+ $.fn.collapse.noConflict = function () {
149
+ $.fn.collapse = old
150
+ return this
151
+ }
152
+
153
+
154
+ /* COLLAPSE DATA-API
155
+ * ================= */
156
+
157
+ $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
158
+ var $this = $(this), href
159
+ , target = $this.attr('data-target')
160
+ || e.preventDefault()
161
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
162
+ , option = $(target).data('collapse') ? 'toggle' : $this.data()
163
+ $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
164
+ $(target).collapse(option)
165
+ })
166
+
167
+ }(window.jQuery);
@@ -0,0 +1,165 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v3.0.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
+ }
57
+
58
+ $this.focus()
59
+
60
+ return false
61
+ }
62
+
63
+ , keydown: function (e) {
64
+ var $this
65
+ , $items
66
+ , $active
67
+ , $parent
68
+ , isActive
69
+ , index
70
+
71
+ if (!/(38|40|27)/.test(e.keyCode)) return
72
+
73
+ $this = $(this)
74
+
75
+ e.preventDefault()
76
+ e.stopPropagation()
77
+
78
+ if ($this.is('.disabled, :disabled')) return
79
+
80
+ $parent = getParent($this)
81
+
82
+ isActive = $parent.hasClass('open')
83
+
84
+ if (!isActive || (isActive && e.keyCode == 27)) {
85
+ if (e.which == 27) $parent.find(toggle).focus()
86
+ return $this.click()
87
+ }
88
+
89
+ $items = $('[role=menu] li:not(.divider):visible a', $parent)
90
+
91
+ if (!$items.length) return
92
+
93
+ index = $items.index($items.filter(':focus'))
94
+
95
+ if (e.keyCode == 38 && index > 0) index-- // up
96
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
97
+ if (!~index) index = 0
98
+
99
+ $items
100
+ .eq(index)
101
+ .focus()
102
+ }
103
+
104
+ }
105
+
106
+ function clearMenus() {
107
+ $(toggle).each(function () {
108
+ getParent($(this)).removeClass('open')
109
+ })
110
+ }
111
+
112
+ function getParent($this) {
113
+ var selector = $this.attr('data-target')
114
+ , $parent
115
+
116
+ if (!selector) {
117
+ selector = $this.attr('href')
118
+ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
119
+ }
120
+
121
+ $parent = selector && $(selector)
122
+
123
+ if (!$parent || !$parent.length) $parent = $this.parent()
124
+
125
+ return $parent
126
+ }
127
+
128
+
129
+ /* DROPDOWN PLUGIN DEFINITION
130
+ * ========================== */
131
+
132
+ var old = $.fn.dropdown
133
+
134
+ $.fn.dropdown = function (option) {
135
+ return this.each(function () {
136
+ var $this = $(this)
137
+ , data = $this.data('dropdown')
138
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
139
+ if (typeof option == 'string') data[option].call($this)
140
+ })
141
+ }
142
+
143
+ $.fn.dropdown.Constructor = Dropdown
144
+
145
+
146
+ /* DROPDOWN NO CONFLICT
147
+ * ==================== */
148
+
149
+ $.fn.dropdown.noConflict = function () {
150
+ $.fn.dropdown = old
151
+ return this
152
+ }
153
+
154
+
155
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
156
+ * =================================== */
157
+
158
+ $(document)
159
+ .on('click.dropdown.data-api', clearMenus)
160
+ .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
161
+ .on('click.dropdown-menu', function (e) { e.stopPropagation() })
162
+ .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
163
+ .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
164
+
165
+ }(window.jQuery);
@@ -0,0 +1,251 @@
1
+ /* =========================================================
2
+ * bootstrap-modal.js v3.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#modals
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
+ /* MODAL CLASS DEFINITION
27
+ * ====================== */
28
+
29
+ var Modal = function (element, options) {
30
+ this.options = options
31
+ this.$element = $(element)
32
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
33
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
34
+ }
35
+
36
+ Modal.prototype = {
37
+
38
+ constructor: Modal
39
+
40
+ , toggle: function () {
41
+ return this[!this.isShown ? 'show' : 'hide']()
42
+ }
43
+
44
+ , show: function () {
45
+ var that = this
46
+ , e = $.Event('show')
47
+
48
+ this.$element.trigger(e)
49
+
50
+ if (this.isShown || e.isDefaultPrevented()) return
51
+
52
+ this.isShown = true
53
+
54
+ this.escape()
55
+
56
+ this.backdrop(function () {
57
+ var transition = $.support.transition && that.$element.hasClass('fade')
58
+
59
+ if (!that.$element.parent().length) {
60
+ that.$element.appendTo(document.body) //don't move modals dom position
61
+ }
62
+
63
+ that.$element.show()
64
+
65
+ if (transition) {
66
+ that.$element[0].offsetWidth // force reflow
67
+ }
68
+
69
+ that.$element
70
+ .addClass('in')
71
+ .attr('aria-hidden', false)
72
+
73
+ that.enforceFocus()
74
+
75
+ transition ?
76
+ that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
77
+ that.$element.focus().trigger('shown')
78
+
79
+ })
80
+ }
81
+
82
+ , hide: function (e) {
83
+ e && e.preventDefault()
84
+
85
+ var that = this
86
+
87
+ e = $.Event('hide')
88
+
89
+ this.$element.trigger(e)
90
+
91
+ if (!this.isShown || e.isDefaultPrevented()) return
92
+
93
+ this.isShown = false
94
+
95
+ this.escape()
96
+
97
+ $(document).off('focusin.modal')
98
+
99
+ this.$element
100
+ .removeClass('in')
101
+ .attr('aria-hidden', true)
102
+
103
+ $.support.transition && this.$element.hasClass('fade') ?
104
+ this.hideWithTransition() :
105
+ this.hideModal()
106
+ }
107
+
108
+ , enforceFocus: function () {
109
+ var that = this
110
+ $(document).on('focusin.modal', function (e) {
111
+ if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
112
+ that.$element.focus()
113
+ }
114
+ })
115
+ }
116
+
117
+ , escape: function () {
118
+ var that = this
119
+ if (this.isShown && this.options.keyboard) {
120
+ this.$element.on('keyup.dismiss.modal', function ( e ) {
121
+ e.which == 27 && that.hide()
122
+ })
123
+ } else if (!this.isShown) {
124
+ this.$element.off('keyup.dismiss.modal')
125
+ }
126
+ }
127
+
128
+ , hideWithTransition: function () {
129
+ var that = this
130
+ , timeout = setTimeout(function () {
131
+ that.$element.off($.support.transition.end)
132
+ that.hideModal()
133
+ }, 500)
134
+
135
+ this.$element.one($.support.transition.end, function () {
136
+ clearTimeout(timeout)
137
+ that.hideModal()
138
+ })
139
+ }
140
+
141
+ , hideModal: function () {
142
+ var that = this
143
+ this.$element.hide()
144
+ this.backdrop(function () {
145
+ that.removeBackdrop()
146
+ that.$element.trigger('hidden')
147
+ })
148
+ }
149
+
150
+ , removeBackdrop: function () {
151
+ this.$backdrop && this.$backdrop.remove()
152
+ this.$backdrop = null
153
+ }
154
+
155
+ , backdrop: function (callback) {
156
+ var that = this
157
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
158
+
159
+ if (this.isShown && this.options.backdrop) {
160
+ var doAnimate = $.support.transition && animate
161
+
162
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
163
+ .appendTo(document.body)
164
+
165
+ this.$backdrop.click(
166
+ this.options.backdrop == 'static' ?
167
+ $.proxy(this.$element[0].focus, this.$element[0])
168
+ : $.proxy(this.hide, this)
169
+ )
170
+
171
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
172
+
173
+ this.$backdrop.addClass('in')
174
+
175
+ if (!callback) return
176
+
177
+ doAnimate ?
178
+ this.$backdrop.one($.support.transition.end, callback) :
179
+ callback()
180
+
181
+ } else if (!this.isShown && this.$backdrop) {
182
+ this.$backdrop.removeClass('in')
183
+
184
+ $.support.transition && this.$element.hasClass('fade')?
185
+ this.$backdrop.one($.support.transition.end, callback) :
186
+ callback()
187
+
188
+ } else if (callback) {
189
+ callback()
190
+ }
191
+ }
192
+ }
193
+
194
+
195
+ /* MODAL PLUGIN DEFINITION
196
+ * ======================= */
197
+
198
+ var old = $.fn.modal
199
+
200
+ $.fn.modal = function (option) {
201
+ return this.each(function () {
202
+ var $this = $(this)
203
+ , data = $this.data('modal')
204
+ , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
205
+ if (!data) $this.data('modal', (data = new Modal(this, options)))
206
+ if (typeof option == 'string') data[option]()
207
+ else if (options.show) data.show()
208
+ })
209
+ }
210
+
211
+ $.fn.modal.defaults = {
212
+ backdrop: true
213
+ , keyboard: true
214
+ , show: true
215
+ }
216
+
217
+ $.fn.modal.Constructor = Modal
218
+
219
+
220
+ /* MODAL NO CONFLICT
221
+ * ================= */
222
+
223
+ $.fn.modal.noConflict = function () {
224
+ $.fn.modal = old
225
+ return this
226
+ }
227
+
228
+
229
+ /* MODAL DATA-API
230
+ * ============== */
231
+
232
+ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
233
+ var $this = $(this)
234
+ , href = $this.attr('href')
235
+ , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
236
+ , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
237
+
238
+ e.preventDefault()
239
+
240
+ $target
241
+ .modal(option)
242
+ .one('hide', function () {
243
+ $this.focus()
244
+ })
245
+ })
246
+
247
+ var $body = $(document.body)
248
+ .on('shown', '.modal', function () { $body.addClass('modal-open') })
249
+ .on('hidden', '.modal', function () { $body.removeClass('modal-open') })
250
+
251
+ }(window.jQuery);