bootstrapped 0.0.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/.gitignore +1 -0
  2. data/README.rdoc +36 -66
  3. data/Rakefile +10 -0
  4. data/bootstrapped.gemspec +10 -5
  5. data/features/Installation.feature +26 -0
  6. data/features/bootstrap_layout.feature +30 -1
  7. data/features/bootstrap_scaffold.feature +4 -5
  8. data/lib/bootstrapped.rb +5 -1
  9. data/lib/bootstrapped/engine.rb +14 -2
  10. data/lib/bootstrapped/version.rb +1 -1
  11. data/lib/generators/bootstrapped.rb +6 -2
  12. data/lib/generators/bootstrapped/install/install_generator.rb +36 -14
  13. data/lib/generators/bootstrapped/install/templates/application.css +8 -0
  14. data/lib/generators/bootstrapped/install/templates/application.js +10 -0
  15. data/lib/generators/bootstrapped/install/templates/bootstrap.coffee +3 -0
  16. data/lib/generators/bootstrapped/install/templates/bootstrap_and_overrides.less +17 -0
  17. data/lib/generators/bootstrapped/layout/layout_generator.rb +14 -8
  18. data/lib/generators/bootstrapped/layout/templates/layout.html.erb +94 -24
  19. data/lib/generators/bootstrapped/scaffold/scaffold_generator.rb +0 -7
  20. data/lib/generators/bootstrapped/scaffold/templates/views/erb/_form.html.erb +16 -15
  21. data/lib/generators/bootstrapped/scaffold/templates/views/erb/edit.html.erb +1 -14
  22. data/lib/generators/bootstrapped/scaffold/templates/views/erb/index.html.erb +36 -32
  23. data/lib/generators/bootstrapped/scaffold/templates/views/erb/new.html.erb +1 -7
  24. data/lib/generators/bootstrapped/scaffold/templates/views/erb/show.html.erb +4 -6
  25. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  26. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  27. data/vendor/assets/javascripts/bootstrap-alert.js +91 -0
  28. data/vendor/assets/javascripts/bootstrap-button.js +98 -0
  29. data/vendor/assets/javascripts/bootstrap-carousel.js +154 -0
  30. data/vendor/assets/javascripts/bootstrap-collapse.js +136 -0
  31. data/vendor/assets/javascripts/bootstrap-dropdown.js +92 -0
  32. data/vendor/assets/javascripts/bootstrap-modal.js +210 -0
  33. data/vendor/assets/javascripts/bootstrap-popover.js +95 -0
  34. data/vendor/assets/javascripts/bootstrap-scrollspy.js +125 -0
  35. data/vendor/assets/javascripts/bootstrap-tab.js +130 -0
  36. data/vendor/assets/javascripts/bootstrap-tooltip.js +270 -0
  37. data/vendor/assets/javascripts/bootstrap-transition.js +51 -0
  38. data/vendor/assets/javascripts/bootstrap-typeahead.js +271 -0
  39. data/vendor/assets/javascripts/modernizr.js +1270 -0
  40. data/vendor/assets/stylesheets/twitter/bootstrap/less/accordion.less +28 -0
  41. data/vendor/assets/stylesheets/twitter/bootstrap/less/alerts.less +70 -0
  42. data/vendor/assets/stylesheets/twitter/bootstrap/less/bootstrap.less +62 -0
  43. data/vendor/assets/stylesheets/twitter/bootstrap/less/bootstrap_base.less +2 -0
  44. data/vendor/assets/stylesheets/twitter/bootstrap/less/breadcrumbs.less +22 -0
  45. data/vendor/assets/stylesheets/twitter/bootstrap/less/button-groups.less +147 -0
  46. data/vendor/assets/stylesheets/twitter/bootstrap/less/buttons.less +165 -0
  47. data/vendor/assets/stylesheets/twitter/bootstrap/less/carousel.less +121 -0
  48. data/vendor/assets/stylesheets/twitter/bootstrap/less/close.less +18 -0
  49. data/vendor/assets/stylesheets/twitter/bootstrap/less/code.less +44 -0
  50. data/vendor/assets/stylesheets/twitter/bootstrap/less/component-animations.less +18 -0
  51. data/vendor/assets/stylesheets/twitter/bootstrap/less/dropdowns.less +131 -0
  52. data/vendor/assets/stylesheets/twitter/bootstrap/less/forms.less +515 -0
  53. data/vendor/assets/stylesheets/twitter/bootstrap/less/grid.less +8 -0
  54. data/vendor/assets/stylesheets/twitter/bootstrap/less/hero-unit.less +20 -0
  55. data/vendor/assets/stylesheets/twitter/bootstrap/less/labels.less +16 -0
  56. data/vendor/assets/stylesheets/twitter/bootstrap/less/layouts.less +17 -0
  57. data/vendor/assets/stylesheets/twitter/bootstrap/less/mixins.less +537 -0
  58. data/vendor/assets/stylesheets/twitter/bootstrap/less/modals.less +72 -0
  59. data/vendor/assets/stylesheets/twitter/bootstrap/less/navbar.less +292 -0
  60. data/vendor/assets/stylesheets/twitter/bootstrap/less/navs.less +344 -0
  61. data/vendor/assets/stylesheets/twitter/bootstrap/less/pager.less +30 -0
  62. data/vendor/assets/stylesheets/twitter/bootstrap/less/pagination.less +55 -0
  63. data/vendor/assets/stylesheets/twitter/bootstrap/less/popovers.less +49 -0
  64. data/vendor/assets/stylesheets/twitter/bootstrap/less/progress-bars.less +95 -0
  65. data/vendor/{framework → assets/stylesheets/twitter/bootstrap/less}/reset.less +37 -52
  66. data/vendor/assets/stylesheets/twitter/bootstrap/less/responsive.less +323 -0
  67. data/vendor/assets/stylesheets/twitter/bootstrap/less/scaffolding.less +29 -0
  68. data/vendor/assets/stylesheets/twitter/bootstrap/less/sprites.less +156 -0
  69. data/vendor/assets/stylesheets/twitter/bootstrap/less/tables.less +139 -0
  70. data/vendor/assets/stylesheets/twitter/bootstrap/less/thumbnails.less +35 -0
  71. data/vendor/assets/stylesheets/twitter/bootstrap/less/tooltip.less +35 -0
  72. data/vendor/assets/stylesheets/twitter/bootstrap/less/type.less +217 -0
  73. data/vendor/assets/stylesheets/twitter/bootstrap/less/utilities.less +23 -0
  74. data/vendor/assets/stylesheets/twitter/bootstrap/less/variables.less +99 -0
  75. data/vendor/assets/stylesheets/twitter/bootstrap/less/wells.less +17 -0
  76. data/vendor/assets/stylesheets/twitter/bootstrap/static/bootstrap.css +3496 -0
  77. metadata +114 -68
  78. data/Gemfile.lock +0 -133
  79. data/lib/generators/bootstrapped/install/templates/bootstrap.less +0 -26
  80. data/lib/generators/bootstrapped/install/templates/forms.less +0 -479
  81. data/lib/generators/bootstrapped/install/templates/mixins.less +0 -222
  82. data/lib/generators/bootstrapped/install/templates/patterns.less +0 -1060
  83. data/lib/generators/bootstrapped/install/templates/reset.less +0 -141
  84. data/lib/generators/bootstrapped/install/templates/scaffolding.less +0 -137
  85. data/lib/generators/bootstrapped/install/templates/tables.less +0 -224
  86. data/lib/generators/bootstrapped/install/templates/type.less +0 -187
  87. data/lib/generators/bootstrapped/install/templates/variables.less +0 -60
  88. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/create.rb +0 -13
  89. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/destroy.rb +0 -8
  90. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/edit.rb +0 -6
  91. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/index.rb +0 -6
  92. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/new.rb +0 -6
  93. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/show.rb +0 -6
  94. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/update.rb +0 -13
  95. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/controller.rb +0 -5
  96. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/model.rb +0 -7
  97. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alerts.js +0 -113
  98. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-buttons.js +0 -62
  99. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -55
  100. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -260
  101. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -90
  102. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -107
  103. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tabs.js +0 -80
  104. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-twipsy.js +0 -321
  105. data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.css +0 -2467
  106. data/vendor/framework/bootstrap.less +0 -26
  107. data/vendor/framework/forms.less +0 -479
  108. data/vendor/framework/mixins.less +0 -222
  109. data/vendor/framework/patterns.less +0 -1060
  110. data/vendor/framework/scaffolding.less +0 -137
  111. data/vendor/framework/tables.less +0 -224
  112. data/vendor/framework/type.less +0 -187
  113. data/vendor/framework/variables.less +0 -60
