puffer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +130 -0
- data/Rakefile +3 -2
- data/VERSION +1 -0
- data/app/views/layouts/puffer.html.erb +38 -0
- data/app/views/puffer/_form.html.erb +19 -0
- data/app/views/puffer/associated/_many.html.erb +56 -0
- data/app/views/puffer/associated/_one.html.erb +47 -0
- data/app/views/puffer/associated/many.rjs +1 -0
- data/app/views/puffer/associated/one.rjs +1 -0
- data/app/views/puffer/association/_many.html.erb +7 -0
- data/app/views/puffer/association/_one.html.erb +16 -0
- data/app/views/puffer/edit.html.erb +20 -0
- data/app/views/puffer/index.html.erb +83 -0
- data/app/views/puffer/new.html.erb +18 -0
- data/app/views/puffer/show.html.erb +29 -0
- data/app/views/puffer/toggle.rjs +1 -0
- data/autotest/discover.rb +2 -0
- data/puffer.gemspec +217 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/admin/categories_controller.rb +3 -0
- data/spec/dummy/app/controllers/admin/posts_controller.rb +3 -0
- data/spec/dummy/app/controllers/admin/profiles_controller.rb +3 -0
- data/spec/dummy/app/controllers/admin/tags_controller.rb +3 -0
- data/spec/dummy/app/controllers/admin/users_controller.rb +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/category.rb +4 -0
- data/spec/dummy/app/models/post.rb +7 -0
- data/spec/dummy/app/models/post_category.rb +4 -0
- data/spec/dummy/app/models/profile.rb +5 -0
- data/spec/dummy/app/models/tag.rb +3 -0
- data/spec/dummy/app/models/tagging.rb +4 -0
- data/spec/dummy/app/models/user.rb +4 -0
- data/spec/dummy/app/views/admin/users/index.html.erb +0 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +45 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +81 -0
- data/spec/dummy/db/migrate/20100930132559_create_admin_users.rb +14 -0
- data/spec/dummy/db/migrate/20100930132656_create_admin_posts.rb +15 -0
- data/spec/dummy/db/migrate/20100930132726_create_admin_categories.rb +13 -0
- data/spec/dummy/db/migrate/20100930132837_create_post_categories.rb +14 -0
- data/spec/dummy/db/migrate/20100930133425_create_admin_profiles.rb +16 -0
- data/spec/dummy/db/migrate/20101011155830_create_tags.rb +13 -0
- data/spec/dummy/db/migrate/20101011160326_create_taggings.rb +16 -0
- data/spec/dummy/db/schema.rb +68 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/spec/dummy/public/javascripts/rails.js +175 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fabricators/categories_fabricator.rb +3 -0
- data/spec/fabricators/posts_fabricator.rb +8 -0
- data/spec/fabricators/profiles_fabricator.rb +9 -0
- data/spec/fabricators/tags_fabricator.rb +3 -0
- data/spec/fabricators/users_fabricator.rb +12 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/lib/params_spec.rb +119 -0
- data/spec/lib/render_fallback_spec.rb +17 -0
- data/spec/lib/resource/routing_spec.rb +67 -0
- data/spec/lib/resource_spec.rb +198 -0
- data/spec/puffer_spec.rb +7 -0
- data/spec/spec_helper.rb +34 -0
- metadata +283 -26
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ree@puffer
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "rails"
|
4
|
+
gem "capybara", ">= 0.4.0"
|
5
|
+
gem "sqlite3-ruby", :require => "sqlite3"
|
6
|
+
gem 'will_paginate', '~> 3.0.beta'
|
7
|
+
|
8
|
+
gem "rspec-rails"
|
9
|
+
gem "autotest"
|
10
|
+
gem 'forgery'
|
11
|
+
gem 'fabrication'
|
12
|
+
|
13
|
+
gem "jeweler"
|
14
|
+
|
15
|
+
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
16
|
+
# gem 'ruby-debug'
|
17
|
+
# gem 'ruby-debug19'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ZenTest (4.4.2)
|
5
|
+
abstract (1.0.0)
|
6
|
+
actionmailer (3.0.3)
|
7
|
+
actionpack (= 3.0.3)
|
8
|
+
mail (~> 2.2.9)
|
9
|
+
actionpack (3.0.3)
|
10
|
+
activemodel (= 3.0.3)
|
11
|
+
activesupport (= 3.0.3)
|
12
|
+
builder (~> 2.1.2)
|
13
|
+
erubis (~> 2.6.6)
|
14
|
+
i18n (~> 0.4)
|
15
|
+
rack (~> 1.2.1)
|
16
|
+
rack-mount (~> 0.6.13)
|
17
|
+
rack-test (~> 0.5.6)
|
18
|
+
tzinfo (~> 0.3.23)
|
19
|
+
activemodel (3.0.3)
|
20
|
+
activesupport (= 3.0.3)
|
21
|
+
builder (~> 2.1.2)
|
22
|
+
i18n (~> 0.4)
|
23
|
+
activerecord (3.0.3)
|
24
|
+
activemodel (= 3.0.3)
|
25
|
+
activesupport (= 3.0.3)
|
26
|
+
arel (~> 2.0.2)
|
27
|
+
tzinfo (~> 0.3.23)
|
28
|
+
activeresource (3.0.3)
|
29
|
+
activemodel (= 3.0.3)
|
30
|
+
activesupport (= 3.0.3)
|
31
|
+
activesupport (3.0.3)
|
32
|
+
arel (2.0.6)
|
33
|
+
autotest (4.4.6)
|
34
|
+
ZenTest (>= 4.4.1)
|
35
|
+
builder (2.1.2)
|
36
|
+
capybara (0.4.0)
|
37
|
+
celerity (>= 0.7.9)
|
38
|
+
culerity (>= 0.2.4)
|
39
|
+
mime-types (>= 1.16)
|
40
|
+
nokogiri (>= 1.3.3)
|
41
|
+
rack (>= 1.0.0)
|
42
|
+
rack-test (>= 0.5.4)
|
43
|
+
selenium-webdriver (>= 0.0.27)
|
44
|
+
xpath (~> 0.1.2)
|
45
|
+
celerity (0.8.6)
|
46
|
+
childprocess (0.1.6)
|
47
|
+
ffi (~> 0.6.3)
|
48
|
+
culerity (0.2.13)
|
49
|
+
diff-lcs (1.1.2)
|
50
|
+
erubis (2.6.6)
|
51
|
+
abstract (>= 1.0.0)
|
52
|
+
fabrication (0.9.4)
|
53
|
+
ffi (0.6.3)
|
54
|
+
rake (>= 0.8.7)
|
55
|
+
forgery (0.3.6)
|
56
|
+
git (1.2.5)
|
57
|
+
i18n (0.5.0)
|
58
|
+
jeweler (1.5.2)
|
59
|
+
bundler (~> 1.0.0)
|
60
|
+
git (>= 1.2.5)
|
61
|
+
rake
|
62
|
+
json_pure (1.4.6)
|
63
|
+
mail (2.2.13)
|
64
|
+
activesupport (>= 2.3.6)
|
65
|
+
i18n (>= 0.4.0)
|
66
|
+
mime-types (~> 1.16)
|
67
|
+
treetop (~> 1.4.8)
|
68
|
+
mime-types (1.16)
|
69
|
+
nokogiri (1.4.4)
|
70
|
+
polyglot (0.3.1)
|
71
|
+
rack (1.2.1)
|
72
|
+
rack-mount (0.6.13)
|
73
|
+
rack (>= 1.0.0)
|
74
|
+
rack-test (0.5.6)
|
75
|
+
rack (>= 1.0)
|
76
|
+
rails (3.0.3)
|
77
|
+
actionmailer (= 3.0.3)
|
78
|
+
actionpack (= 3.0.3)
|
79
|
+
activerecord (= 3.0.3)
|
80
|
+
activeresource (= 3.0.3)
|
81
|
+
activesupport (= 3.0.3)
|
82
|
+
bundler (~> 1.0)
|
83
|
+
railties (= 3.0.3)
|
84
|
+
railties (3.0.3)
|
85
|
+
actionpack (= 3.0.3)
|
86
|
+
activesupport (= 3.0.3)
|
87
|
+
rake (>= 0.8.7)
|
88
|
+
thor (~> 0.14.4)
|
89
|
+
rake (0.8.7)
|
90
|
+
rspec (2.3.0)
|
91
|
+
rspec-core (~> 2.3.0)
|
92
|
+
rspec-expectations (~> 2.3.0)
|
93
|
+
rspec-mocks (~> 2.3.0)
|
94
|
+
rspec-core (2.3.1)
|
95
|
+
rspec-expectations (2.3.0)
|
96
|
+
diff-lcs (~> 1.1.2)
|
97
|
+
rspec-mocks (2.3.0)
|
98
|
+
rspec-rails (2.3.1)
|
99
|
+
actionpack (~> 3.0)
|
100
|
+
activesupport (~> 3.0)
|
101
|
+
railties (~> 3.0)
|
102
|
+
rspec (~> 2.3.0)
|
103
|
+
rubyzip (0.9.4)
|
104
|
+
selenium-webdriver (0.1.2)
|
105
|
+
childprocess (~> 0.1.5)
|
106
|
+
ffi (~> 0.6.3)
|
107
|
+
json_pure
|
108
|
+
rubyzip
|
109
|
+
sqlite3-ruby (1.3.2)
|
110
|
+
thor (0.14.6)
|
111
|
+
treetop (1.4.9)
|
112
|
+
polyglot (>= 0.3.1)
|
113
|
+
tzinfo (0.3.23)
|
114
|
+
will_paginate (3.0.pre2)
|
115
|
+
xpath (0.1.2)
|
116
|
+
nokogiri (~> 1.3)
|
117
|
+
|
118
|
+
PLATFORMS
|
119
|
+
ruby
|
120
|
+
|
121
|
+
DEPENDENCIES
|
122
|
+
autotest
|
123
|
+
capybara (>= 0.4.0)
|
124
|
+
fabrication
|
125
|
+
forgery
|
126
|
+
jeweler
|
127
|
+
rails
|
128
|
+
rspec-rails
|
129
|
+
sqlite3-ruby
|
130
|
+
will_paginate (~> 3.0.beta)
|
data/Rakefile
CHANGED
@@ -28,9 +28,10 @@ require 'jeweler'
|
|
28
28
|
|
29
29
|
Jeweler::Tasks.new do |gem|
|
30
30
|
gem.name = "puffer"
|
31
|
-
gem.summary = %Q{Admin interface
|
32
|
-
gem.description = %Q{
|
31
|
+
gem.summary = %Q{Admin interface builder}
|
32
|
+
gem.description = %Q{In Soviet Russia puffer admins you}
|
33
33
|
gem.email = "kinwizard@gmail.com"
|
34
34
|
gem.homepage = "http://github.com/puffer/puffer"
|
35
35
|
gem.authors = ["pyromaniac"]
|
36
36
|
end
|
37
|
+
Jeweler::GemcutterTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<title><%= [@title, 'Puffer'].compact.join(' - ') %></title>
|
5
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
6
|
+
<%= csrf_meta_tag %>
|
7
|
+
<%= stylesheet_link_tag 'terbium_reset' %>
|
8
|
+
<%= stylesheet_link_tag 'terbium' %>
|
9
|
+
<%= yield :stylesheet %>
|
10
|
+
<%= javascript_include_tag 'prototype', 'effects', 'dragdrop', 'controls' %>
|
11
|
+
<%= javascript_include_tag 'terbium' %>
|
12
|
+
<%= javascript_include_tag 'terbium_popup' %>
|
13
|
+
<%= yield :javascript %>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div class="header">
|
17
|
+
<div class="logo"><a href="/admin">Puffer</a></div>
|
18
|
+
<ul class="navigation">
|
19
|
+
<%= puffer_navigation do |title, path| %>
|
20
|
+
<li<%= raw(current_path.include?(path) ? ' class="selected"' : '') %>><%= link_to title, path %></li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|
23
|
+
<div class="logout">
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<div class="additional_navigation" id="additional_navigation">
|
27
|
+
<%= yield :additional_navigation %>
|
28
|
+
</div>
|
29
|
+
<div class="body">
|
30
|
+
<div class="content">
|
31
|
+
<%= yield %>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<% if flash[:notice] %>
|
35
|
+
<div class="notice" id="notice"><%= flash[:notice] %></div>
|
36
|
+
<% end %>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= f.error_messages %>
|
2
|
+
|
3
|
+
<ul>
|
4
|
+
<% case action
|
5
|
+
when 'new' then
|
6
|
+
@fields = controller.create_fields || controller.form_fields
|
7
|
+
when 'edit' then
|
8
|
+
@fields = controller.update_fields || controller.form_fields
|
9
|
+
end %>
|
10
|
+
<% @fields.each do |field| -%>
|
11
|
+
<li><%= f.terbium_field field %></li>
|
12
|
+
<% end -%>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<div class="buttons">
|
16
|
+
<%= f.submit 'Save' %>
|
17
|
+
<%= f.submit 'Save and exit' %>
|
18
|
+
<%= link_to 'cancel', request.referer %>
|
19
|
+
</div>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<% ids = "$$('#associated_#{field} input[type=hidden]').collect(function(element){return $F(element)})" %>
|
2
|
+
<div class="header">
|
3
|
+
<div class="popup_close"><%= link_to t(:close), '#', :terbium_popup_close => true %></div>
|
4
|
+
<ul class="navigation">
|
5
|
+
<li<%= ' class="selected"' if params[:action] == "associated_#{field}" %>>
|
6
|
+
<%= link_to t(:existing), '#', :ajax => resource_path(record, "associated_#{field}"), :ids => ids %>
|
7
|
+
</li>
|
8
|
+
<li<%= ' class="selected"' if params[:action] == "associated_#{field}_choosing" %>>
|
9
|
+
<%= link_to t(:choosing), '#', :ajax => resource_path(record, "associated_#{field}_choosing"), :ids => ids %>
|
10
|
+
</li>
|
11
|
+
<li class="notab">
|
12
|
+
<% form_tag '#', :class => 'associated_search', :ajax => current_path, :ids => ids do %>
|
13
|
+
<%= text_field_tag :query, resource_session[:query] %>
|
14
|
+
<%= submit_tag 'Search' %>
|
15
|
+
<% if resource_session[:query].present? %>
|
16
|
+
<%= link_to 'clear', '#', :ajax => current_path(:query => ''), :ids => ids %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
</li>
|
20
|
+
</ul>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="pagination">
|
24
|
+
<%= will_paginate associated, :renderer => AssociatedLinkRenderer, :ids => ids %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="popup_content">
|
28
|
+
<table class="list_table">
|
29
|
+
<thead>
|
30
|
+
<tr>
|
31
|
+
<% field.association_fields.each do |f| -%>
|
32
|
+
<th><%= f.label %></th>
|
33
|
+
<% end -%>
|
34
|
+
<th class="actions">Actions</th>
|
35
|
+
</tr>
|
36
|
+
</thead>
|
37
|
+
<tbody>
|
38
|
+
<% associated.each do |association| -%>
|
39
|
+
<tr id="<%= dom_id association %>">
|
40
|
+
<% field.association_fields.each do |f| -%>
|
41
|
+
<td><%= render_field association, f %></td>
|
42
|
+
<% end -%>
|
43
|
+
<td class="actions">
|
44
|
+
<%= link_to t(:show), resource_path(association), :target => '_blank' if (resource_path(association) rescue nil) %>
|
45
|
+
<% if params[:action] == "associated_#{field}" %>
|
46
|
+
<%= link_to_function t(:remove), "$('associated_#{field}_#{association.id}').remove(); $('#{dom_id association}').remove()" %>
|
47
|
+
<% else %>
|
48
|
+
<%= link_to_function t(:add), "$('associated_#{field}').insert({bottom: \"#{escape_javascript hidden_field_tag("#{model_name}[#{field.to_s.singularize}_ids][]", association.id, :id => "associated_#{field}_#{association.id}")}\"}); $('#{dom_id association}').remove()" %>
|
49
|
+
<%= link_to_function t(:add), "$('associated_#{field}').replace(\"#{escape_javascript render(:partial => "terbium/association/many", :object => @choosen + [association], :locals => {:field => field})}\"); Event.addBehavior.reload()" %>
|
50
|
+
<% end %>
|
51
|
+
</td>
|
52
|
+
</tr>
|
53
|
+
<% end -%>
|
54
|
+
</tbody>
|
55
|
+
</table>
|
56
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
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>
|
@@ -0,0 +1 @@
|
|
1
|
+
page.replace_html 'terbium_popup', :partial => 'terbium/associated/many', :locals => {:field => @field, :associated => @records}
|
@@ -0,0 +1 @@
|
|
1
|
+
page.replace_html 'terbium_popup', :partial => 'terbium/associated/one', :locals => {:field => @field, :associated => @records}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div id="associated_<%= field %>">
|
2
|
+
<%= link_to "#{t(:choose_associated)} (#{many.size})", '#', :terbium_popup => resource_path(record, "associated_#{field}"), :ids => "$$('#associated_#{field} input[type=hidden]').collect(function(element){return $F(element)})" %>
|
3
|
+
<%= hidden_field_tag "#{model_name}[#{field.to_s.singularize}_ids][]" %>
|
4
|
+
<% many.each do |association| %>
|
5
|
+
<%= hidden_field_tag "#{model_name}[#{field.to_s.singularize}_ids][]", association.id, :id => "associated_#{field}_#{association.id}" %>
|
6
|
+
<% end %>
|
7
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
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>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% @title = "Edit #{controller.model_name.humanize.downcase}" %>
|
2
|
+
<h1><%= @title %></h1>
|
3
|
+
<% form_for record, :url => resource_path, :html => {:multipart => true} do |f| %>
|
4
|
+
<%= hidden_field_tag :edit_locale, params[:edit_locale] if params[:edit_locale] %>
|
5
|
+
|
6
|
+
<%= render :partial => 'terbium/form', :locals => { :f => f, :action => 'edit' } %>
|
7
|
+
<% end %>
|
8
|
+
<% content_for :additional_navigation do %>
|
9
|
+
<ul class="buttons">
|
10
|
+
<% 0.upto(resource_ancestors_records.length - 1) do |i| %>
|
11
|
+
<li><%= link_to resource_ancestors[i].to_s.pluralize.humanize, polymorphic_path([route_prefix] + resource_ancestors_records[0..i-3] + [resource_ancestors[i].to_s.pluralize]) %></li>
|
12
|
+
<li><%= link_to resource_ancestors_records[i].to_title, polymorphic_path([route_prefix] + resource_ancestors_records[0..i]) %></li>
|
13
|
+
<% end %>
|
14
|
+
<% if plural? %>
|
15
|
+
<li><%= link_to controller.model_name.pluralize.humanize, resources_path %></li>
|
16
|
+
<% else %>
|
17
|
+
<li><%= link_to resource.humanize, resource_path %></li>
|
18
|
+
<% end %>
|
19
|
+
</ul>
|
20
|
+
<% end %>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<% @title = current_resource.human_name %>
|
2
|
+
<h1><%= @title %></h1>
|
3
|
+
<% if respond_to? :will_paginate %>
|
4
|
+
<%= will_paginate @records, :url => current_resource.index_path(:page => '') %>
|
5
|
+
<% end %>
|
6
|
+
<div class="columns">
|
7
|
+
<div class="row">
|
8
|
+
<div class="column left_column">
|
9
|
+
<% if @records.empty? %>
|
10
|
+
<p>Sorry, but there is no records in <%= current_resource.human_name %></p>
|
11
|
+
<% else %>
|
12
|
+
<table class="list_table">
|
13
|
+
<thead>
|
14
|
+
<tr>
|
15
|
+
<% index_fields.each do |field| -%>
|
16
|
+
<th><%= render_head field %></th>
|
17
|
+
<% end -%>
|
18
|
+
<th class="actions">Actions</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% @records.each do |record| -%>
|
23
|
+
<tr>
|
24
|
+
<% index_fields.each do |field| -%>
|
25
|
+
<td><%= render_field record, field %></td>
|
26
|
+
<% end -%>
|
27
|
+
<td class="actions">
|
28
|
+
<%= link_to 'show', current_resource.path(record), :class => 'show_entry' if controller.show_fields || resource_children.present? %>
|
29
|
+
<%= link_to 'edit', current_resource.edit_path(record), :class => 'edit_entry' if controller.update_fields || controller.form_fields %>
|
30
|
+
<%= link_to 'destroy', current_resource.path(record), :confirm => "Are you sure?", :method => :delete, :class => 'remove_entry' if current_config.destroy %>
|
31
|
+
<% current_resource.children(:post_id => record.id).each do |child| %>
|
32
|
+
<% if child.plural? %>
|
33
|
+
<p><%= link_to "#{child.human_name}(#{child.collection.size})", child.index_path %></p>
|
34
|
+
<% else %>
|
35
|
+
<p><%= link_to "#{child.member ? 'Edit' : 'Add'} #{child.human_name}", child.index_path %></p>
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
38
|
+
</td>
|
39
|
+
</tr>
|
40
|
+
<% end -%>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
<div class="column right_column panel">
|
46
|
+
<dl>
|
47
|
+
<dt>Search</dt>
|
48
|
+
<dd>
|
49
|
+
<%= form_tag current_resource.index_path, {:method => :get} do %>
|
50
|
+
<%= text_field_tag :query, resource_session[:query] %>
|
51
|
+
<%= submit_tag 'Search' %>
|
52
|
+
<% if resource_session[:query].present? %>
|
53
|
+
<%= link_to 'clear', current_resource.index_path(:query => '') %>
|
54
|
+
<% end %>
|
55
|
+
<% end %>
|
56
|
+
</dd>
|
57
|
+
<% boolean_fields.each do |field| %>
|
58
|
+
<dt><%= field.label %></dt>
|
59
|
+
<dd>
|
60
|
+
<ul>
|
61
|
+
<% [['All', nil], ['Yes', '1'], ['No', '0'], ['Not set', 'nil']].each do |option| %>
|
62
|
+
<li><%= link_to_unless resource_session[:boolean][field.query_column] == option[1], option[0], current_resource.index_path(:boolean => { field.query_column => option[1]}) %></li>
|
63
|
+
<% end %>
|
64
|
+
</ul>
|
65
|
+
</dd>
|
66
|
+
<% end %>
|
67
|
+
</dl>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
<% if respond_to? :will_paginate %>
|
72
|
+
<%= will_paginate @records, :url => current_resource.index_path(:page => '') %>
|
73
|
+
<% end %>
|
74
|
+
|
75
|
+
<% content_for :additional_navigation do %>
|
76
|
+
<ul class="buttons">
|
77
|
+
<% current_resource.ancestors.each do |resource| %>
|
78
|
+
<%= link_to resource.plural? ? resource.human_name : resource.member.to_title, resource.index_path %>
|
79
|
+
<%= link_to resource.member.to_title, resource.path unless resource.plural? %>
|
80
|
+
<% end %>
|
81
|
+
<%= link_to current_resource.plural? ? current_resource.human_name : current_resource.member.to_title, current_resource.index_path %>
|
82
|
+
</ul>
|
83
|
+
<% end %>
|