bowtie 0.4.1 → 0.4.2

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.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{bowtie}
3
- s.version = "0.4.1"
3
+ s.version = "0.4.2"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Tomás Pollak"]
@@ -1,15 +1,22 @@
1
- class String
1
+ # if we have active support, lets use it
2
+ # otherwise add the few needed methods to avoid loading it
2
3
 
3
- def titleize
4
- self.capitalize.gsub('_',' ')
5
- end
4
+ unless defined?(ActiveSupport::Inflector)
6
5
 
7
- def singularize
8
- self.gsub(/ies/,'y').gsub(/s$/, '')
9
- end
6
+ class String
7
+
8
+ def titleize
9
+ self.capitalize.gsub('_',' ')
10
+ end
11
+
12
+ def singularize
13
+ self.gsub(/ies/,'y').gsub(/s$/, '')
14
+ end
15
+
16
+ def pluralize
17
+ self.gsub(/y$/,'ie') + "s"
18
+ end
10
19
 
11
- def pluralize
12
- self.gsub(/y$/,'ie') + "s"
13
20
  end
14
21
 
15
22
  end
@@ -1,9 +1,9 @@
1
1
  <tr id="resource-<%= @r.primary_key.to_s %>" class="<%= @r.state.to_s if @r.respond_to?(:state) %>">
2
2
  <td class="<%= @model.primary_key %>-col"><a href="<%= url_for(@r) %>"><%= @r.primary_key %></a></td>
3
3
 
4
- <% @r.attributes.each do |k, v| %>
5
- <% next if k == @model.primary_key or k.to_s[/id$/] or k == '_type' %>
6
- <td class="<%= k %>-col <%= k.class.name.downcase %> editable"><%= truncate(v, 64) || 'nil' %></td>
4
+ <% @model.field_names.each do |f| %>
5
+ <% next if f == @model.primary_key or f.to_s[/_id$/] or f.to_s == '_type' %>
6
+ <td class="<%= f %>-col editable"><%= truncate(@r.send(f), 64) || 'nil' %></td>
7
7
  <% end %>
8
8
 
9
9
  <% unless params[:association] %>
@@ -3,14 +3,13 @@
3
3
  <tr>
4
4
  <th title="<%= @model.primary_key %>" class="<%= @model.primary_key %>-col"><%= @model.primary_key.to_s.upcase %></th>
5
5
 
6
- <!-- filter id, _type and associations -->
7
- <% @resources.first.attributes.each do |k, v| %>
8
- <% next if k.to_s == 'id' or k.to_s[/id$/] or k == '_type' or v.class == Array %>
9
- <th title="<%= v.class %>" class="<%= k.to_s %>-col <%= v.class.name.downcase %>"><%= k.to_s.titleize %></th>
6
+ <% @model.field_names.each do |f| %>
7
+ <% next if f == @model.primary_key or f.to_s[/_id$/] or f.to_s == '_type' %>
8
+ <th class="<%= f.to_s %>-col"><%= f.to_s.titleize %></th>
10
9
  <% end %>
11
10
 
12
11
  <% unless params[:association] %>
13
- <% @resources.first.class.model_associations.each do |rel_name, assoc| %>
12
+ <% @model.model_associations.each do |rel_name, assoc| %>
14
13
  <%= render_assoc_header(rel_name, assoc) %>
15
14
  <% end %>
16
15
  <% end %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bowtie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Tom\xC3\xA1s Pollak"