index_for 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f14f26a1c9efefc34c8d33c4de1d1a41b77cb89
4
- data.tar.gz: 6fed5c4f46ac45db3a75d52e0f30a3f3dc8e6d13
3
+ metadata.gz: 5201f828b842ddaac961004a256ed963fa357c5f
4
+ data.tar.gz: d1aa9988355935416b80bf99d94f317b114a6693
5
5
  SHA512:
6
- metadata.gz: f191d29aa8344e4a125235730fe14ce5fadbdc22ae744a6f319d64a9e630c17956d8755df6c6f72692334ebf28a52796f1ccebfa479b25db8f814864b151588a
7
- data.tar.gz: 0858423aebf41a38831d7ec4ed2a93c64e55b89edeabac7ff541d8a576f06d7a93cc270a6d0eaad45bfb5e5d1f7bd36e68c6b3d559fd9d47b920dc32bb8c47be
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
- <% attributes.each do |attribute| -%>
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(@<%= singular_name %>) %>
8
+ <%%= link_to 'New', new_<%= singular_name %>_path %>
@@ -4,4 +4,4 @@
4
4
  <% end -%>
5
5
  = i.actions :all
6
6
 
7
- = link_to 'New', new_<%= singular_name %>_path(@<%= singular_name %>)
7
+ = link_to 'New', new_<%= singular_name %>_path
@@ -4,4 +4,4 @@
4
4
  <% end -%>
5
5
  = i.actions :all
6
6
 
7
- = link_to 'New', new_<%= singular_name %>_path(@<%= singular_name %>)
7
+ = 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 %>)
@@ -20,6 +20,8 @@ module IndexFor
20
20
  else
21
21
  object.send(attribute_name)
22
22
  end
23
+ rescue
24
+ options.key?(:if_raise) ? options[:if_raise] : raise
23
25
  end
24
26
 
25
27
  def attribute_label attribute_name
@@ -27,4 +29,4 @@ module IndexFor
27
29
  end
28
30
 
29
31
  end
30
- end
32
+ end
@@ -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 :"show_for.yes", :default => "Yes"
73
+ translate :"index_for.yes", :default => "Yes"
74
74
  when FalseClass
75
- translate :"show_for.no", :default => "No"
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
@@ -1,3 +1,3 @@
1
1
  module IndexFor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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: 2014-08-26 00:00:00.000000000 Z
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.2.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