puffer 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -3,7 +3,11 @@
3
3
  <% records.each do |record| %>
4
4
  <li data-id="<%= record[primary_key] %>">
5
5
  <div class="title"><strong><%= record[primary_key] %></strong> — <%= record.to_title %></div>
6
- <div class="description">record.password</div>
6
+ <ul class="description">
7
+ <% @field.association_columns.searchable.each do |column| %>
8
+ <li><strong><%= column.label %>:</strong> <%= render_field column, record %></li>
9
+ <% end %>
10
+ </ul>
7
11
  </li>
8
12
  <% end %>
9
13
  </ul>
@@ -382,6 +382,13 @@ input[type=submit]
382
382
  .association .rui-autocompleter li .description
383
383
  {
384
384
  display: none;
385
+ margin: 5px 10px;
386
+ }
387
+
388
+ .association .rui-autocompleter li .description li
389
+ {
390
+ margin: 0;
391
+ padding: 0;
385
392
  }
386
393
 
387
394
  .association .rui-autocompleter li:hover .description
@@ -18,7 +18,7 @@ module Puffer
18
18
  define_method "associated_#{field}_choosing" do
19
19
  @field = field
20
20
  @record = resource.member if params[:id]
21
- @records = field.reflection.klass.includes(field.association_fields.includes).joins(field.association_fields.includes).where(field.association_fields.searches(params[:search])).limit(100).all
21
+ @records = field.reflection.klass.includes(field.association_columns.includes).where(field.association_columns.searches(params[:search])).limit(100).all
22
22
  render 'puffer/associated/one'
23
23
  end
24
24
 
@@ -62,11 +62,11 @@ module Puffer
62
62
  @model
63
63
  end
64
64
 
65
- def association_fields
66
- raise "Can`t find records for association building. Please set :search_fields option for '#{field}' field." unless options[:search_fields].present?
65
+ def association_columns
66
+ raise "Can`t find records for association building. Please set :columns option for '#{field}' field." unless options[:columns].present?
67
67
  @reflection_fields ||= begin
68
68
  fields = Puffer::Fields.new
69
- options[:search_fields].each do |field_name|
69
+ options[:columns].each do |field_name|
70
70
  fields.field reflection.klass, field_name
71
71
  end
72
72
  fields
@@ -96,7 +96,7 @@ module Puffer
96
96
 
97
97
  def collection
98
98
  scope = parent ? parent.member.send(model_name.pluralize) : model
99
- scope.includes(includes).joins(includes).where(searches(params[:search])).order(order).paginate :page => params[:page]
99
+ scope.includes(includes).where(searches(params[:search])).order(order).paginate :page => params[:page]
100
100
  end
101
101
 
102
102
  def member
data/puffer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{puffer}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["pyromaniac"]
@@ -32,12 +32,9 @@ Gem::Specification.new do |s|
32
32
  "app/views/layouts/puffer.html.erb",
33
33
  "app/views/puffer/_form.html.erb",
34
34
  "app/views/puffer/associated/_many.html.erb",
35
- "app/views/puffer/associated/_one.html.erb",
36
35
  "app/views/puffer/associated/many.rjs",
37
36
  "app/views/puffer/associated/one.js.erb",
38
- "app/views/puffer/associated/one.rjs",
39
37
  "app/views/puffer/association/_many.html.erb",
40
- "app/views/puffer/association/_one.html.erb",
41
38
  "app/views/puffer/edit.html.erb",
42
39
  "app/views/puffer/index.html.erb",
43
40
  "app/views/puffer/new.html.erb",
@@ -12,7 +12,7 @@ class Admin::ProfilesController < Puffer::Base
12
12
  end
13
13
 
14
14
  form do
15
- field :user, :search_fields => [:email, :password]
15
+ field :user, :columns => [:email, :password]
16
16
  field :name
17
17
  field :surname
18
18
  field :birth_date
@@ -382,6 +382,13 @@ input[type=submit]
382
382
  .association .rui-autocompleter li .description
383
383
  {
384
384
  display: none;
385
+ margin: 5px 10px;
386
+ }
387
+
388
+ .association .rui-autocompleter li .description li
389
+ {
390
+ margin: 0;
391
+ padding: 0;
385
392
  }
