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.
- data/bowtie.gemspec +1 -1
- data/lib/bowtie/core_extensions.rb +16 -9
- data/lib/bowtie/views/row.erb +3 -3
- data/lib/bowtie/views/table.erb +4 -5
- metadata +3 -3
data/bowtie.gemspec
CHANGED
@@ -1,15 +1,22 @@
|
|
1
|
-
|
1
|
+
# if we have active support, lets use it
|
2
|
+
# otherwise add the few needed methods to avoid loading it
|
2
3
|
|
3
|
-
|
4
|
-
self.capitalize.gsub('_',' ')
|
5
|
-
end
|
4
|
+
unless defined?(ActiveSupport::Inflector)
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
data/lib/bowtie/views/row.erb
CHANGED
@@ -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
|
-
<% @
|
5
|
-
<% next if
|
6
|
-
<td class="<%=
|
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] %>
|
data/lib/bowtie/views/table.erb
CHANGED
@@ -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
|
-
|
7
|
-
|
8
|
-
|
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
|
-
<% @
|
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:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Tom\xC3\xA1s Pollak"
|