@@ -3,20 +3,26 @@ require 'generators/bootstrapped'
3
3
  module Bootstrapped
4
4
  module Generators
5
5
  class LayoutGenerator < Base
6
- argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'
6
+ desc "This generator generates layout file with navigation."
7
+ argument :layout_name, :type => :string, :default => "application"
8
+ argument :layout_type, :type => :string, :default => "fixed",
9
+ :banner => "*fixed or fluid"
7
10
 
8
- def create_layout
9
- template 'layout.html.erb', "app/views/layouts/#{file_name}.html.erb"
11
+ attr_reader :app_name, :container_class
12
+
13
+ def generate_layout
14
+ app = ::Rails.application
15
+ @app_name = app.class.to_s.split("::").first
16
+ @container_class = layout_type == "fluid" ? "container-fluid" : "container"
17
+ template "layout.html.erb", "app/views/layouts/#{layout_name}.html.erb"
18
+ end
19
+
20
+ def copy_additional_files
10
21
  copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
11
22
  copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
12
23
  copy_file '_flash.html.erb', 'app/views/share/_flash.html.erb'
13
24
  end
14
25
 
15
- private
16
-
17
- def file_name
18
- layout_name.underscore
19
- end
20
26
  end
21
27
  end
22
28
  end
@@ -1,36 +1,106 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title><%%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
5
- <%%= stylesheet_link_tag "application" %>
6
- <%%= javascript_include_tag "application" %>
7
- <%%= csrf_meta_tag %>
4
+ <meta charset="utf-8">
5
+ <title><%%= content_for?(:title) ? yield(:title) : "<%= app_name %>" %></title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta name="description" content="">
8
+ <meta name="author" content="">
9
+ <%%= csrf_meta_tags %>
8
10
  <%%= yield(:head) %>
