index_for 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 +4 -4
- data/lib/generators/index_for/install_generator.rb +1 -0
- data/lib/generators/index_for/templates/index.html.erb +2 -2
- data/lib/generators/index_for/templates/index.html.haml +1 -1
- data/lib/generators/index_for/templates/index.html.slim +1 -1
- data/lib/generators/index_for/templates/show.html.erb +8 -0
- data/lib/generators/index_for/templates/show.html.haml +7 -0
- data/lib/generators/index_for/templates/show.html.slim +7 -0
- data/lib/index_for/attribute.rb +3 -1
- data/lib/index_for/builder.rb +6 -6
- data/lib/index_for/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5201f828b842ddaac961004a256ed963fa357c5f
|
4
|
+
data.tar.gz: d1aa9988355935416b80bf99d94f317b114a6693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a8d66ac7b1278263c5765c34614892ed25db8d2512d3e91434053f03bb20818f854502472dc036ac062e3c5f9490943aef07954ac9595a1b484f7c03cbec77
|
7
|
+
data.tar.gz: bd1c4defc9f373abd0165d82b04856b18dcf9d3238f3e1a6fba302b53a71457342cad11fee6f7284009e03ad5a7fa42981266ed12a0bba4c7c3f574120b09eea
|
@@ -16,6 +16,7 @@ module IndexFor
|
|
16
16
|
def copy_generator_template
|
17
17
|
engine = options[:template_engine]
|
18
18
|
copy_file "index.html.#{engine}", "lib/templates/#{engine}/scaffold/index.html.#{engine}"
|
19
|
+
copy_file "show.html.#{engine}", "lib/templates/#{engine}/scaffold/show.html.#{engine}"
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%%= index_for @<%= plural_name %> do |i| %>
|
2
|
-
|
2
|
+
<%- attributes.each do |attribute| -%>
|
3
3
|
<%%= i.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %> %>
|
4
4
|
<% end -%>
|
5
5
|
<%%= i.actions :all %>
|
6
6
|
<%% end %>
|
7
7
|
|
8
|
-
<%%= link_to 'New', new_<%= singular_name %>_path
|
8
|
+
<%%= link_to 'New', new_<%= singular_name %>_path %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%%= show_for @<%= singular_name %> do |s| %>
|
2
|
+
<%- attributes.each do |attribute| -%>
|
3
|
+
<%%= s.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %> %>
|
4
|
+
<% end -%>
|
5
|
+
<%% end %>
|
6
|
+
|
7
|
+
<%%= link_to 'Edit', new_<%= singular_name %>_path(@<%= singular_name %>) %>
|
8
|
+
<%%= link_to 'Destroy', new_<%= singular_name %>_path(@<%= singular_name %>) %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
= show_for @<%= singular_name %> do |s|
|
2
|
+
<%- attributes.each do |attribute| -%>
|
3
|
+
= s.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %>
|
4
|
+
<% end -%>
|
5
|
+
|
6
|
+
= link_to 'Edit', new_<%= singular_name %>_path(@<%= singular_name %>)
|
7
|
+
= link_to 'Destroy', new_<%= singular_name %>_path(@<%= singular_name %>)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
= show_for @<%= singular_name %> do |s|
|
2
|
+
<%- attributes.each do |attribute| -%>
|
3
|
+
= s.<%= attribute.reference? ? :association : :attribute %> :<%= attribute.name %>
|
4
|
+
<% end -%>
|
5
|
+
|
6
|
+
= link_to 'Edit', new_<%= singular_name %>_path(@<%= singular_name %>)
|
7
|
+
= link_to 'Destroy', new_<%= singular_name %>_path(@<%= singular_name %>)
|
data/lib/index_for/attribute.rb
CHANGED
data/lib/index_for/builder.rb
CHANGED
@@ -4,7 +4,7 @@ module IndexFor
|
|
4
4
|
class Builder
|
5
5
|
include IndexFor::ShareHelper
|
6
6
|
include IndexFor::Attribute
|
7
|
-
|
7
|
+
|
8
8
|
attr_accessor :object, :html_options, :template
|
9
9
|
|
10
10
|
def initialize object, html_options, template
|
@@ -41,7 +41,7 @@ module IndexFor
|
|
41
41
|
type_html_options = {}
|
42
42
|
type_html_options.merge!(html_options[:"#{type}_html"]) if html_options[:"#{type}_html"]
|
43
43
|
type_html_options.merge!(options[:html]) if options[:html]
|
44
|
-
|
44
|
+
|
45
45
|
append_class type_html_options, type_class
|
46
46
|
|
47
47
|
type_html_options
|
@@ -70,11 +70,11 @@ module IndexFor
|
|
70
70
|
when Date, Time, DateTime
|
71
71
|
I18n.l content, :format => options[:format] || IndexFor.i18n_format
|
72
72
|
when TrueClass
|
73
|
-
translate :"
|
73
|
+
translate :"index_for.yes", :default => "Yes"
|
74
74
|
when FalseClass
|
75
|
-
translate :"
|
75
|
+
translate :"index_for.no", :default => "No"
|
76
76
|
when Array, Hash
|
77
|
-
content.empty? ? blank_content(options) :
|
77
|
+
content.empty? ? blank_content(options) :
|
78
78
|
collection_content(content, options, &block)
|
79
79
|
when Proc
|
80
80
|
@template.capture(@object, &content)
|
@@ -115,4 +115,4 @@ module IndexFor
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
118
|
-
end
|
118
|
+
end
|
data/lib/index_for/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: index_for
|
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
|
- Theo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -113,6 +113,9 @@ files:
|
|
113
113
|
- lib/generators/index_for/templates/index.html.haml
|
114
114
|
- lib/generators/index_for/templates/index.html.slim
|
115
115
|
- lib/generators/index_for/templates/index_for.rb
|
116
|
+
- lib/generators/index_for/templates/show.html.erb
|
117
|
+
- lib/generators/index_for/templates/show.html.haml
|
118
|
+
- lib/generators/index_for/templates/show.html.slim
|
116
119
|
- lib/index_for.rb
|
117
120
|
- lib/index_for/attribute.rb
|
118
121
|
- lib/index_for/builder.rb
|
@@ -143,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
version: '0'
|
144
147
|
requirements: []
|
145
148
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.4.6
|
147
150
|
signing_key:
|
148
151
|
specification_version: 4
|
149
152
|
summary: Wrap your objects with a helper to easily list them
|