beautiful_scaffold 0.2.7 → 0.3.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG +18 -0
  2. data/Gemfile +2 -2
  3. data/README.rdoc +10 -0
  4. data/beautiful_scaffold.gemspec +1 -1
  5. data/lib/generators/beautiful_jointable_generator.rb +1 -1
  6. data/lib/generators/beautiful_locale_generator.rb +95 -7
  7. data/lib/generators/beautiful_scaffold_common_methods.rb +49 -12
  8. data/lib/generators/beautiful_scaffold_generator.rb +12 -22
  9. data/lib/generators/templates/app/assets/javascripts/application-bs.js +34 -0
  10. data/lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js +123 -19
  11. data/lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js +42 -39
  12. data/lib/generators/templates/app/assets/javascripts/fixed_menu.js +19 -0
  13. data/lib/generators/templates/app/assets/stylesheets/application-bs.css +26 -0
  14. data/lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss +46 -1
  15. data/lib/generators/templates/app/views/_form_habtm_tag.html.erb +3 -26
  16. data/lib/generators/templates/app/views/_mass_inserting.html.erb +2 -9
  17. data/lib/generators/templates/app/views/_modal_columns.html.erb +1 -29
  18. data/lib/generators/templates/app/views/dashboard.html.erb +1 -0
  19. data/lib/generators/templates/app/views/edit.html.erb +1 -1
  20. data/lib/generators/templates/app/views/index.html.erb +4 -8
  21. data/lib/generators/templates/app/views/layout.html.erb +40 -44
  22. data/lib/generators/templates/app/views/new.html.erb +1 -1
  23. data/lib/generators/templates/app/views/partials/_form_field.html.erb +8 -14
  24. data/lib/generators/templates/app/views/partials/_index_search.html.erb +1 -5
  25. data/lib/generators/templates/app/views/partials/_index_search_default_fields.html.erb +3 -0
  26. data/lib/generators/templates/app/views/partials/_show_field.html.erb +1 -1
  27. data/lib/generators/templates/app/views/partials/_sign_in_form.html.erb +0 -5
  28. data/lib/generators/templates/app/views/show.html.erb +1 -1
  29. data/lib/generators/templates/app/views/treeview.html.erb +9 -11
  30. metadata +9 -18
  31. data/lib/generators/templates/app/assets/images/glyphicons-halflings-white.png +0 -0
  32. data/lib/generators/templates/app/assets/images/glyphicons-halflings.png +0 -0
  33. data/lib/generators/templates/app/assets/javascripts/bootstrap-alert.js +0 -90
  34. data/lib/generators/templates/app/assets/javascripts/bootstrap-dropdown.js +0 -100
  35. data/lib/generators/templates/app/assets/javascripts/bootstrap-modal.js +0 -218
  36. data/lib/generators/templates/app/assets/javascripts/bootstrap-tooltip.js +0 -275
  37. data/lib/generators/templates/app/assets/javascripts/bootstrap.js +0 -2027
  38. data/lib/generators/templates/app/assets/javascripts/bootstrap.min.js +0 -6
  39. data/lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.css +0 -1040
  40. data/lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.min.css +0 -9
  41. data/lib/generators/templates/app/assets/stylesheets/bootstrap.css +0 -5624
  42. data/lib/generators/templates/app/assets/stylesheets/bootstrap.min.css +0 -9
  43. data/lib/generators/templates/app/views/_treeview_js.html.erb +0 -42
@@ -1,7 +1,7 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <%- if @beautiful_attributes.include?(attribute.name + ':richtext') then -%>
3
3
  <div class="control-group">
4
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
4
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
5
5
  <div class="controls">
6
6
  <%%= f.text_area :<%= attribute.name %>, :class => "richtext-editor" %>
7
7
  </div>
@@ -31,25 +31,22 @@
31
31
  <%% end %>
32
32
  <%- elsif @beautiful_attributes.include?(attribute.name + ':wysiwyg') then -%>
33
33
  <div class="control-group">
34
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
34
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
35
35
  <div class="controls">
36
36
  <%%= f.text_area :<%= attribute.name %>, :class => "wysiwyg-editor" %>
