bootstrap2-rails 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ <% if model.errors.any? %>
2
+ <div class="alert alert-block">
3
+ <p>
4
+ <strong><%= pluralize(model.errors.count, "error") %> prohibited this <%= model.class.to_s.downcase %> from being saved:</strong>
5
+ <ul>
6
+ <% model.errors.full_messages.each do |msg| %>
7
+ <li style="display: block"><%= msg %></li>
8
+ <% end %>
9
+ </ul>
10
+ </p>
11
+ </div>
12
+
13
+ <script type="text/javascript">
14
+ $('document').ready(function() {
15
+ $(".field_with_errors label").css('color', 'red');
16
+
17
+ // Remove field_with_errors div
18
+ $(".field_with_errors").each(function(index, element) {
19
+ var content = element.innerHTML;
20
+ $(element).replaceWith(content);
21
+ });
22
+
23
+ <% model.errors.each do |a| %>
24
+ $('#<%= model.class.to_s.downcase %>_<%= a %>').css('border-color', 'red');
25
+ <% end %>
26
+ });
27
+ </script>
28
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module BootstrapRails
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,33 +1,6 @@
1
1
  <%%= form_for(@<%= singular_table_name %>, html: {class: 'form-horizontal'}) do |f| %>
2
- <%% if @<%= singular_table_name %>.errors.any? %>
3
- <div class="alert alert-error">
4
- <p>
5
- <strong><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</strong>
6
- </p>
7
- <ul>
8
- <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
9
- <li style="display: block"><%%= msg %></li>
10
- <%% end %>
11
- </ul>
12
- </div>
13
-
14
- <script type="text/javascript">
15
- $('document').ready(function() {
16
- $(".field_with_errors label").css('color', 'red');
17
-
18
- // Remove field_with_errors div
19
- $(".field_with_errors").each(function(index, element) {
20
- var content = element.innerHTML;
21
- $(element).replaceWith(content);
22
- });
23
-
24
- <%% @<%= singular_table_name %>.errors.each do |a| %>
25
- $('#<%= singular_table_name %>_<%%= a %>').css('border-color', 'red');
26
- <%% end %>
27
- });
28
- </script>
29
- <%% end %>
30
-
2
+ <%%= render(partial: 'shared/errors', locals: {model: @<%= singular_table_name %>}) %>
3
+
31
4
  <% attributes.each do |attribute| -%>
32
5
  <div class="control-group">
33
6
  <%%= f.label :<%= attribute.name %>, class: 'control-label' %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-24 00:00:00.000000000 Z
12
+ date: 2012-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: will_paginate
16
- requirement: &74743050 !ruby/object:Gem::Requirement
16
+ requirement: &71973290 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *74743050
24
+ version_requirements: *71973290
25
25
  description: This is a scaffold replacement with a Twitter Bootstrap look
26
26
  email:
27
27
  - stapait@gmail.com
@@ -34,6 +34,7 @@ files:
34
34
  - README.rdoc
35
35
  - Rakefile
36
36
  - app/views/layouts/application.html.erb
37
+ - app/views/shared/_errors.html.erb
37
38
  - app/views/shared/_menu.html.erb
38
39
  - app/views/shared/_search.html.erb
39
40
  - bootstrap2-rails.gemspec