11
+
12
+ <%%= stylesheet_link_tag "application", :media => "all" %>
13
+
14
+ <style type="text/css">
15
+ body {
16
+ padding-top: 60px;
17
+ padding-bottom: 40px;
18
+ }
19
+ .sidebar-nav {
20
+ padding: 9px 0;
21
+ }
22
+ </style>
23
+
24
+ <!--[if lt IE 9]>
25
+ <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
26
+ <![endif]-->
27
+
28
+ <link rel="shortcut icon" href="images/favicon.ico">
29
+ <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
30
+ <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
31
+ <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
9
32
  </head>
10
- <body class="with-header">
11
- <div class="topbar">
12
- <div class="fill">
13
- <div class="container">
14
- <%%= link_to app_name, '#', :class => "brand" %>
15
- <ul class="nav">
16
- <li class="active">
17
- <a href='#'>Home</a>
18
- </li>
19
- <li>
20
- <a href='#'>About</a>
21
- </li>
22
- </ul>
23
- <p class="pull-right"><%%= text_field '#', '#'%></p>
33
+
34
+ <body>
35
+
36
+ <div class="navbar navbar-fixed-top">
37
+ <div class="navbar-inner">
38
+ <%- if layout_type == "fluid" -%>
39
+ <div class="container-fluid">
40
+ <%- else -%>
41
+ <div class="container">
42
+ <%- end -%>
43
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
44
+ <span class="icon-bar"></span>
45
+ <span class="icon-bar"></span>
46
+ <span class="icon-bar"></span>
47
+ </a>
48
+ <a class="brand" href="#">Project name</a>
49
+ <div class="nav-collapse">
50
+ <ul class="nav">
51
+ <li class="active"><a href="#">Home</a></li>
52
+ <li><a href="#about">About</a></li>
53
+ <li><a href="#contact">Contact</a></li>
54
+ </ul>
55
+ <p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>
56
+ </div><!--/.nav-collapse -->
24
57
  </div>
25
58
  </div>
26
59
  </div>
