browsercms 3.5.0.rc2 → 3.5.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/cms/shared/_admin_sidebar.html.erb +14 -8
- data/doc/release_notes.md +38 -0
- data/lib/cms/engine.rb +5 -0
- data/lib/cms/upgrades/v3_4_0.rb +1 -2
- data/lib/cms/upgrades/v3_5_0.rb +52 -1
- data/lib/cms/version.rb +1 -1
- metadata +2 -2
@@ -1,8 +1,11 @@
|
|
1
|
+
<%
|
2
|
+
# Using cms. prefix on the links here so this view can be used by models from engines.
|
3
|
+
%>
|
1
4
|
<div class="first">
|
2
5
|
<h3>Users</h3>
|
3
6
|
<ul>
|
4
|
-
<li<%= ' class="open"' if @menu_section == 'users' %>><%= link_to "Users", users_path %></li>
|
5
|
-
<li<%= ' class="open"' if @menu_section == 'groups' %>><%= link_to "Groups", groups_path %></li>
|
7
|
+
<li<%= ' class="open"' if @menu_section == 'users' %>><%= link_to "Users", cms.users_path %></li>
|
8
|
+
<li<%= ' class="open"' if @menu_section == 'groups' %>><%= link_to "Groups", cms.groups_path %></li>
|
6
9
|
</ul>
|
7
10
|
</div>
|
8
11
|
<div class="bottom_cap bottom_pad"></div>
|
@@ -11,9 +14,9 @@
|
|
11
14
|
<div>
|
12
15
|
<h3>Templates</h3>
|
13
16
|
<ul>
|
14
|
-
<li<%= ' class="open"' if @menu_section == 'page_partials' %>><%= link_to "Page Partials", page_partials_path %></li>
|
15
|
-
<li<%= ' class="open"' if @menu_section == 'page_templates' %>><%= link_to "Page Templates", page_templates_path %></li>
|
16
|
-
<li<%= ' class="open"' if @menu_section == 'page_routes' %>><%= link_to "Page Routes", page_routes_path %></li>
|
17
|
+
<li<%= ' class="open"' if @menu_section == 'page_partials' %>><%= link_to "Page Partials", cms.page_partials_path %></li>
|
18
|
+
<li<%= ' class="open"' if @menu_section == 'page_templates' %>><%= link_to "Page Templates", cms.page_templates_path %></li>
|
19
|
+
<li<%= ' class="open"' if @menu_section == 'page_routes' %>><%= link_to "Page Routes", cms.page_routes_path %></li>
|
17
20
|
</ul>
|
18
21
|
</div>
|
19
22
|
<div class="bottom_cap bottom_pad"></div>
|
@@ -22,9 +25,12 @@
|
|
22
25
|
<div>
|
23
26
|
<h3>Tools</h3>
|
24
27
|
<ul>
|
25
|
-
<li<%= ' class="open"' if @menu_section == 'caching' %>><%= link_to "Page Caching", cache_path %></li>
|
26
|
-
<li<%= ' class="open"' if @menu_section == 'redirects' %>><%= link_to "Redirects", redirects_path %></li>
|
27
|
-
<li<%= ' class="open"' if @menu_section == 'email_messages' %>><%= link_to "Email Messages", email_messages_path %></li>
|
28
|
+
<li<%= ' class="open"' if @menu_section == 'caching' %>><%= link_to "Page Caching", cms.cache_path %></li>
|
29
|
+
<li<%= ' class="open"' if @menu_section == 'redirects' %>><%= link_to "Redirects", cms.redirects_path %></li>
|
30
|
+
<li<%= ' class="open"' if @menu_section == 'email_messages' %>><%= link_to "Email Messages", cms.email_messages_path %></li>
|
31
|
+
<% Rails.application.config.cms.tools_menu.each do |menu_item| %>
|
32
|
+
<li <%= ' class="open"' if @menu_section == menu_item[:menu_section] %>><%= link_to(menu_item[:name], self.send(menu_item[:engine]).send(menu_item[:route_name])) %></li>
|
33
|
+
<% end %>
|
28
34
|
</ul>
|
29
35
|
</div>
|
30
36
|
<div class="bottom_cap"></div>
|
data/doc/release_notes.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
+
v3.5.0.rc3
|
2
|
+
==========
|
3
|
+
|
4
|
+
* Add new migration methods to make it easier for modules to namespace their blocks.
|
5
|
+
* Allow modules to add new links to the Admin tab without overriding views.
|
6
|
+
|
7
|
+
In an engine, you can do the following:
|
8
|
+
|
9
|
+
```
|
10
|
+
# In lib/bcms_your_module/engine.rb
|
11
|
+
initializer 'bcms_your_module.add_menu_item' do |app|
|
12
|
+
app.config.cms.tools_menu << {:menu_section => 'widgets',
|
13
|
+
:name => 'List of Widgets',
|
14
|
+
:engine=>'bcms_your_module',
|
15
|
+
:route_name => 'widgets_path'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# In app/controllers/bcms_your_module/widget_controller.rb
|
20
|
+
class BcmsYourModule::WidgetsController < Cms::BaseController
|
21
|
+
|
22
|
+
layout 'cms/administration'
|
23
|
+
check_permissions :administrate
|
24
|
+
|
25
|
+
def index
|
26
|
+
@menu_section = 'widgets'
|
27
|
+
# Do something interesting
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# In config/routes.rb
|
32
|
+
BcmsYourModule::Engine.routes.draw do
|
33
|
+
get '/widgets' => 'widgets#index', :as =>:widgets
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
|
1
39
|
v3.5.0.rc2
|
2
40
|
==========
|
3
41
|
|
data/lib/cms/engine.rb
CHANGED
@@ -21,6 +21,9 @@ module Cms
|
|
21
21
|
|
22
22
|
config.cms = ActiveSupport::OrderedOptions.new
|
23
23
|
config.cms.attachments = ActiveSupport::OrderedOptions.new
|
24
|
+
|
25
|
+
# Allows additional menu items to be added to the 'Tools' menu on the Admin tab.
|
26
|
+
config.cms.tools_menu = ActiveSupport::OrderedOptions.new
|
24
27
|
|
25
28
|
# Make sure we use our rails model template (rather then its default) when `rails g cms:content_block` is run.
|
26
29
|
config.app_generators do |g|
|
@@ -56,6 +59,8 @@ module Cms
|
|
56
59
|
# I.e.
|
57
60
|
# config.cms.site_domain = "www.browsercms.org"
|
58
61
|
app.config.cms.site_domain = "localhost:3000"
|
62
|
+
|
63
|
+
app.config.cms.tools_menu = []
|
59
64
|
end
|
60
65
|
|
61
66
|
initializer 'browsercms.add_core_routes', :after => 'action_dispatch.prepare_dispatcher' do |app|
|
data/lib/cms/upgrades/v3_4_0.rb
CHANGED
@@ -15,7 +15,7 @@ models.each do |model_name|
|
|
15
15
|
end
|
16
16
|
TEXT
|
17
17
|
insert_into_file migration, text, :after => "def up\n"
|
18
|
-
insert_into_file migration, "require 'cms/upgrades/v3_4_0'\n", :before=>"class"
|
18
|
+
insert_into_file migration, "require 'cms/upgrades/v3_4_0'\n", :before => "class"
|
19
19
|
insert_into_file migration, "include Cms::Upgrades::V3_4_0::SchemaStatements\n", :after => "Migration\n"
|
20
20
|
end
|
21
21
|
|
@@ -27,6 +27,5 @@ TEXT
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
30
|
end
|
32
31
|
end
|
data/lib/cms/upgrades/v3_5_0.rb
CHANGED
@@ -8,6 +8,53 @@ module Cms
|
|
8
8
|
gsub_file "config/environments/production.rb", /config.action_controller.page_cache_directory.+$/, ""
|
9
9
|
end
|
10
10
|
|
11
|
+
# Technically these updates are for v3_4_0, but I want to avoid having to change existing migrations
|
12
|
+
#
|
13
|
+
# These migrations are designed to make it easy for modules to write migrations for their content blocks with minimal code.
|
14
|
+
module Retroactive_v3_4_0Updates
|
15
|
+
# Applys table namespacing and other fixes to blocks that need upgrading from < 3.4.0 to 3.5.
|
16
|
+
#
|
17
|
+
# @param [String] module_name I.e. module table_prefix (i.e. BcmsWhatever)
|
18
|
+
# @param [String] model_class_name I.e. 'Slide' or 'NewsArticle'
|
19
|
+
def v3_5_0_apply_namespace_to_block(module_name, model_class_name)
|
20
|
+
puts "Applying namespace '#{module_name}' to model '#{model_class_name}'"
|
21
|
+
table_prefix = module_name.underscore
|
22
|
+
model_name = model_class_name.underscore
|
23
|
+
|
24
|
+
rename_table model_name.pluralize, "#{table_prefix}_#{model_name.pluralize}"
|
25
|
+
rename_table "#{model_name}_versions", "#{table_prefix}_#{model_name}_versions"
|
26
|
+
v3_5_0_standardize_version_id_column(table_prefix, model_name)
|
27
|
+
v3_5_0_namespace_model_data(module_name, model_class_name)
|
28
|
+
v3_5_0_update_connector_namespaces(module_name, model_class_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def v3_5_0_standardize_version_id_column(table_prefix, model_name)
|
32
|
+
if column_exists?("#{table_prefix}_#{model_name}_versions", "#{model_name}_id")
|
33
|
+
rename_column("#{table_prefix}_#{model_name}_versions", "#{model_name}_id", :original_record_id)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def v3_5_0_namespace_model_data(module_name, model_class_name)
|
38
|
+
found = Cms::ContentType.named(model_class_name).first
|
39
|
+
if found
|
40
|
+
found.name = v3_5_0_namespace_model(module_name, model_class_name)
|
41
|
+
found.save!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def v3_5_0_update_connector_namespaces(module_name, model_class_name)
|
46
|
+
namespaced_class = v3_5_0_namespace_model(module_name, model_class_name)
|
47
|
+
Cms::Connector.where(:connectable_type => model_class_name).each do |connector|
|
48
|
+
connector.connectable_type = namespaced_class
|
49
|
+
connector.save!
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def v3_5_0_namespace_model(module_name, model_class_name)
|
54
|
+
"#{module_name}::#{model_class_name}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
11
58
|
# Add additional methods to ActiveRecord::Migration when this file is required.
|
12
59
|
module FileStorageUpdates
|
13
60
|
|
@@ -32,6 +79,7 @@ module Cms
|
|
32
79
|
loc = path_for_attachment(attachment)
|
33
80
|
file_in_attachments_dir(loc)
|
34
81
|
end
|
82
|
+
|
35
83
|
# For a given class with an Attachment association (pre-3.5.0), migrate its attachment data to match the new
|
36
84
|
# table structure.
|
37
85
|
def migrate_attachment_for(klass)
|
@@ -152,4 +200,7 @@ module Cms
|
|
152
200
|
end
|
153
201
|
end
|
154
202
|
end
|
155
|
-
|
203
|
+
if defined?(ActiveRecord::Migration)
|
204
|
+
ActiveRecord::Migration.send(:include, Cms::Upgrades::V3_5_0::FileStorageUpdates)
|
205
|
+
ActiveRecord::Migration.send(:include, Cms::Upgrades::V3_5_0::Retroactive_v3_4_0Updates)
|
206
|
+
end
|
data/lib/cms/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browsercms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.0.
|
4
|
+
version: 3.5.0.rc3
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|