37
37
  </div>
38
38
  </div>
39
39
  <%%= f.hidden_field :<%= attribute.name %>_typetext, :value => "html" %>
40
- <script type="text/javascript">
41
- $('.wysiwyg-editor').wysihtml5({"html": true});
42
- </script>
43
40
  <%- elsif @beautiful_attributes.include?(attribute.name + ':references') then -%>
44
41
  <div class="control-group">
45
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
42
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
46
43
  <div class="controls">
47
44
  <%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.camelcase %>.all, :id, :caption, :include_blank => true %>
48
45
  </div>
49
46
  </div>
50
47
  <%- elsif @beautiful_attributes.include?(attribute.name + ':price') then -%>
51
48
  <div class="control-group">
52
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
49
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
53
50
  <div class="controls">
54
51
  <div class="input-prepend">
55
52
  <span class="add-on">$</span><%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
@@ -58,7 +55,7 @@
58
55
  </div>
59
56
  <%- elsif @beautiful_attributes.include?(attribute.name + ':date') then -%>
60
57
  <div class="control-group">
61
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
58
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
62
59
  <div class="controls">
63
60
  <div class="input-append">
64
61
  <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(3i)]" id="<%= singular_table_name %>_<%= attribute.name %>_3i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.day rescue "" end %>" />
@@ -70,7 +67,7 @@
70
67
  </div>
71
68
  <%- elsif @beautiful_attributes.include?(attribute.name + ':datetime') then -%>
72
69
  <div class="control-group">
73
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
70
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
74
71
  <div class="controls">
75
72
  <div class="input-append">
76
73
  <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(3i)]" id="<%= singular_table_name %>_<%= attribute.name %>_3i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.day rescue "" end %>" />
@@ -87,19 +84,16 @@
87
84
  </div>
88
85
  <%- elsif @beautiful_attributes.include?(attribute.name + ':color') then -%>
89
86
  <div class="control-group">
90
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
87
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
91
88
  <div class="controls">
92
89
  <div class="input-append color" data-color="<%%= (@<%= model %>.<%= attribute.name %> || "rgba(0, 0, 0)") %>" data-color-format="rgba">
93
90
  <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %><span class="add-on"><i style="background-color: rgb(0, 0, 0)"></i></span>
94
91
  </div>
95
92
  </div>
96
93
  </div>
97
- <script type="text/javascript">
98
- $('.color').colorpicker({format: 'rgba'});
99
- </script>
100
94
  <%- else -%>
101
95
  <div class="control-group">
102
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
96
+ <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
103
97
  <div class="controls">
104
98
  <%%= f.<%= attribute.field_type %> :<%= attribute.name %><%= ', :rows => 5' if attribute.field_type == :text_area %> %>
105
99
  </div>
@@ -8,8 +8,4 @@
8
8
  <%- attribute = "_fulltext" -%>
9
9
  <%- end -%>
10
10
  <%%= ransack_field("<%= singular_table_name %>", "<%= a.name %><%= attribute %>", f, "<%= caption %>") %>
11
- <%- end -%>
12
-
13
- <%- { :created_at => "Created At", :updated_at => "Updated At", :id => "Id" }.each{ |k,v| -%>
14
- <%%= ransack_field("<%= singular_table_name %>", "<%= k.to_s %>", f, "<%= v %>") %>
15
- <%- } -%>
11
+ <%- end -%>
@@ -0,0 +1,3 @@
1
+ <%- { :created_at => "Created At", :updated_at => "Updated At", :id => "Id" }.each{ |k,v| -%>
2
+ <%%= ransack_field("<%= singular_table_name %>", "<%= k.to_s %>", f, "<%= v %>") %>
3
+ <%- } -%>
@@ -1,6 +1,6 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <p>
3
- <b><%%= t(:<%= attribute.name %>, :default => "<%= attribute.human_name %>") %>:</b>
3
+ <b><%%= <%= i18n_t_a(singular_table_name, attribute.name) %> %>:</b>
4
4
  <%- if @beautiful_attributes.include?(attribute.name + ':price') then -%>