27
- <%%= display_flash_message %>
60
+
61
+ <%- if layout_type == "fluid" -%>
62
+ <div class="container-fluid">
63
+ <%- else -%>
28
64
  <div class="container">
29
- <%%= content_tag :h1, yield(:title) if show_title %>
30
- <%%= yield %>
65
+ <%- end -%>
66
+ <%- if layout_type == "fluid" -%>
67
+ <div class="row-fluid">
68
+ <%- else -%>
69
+ <div class="row">
70
+ <%- end -%>
71
+ <div class="span3">
72
+ <div class="well sidebar-nav">
73
+ <ul class="nav nav-list">
74
+ <li class="nav-header">Sidebar</li>
75
+ <%- (1..3).each do |i| -%>
76
+ <li><a href="#">Link</a></li>
77
+ <li><a href="#">Link</a></li>
78
+ <li><a href="#">Link</a></li>
79
+ <% end %>
80
+ <li class="nav-header">Sidebar</li>
81
+ <%- (1..3).each do |i| -%>
82
+ <li><a href="#">Link</a></li>
83
+ <li><a href="#">Link</a></li>
84
+ <li><a href="#">Link</a></li>
85
+ <% end %>
86
+ </ul>
87
+ </div><!--/.well -->
88
+ </div><!--/span-->
89
+ <div class="span9">
90
+ <%%= content_tag :h1, yield(:title) if show_title %>
91
+ <%%= yield %>
92
+ </div><!--/span-->
93
+ </div><!--/row-->
94
+
95
+ <hr>
96
+
31
97
  <footer>
32
- <p><%%= app_name %> &copy; <%= Time.now.year %></p>
98
+ <p><%%= app_name %> &copy; <%= Time.now.year %></p>
33
99
  </footer>
34
- </div>
100
+
101
+ </div><!--/.fluid-container-->
102
+
103
+ <%%= javascript_include_tag "application" %>
104
+
35
105
  </body>
36
- </html>
106
+ </html>
@@ -20,7 +20,6 @@ module Bootstrapped
20
20
 
21
21
  class_option :testunit, :desc => 'Use test/unit for test files.', :group => 'Test framework', :type => :boolean
22
22
  class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
23
- class_option :shoulda, :desc => 'Use shoulda for test files.', :group => 'Test framework', :type => :boolean
24
23
 
25
24
  def initialize(*args, &block)
26
25
  super
@@ -64,10 +63,6 @@ module Bootstrapped
64
63
  end
65
64
  end
66
65
 
67
- def add_gems
68
- add_gem "mocha", :group => :test
69
- end
70
-
71
66
  def create_model
72
67
  unless @skip_model
73
68
  template 'model.rb', "app/models/#{model_path}.rb"
@@ -276,8 +271,6 @@ module Bootstrapped
276
271
  return @test_framework = :testunit
277
272
  elsif options.rspec?
278
273
  return @test_framework = :rspec
279
- elsif options.shoulda?
280
- return @test_framework = :shoulda
281
274
  else
282
275
  return @test_framework = default_test_framework
283
276
  end
@@ -1,16 +1,17 @@
1
- <%%= error_messages_for <%= item_path :instance_variable => true %> %>
2
- <%%= form_for <%= item_path :instance_variable => true %> do |f| %>
3
- <fieldset>
4
- <%- model_attributes.each do |attribute| -%>
5
- <div class="clearfix">
6
- <%%= f.label :<%= attribute.name %> %>
7
- <div class="input">
8
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %>, :class => "xxlarge" %>
9
- </div>
10
- </div>
11
- <%- end -%>
12
- <div class="actions">
13
- <%%= f.submit :class => "btn primary float-right"%>
14
- </div>
15
- <fieldset>
1
+ <%%= form_for <%= item_path :instance_variable => true %>, :html => { :class => 'form-horizontal' } do |f| %>
2
+ <fieldset>
3
+ <legend><%%= form_action_title %> <%= singular_name.titleize %></legend>
4
+ <%- model_attributes.each do |attribute| -%>
5
+ <div class="control-group">
6
+ <%%= f.label :<%= attribute.name %>, :class => 'control-label' %>
7
+ <div class="controls">
8
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %>, :class => '<%= attribute.field_type %>' %>
9
+ </div>
10
+ </div>
11
+ <%- end -%>
12
+ <div class="form-actions">
13
+ <%%= f.submit nil, :class => 'btn btn-primary' %>
14
+ <%%= link_to 'Cancel', <%= items_path %>, :class => 'btn' %>
15
+ </div>
16
+ </fieldset>
16
17
  <%% end %>
