bowtie 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{bowtie}
3
- s.version = "0.4.8"
3
+ s.version = "0.5.0"
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"]
@@ -78,7 +78,7 @@ module Bowtie
78
78
  res = Bowtie.get_associated(model, params)
79
79
 
80
80
  @model = get_model_class(params[:association])
81
- redirect('/' + model.linkable + '?error=doesnt+exist') if res.nil? or (res.is_a?(Array) and res.empty?)
81
+ redirect referer + '?error=doesnt+exist' if res.nil? or (res.is_a?(Array) and res.empty?)
82
82
 
83
83
  if res.is_a?(Array)
84
84
  @resources = Bowtie.add_paging(res, params[:page])
@@ -18,6 +18,10 @@ module Bowtie
18
18
  def redirect(uri, *args)
19
19
  super base_path + uri.downcase, *args
20
20
  end
21
+
22
+ def referer
23
+ URI.parse(@env['HTTP_REFERER']).path.sub("#{base_path}", '')
24
+ end
21
25
 
22
26
  def clean_params
23
27
  @env['rack.request.query_hash'].delete_if{|a,b| %w(model page notice error q).include?(a) }
@@ -287,6 +287,21 @@ table tr:hover td{
287
287
  background: #ffffed;
288
288
  }
289
289
 
290
+
291
+ /* show resource
292
+ -------------------------------------------------------------*/
293
+
294
+ #assocs{
295
+ float: right;
296
+ font-size: 1.2em;
297
+ border: 1px solid #333;
298
+ padding: 5px 10px;
299
+ margin-top: 15px;
300
+ -moz-border-radius: 5px;
301
+ -webkit-border-radius: 5px;
302
+ background-color: #fafafa;
303
+ }
304
+
290
305
  /* forms
291
306
  -------------------------------------------------------------*/
292
307
 
@@ -1,3 +1,13 @@
1
+
2
+ <div id="assocs">
3
+
4
+ <% @model.model_associations.each do |rel_name, assoc| %>
5
+ <%= rel_name %>: <strong><%= render_assoc_row(@resource, rel_name, assoc) %></strong>
6
+ <% end %>
7
+
8
+ </div><!-- /assocs -->
9
+
10
+
1
11
  <h1><%= @title || @model.name + ':' + @resource.id.to_s %></h1>
2
12
 
3
13
  <form class="big destroy" method="post" action="<%= model_path(@resource.class) %>/<%= @resource.id %>" onsubmit="return confirm('Are you sure?');">
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: 31
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 8
10
- version: 0.4.8
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Tom\xC3\xA1s Pollak"