rails_helpers 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d744d8723af469935083e6b8893faec2bcd18f8c
|
4
|
+
data.tar.gz: 683177bfab5e067bcb7a1ce80d4b677a038e7dd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1268a5b33dad87496c5e2ae05a72b1ce99f4f201f985450375236e537f90ab0720d7e78c29060a0d8de06179aeb555b4e58c1c22f1777f846eb549610a1f4c8f
|
7
|
+
data.tar.gz: 1f76e73cdd6c38b18415e31dd481ab4e1cfa237972f56657f0f964a939a798087a7ae99825a77159ce34041e5d23f796f5e5ec953f02c175b660c2560c58e17f
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'active_support/concern'
|
2
2
|
require 'rails_helpers/helpers/bootstrap'
|
3
3
|
require 'rails_helpers/helpers/body_classes'
|
4
|
+
require 'rails_helpers/helpers/bootstrap_form_error_helper'
|
4
5
|
|
5
6
|
module RailsHelpers
|
6
7
|
module Helpers
|
@@ -8,5 +9,6 @@ module RailsHelpers
|
|
8
9
|
|
9
10
|
include Bootstrap
|
10
11
|
include BodyClasses
|
12
|
+
include BootstrapFormErrorHelper
|
11
13
|
end
|
12
14
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RailsHelpers::Helpers
|
2
|
+
module BootstrapFormErrorHelper
|
3
|
+
|
4
|
+
def has_error_for?(f, *attributes)
|
5
|
+
'has-error' if attributes.detect { |attr| f.object.errors.include?(attr) }
|
6
|
+
end
|
7
|
+
|
8
|
+
def error_description_list(f, attribute)
|
9
|
+
errors = f.object.errors.full_messages_for(attribute)
|
10
|
+
return '' if errors.blank?
|
11
|
+
|
12
|
+
content_tag :ul, class: 'error-description' do
|
13
|
+
buffer = ''
|
14
|
+
errors.each do |e|
|
15
|
+
buffer << (content_tag :li, e)
|
16
|
+
end
|
17
|
+
buffer.html_safe
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keitaroh Kobayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- lib/rails_helpers/helpers.rb
|
70
70
|
- lib/rails_helpers/helpers/body_classes.rb
|
71
71
|
- lib/rails_helpers/helpers/bootstrap.rb
|
72
|
+
- lib/rails_helpers/helpers/bootstrap_form_error_helper.rb
|
72
73
|
- lib/rails_helpers/version.rb
|
73
74
|
- rails_helpers.gemspec
|
74
75
|
homepage: ''
|
@@ -91,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
version: '0'
|
92
93
|
requirements: []
|
93
94
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.4.5
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: A bunch of code that I like to have in my Rails apps. Use at your own risk.
|