refinerycms 0.9.6.5 → 0.9.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/application.rb +1 -1
- data/app/controllers/application_controller.rb +1 -1
- data/config/environment.rb +2 -2
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/preinitializer.rb +1 -1
- data/db/migrate/20100114092849_add_themes_table.rb +12 -12
- data/db/migrate/20100202034802_remove_custom_title_image_id_and_image_id_from_pages.rb +6 -6
- data/db/schema.rb +1 -1
- data/db/seeds.rb +2 -2
- data/lib/refinery_initializer.rb +1 -1
- data/public/javascripts/refinery/admin.js +61 -61
- data/readme.md +3 -3
- data/test/files/The world!.gif +0 -0
- data/test/files/car-wallpapers19.jpg +0 -0
- data/test/fixtures/images.yml +14 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/image_test.rb +19 -8
- data/test/unit/page_part_test.rb +11 -11
- data/test/unit/page_test.rb +125 -125
- data/vendor/plugins/authentication/app/controllers/users_controller.rb +20 -20
- data/vendor/plugins/authentication/app/models/user.rb +5 -5
- data/vendor/plugins/authentication/app/views/user_mailer/reset_notification.html.erb +2 -2
- data/vendor/plugins/authentication/app/views/users/forgot.html.erb +1 -1
- data/vendor/plugins/authentication/app/views/users/reset.html.erb +2 -2
- data/vendor/plugins/authentication/config/routes.rb +4 -4
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +1 -1
- data/vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +1 -1
- data/vendor/plugins/dashboard/rails/init.rb +1 -1
- data/vendor/plugins/images/app/models/image.rb +14 -14
- data/vendor/plugins/images/app/views/admin/images/_form.html.erb +1 -8
- data/vendor/plugins/images/app/views/admin/images/insert.html.erb +1 -1
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +3 -3
- data/vendor/plugins/inquiries/app/views/inquiries/new.html.erb +1 -1
- data/vendor/plugins/inquiries/app/views/inquiries/thank_you.html.erb +1 -1
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/controllers/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/views/news_items/index.html.erb +1 -1
- data/vendor/plugins/news/app/views/news_items/show.html.erb +1 -1
- data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +1 -1
- data/vendor/plugins/pages/app/models/page.rb +42 -42
- data/vendor/plugins/pages/app/models/page_part.rb +1 -1
- data/vendor/plugins/pages/app/presenters/page_presenter.rb +1 -1
- data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_list.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +1 -1
- data/vendor/plugins/pages/app/views/pages/home.html.erb +1 -1
- data/vendor/plugins/pages/app/views/pages/show.html.erb +1 -1
- data/vendor/plugins/pages/rails/init.rb +5 -5
- data/vendor/plugins/rails_indexes/lib/indexer.rb +49 -47
- data/vendor/plugins/rails_indexes/tasks/indexer.rake +5 -3
- data/vendor/plugins/rails_indexes/test/fixtures/app/controllers/users_controller.rb +3 -3
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/address.rb +2 -2
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/company.rb +4 -4
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/country.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/freelancer.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/gift.rb +4 -4
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/god.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/user.rb +7 -6
- data/vendor/plugins/rails_indexes/test/fixtures/app/sweepers/user_sweeper.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/schema.rb +9 -9
- data/vendor/plugins/rails_indexes/test/rails_indexes_test.rb +18 -18
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/layouts/application.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_content_page.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_head.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_header.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +5 -5
- data/vendor/plugins/refinery/app/views/shared/_submenu.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_continue_editing.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_error_messages_for.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +27 -13
- data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_sortable_list.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_sortable_list.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/index.html.erb +2 -2
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/index.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/show.html.erb +1 -1
- data/vendor/plugins/refinery/lib/refinery/activity.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +4 -4
- data/vendor/plugins/refinery/lib/refinery/application_helper.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/base_presenter.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +1 -1
- data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +1 -1
- data/vendor/plugins/resources/app/models/resource.rb +8 -8
- data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +1 -1
- data/vendor/plugins/resources/app/views/admin/resources/index.html.erb +1 -1
- data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +1 -1
- data/vendor/plugins/resources/config/routes.rb +2 -2
- data/vendor/plugins/resources/rails/init.rb +1 -1
- data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +17 -17
- data/vendor/plugins/themes/app/models/theme.rb +40 -40
- data/vendor/plugins/themes/app/views/admin/themes/_form.html.erb +1 -1
- data/vendor/plugins/themes/config/routes.rb +2 -2
- data/vendor/plugins/themes/lib/theme_server.rb +26 -0
- data/vendor/plugins/themes/rails/init.rb +3 -1
- metadata +6 -3
- data/vendor/plugins/themes/app/controllers/themes_controller.rb +0 -45
@@ -2,10 +2,10 @@ class Company < ActiveRecord::Base
|
|
2
2
|
|
3
3
|
belongs_to :owner, :foreign_key => 'owner_id', :class_name => 'User'
|
4
4
|
belongs_to :country
|
5
|
-
|
5
|
+
|
6
6
|
has_one :address, :as => :addressable
|
7
|
-
|
7
|
+
|
8
8
|
has_many :users
|
9
|
-
|
9
|
+
|
10
10
|
has_and_belongs_to_many :freelancers
|
11
|
-
end
|
11
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class Gift < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
set_primary_key :custom_primary_key
|
4
4
|
has_and_belongs_to_many :users, :join_table => "purchases", :association_foreign_key => 'buyer_id', :foreign_key => 'present_id'
|
5
|
-
|
5
|
+
|
6
6
|
def search_all(name, price)
|
7
7
|
Gift.find_all_by_name_and_price(name, price)
|
8
8
|
end
|
9
|
-
|
10
|
-
end
|
9
|
+
|
10
|
+
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
class User < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
has_one :company, :foreign_key => 'owner_id'
|
4
|
-
has_one :address, :as => :addressable
|
4
|
+
has_one :address, :as => :addressable
|
5
5
|
|
6
6
|
has_and_belongs_to_many :users, :join_table => "purchases", :association_foreign_key => 'present_id', :foreign_key => 'buyer_id'
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
validates_uniqueness_of :name
|
9
|
+
|
9
10
|
def search_via_email(email = "user@domain.com")
|
10
11
|
self.find_by_email(email)
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
def search_via_email_and_name(email, name)
|
14
15
|
self.find_by_email_and_name(email, name)
|
15
16
|
end
|
16
|
-
end
|
17
|
+
end
|
@@ -3,44 +3,44 @@ ActiveRecord::Schema.define do
|
|
3
3
|
t.column "name", :text
|
4
4
|
t.column "email", :text
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
create_table "companies", :force => true do |t|
|
8
8
|
t.column "name", :text
|
9
9
|
t.column "owned_id", :integer
|
10
10
|
t.column "country_id", :integer
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
add_index :companies, :country_id
|
14
|
-
|
14
|
+
|
15
15
|
create_table "addresses", :force => true do |t|
|
16
16
|
t.column "addressable_type", :string
|
17
17
|
t.column "addressable_id", :integer
|
18
18
|
t.column "address", :text
|
19
19
|
t.column "country_id", :integer
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
create_table "freelancers", :force => true do |t|
|
23
23
|
t.column "name", :string
|
24
24
|
t.column "price_per_hour", :integer
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
create_table "companies_freelancers", :force => true do |t|
|
28
28
|
t.column "freelancer_id", :integer
|
29
29
|
t.column "company_id", :integer
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
create_table "gifts", :force => true do |t|
|
33
33
|
t.column "custom_primary_key", :integer
|
34
34
|
t.column "name", :string
|
35
35
|
t.column "price", :integer
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
create_table "purchases", :force => true do |t|
|
39
39
|
t.column "present_id", :integer
|
40
40
|
t.column "buyer_id", :integer
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
create_table "countries", :force => true do |t|
|
44
44
|
t.column "name", :string
|
45
45
|
end
|
46
|
-
end
|
46
|
+
end
|
@@ -1,51 +1,51 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class RailsIndexesTest < ActiveSupport::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
test "relationship indexes are found" do
|
6
6
|
@relationship_indexes = Indexer.check_for_indexes
|
7
7
|
|
8
8
|
assert @relationship_indexes.size > 0
|
9
|
-
|
9
|
+
|
10
10
|
assert @relationship_indexes.has_key?("companies")
|
11
11
|
assert @relationship_indexes.has_key?("companies_freelancers")
|
12
12
|
assert @relationship_indexes.has_key?("addresses")
|
13
13
|
assert @relationship_indexes.has_key?("purchases")
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
# should add 2 composite indexes or each pair
|
17
17
|
test "has_and_belongs_to_many" do
|
18
18
|
@relationship_indexes = Indexer.check_for_indexes(true)
|
19
|
-
|
19
|
+
|
20
20
|
assert @relationship_indexes["companies_freelancers"].include?(["company_id", "freelancer_id"])
|
21
21
|
assert @relationship_indexes["companies_freelancers"].include?(["freelancer_id", "company_id"])
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
test "has_and_belongs_to_many with custom columns" do
|
25
25
|
@relationship_indexes = Indexer.check_for_indexes(true)
|
26
|
-
|
26
|
+
|
27
27
|
assert @relationship_indexes["purchases"].include?(["present_id", "buyer_id"])
|
28
28
|
assert @relationship_indexes["purchases"].include?(["buyer_id", "present_id"])
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
test "belongs_to" do
|
32
32
|
@relationship_indexes = Indexer.check_for_indexes(true)
|
33
33
|
assert @relationship_indexes["addresses"].include?("country_id")
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
test "belongs_to with a custom foreign key" do
|
37
37
|
@relationship_indexes = Indexer.check_for_indexes(true)
|
38
38
|
assert @relationship_indexes["companies"].include?("owner_id")
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
test "should not add an already existing index" do
|
42
42
|
@relationship_indexes = Indexer.check_for_indexes(true)
|
43
43
|
assert !(@relationship_indexes["companies"].include?("country_id"))
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
test "default find_by indexes for primary keys" do
|
47
47
|
@find_by_indexes = Indexer.ar_find_indexes(false)
|
48
|
-
|
48
|
+
|
49
49
|
# Default added the primary key for each table
|
50
50
|
assert @find_by_indexes.has_key?("users")
|
51
51
|
assert @find_by_indexes.has_key?("companies")
|
@@ -53,30 +53,30 @@ class RailsIndexesTest < ActiveSupport::TestCase
|
|
53
53
|
assert @find_by_indexes.has_key?("freelancers")
|
54
54
|
assert @find_by_indexes.has_key?("countries")
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
test "default find_by indexes for custom primary keys" do
|
58
58
|
@find_by_indexes = Indexer.ar_find_indexes(false)
|
59
59
|
|
60
60
|
assert @find_by_indexes["gifts"].include?("custom_primary_key")
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
test "find_by indexes for self.find_by_email_and_name" do
|
64
64
|
@find_by_indexes = Indexer.ar_find_indexes(false)
|
65
|
-
|
65
|
+
|
66
66
|
assert @find_by_indexes["users"].include?(["name", "email"])
|
67
67
|
assert @find_by_indexes["users"].include?(["email", "name"])
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
test "find_by indexes for Gift.find_all_by_name_and_price" do
|
71
71
|
@find_by_indexes = Indexer.ar_find_indexes(false)
|
72
|
-
|
72
|
+
|
73
73
|
assert @find_by_indexes["gifts"].include?(["name", "price"])
|
74
74
|
assert @find_by_indexes["gifts"].include?(["price", "name"])
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
test "find_by indexes from UsersController" do
|
78
78
|
@find_by_indexes = Indexer.ar_find_indexes(false)
|
79
|
-
|
79
|
+
|
80
80
|
assert @find_by_indexes["freelancers"].include?("name")
|
81
81
|
|
82
82
|
end
|
@@ -15,4 +15,4 @@
|
|
15
15
|
<%= javascript_include_tag 'admin', 'thickbox', 'wymeditor/jquery.refinery.wymeditor.js', 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
|
16
16
|
<%= javascript_include_tag "http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js" if RefinerySetting.find_or_set(:show_firebug_lite, false) -%>
|
17
17
|
<%= yield :head %>
|
18
|
-
</head>
|
18
|
+
</head>
|
@@ -8,10 +8,10 @@
|
|
8
8
|
<% if menu_branch.in_menu? %>
|
9
9
|
<li<%= " class='#{css.join(' ')}'" if css.present? -%><%= " id='#{domid}'" if domid.present? -%>>
|
10
10
|
<%= link_to menu_branch.title, menu_branch.url %>
|
11
|
-
<%
|
12
|
-
unless hide_children or
|
13
|
-
menu_branch.parent_id.present? or
|
14
|
-
(children = menu_branch.children.collect{|c| c if c.in_menu? }.compact).empty?
|
11
|
+
<%
|
12
|
+
unless hide_children or
|
13
|
+
menu_branch.parent_id.present? or
|
14
|
+
(children = menu_branch.children.collect{|c| c if c.in_menu? }.compact).empty?
|
15
15
|
-%>
|
16
16
|
<ul class='clearfix'>
|
17
17
|
<%= render :partial => "/shared/menu_branch",
|
@@ -20,4 +20,4 @@
|
|
20
20
|
</ul>
|
21
21
|
<% end -%>
|
22
22
|
</li>
|
23
|
-
<% end -%>
|
23
|
+
<% end -%>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<%= error_messages_for symbol %>
|
2
|
-
<input type='hidden' id='fieldsWithErrors' value='<%= object.errors.collect { |attrib, msg| "#{object.class.name.underscore}_#{attrib}"}.join(",") %>' />
|
2
|
+
<input type='hidden' id='fieldsWithErrors' value='<%= object.errors.collect { |attrib, msg| "#{object.class.name.underscore}_#{attrib}"}.join(",") %>' />
|
@@ -2,33 +2,47 @@
|
|
2
2
|
description ||= "image"
|
3
3
|
thumbnail ||= "medium"
|
4
4
|
toggle_image_display ||= false
|
5
|
+
randomiser = rand(Time.now.yesterday.to_i * Time.now.to_i)
|
5
6
|
-%>
|
6
|
-
<%= link_to "Show", "", :id => "
|
7
|
-
<%= f.hidden_field field, :id =>
|
7
|
+
<%= link_to "Show", "", :id => "current_image_toggler_#{randomiser}" if toggle_image_display -%>
|
8
|
+
<%= f.hidden_field field, :id => "current_image_id_#{randomiser}" -%>
|
8
9
|
|
9
|
-
<div id='
|
10
|
-
<a id='
|
10
|
+
<div id='current_image_container_<%= randomiser %>'<%= " style='display: none'" if toggle_image_display %> style="margin-top: 10px;">
|
11
|
+
<a id='current_image_link_<%= randomiser %>' href="<%= insert_admin_images_url %>?thickbox=true&modal=true&titlebar=true&callback=image_picker_<%= randomiser %>_changed&KeepThis=true&TB_iframe=true&width=958&height=510" style='border: 0px' title='Change <%= description.titleize %>' name='Change <%= description.titleize %>' class='thickbox'>
|
11
12
|
<% unless image.nil? -%>
|
12
13
|
<%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image"} %>
|
13
14
|
<% else -%>
|
14
|
-
<img id="
|
15
|
+
<img id="current_picked_image_<%= randomiser %>" class="" src="" alt="" style='display: none' />
|
15
16
|
<% end -%>
|
16
|
-
<p id='
|
17
|
+
<p id='no_picked_image_selected_<%= randomiser %>' <%= "style='display: none;'" if image.present? %>>
|
17
18
|
There is currently no <%= description %> selected, please click here to add one.
|
18
19
|
</p>
|
19
20
|
</a>
|
20
21
|
<br/>
|
21
|
-
<%= link_to "Remove current #{description}", "#", :id => "
|
22
|
+
<%= link_to "Remove current #{description}", "#", :id => "remove_picked_image_#{randomiser}", :style => "#{"display:none;" if image.nil?}" %>
|
22
23
|
</div>
|
23
24
|
|
24
25
|
<% content_for :head do -%>
|
25
26
|
<script type='text/javascript'>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
// We're so un-object-oriented here. We need to rewrite the jQuery admin.js file to use OO.
|
28
|
+
var image_picker_<%= randomiser %>_options = {
|
29
|
+
thumbnail: '<%= thumbnail %>'
|
30
|
+
, toggle_image_display: <%= toggle_image_display.to_s %>
|
31
|
+
, description: '<%= description %>'
|
32
|
+
, field: '#current_image_id_<%= randomiser %>'
|
33
|
+
, image_display: '#current_picked_image_<%= randomiser %>'
|
34
|
+
, no_image_message: '#no_picked_image_selected_<%= randomiser %>'
|
35
|
+
, remove_image_button: '#remove_picked_image_<%= randomiser %>'
|
36
|
+
, image_container: '#current_image_container_<%= randomiser %>'
|
37
|
+
};
|
38
|
+
|
39
|
+
$(document).ready(function(e) {
|
40
|
+
image_picker.init(image_picker_<%= randomiser %>_options);
|
32
41
|
});
|
42
|
+
|
43
|
+
image_picker_<%= randomiser %>_changed = function(args) {
|
44
|
+
image_picker.init(image_picker_<%= randomiser %>_options);
|
45
|
+
image_picker.changed(args);
|
46
|
+
}
|
33
47
|
</script>
|
34
48
|
<% end %>
|
data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_sortable_list.html.erb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
<%%= render :partial => '<%= singular_name %>', :collection => @<%= plural_name %> %>
|
2
|
-
<%%= render :partial => "/shared/admin/sortable_list", :locals => {:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)} %>
|
2
|
+
<%%= render :partial => "/shared/admin/sortable_list", :locals => {:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)} %>
|