@@ -1,14 +1 @@
1
- <%% title "Edit <%= singular_name.titleize %>" %>
2
-
3
- <%= render_form %>
4
-
5
- <%- if actions? :show, :index -%>
6
- <p>
7
- <%- if action? :show -%>
8
- <%%= link_to "Show", <%= item_path :instance_variable => true %> %> |
9
- <%- end -%>
10
- <%- if action? :index -%>
11
- <%%= link_to "View All", <%= items_path %> %>
12
- <%- end -%>
13
- </p>
14
- <%- end -%>
1
+ <%%= render :partial => 'form', :locals => { :form_action_title => 'Edit' } %>
@@ -1,39 +1,43 @@
1
1
  <%% title "<%= plural_name.titleize %>" %>
2
2
 
3
3
  <div class="well">
4
- <table class="zebra-striped">
5
- <tr>
6
- <%- model_attributes.each do |attribute| %>
7
- <th><%= attribute.human_name.titleize %></th>
8
- <%- end -%>
9
- <%- if action? :show -%>
10
- <th></th>
11
- <%- end -%>
12
- <%- if action? :edit -%>
13
- <th></th>
14
- <%- end -%>
15
- <%- if action? :destroy -%>
16
- <th></th>
17
- <%- end -%>
18
- </tr>
19
- <%% @<%= instances_name %>.each do |<%= instance_name %>| %>
20
- <tr>
21
- <%- model_attributes.each do |attribute| %>
22
- <td><%%= <%= instance_name %>.<%= attribute.name %> %></td>
23
- <%- end -%>
24
- <%- if action? :show -%>
25
- <td><%%= link_to "Show", <%= item_path %> %></td>
26
- <%- end -%>
27
- <%- if action? :edit -%>
28
- <td><%%= link_to "Edit", <%= item_path :action => :edit %> %></td>
29
- <%- end -%>
30
- <%- if action? :destroy -%>
31
- <td><%%= link_to "Destroy", <%= item_path %>, :confirm => 'Are you sure?', :method => :delete %></td>
32
- <%- end -%>
33
- </tr>
34
- <%% end %>
4
+ <table class="table table-striped">
5
+ <thead>
6
+ <tr>
7
+ <%- model_attributes.each do |attribute| -%>
8
+ <th><%= attribute.human_name.titleize %></th>
9
+ <%- end -%>
10
+ <%- if action? :show -%>
11
+ <th></th>
12
+ <%- end -%>
13
+ <%- if action? :edit -%>
14
+ <th></th>
15
+ <%- end -%>
16
+ <%- if action? :destroy -%>
17
+ <th></th>
18
+ <%- end -%>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <%% @<%= instances_name %>.each do |<%= instance_name %>| %>
23
+ <tr>
24
+ <%- model_attributes.each do |attribute| -%>
25
+ <td><%%= <%= instance_name %>.<%= attribute.name %> %></td>
26
+ <%- end -%>
27
+ <%- if action? :show -%>
28
+ <td><%%= link_to "Show", <%= item_path %>, :class => 'btn btn-mini btn-primary' %></td>
29
+ <%- end -%>
30
+ <%- if action? :edit -%>
31
+ <td><%%= link_to "Edit", <%= item_path :action => :edit %>, :class => 'btn btn-mini' %></td>
32
+ <%- end -%>
33
+ <%- if action? :destroy -%>
34
+ <td><%%= link_to "Destroy", <%= item_path %>, :confirm => 'Are you sure?', :method => :delete, :class => 'btn btn-mini btn-danger' %></td>
35
+ <%- end -%>
36
+ </tr>
37
+ <%% end %>
38
+ </tbody>
35
39
  </table>
36
40
  </div>
37
41
  <%- if action? :new -%>