5
5
  <%%= number_to_currency(@<%= singular_table_name %>.<%= attribute.name %>) %>
6
6
  <%- elsif @beautiful_attributes.include?(attribute.name + ':boolean') then -%>
@@ -15,9 +15,4 @@
15
15
  <%% end %>
16
16
  <a data-toggle="modal" href="#modal-forget-password" class="nopjax"><%%= t(:forgot_your_password, :default => "Forgot your password?") %></a>
17
17
  <a data-toggle="modal" href="#modal-register-form" class="nopjax"><%%= t(:register, :default => "Register") %></a>
18
- <script type="text/javascript">
19
- $('.dropdown-menu').find('form').click(function (e) {
20
- e.stopPropagation();
21
- });
22
- </script>
23
18
  </div>
@@ -1,4 +1,4 @@
1
- <h2><%%= t(:show, :default => "Show") %> <%%= t(:<%= singular_table_name %>, :default => "<%= singular_table_name %>") %></h2>
1
+ <h2><%%= t(:show, :default => "Show") %> <%%= <%= i18n_t_m(singular_table_name) %> %></h2>
2
2
 
3
3
  <%= render_partial 'app/views/partials/_show_field.html.erb' %>
4
4
  <!-- Beautiful_scaffold - AddField - Field - Do not remove -->
@@ -1,6 +1,13 @@
1
- <h2><%%= t(:treeview, :default => 'Treeview') %> <%%= t(:<%= singular_table_name %>, :default => "<%= singular_table_name %>") %></h2>
1
+ <h2><%%= t(:treeview, :default => 'Treeview') %> <%%= <%= i18n_t_m(singular_table_name) %> %></h2>
2
2
 
3
- <div id="treeview">
3
+ <%%
4
+ namespace_for_url = "<%= namespace_for_url %>"
5
+ plural_model_name = "<%= model_pluralize %>"
6
+ model_name = "<%= singular_table_name %>"
7
+ opened_node = <%= model_camelize %>.select(:id).all.map{ |g| '"treeelt_' + g.id.to_s + '"' }.join(',').html_safe
8
+ %>
9
+
10
+ <div id="treeview" data-model="<%%= model_name %>" data-url="/<%%= namespace_for_url %><%%= plural_model_name %>/" data-opened="[<%%= opened_node %>]">
4
11
  <ul>
5
12
  <%% <%= model_camelize %>.transaction do %>
6
13
  <%% ar = <%= model_camelize %>.where(:<%= model %>_id => nil) %>
@@ -12,12 +19,3 @@
12
19
  </ul>
13
20
  </div>
14
21
 
15
- <%%
16
- namespace_for_url = "<%= namespace_for_url %>"
17
- plural_model_name = "<%= model_pluralize %>"
18
- model_name = "<%= singular_table_name %>"
19
- opened_node = <%= model_camelize %>.select(:id).all.map{ |g| '"treeelt_' + g.id.to_s + '"' }.join(',').html_safe
20
- %>
21
-
22
- <%%= render :partial => "layouts/treeview_js", :locals => { :model_name => model_name, :plural_model_name => plural_model_name, :opened_node => opened_node, :namespace_for_url => namespace_for_url } %>
23
-
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beautiful_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
5
- prerelease:
4
+ version: 0.3.0.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sylvain Claudel
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-05 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Beautiful Scaffold generate a complete scaffold (sort, export, paginate
15
15
  and filter data) http://www.beautiful-scaffold.com
@@ -31,36 +31,27 @@ files:
31
31
  - lib/generators/beautiful_scaffold_common_methods.rb
32
32
  - lib/generators/beautiful_scaffold_generator.rb
33
33
  - lib/generators/templates/app/assets/images/alpha.png
34
- - lib/generators/templates/app/assets/images/glyphicons-halflings-white.png
35
- - lib/generators/templates/app/assets/images/glyphicons-halflings.png
36
34
  - lib/generators/templates/app/assets/images/hue.png
37
35
  - lib/generators/templates/app/assets/images/saturation.png
38
36
  - lib/generators/templates/app/assets/images/ui-anim_basic_16x16.gif