386
393
 
387
394
  .association .rui-autocompleter li:hover .description
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puffer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - pyromaniac
@@ -206,12 +206,9 @@ files:
206
206
  - app/views/layouts/puffer.html.erb
207
207
  - app/views/puffer/_form.html.erb
208
208
  - app/views/puffer/associated/_many.html.erb
209
- - app/views/puffer/associated/_one.html.erb
210
209
  - app/views/puffer/associated/many.rjs
211
210
  - app/views/puffer/associated/one.js.erb
212
- - app/views/puffer/associated/one.rjs
213
211
  - app/views/puffer/association/_many.html.erb
214
- - app/views/puffer/association/_one.html.erb
215
212
  - app/views/puffer/edit.html.erb
216
213
  - app/views/puffer/index.html.erb
217
214
  - app/views/puffer/new.html.erb
@@ -1,47 +0,0 @@
1
- <div class="header">
2
- <div class="popup_close"><%= link_to t(:close), '#', :terbium_popup_close => true %></div>
3
- <ul class="navigation">
4
- <li class="selected">
5
- <%= link_to t(:choosing), '#', :ajax => resource_path(record, "associated_#{field}_choosing") %>
6
- </li>
7
- <li class="notab">
8
- <% form_tag '#', :class => 'associated_search', :ajax => current_path do %>
9
- <%= text_field_tag :query, resource_session[:query] %>
10
- <%= submit_tag 'Search' %>
11
- <% if resource_session[:query].present? %>
12
- <%= link_to 'clear', '#', :ajax => current_path(:query => '') %>
13
- <% end %>
14
- <% end %>
15
- </li>
16
- </ul>
17
- </div>
18
-
19
- <div class="pagination">
20
- <%= will_paginate associated, :renderer => AssociatedLinkRenderer %>
21
- </div>
22
-
23
- <div class="popup_content">
24
- <table class="list_table">
25
- <thead>
26
- <tr>
27
- <% field.association_fields.each do |f| -%>
28
- <th><%= f.label %></th>
29
- <% end -%>
30
- <th class="actions">Actions</th>
31
- </tr>
32
- </thead>
33
- <tbody>
34
- <% associated.each do |association| -%>
35
- <tr id="<%= dom_id association %>">
36
- <% field.association_fields.each do |f| -%>
37
- <td><%= render_field association, f %></td>
38
- <% end -%>
39
- <td class="actions">
40
- <%= link_to t(:show), resource_path(association), :target => '_blank' if (resource_path(association) rescue nil) %>
41
- <%= link_to_function t(:choose), "$('associated_#{field}').replace(\"#{escape_javascript render(:partial => "terbium/association/one", :object => association, :locals => {:field => field})}\"); Event.addBehavior.reload(); this.up('.terbium_popup', 0).popup.hide()" %>
42
- </td>
43
- </tr>
44
- <% end -%>
45
- </tbody>
46
- </table>
47
- </div>
@@ -1 +0,0 @@
1
- page.replace_html 'terbium_popup', :partial => 'terbium/associated/one', :locals => {:field => @field, :associated => @records}
@@ -1,16 +0,0 @@
1
- <div id="associated_<%= field %>">
2
- <% if one %>
3
- <%= link_to_if_path one.to_title, :target => '_blank' do resource_path(one) end %>
4
- <%= link_to_function t(:clear_associated), "clear_associated_#{field}()" %>
5
- <% javascript_tag do %>
6
- function clear_associated_<%= field %>() {
7
- $('associated_<%= field %>').replace("<%= escape_javascript render(:partial => "terbium/association/one", :object => nil, :locals => {:field => field}) %>");
8
- Event.addBehavior.reload();
9
- }
10
- <% end %>
11
- <%= hidden_field_tag "#{model_name}[#{field.association_key}]", one.id, :id => "associated_#{field}_#{one.id}" %>
12
- <% else %>
13
- <%= link_to t(:choose_associated), '#', :terbium_popup => resource_path(record, "associated_#{field}_choosing") %>
14
- <%= hidden_field_tag "#{model_name}[#{field.association_key}]" %>
15
- <% end %>
16
- </div>