refinerycms-core 2.0.2 → 2.0.3
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/app/assets/javascripts/refinery/admin.js.erb +25 -20
- data/app/assets/javascripts/refinery/site_bar.js +12 -14
- data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +2 -1
- data/app/assets/stylesheets/refinery/{refinery.css.scss → layout.css.scss} +1 -7
- data/app/assets/stylesheets/refinery/refinery.css +15 -0
- data/app/controllers/refinery/admin/{refinery_core_controller.rb → core_controller.rb} +2 -2
- data/app/controllers/refinery/admin_controller.rb +4 -1
- data/app/helpers/refinery/admin/core_helper.rb +6 -0
- data/app/helpers/refinery/admin/dialogs_helper.rb +6 -0
- data/app/helpers/refinery/admin_helper.rb +4 -0
- data/app/helpers/refinery/fast_helper.rb +4 -0
- data/app/helpers/refinery/sitemap_helper.rb +4 -0
- data/app/models/refinery/core/base_model.rb +0 -2
- data/config/routes.rb +1 -1
- data/lib/generators/refinery/cms/cms_generator.rb +24 -10
- data/lib/generators/refinery/cms/templates/.gitignore +3 -0
- data/lib/generators/refinery/dummy/dummy_generator.rb +21 -21
- data/lib/generators/refinery/engine/templates/.gitignore +2 -0
- data/lib/generators/refinery/engine/templates/Gemfile +1 -1
- data/lib/generators/refinery/engine/templates/lib/generators/refinery/extension_plural_name_generator.rb +1 -0
- data/lib/generators/refinery/engine/templates/script/rails +10 -0
- data/lib/generators/refinery/form/templates/.gitignore +2 -0
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name.rb +1 -0
- data/lib/generators/refinery/form/templates/script/rails +10 -0
- data/lib/refinery/application_controller.rb +9 -2
- data/lib/refinery/core/engine.rb +9 -18
- data/lib/refinery/core.rb +5 -6
- data/lib/refinery/menu.rb +2 -18
- data/lib/refinery/menu_item.rb +1 -5
- data/lib/refinery/version.rb +1 -1
- data/spec/controllers/refinery/admin/refinery_core_controller_spec.rb +4 -4
- data/spec/controllers/refinery/fast_controller_spec.rb +1 -1
- data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +0 -3
- data/spec/lib/refinery/application_controller_spec.rb +15 -0
- data/spec/support/database_cleaner.rb +1 -1
- metadata +170 -171
- data/lib/generators/refinery/cms/templates/config/initializers/devise.rb +0 -229
@@ -173,29 +173,33 @@ submit_and_continue = function(e, redirect_to) {
|
|
173
173
|
$('.fieldWithErrors').removeClass('fieldWithErrors').addClass('field');
|
174
174
|
$('#flash_container .errorExplanation').remove();
|
175
175
|
|
176
|
-
$.post(
|
177
|
-
|
178
|
-
|
176
|
+
$.post(
|
177
|
+
$('#continue_editing').get(0).form.action
|
178
|
+
, $($('#continue_editing').get(0).form).serialize()
|
179
|
+
, function(data) {
|
180
|
+
if (($flash_container = $('#flash_container')).length > 0) {
|
181
|
+
$flash_container.html(data);
|
179
182
|
|
180
|
-
|
183
|
+
$('#flash').css({'width': 'auto', 'visibility': null}).fadeIn(550);
|
181
184
|
|
182
|
-
|
185
|
+
$('.errorExplanation').not($('#flash_container .errorExplanation')).remove();
|
183
186
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
187
|
+
if ((error_fields = $('#fieldsWithErrors').val()) != null) {
|
188
|
+
$.each(error_fields.split(','), function() {
|
189
|
+
$("#" + this).wrap("<div class='fieldWithErrors' />");
|
190
|
+
});
|
191
|
+
} else if (redirect_to) {
|
192
|
+
window.location = redirect_to;
|
193
|
+
}
|
191
194
|
|
192
|
-
|
195
|
+
$('.fieldWithErrors:first :input:first').focus();
|
193
196
|
|
194
|
-
|
197
|
+
$('#continue_editing').val(false);
|
195
198
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
+
init_flash_messages();
|
200
|
+
}
|
201
|
+
}, 'html'
|
202
|
+
);
|
199
203
|
|
200
204
|
e.preventDefault();
|
201
205
|
};
|
@@ -398,13 +402,14 @@ var link_dialog = {
|
|
398
402
|
},
|
399
403
|
|
400
404
|
init_resources_submit: function(){
|
405
|
+
<% absolute_page_links = defined?(Refinery::Pages) && Refinery::Pages.absolute_page_links %>
|
401
406
|
$('#existing_resource_area .form-actions-dialog #submit_button').click(function(e){
|
402
407
|
e.preventDefault();
|
403
408
|
if((resource_selected = $('#existing_resource_area_content ul li.linked a')).length > 0) {
|
404
409
|
resourceUrl = parseURL(resource_selected.attr('href'));
|
405
|
-
relevant_href = <%=
|
410
|
+
relevant_href = <%= absolute_page_links ? "resource_selected.attr('href')" : "resourceUrl.pathname" %>;
|
406
411
|
|
407
|
-
<% unless
|
412
|
+
<% unless absolute_page_links %>
|
408
413
|
// Add any alternate resource stores that need a absolute URL in the regex below
|
409
414
|
if(resourceUrl.hostname.match(/s3.amazonaws.com/)) {
|
410
415
|
relevant_href = resourceUrl.protocol + '//' + resourceUrl.host + relevant_href;
|
@@ -455,7 +460,7 @@ var link_dialog = {
|
|
455
460
|
|
456
461
|
var link = $(this).children('a.page_link').get(0);
|
457
462
|
var port = (window.location.port.length > 0 ? (":" + window.location.port) : "");
|
458
|
-
var url = link.href<%= %q{.replace(window.location.protocol + "//" + window.location.hostname + port, "")} unless Refinery::Pages.absolute_page_links %>;
|
463
|
+
var url = link.href<%= %q{.replace(window.location.protocol + "//" + window.location.hostname + port, "")} unless defined?(Refinery::Pages) && Refinery::Pages.absolute_page_links %>;
|
459
464
|
|
460
465
|
link_dialog.update_parent(url, link.rel.replace(/\ ?<em>.+?<\/em>/, ''));
|
461
466
|
});
|
@@ -1,16 +1,14 @@
|
|
1
|
-
|
2
|
-
$(
|
3
|
-
|
4
|
-
$logo.css('left', ($('#site_bar_content').width() / 2) - ($logo.width() / 2));
|
1
|
+
(function($) {
|
2
|
+
$logo = $('#site_bar_content #site_bar_refinery_cms_logo');
|
3
|
+
$logo.css('left', ($('#site_bar_content').width() / 2) - ($logo.width() / 2));
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
$switch_anchor = $('#editor_switch a').not('.ie7 #editor_switch a, .ie6 #editor_switch a');
|
6
|
+
if ($.isFunction($switch_anchor.corner)) {
|
7
|
+
$switch_anchor.corner('6px');
|
8
|
+
}
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}
|
10
|
+
$('#editor_switch a').appendTo((span = $('<span></span>').prependTo('#editor_switch')));
|
11
|
+
if ($.isFunction(span.corner)) {
|
12
|
+
span.corner('6px');
|
13
|
+
}
|
14
|
+
})(jQuery);
|
@@ -5,4 +5,5 @@
|
|
5
5
|
|
6
6
|
if (continue_editing_button = $("#continue_editing")).length > 0 and continue_editing_button.attr("rel") != "no-prompt"
|
7
7
|
$("#editor_switch a").click (e) ->
|
8
|
-
|
8
|
+
if $("form[data-changes-made]").length > 0
|
9
|
+
e.preventDefault() unless confirm("<%= ::I18n.t('confirm_changes', :scope => 'refinery.js.admin') %>")
|
@@ -1565,10 +1565,4 @@ a.information:hover {
|
|
1565
1565
|
}
|
1566
1566
|
.ie8 .pagination a, .ie8 #content .pagination a, .ie8 .pagination .current, .ie8 .disabled, .ie8 .pagination em {
|
1567
1567
|
padding-bottom: 6px;
|
1568
|
-
}
|
1569
|
-
|
1570
|
-
@import 'site_bar';
|
1571
|
-
@import 'ui';
|
1572
|
-
@import 'submenu';
|
1573
|
-
@import 'tooltips';
|
1574
|
-
@import 'wymeditor/skins/refinery/skin';
|
1568
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into refinery.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
*= require_self
|
9
|
+
*= require refinery/layout
|
10
|
+
*= require refinery/site_bar
|
11
|
+
*= require refinery/ui
|
12
|
+
*= require refinery/submenu
|
13
|
+
*= require refinery/tooltips
|
14
|
+
*= require wymeditor/skins/refinery/skin
|
15
|
+
*/
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
1
|
+
module Refinery
|
2
2
|
module Admin
|
3
|
-
class
|
3
|
+
class CoreController < ::Refinery::AdminController
|
4
4
|
def update_plugin_positions
|
5
5
|
params[:menu].each_with_index do |plugin_name, index|
|
6
6
|
if (plugin = current_refinery_user.plugins.find_by_name(plugin_name))
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# Filters added to this controller apply to all controllers in the refinery backend.
|
2
2
|
# Likewise, all the methods added will be available for all controllers in the refinery backend.
|
3
|
-
module
|
3
|
+
module Refinery
|
4
4
|
class AdminController < ::ActionController::Base
|
5
|
+
include ::Refinery::ApplicationController
|
6
|
+
helper Refinery::Core::Engine.helpers
|
7
|
+
include Refinery::Admin::BaseController
|
5
8
|
|
6
9
|
end
|
7
10
|
end
|
data/config/routes.rb
CHANGED
@@ -8,7 +8,7 @@ Refinery::Core::Engine.routes.draw do
|
|
8
8
|
resources :dialogs, :only => :show
|
9
9
|
end
|
10
10
|
|
11
|
-
match '/refinery/update_menu_positions', :to => 'admin/
|
11
|
+
match '/refinery/update_menu_positions', :to => 'admin/core#update_plugin_positions'
|
12
12
|
|
13
13
|
get '/sitemap.xml' => 'sitemap#index', :defaults => { :format => 'xml' }
|
14
14
|
end
|
@@ -24,6 +24,8 @@ module Refinery
|
|
24
24
|
|
25
25
|
stop_pretending?
|
26
26
|
|
27
|
+
append_gemfile!
|
28
|
+
|
27
29
|
append_gitignore!
|
28
30
|
|
29
31
|
forced_overwriting?
|
@@ -45,6 +47,14 @@ module Refinery
|
|
45
47
|
|
46
48
|
protected
|
47
49
|
|
50
|
+
def append_gemfile!
|
51
|
+
if destination_path.join('Gemfile').file? &&
|
52
|
+
destination_path.join('Gemfile').read !~ %r{group :development, :test do\n.+?gem 'sqlite3'\nend}m
|
53
|
+
gsub_file 'Gemfile', %q{gem 'sqlite3'}, %q{group :development, :test do
|
54
|
+
gem 'sqlite3'
|
55
|
+
end} end
|
56
|
+
end
|
57
|
+
|
48
58
|
def append_gitignore!
|
49
59
|
# Ensure .gitignore exists and append our rules to it.
|
50
60
|
create_file ".gitignore" unless destination_path.join('.gitignore').file?
|
@@ -62,7 +72,7 @@ gem 'heroku'
|
|
62
72
|
gem 'fog'
|
63
73
|
}
|
64
74
|
# If postgres is not the database in use, Heroku still needs it.
|
65
|
-
if destination_path.join('Gemfile').read !~ %r{gem ['"]pg['"]}
|
75
|
+
if destination_path.join('Gemfile').file? && destination_path.join('Gemfile').read !~ %r{gem ['"]pg['"]}
|
66
76
|
append_file 'Gemfile', %q{
|
67
77
|
# Postgres support (added for Heroku)
|
68
78
|
gem 'pg'
|
@@ -92,7 +102,7 @@ gem 'pg'
|
|
92
102
|
end
|
93
103
|
|
94
104
|
def deploy_to_hosting?
|
95
|
-
if
|
105
|
+
if heroku?
|
96
106
|
append_heroku_gems!
|
97
107
|
|
98
108
|
bundle!
|
@@ -112,7 +122,10 @@ gem 'pg'
|
|
112
122
|
say_status message, nil, :yellow if message
|
113
123
|
|
114
124
|
say_status "Creating Heroku app..", nil
|
115
|
-
run "heroku create
|
125
|
+
run ["heroku create",
|
126
|
+
(options[:heroku] if heroku?),
|
127
|
+
"#{"--stack #{options[:stack]}" if options[:stack]}"
|
128
|
+
].compact.join(' ')
|
116
129
|
|
117
130
|
say_status "Pushing to Heroku (this takes time, be patient)..", nil
|
118
131
|
run "git push heroku master"
|
@@ -135,12 +148,6 @@ gem 'pg'
|
|
135
148
|
next unless destination_path.join(env).file?
|
136
149
|
|
137
150
|
gsub_file env, "config.assets.compile = false", "config.assets.compile = true", :verbose => false
|
138
|
-
|
139
|
-
insert_into_file env, %Q{
|
140
|
-
# Refinery has set config.assets.initialize_on_precompile = false by default.
|
141
|
-
config.assets.initialize_on_precompile = false
|
142
|
-
|
143
|
-
}, :after => "Application.configure do\n" if env =~ /production/
|
144
151
|
end
|
145
152
|
end
|
146
153
|
|
@@ -150,6 +157,10 @@ gem 'pg'
|
|
150
157
|
self.options = force_options
|
151
158
|
end
|
152
159
|
|
160
|
+
def heroku?
|
161
|
+
options[:heroku].present?
|
162
|
+
end
|
163
|
+
|
153
164
|
def manage_roadblocks!
|
154
165
|
%w(public/index.html app/views/layouts/application.html.erb).each do |roadblock|
|
155
166
|
if (roadblock_path = destination_path.join(roadblock)).file?
|
@@ -190,6 +201,7 @@ gem 'pg'
|
|
190
201
|
generator_args = []
|
191
202
|
generator_args << '--quiet' if self.options[:quiet]
|
192
203
|
Refinery::CoreGenerator.start generator_args
|
204
|
+
Refinery::AuthenticationGenerator.start generator_args
|
193
205
|
Refinery::ResourcesGenerator.start generator_args
|
194
206
|
Refinery::PagesGenerator.start generator_args
|
195
207
|
Refinery::ImagesGenerator.start generator_args
|
@@ -197,7 +209,7 @@ gem 'pg'
|
|
197
209
|
end
|
198
210
|
|
199
211
|
def sanity_check_heroku_application_name!
|
200
|
-
if options[:heroku].to_s.include?('_') || options[:heroku].to_s.length > 30
|
212
|
+
if heroku? && options[:heroku].to_s.include?('_') || options[:heroku].to_s.length > 30
|
201
213
|
message = ["\nThe application name '#{options[:heroku]}' that you specified is invalid for Heroku."]
|
202
214
|
suggested_name = options[:heroku].dup.to_s
|
203
215
|
if suggested_name.include?('_')
|
@@ -214,6 +226,8 @@ gem 'pg'
|
|
214
226
|
message << "We have changed the name to '#{suggested_name}' for you, hope it suits you.\n"
|
215
227
|
message.join("\n")
|
216
228
|
end
|
229
|
+
|
230
|
+
options[:heroku] = '' if options[:heroku] == 'heroku'
|
217
231
|
end
|
218
232
|
|
219
233
|
def seed_database!
|
@@ -54,33 +54,33 @@ module Refinery
|
|
54
54
|
|
55
55
|
attr :database
|
56
56
|
|
57
|
-
|
57
|
+
protected
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
def dummy_path
|
60
|
+
'spec/dummy'
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
def module_name
|
64
|
+
'Dummy'
|
65
|
+
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
67
|
+
def application_definition
|
68
|
+
@application_definition ||= begin
|
69
|
+
dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
|
70
|
+
unless options[:pretend] || !File.exists?(dummy_application_path)
|
71
|
+
contents = File.read(dummy_application_path)
|
72
|
+
contents[(contents.index("module #{module_name}"))..-1]
|
74
73
|
end
|
75
74
|
end
|
76
|
-
|
75
|
+
end
|
76
|
+
alias :store_application_definition! :application_definition
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
def camelized
|
79
|
+
@camelized ||= name.gsub(/\W/, '_').squeeze('_').camelize
|
80
|
+
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
def gemfile_path
|
83
|
+
'../../../../Gemfile'
|
84
|
+
end
|
85
85
|
end
|
86
86
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
5
|
+
dummy_rails_path = File.expand_path('../../spec/dummy/script/rails', __FILE__)
|
6
|
+
if File.exist?(dummy_rails_path)
|
7
|
+
load dummy_rails_path
|
8
|
+
else
|
9
|
+
puts "Please first run 'rake refinery:testing:dummy_app' to create a dummy Refinery CMS application."
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
5
|
+
dummy_rails_path = File.expand_path('../../spec/dummy/script/rails', __FILE__)
|
6
|
+
if File.exist?(dummy_rails_path)
|
7
|
+
load dummy_rails_path
|
8
|
+
else
|
9
|
+
puts "Please first run 'rake refinery:testing:dummy_app' to create a dummy Refinery CMS application."
|
10
|
+
end
|
@@ -65,8 +65,15 @@ module Refinery
|
|
65
65
|
|
66
66
|
# use a different model for the meta information.
|
67
67
|
def present(model)
|
68
|
-
|
69
|
-
|
68
|
+
@meta = presenter_for(model).new(model)
|
69
|
+
end
|
70
|
+
|
71
|
+
def presenter_for(model, default=BasePresenter)
|
72
|
+
return default if model.nil?
|
73
|
+
|
74
|
+
"#{model.class.name}Presenter".constantize
|
75
|
+
rescue NameError
|
76
|
+
default
|
70
77
|
end
|
71
78
|
|
72
79
|
def refinery_user_required?
|
data/lib/refinery/core/engine.rb
CHANGED
@@ -24,16 +24,8 @@ module Refinery
|
|
24
24
|
def refinery_inclusion!
|
25
25
|
before_inclusion_procs.each(&:call)
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
c.send :helper, Refinery::Core::Engine.helpers
|
30
|
-
end
|
31
|
-
|
32
|
-
[Refinery::UsersController, Refinery::SessionsController, Refinery::PasswordsController].each do |c|
|
33
|
-
c.send :helper, Refinery::Core::Engine.helpers
|
34
|
-
end
|
35
|
-
|
36
|
-
Refinery::AdminController.send :include, Refinery::Admin::BaseController
|
27
|
+
::ApplicationController.send :include, Refinery::ApplicationController
|
28
|
+
::ApplicationController.send :helper, Refinery::Core::Engine.helpers
|
37
29
|
|
38
30
|
after_inclusion_procs.each(&:call)
|
39
31
|
end
|
@@ -41,10 +33,6 @@ module Refinery
|
|
41
33
|
|
42
34
|
config.autoload_paths += %W( #{config.root}/lib )
|
43
35
|
|
44
|
-
# We can't reload the base class because otherwise in development mode
|
45
|
-
# we lose any configuration that is applied to it like macros for Dragonfly.
|
46
|
-
config.autoload_once_paths += %W( #{config.root}/app/models/refinery/core )
|
47
|
-
|
48
36
|
# Include the refinery controllers and helpers dynamically
|
49
37
|
config.to_prepare &method(:refinery_inclusion!).to_proc
|
50
38
|
|
@@ -97,10 +85,13 @@ module Refinery
|
|
97
85
|
end
|
98
86
|
|
99
87
|
initializer "refinery.acts_as_indexed" do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
88
|
+
ActiveSupport.on_load(:active_record) do
|
89
|
+
require 'acts_as_indexed'
|
90
|
+
ActsAsIndexed.configure do |config|
|
91
|
+
config.index_file = Rails.root.join('tmp', 'index')
|
92
|
+
config.index_file_depth = 3
|
93
|
+
config.min_word_size = 3
|
94
|
+
end
|
104
95
|
end
|
105
96
|
end
|
106
97
|
|
data/lib/refinery/core.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rails/all'
|
2
2
|
require 'rbconfig'
|
3
|
-
require 'acts_as_indexed'
|
4
3
|
require 'truncate_html'
|
5
4
|
require 'will_paginate'
|
6
5
|
|
@@ -158,12 +157,12 @@ module Refinery
|
|
158
157
|
end
|
159
158
|
end
|
160
159
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
end
|
160
|
+
private
|
161
|
+
def validate_extension!(const)
|
162
|
+
unless const.respond_to?(:root) && const.root.is_a?(Pathname)
|
163
|
+
raise InvalidEngineError, "Engine must define a root accessor that returns a pathname to its root"
|
166
164
|
end
|
165
|
+
end
|
167
166
|
end
|
168
167
|
|
169
168
|
module Core
|
data/lib/refinery/menu.rb
CHANGED
@@ -1,30 +1,14 @@
|
|
1
1
|
module Refinery
|
2
|
-
|
3
|
-
# Create a little something to store the instances of the menu.
|
4
|
-
class << self
|
5
|
-
attr_accessor :menus
|
6
|
-
def menus
|
7
|
-
@@menus ||= HashWithIndifferentAccess.new
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
2
|
class Menu
|
12
3
|
|
13
4
|
def initialize(objects = nil)
|
14
5
|
objects.each do |item|
|
15
6
|
item = item.to_refinery_menu_item if item.respond_to?(:to_refinery_menu_item)
|
16
|
-
items << MenuItem.new(item.merge(:
|
7
|
+
items << MenuItem.new(item.merge(:menu => self))
|
17
8
|
end if objects
|
18
|
-
|
19
|
-
::Refinery.menus[self.id] = self
|
20
9
|
end
|
21
10
|
|
22
|
-
attr_accessor :items
|
23
|
-
|
24
|
-
def id
|
25
|
-
require 'securerandom' unless defined?(::SecureRandom)
|
26
|
-
@id ||= ::SecureRandom.hex(8)
|
27
|
-
end
|
11
|
+
attr_accessor :items
|
28
12
|
|
29
13
|
def items
|
30
14
|
@items ||= []
|
data/lib/refinery/menu_item.rb
CHANGED
@@ -3,7 +3,7 @@ module Refinery
|
|
3
3
|
|
4
4
|
class << self
|
5
5
|
def attributes
|
6
|
-
[:title, :parent_id, :lft, :rgt, :depth, :url, :
|
6
|
+
[:title, :parent_id, :lft, :rgt, :depth, :url, :menu, :menu_match]
|
7
7
|
end
|
8
8
|
|
9
9
|
def apply_attributes!
|
@@ -77,10 +77,6 @@ module Refinery
|
|
77
77
|
hash.inspect
|
78
78
|
end
|
79
79
|
|
80
|
-
def menu
|
81
|
-
::Refinery.menus[menu_id]
|
82
|
-
end
|
83
|
-
|
84
80
|
def parent
|
85
81
|
@parent ||= (menu.detect{|item| item.original_type == original_type && item.original_id == parent_id} if has_parent?)
|
86
82
|
end
|
data/lib/refinery/version.rb
CHANGED
@@ -2,16 +2,16 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Refinery
|
4
4
|
module Admin
|
5
|
-
describe
|
5
|
+
describe CoreController do
|
6
6
|
login_refinery_user
|
7
7
|
|
8
8
|
it "should update the plugin positions" do
|
9
|
-
plugins =
|
9
|
+
plugins = refinery_user.plugins.reverse.collect(&:name)
|
10
10
|
|
11
11
|
post 'update_plugin_positions', :menu => plugins
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
refinery_user.plugins.reload
|
14
|
+
refinery_user.plugins.each_with_index do |plugin, idx|
|
15
15
|
plugin.name.should eql(plugins[idx])
|
16
16
|
end
|
17
17
|
end
|