39
37
  - lib/generators/templates/app/assets/javascripts/a-wysihtml5-0.3.0.min.js
40
38
  - lib/generators/templates/app/assets/javascripts/advanced.js
39
+ - lib/generators/templates/app/assets/javascripts/application-bs.js
41
40
  - lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js
42
- - lib/generators/templates/app/assets/javascripts/bootstrap-alert.js
43
41
  - lib/generators/templates/app/assets/javascripts/bootstrap-colorpicker.js
44
42
  - lib/generators/templates/app/assets/javascripts/bootstrap-datepicker.js
45
43
  - lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js
46
- - lib/generators/templates/app/assets/javascripts/bootstrap-dropdown.js
47
- - lib/generators/templates/app/assets/javascripts/bootstrap-modal.js
48
44
  - lib/generators/templates/app/assets/javascripts/bootstrap-timepicker.js
49
- - lib/generators/templates/app/assets/javascripts/bootstrap-tooltip.js
50
45
  - lib/generators/templates/app/assets/javascripts/bootstrap-wysihtml5.js
51
- - lib/generators/templates/app/assets/javascripts/bootstrap.js
52
- - lib/generators/templates/app/assets/javascripts/bootstrap.min.js
46
+ - lib/generators/templates/app/assets/javascripts/fixed_menu.js
53
47
  - lib/generators/templates/app/assets/javascripts/jquery.jstree.js
54
48
  - lib/generators/templates/app/assets/javascripts/jquery.livequery.js
55
49
  - lib/generators/templates/app/assets/javascripts/jquery.pjax.js
56
50
  - lib/generators/templates/app/assets/javascripts/modernizr.custom.js
57
51
  - lib/generators/templates/app/assets/javascripts/tagit.js
52
+ - lib/generators/templates/app/assets/stylesheets/application-bs.css
58
53
  - lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss
59
- - lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.css
60
- - lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.min.css
61
54
  - lib/generators/templates/app/assets/stylesheets/bootstrap-wysihtml5.css
62
- - lib/generators/templates/app/assets/stylesheets/bootstrap.css
63
- - lib/generators/templates/app/assets/stylesheets/bootstrap.min.css
64
55
  - lib/generators/templates/app/assets/stylesheets/colorpicker.css
65
56
  - lib/generators/templates/app/assets/stylesheets/datepicker.css
66
57
  - lib/generators/templates/app/assets/stylesheets/reset.css
@@ -84,7 +75,6 @@ files:
84
75
  - lib/generators/templates/app/views/_form_habtm_tag.html.erb
85
76
  - lib/generators/templates/app/views/_mass_inserting.html.erb
86
77
  - lib/generators/templates/app/views/_modal_columns.html.erb
87
- - lib/generators/templates/app/views/_treeview_js.html.erb
88
78
  - lib/generators/templates/app/views/dashboard.html.erb
89
79
  - lib/generators/templates/app/views/edit.html.erb
90
80
  - lib/generators/templates/app/views/index.html.erb
@@ -96,6 +86,7 @@ files:
96
86
  - lib/generators/templates/app/views/partials/_index_column.html.erb
97
87
  - lib/generators/templates/app/views/partials/_index_header.html.erb
98
88
  - lib/generators/templates/app/views/partials/_index_search.html.erb
89
+ - lib/generators/templates/app/views/partials/_index_search_default_fields.html.erb
99
90
  - lib/generators/templates/app/views/partials/_register_form.html.erb
100
91
  - lib/generators/templates/app/views/partials/_show_field.html.erb
101
92
  - lib/generators/templates/app/views/partials/_sign_in_form.html.erb
@@ -249,9 +240,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
240
  required_rubygems_version: !ruby/object:Gem::Requirement
250
241
  none: false
251
242
  requirements:
252
- - - ! '>='
243
+ - - ! '>'
253
244
  - !ruby/object:Gem::Version
254
- version: '0'
245
+ version: 1.3.1
255
246
  requirements: []
256
247
  rubyforge_project: beautiful_scaffold
257
248
  rubygems_version: 1.8.25