38
- <p><%%= link_to "New <%= singular_name.titleize %>", <%= item_path :action => :new %>, :class => 'btn primary float-right' %></p>
42
+ <p><%%= link_to "New <%= singular_name.titleize %>", <%= item_path :action => :new %>, :class => 'btn primary' %></p>
39
43
  <%- end -%>
@@ -1,7 +1 @@
1
- <%% title "New <%= singular_name.titleize %>" %>
2
-
3
- <%= render_form %>
4
-
5
- <%- if action? :index -%>
6
- <p><%%= link_to "Back to List", <%= items_path %> %></p>
7
- <%- end -%>
1
+ <%%= render :partial => 'form', :locals => { :form_action_title => 'New' } %>
@@ -1,23 +1,21 @@
1
1
  <%% title "<%= singular_name.titleize %> Details" %>
2
2
 
3
3
  <div class="well">
4
-
5
- <%- model_attributes.each do |attribute| %>
4
+ <%- model_attributes.each do |attribute| -%>
6
5
  <p>
7
6
  <strong><%= attribute.human_name.titleize %>:</strong>
8
7
  <%%= @<%= instance_name %>.<%= attribute.name %> %>
9
8
  </p>
10
9
  <% end -%>
11
10
  </div>
12
-
13
11
  <p>
14
12
  <%- if action? :edit -%>
15
- <%%= link_to "Edit", <%= item_path :action => :edit, :instance_variable => true %>, :class => 'btn float-right' %> |
13
+ <%%= link_to "Edit", <%= item_path :action => :edit, :instance_variable => true %>, :class => 'btn' %> |
16
14
  <%- end -%>
17
15
  <%- if action? :destroy -%>
18
- <%%= link_to "Destroy", <%= item_path :instance_variable => true %>, :confirm => 'Are you sure?', :method => :delete, :class => 'btn float-right' %> |
16
+ <%%= link_to "Destroy", <%= item_path :instance_variable => true %>, :confirm => 'Are you sure?', :method => :delete, :class => 'btn' %> |
19
17
  <%- end -%>
20
18
  <%- if action? :index -%>
21
- <%%= link_to "View All", <%= items_path %>, :class => 'btn float-right' %>
19
+ <%%= link_to "View All", <%= items_path %>, :class => 'btn btn-danger' %>
22
20
  <%- end -%>
23
21
  </p>
@@ -0,0 +1,91 @@
1
+ /* ==========================================================
2
+ * bootstrap-alert.js v2.0.0
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"
24
+
25
+ /* ALERT CLASS DEFINITION
26
+ * ====================== */
27
+
28
+ var dismiss = '[data-dismiss="alert"]'
29
+ , Alert = function ( el ) {
30
+ $(el).on('click', dismiss, this.close)
31
+ }
32
+
33
+ Alert.prototype = {
34
+
35
+ constructor: Alert
36
+
37
+ , close: function ( e ) {
38
+ var $this = $(this)
39
+ , selector = $this.attr('data-target')
40
+ , $parent
41
+
42
+ if (!selector) {
43
+ selector = $this.attr('href')
44
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45
+ }
46
+
47
+ $parent = $(selector)
48
+ $parent.trigger('close')
49
+
50
+ e && e.preventDefault()
51
+
52
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
53
+
54
+ $parent.removeClass('in')
55
+
56
+ function removeElement() {
57
+ $parent.remove()
58
+ $parent.trigger('closed')
59
+ }
60
+
61
+ $.support.transition && $parent.hasClass('fade') ?
62
+ $parent.on($.support.transition.end, removeElement) :
63
+ removeElement()
64
+ }
65
+
66
+ }
67
+
68
+
69
+ /* ALERT PLUGIN DEFINITION
70
+ * ======================= */
71
+
72
+ $.fn.alert = function ( option ) {
73
+ return this.each(function () {
74
+ var $this = $(this)
75
+ , data = $this.data('alert')
76
+ if (!data) $this.data('alert', (data = new Alert(this)))
77
+ if (typeof option == 'string') data[option].call($this)
78
+ })
79
+ }
80
+
81
+ $.fn.alert.Constructor = Alert
82
+
83
+
84
+ /* ALERT DATA-API
85
+ * ============== */
86
+
87
+ $(function () {
88
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
89
+ })
90
+
91
+ }( window.jQuery )