@@ -1,90 +0,0 @@
1
- /* ==========================================================
2
- * bootstrap-alert.js v2.0.4
3
- * http://twitter.github.com/bootstrap/javascript.html#alerts
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
- /* ALERT CLASS DEFINITION
27
- * ====================== */
28
-
29
- var dismiss = '[data-dismiss="alert"]'
30
- , Alert = function (el) {
31
- $(el).on('click', dismiss, this.close)
32
- }
33
-
34
- Alert.prototype.close = function (e) {
35
- var $this = $(this)
36
- , selector = $this.attr('data-target')
37
- , $parent
38
-
39
- if (!selector) {
40
- selector = $this.attr('href')
41
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
42
- }
43
-
44
- $parent = $(selector)
45
-
46
- e && e.preventDefault()
47
-
48
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
49
-
50
- $parent.trigger(e = $.Event('close'))
51
-
52
- if (e.isDefaultPrevented()) return
53
-
54
- $parent.removeClass('in')
55
-
56
- function removeElement() {
57
- $parent
58
- .trigger('closed')
59
- .remove()
60
- }
61
-
62
- $.support.transition && $parent.hasClass('fade') ?
63
- $parent.on($.support.transition.end, removeElement) :
64
- removeElement()
65
- }
66
-
67
-
68
- /* ALERT PLUGIN DEFINITION
69
- * ======================= */
70
-
71
- $.fn.alert = function (option) {
72
- return this.each(function () {
73
- var $this = $(this)
74
- , data = $this.data('alert')
75
- if (!data) $this.data('alert', (data = new Alert(this)))
76
- if (typeof option == 'string') data[option].call($this)
77
- })
78
- }
79
-
80
- $.fn.alert.Constructor = Alert
81
-
82
-
83
- /* ALERT DATA-API
84
- * ============== */
85
-
86
- $(function () {
87
- $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
88
- })
89
-
90
- }(window.jQuery);
@@ -1,100 +0,0 @@
1
- /* ============================================================
2
- * bootstrap-dropdown.js v2.0.4
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
- , selector
45
- , isActive
46
-
47
- if ($this.is('.disabled, :disabled')) return
48
-
49
- selector = $this.attr('data-target')
50
-
51
- if (!selector) {
52
- selector = $this.attr('href')
53
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
54
- }
55
-
56
- $parent = $(selector)
57
- $parent.length || ($parent = $this.parent())
58
-
59
- isActive = $parent.hasClass('open')
60
-
61
- clearMenus()
62
-
63
- if (!isActive) $parent.toggleClass('open')
64
-
65
- return false
66
- }
67
-
68
- }
69
-
70
- function clearMenus() {
71
- $(toggle).parent().removeClass('open')
72
- }
73
-
74
-
75
- /* DROPDOWN PLUGIN DEFINITION
76
- * ========================== */
77
-
78
- $.fn.dropdown = function (option) {
79
- return this.each(function () {
80
- var $this = $(this)
81
- , data = $this.data('dropdown')
82
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
83
- if (typeof option == 'string') data[option].call($this)
84
- })
85
- }
86
-
87
- $.fn.dropdown.Constructor = Dropdown
88
-
89
-
90
- /* APPLY TO STANDARD DROPDOWN ELEMENTS
91
- * =================================== */
92
-
93
- $(function () {
94
- $('html').on('click.dropdown.data-api', clearMenus)
95
- $('body')
96
- .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
97
- .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
98
- })
99
-
100
- }(window.jQuery);
@@ -1,218 +0,0 @@
1
- /* =========================================================
2
- * bootstrap-modal.js v2.0.4
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 (content, options) {
30
- this.options = options
31
- this.$element = $(content)
32
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
33
- }
34
-
35
- Modal.prototype = {
36
-
37
- constructor: Modal
38
-
39
- , toggle: function () {
40
- return this[!this.isShown ? 'show' : 'hide']()
41
- }
42
-
43
- , show: function () {
44
- var that = this
45
- , e = $.Event('show')
46
-
47
- this.$element.trigger(e)
48
-
49
- if (this.isShown || e.isDefaultPrevented()) return
50
-
51
- $('body').addClass('modal-open')
52
-
53
- this.isShown = true
54
-
55
- escape.call(this)
56
- backdrop.call(this, 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
64
- .show()
65
-
66
- if (transition) {
67
- that.$element[0].offsetWidth // force reflow
68
- }
69
-
70
- that.$element.addClass('in')
71
-
72
- transition ?
73
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
74
- that.$element.trigger('shown')
75
-
76
- })
77
- }
78
-
79
- , hide: function (e) {
80
- e && e.preventDefault()
81
-
82
- var that = this
83
-
84
- e = $.Event('hide')
85
-
86
- this.$element.trigger(e)
87
-
88
- if (!this.isShown || e.isDefaultPrevented()) return
89
-
90
- this.isShown = false
91
-
92
- $('body').removeClass('modal-open')
93
-
94
- escape.call(this)
95
-
96
- this.$element.removeClass('in')
97
-
98
- $.support.transition && this.$element.hasClass('fade') ?
99
- hideWithTransition.call(this) :
100
- hideModal.call(this)
101
- }
102
-
103
- }
104
-
105
-
106
- /* MODAL PRIVATE METHODS
107
- * ===================== */
108
-
109
- function hideWithTransition() {
110
- var that = this
111
- , timeout = setTimeout(function () {
112
- that.$element.off($.support.transition.end)
113
- hideModal.call(that)
114
- }, 500)
115
-
116
- this.$element.one($.support.transition.end, function () {
117
- clearTimeout(timeout)
118
- hideModal.call(that)
119
- })
120
- }
121
-
122
- function hideModal(that) {
123
- this.$element
124
- .hide()
125
- .trigger('hidden')
126
-
127
- backdrop.call(this)
128
- }
129
-
130
- function backdrop(callback) {
131
- var that = this
132
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
133
-
134
- if (this.isShown && this.options.backdrop) {
135
- var doAnimate = $.support.transition && animate
136
-
137
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
138
- .appendTo(document.body)
139
-
140
- if (this.options.backdrop != 'static') {
141
- this.$backdrop.click($.proxy(this.hide, this))
142
- }
143
-
144
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
145
-
146
- this.$backdrop.addClass('in')
147
-
148
- doAnimate ?
149
- this.$backdrop.one($.support.transition.end, callback) :
150
- callback()
151
-
152
- } else if (!this.isShown && this.$backdrop) {
153
- this.$backdrop.removeClass('in')
154
-
155
- $.support.transition && this.$element.hasClass('fade')?
156
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
157
- removeBackdrop.call(this)
158
-
159
- } else if (callback) {
160
- callback()
161
- }
162
- }
163
-
164
- function removeBackdrop() {
165
- this.$backdrop.remove()
166
- this.$backdrop = null
167
- }
168
-
169
- function escape() {
170
- var that = this
171
- if (this.isShown && this.options.keyboard) {
172
- $(document).on('keyup.dismiss.modal', function ( e ) {
173
- e.which == 27 && that.hide()
174
- })
175
- } else if (!this.isShown) {
176
- $(document).off('keyup.dismiss.modal')
177
- }
178
- }
179
-
180
-
181
- /* MODAL PLUGIN DEFINITION
182
- * ======================= */
183
-
184
- $.fn.modal = function (option) {
185
- return this.each(function () {
186
- var $this = $(this)
187
- , data = $this.data('modal')
188
- , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
189
- if (!data) $this.data('modal', (data = new Modal(this, options)))
190
- if (typeof option == 'string') data[option]()
191
- else if (options.show) data.show()
192
- })
193
- }
194
-
195
- $.fn.modal.defaults = {
196
- backdrop: true
197
- , keyboard: true
198
- , show: true
199
- }
200
-
201
- $.fn.modal.Constructor = Modal
202
-
203
-
204
- /* MODAL DATA-API
205
- * ============== */
206
-
207
- $(function () {
208
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
209
- var $this = $(this), href
210
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
211
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
212
-
213
- e.preventDefault()
214
- $target.modal(option)
215
- })
216
- })
217
-
218
- }(window.jQuery);