browsercms 4.0.0.alpha → 4.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/bcms/ckeditor.js +1 -0
- data/app/assets/javascripts/bcms/{ckeditor_load.js.erb → ckeditor_load.js} +4 -1
- data/app/assets/javascripts/bcms/ckeditor_standard_config.js +1 -13
- data/app/assets/javascripts/cms/application.js +1 -0
- data/app/assets/javascripts/cms/{attachment_manager.js.erb → attachment_manager.js} +19 -13
- data/app/assets/javascripts/cms/content_types.js +13 -0
- data/app/assets/javascripts/cms/core_library.js.erb +3 -3
- data/app/assets/javascripts/cms/form_builder.js +1 -1
- data/app/assets/javascripts/cms/page_editor.js +9 -8
- data/app/assets/javascripts/cms/sitemap.js +5 -5
- data/app/assets/javascripts/cms/user.js +1 -1
- data/app/assets/stylesheets/cms/_assets.css.scss +5 -0
- data/app/assets/stylesheets/cms/_main-area.css.scss +1 -1
- data/app/assets/stylesheets/cms/_sitemap.css.scss +13 -0
- data/app/assets/stylesheets/cms/styles/_images.css.scss +11 -0
- data/app/controllers/cms/application_controller.rb +0 -1
- data/app/controllers/cms/content_controller.rb +3 -0
- data/app/controllers/cms/content_types_controller.rb +14 -0
- data/app/controllers/cms/inline_content_controller.rb +10 -8
- data/app/controllers/cms/passwords_controller.rb +5 -0
- data/app/controllers/cms/sites/passwords_controller.rb +5 -0
- data/app/helpers/cms/content_types_helper.rb +4 -0
- data/app/helpers/cms/form_tag_helper.rb +9 -1
- data/app/helpers/cms/page_helper.rb +2 -6
- data/app/helpers/cms/path_helper.rb +9 -0
- data/app/helpers/cms/section_nodes_helper.rb +1 -1
- data/app/inputs/name_input.rb +42 -0
- data/app/models/cms/attachment.rb +1 -0
- data/app/models/cms/content_type.rb +6 -0
- data/app/models/cms/dynamic_view.rb +2 -1
- data/app/models/cms/page.rb +6 -0
- data/app/models/cms/persistent_user.rb +1 -0
- data/app/models/cms/section_node.rb +8 -0
- data/app/models/cms/user.rb +9 -0
- data/app/portlets/helpers/cms/list_portlet_helper.rb +5 -0
- data/app/portlets/list_portlet.rb +40 -0
- data/app/views/cms/application/_add_content_modal.html.erb +2 -2
- data/app/views/cms/application/_exception.html.erb +1 -1
- data/app/views/cms/attachments/_attachment.html.erb +8 -6
- data/app/views/cms/attachments/_attachment_manager.html.erb +35 -18
- data/app/views/cms/attachments/_attachment_table.html.erb +12 -7
- data/app/views/cms/content/editing_frame.html.erb +1 -1
- data/app/views/cms/content_block/_sidebar.html.erb +2 -1
- data/app/views/cms/content_types/_order_field.html.erb +5 -0
- data/app/views/cms/content_types/index.html.erb +3 -0
- data/app/views/cms/forms/_form.html.erb +3 -2
- data/app/views/cms/pages/_main_form.html.erb +1 -1
- data/app/views/cms/passwords/new.html.erb +16 -0
- data/app/views/cms/section_nodes/_children.html.erb +2 -0
- data/app/views/cms/section_nodes/_row_buttons.html.erb +1 -1
- data/app/views/cms/section_nodes/_section_node.html.erb +1 -1
- data/app/views/cms/sessions/new.html.erb +10 -11
- data/app/views/layouts/cms/application.html.erb +4 -1
- data/app/views/portlets/email_page/_form.html.erb +1 -1
- data/app/views/portlets/email_page/render.html.erb +1 -1
- data/app/views/portlets/list/_form.html.erb +33 -0
- data/app/views/portlets/list/_list.html.erb +6 -0
- data/app/views/portlets/list/_table.html.erb +13 -0
- data/app/views/portlets/list/render.html.erb +1 -0
- data/app/views/portlets/tag_cloud/_form.html.erb +1 -1
- data/config/routes.rb +10 -5
- data/db/browsercms.seeds.rb +10 -8
- data/db/migrate/20130327184912_browsercms400.rb +30 -0
- data/doc/features/simple_form_refactor.md +2 -2
- data/doc/release_notes.md +38 -1
- data/lib/cms/acts/cms_user.rb +2 -2
- data/lib/cms/authentication/test_password_strategy.rb +10 -1
- data/lib/cms/behaviors/connecting.rb +20 -9
- data/lib/cms/commands/actions.rb +1 -3
- data/lib/cms/configuration.rb +2 -1
- data/lib/cms/configure_simple_form_bootstrap.rb +9 -0
- data/lib/cms/engine.rb +14 -5
- data/lib/cms/route_extensions.rb +2 -0
- data/lib/cms/version.rb +1 -1
- data/lib/generators/cms/content_block/content_block_generator.rb +21 -0
- data/lib/generators/cms/content_block/templates/_form.html.erb +1 -1
- data/lib/generators/cms/content_block/templates/application_controller.rb.erb +4 -0
- data/lib/generators/cms/content_block/templates/render.html.erb +22 -20
- data/lib/generators/cms/portlet/templates/_form.html.erb +3 -3
- data/lib/generators/cms/portlet/templates/portlet.rb +2 -0
- metadata +25 -15
- data/app/inputs/cms_text_field_input.rb +0 -29
- data/db/migrate/20131206214021_devise_create_users.rb +0 -47
- data/db/migrate/20131211223908_kill_reset_password.rb +0 -5
- data/db/migrate/20131218222005_create_cms_external_users.rb +0 -10
@@ -7,5 +7,5 @@
|
|
7
7
|
<!--<li><%= link_to("Hide", "#", class: 'add-link') unless section_node.root? %></li>-->
|
8
8
|
<li><%= link_to 'Remove', engine_aware_path(section_node.node),
|
9
9
|
class: 'add-link http_delete confirm_with_title',
|
10
|
-
title: "Are you sure you want to remove #{section_node.node.name}?"
|
10
|
+
title: "Are you sure you want to remove #{section_node.node.name}?" if section_node.deletable? %></li>
|
11
11
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<ul class="nav nav-list
|
1
|
+
<ul class="nav nav-list">
|
2
2
|
<li class="nav-list-item">
|
3
3
|
<span class="nav-list-span <%= sitemap_depth_class(section_node) %> <%= draggable_class?(@modifiable_sections, section_node, parent) %>"
|
4
4
|
data-id="<%= section_node.id %>"
|
@@ -1,17 +1,16 @@
|
|
1
1
|
<% use_page_title 'Sign in' %>
|
2
2
|
<%= render 'cms/application/page_title' %>
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
<%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
5
|
+
<%= render layout: 'cms/application/main_with_sidebar' do %>
|
6
6
|
<%= f.input :login, :required => false, :autofocus => true %>
|
7
7
|
<%= f.input :password, :required => false %>
|
8
8
|
<%= f.input :remember_me, :as => :boolean if devise_mapping.rememberable? %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%= render "devise/shared/links" %>
|
9
|
+
<%= render "devise/shared/links" %>
|
10
|
+
<% end %>
|
11
|
+
<%= render layout: 'cms/application/row' do %>
|
12
|
+
<%= button_menu :bottom do %>
|
13
|
+
<%= f.button :submit, "Sign in", class: 'right btn-primary' %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<%= javascript_include_tag "cms/application" %>
|
5
|
-
<%= javascript_include_tag
|
5
|
+
<%= javascript_include_tag cms_content_editor %>
|
6
6
|
<%= render 'layouts/cms/head' %>
|
7
7
|
</head>
|
8
8
|
<body>
|
@@ -11,6 +11,9 @@
|
|
11
11
|
</nav>
|
12
12
|
<%= render 'cms/sites/flash' %>
|
13
13
|
<section class="container center-column main-container bottom-form-btn clearfix">
|
14
|
+
<% if content_for?(:before_main_content) %>
|
15
|
+
<%= yield :before_main_content %>
|
16
|
+
<% end %>
|
14
17
|
<%= yield %>
|
15
18
|
<div class="padded row-fluid">
|
16
19
|
<div class="span12"><%= render :partial => 'layouts/cms/footer' %></div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= f.input :name %>
|
2
2
|
<%= f.input :sender, hint: "Enter the email for the 'from' field on any emails sent out." %>
|
3
|
-
<%= f.input :subject,
|
3
|
+
<%= f.input :subject, input_html: { value: f.object.subject || "A link you might be interested in" } %>
|
4
4
|
<%= f.input :success_url, hint: "Leave blank to return the same page" %>
|
5
5
|
<%= f.input :template, as: :template_editor %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="email-page-portlet">
|
2
|
-
<%=
|
2
|
+
<%= cms_form_for @email_message, :url => cms.portlet_handler_path(@portlet, "deliver"), :method=>'post' do |f| %>
|
3
3
|
<%= hidden_field_tag :email_page_portlet_url, @email_page_portlet_url %>
|
4
4
|
<%= f.cms_error_messages %>
|
5
5
|
<p>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%
|
2
|
+
# Setup that would otherwise be done in Controller#new / #edit
|
3
|
+
if @block.content_type.blank?
|
4
|
+
@block.content_type = Cms::HtmlBlock.name
|
5
|
+
end
|
6
|
+
@orderable_attributes = @block.current_content_type.orderable_attributes
|
7
|
+
|
8
|
+
views = {
|
9
|
+
list: "List",
|
10
|
+
table: "Table",
|
11
|
+
}
|
12
|
+
%>
|
13
|
+
<% if @block.persisted? %>
|
14
|
+
<% content_for :sidebar_after do %>
|
15
|
+
<div class='sidebar-block'>
|
16
|
+
<h4 class="gray">Custom View</h4>
|
17
|
+
|
18
|
+
<p>Create/edit the following file: app/views/<%= @block.view_as_path %></p>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
<%= f.input :name, as: :name %>
|
23
|
+
<%= f.input :content_type,
|
24
|
+
collection: Cms::ContentType.available,
|
25
|
+
label_method: :display_name,
|
26
|
+
value_method: :name,
|
27
|
+
include_blank: false,
|
28
|
+
input_html: {'data-role' => "content_type_selector"} %>
|
29
|
+
<%= f.input :limit, hint: 'Show at most this many items.', placeholder: 'Displays all items if left blank.' %>
|
30
|
+
<%= render partial: 'cms/content_types/order_field', locals: {f: f, collection: @orderable_attributes} %>
|
31
|
+
<%= f.input :reverse_order, as: :boolean %>
|
32
|
+
<%= f.input :view_as, collection: views.invert, include_blank: false %>
|
33
|
+
<%= f.input :template, as: :template_editor %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h1 class="cms-list-portlet"><%= @portlet.name %></h1>
|
2
|
+
<table class="cms-list-portlet" data-view-as="table">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
</tr>
|
7
|
+
</thead>
|
8
|
+
<% collection.each do |content| %>
|
9
|
+
<tr>
|
10
|
+
<td><%= link_to_addressable_content(content.name, content) %></td>
|
11
|
+
</tr>
|
12
|
+
<% end %>
|
13
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render file: @portlet.view_as_full_path, locals: {collection: @content_blocks} %>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<%= f.input :name %>
|
2
2
|
<%= f.input :limit, :size => 4 %>
|
3
|
-
<%= f.input :sizes, :
|
3
|
+
<%= f.input :sizes, input_html: { value: f.object.sizes || TagCloudPortlet.default_sizes } %>
|
4
4
|
<%= f.input :template, as: :template_editor %>
|
data/config/routes.rb
CHANGED
@@ -14,20 +14,20 @@ Cms::Engine.routes.draw do
|
|
14
14
|
skip: [:sessions],
|
15
15
|
path: :users,
|
16
16
|
class_name: 'Cms::PersistentUser',
|
17
|
-
controllers: {
|
17
|
+
controllers: {passwords: 'cms/passwords'},
|
18
18
|
module: :devise
|
19
19
|
|
20
20
|
devise_scope :cms_user do
|
21
21
|
get '/login' => "sessions#new", :as => 'login'
|
22
|
-
get '/login' => "sessions#new", :as =>
|
23
|
-
post '/login' => "sessions#create", :as =>
|
22
|
+
get '/login' => "sessions#new", :as => :new_cms_user_session
|
23
|
+
post '/login' => "sessions#create", :as => :cms_user_session
|
24
24
|
get '/logout' => "sessions#destroy", :as => 'logout'
|
25
25
|
|
26
26
|
end
|
27
27
|
|
28
28
|
get '/toolbar', :to => "toolbar#index", :as => 'toolbar'
|
29
29
|
|
30
|
-
put "/inline_content/:
|
30
|
+
put "/inline_content/:id", to: "inline_content#update", as: "update_inline_content"
|
31
31
|
resources :page_components
|
32
32
|
resources :connectors do
|
33
33
|
member do
|
@@ -39,6 +39,11 @@ Cms::Engine.routes.draw do
|
|
39
39
|
end
|
40
40
|
resources :links
|
41
41
|
|
42
|
+
resources :content_types, only: [] do
|
43
|
+
collection do
|
44
|
+
post :index
|
45
|
+
end
|
46
|
+
end
|
42
47
|
resources :pages do
|
43
48
|
member do
|
44
49
|
put :archive
|
@@ -116,7 +121,7 @@ Cms::Engine.routes.draw do
|
|
116
121
|
resources :redirects
|
117
122
|
resources :page_partials, :controller => 'dynamic_views'
|
118
123
|
resources :page_templates, :controller => 'dynamic_views'
|
119
|
-
resources :page_routes, except: :show
|
124
|
+
resources :page_routes, except: :show do
|
120
125
|
resources :conditions, :controller => "page_route_conditions"
|
121
126
|
resources :requirements, :controller => "page_route_requirements"
|
122
127
|
end
|
data/db/browsercms.seeds.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'cms/data_loader'
|
2
2
|
|
3
|
+
Cms::User.current = cmsadmin = Cms::User.new(login: "cmsadmin", first_name: "CMS", last_name: "Administrator", email: "cmsadmin@example.com")
|
3
4
|
if %w[development test dev local].include?(Rails.env)
|
4
|
-
pwd =
|
5
|
+
pwd = cmsadmin.change_password('cmsadmin')
|
5
6
|
else
|
6
|
-
pwd =
|
7
|
+
pwd = cmsadmin.new_password
|
7
8
|
end
|
8
|
-
|
9
|
+
cmsadmin.save
|
9
10
|
|
10
11
|
create_permission(:administrate, :name => "administrate", :full_name => "Administer CMS", :description => "Allows users to administer the CMS, including adding users and groups.")
|
11
12
|
create_permission(:edit_content, :name => "edit_content", :full_name => "Edit Content", :description => "Allows users to Add, Edit and Delete both Pages and Blocks. Can Save (but not Publish) and Assign them as well.")
|
@@ -21,8 +22,8 @@ group_types(:cms_user).permissions<<permissions(:publish_content)
|
|
21
22
|
create_group(:guest, :name => 'Guest', :code => 'guest', :group_type => group_types(:guest_group_type))
|
22
23
|
create_group(:content_admin, :name => 'Cms Administrators', :code => 'cms-admin', :group_type => group_types(:cms_user))
|
23
24
|
create_group(:content_editor, :name => 'Content Editors', :code => 'content-editor', :group_type => group_types(:cms_user))
|
24
|
-
|
25
|
-
|
25
|
+
cmsadmin.groups << groups(:content_admin)
|
26
|
+
cmsadmin.groups << groups(:content_editor)
|
26
27
|
|
27
28
|
groups(:content_admin).permissions<<permissions(:administrate)
|
28
29
|
groups(:content_editor).permissions<<permissions(:edit_content)
|
@@ -30,11 +31,10 @@ groups(:content_editor).permissions<<permissions(:publish_content)
|
|
30
31
|
|
31
32
|
create_site(:default, :name => "Default", :domain => "example.com")
|
32
33
|
create_section(:root, :name => "My Site", :path => "/", :root => true)
|
33
|
-
create_section(:system, :name => "system", :parent => sections(:root), :path => "/system", :hidden => true)
|
34
|
-
|
35
|
-
Cms::Group.all.each { |g| g.sections = Cms::Section.all }
|
36
34
|
|
37
35
|
create_page(:home, :name => "Home", :path => "/", :section => sections(:root), :template_file_name => "default.html.erb", :cacheable => true)
|
36
|
+
|
37
|
+
create_section(:system, :name => "system", :parent => sections(:root), :path => "/system", :hidden => true)
|
38
38
|
create_page(:not_found, :name => "Page Not Found", :path => "/system/not_found", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
|
39
39
|
create_page(:access_denied, :name => "Access Denied", :path => "/system/access_denied", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
|
40
40
|
create_page(:server_error, :name => "Server Error", :path => "/system/server_error", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
|
@@ -52,6 +52,8 @@ pages(:server_error).create_connector(html_blocks(:server_error), "main")
|
|
52
52
|
pages(:server_error).publish!
|
53
53
|
pages(:home).publish!
|
54
54
|
|
55
|
+
Cms::Group.all.each { |g| g.sections = Cms::Section.all }
|
56
|
+
|
55
57
|
unless Cms::DataLoader.silent_mode
|
56
58
|
puts "*************************************************"
|
57
59
|
puts "* YOUR CMS username/password is: cmsadmin/#{pwd}"
|
@@ -55,10 +55,40 @@ class Browsercms400 < ActiveRecord::Migration
|
|
55
55
|
t.timestamps
|
56
56
|
end
|
57
57
|
|
58
|
+
add_devise_users
|
59
|
+
remove_reset_password_portlet
|
60
|
+
add_external_users
|
58
61
|
end
|
59
62
|
|
63
|
+
|
64
|
+
|
60
65
|
private
|
61
66
|
|
67
|
+
def add_external_users
|
68
|
+
change_table :cms_users do |t|
|
69
|
+
t.column :type, :string, default: 'Cms::User'
|
70
|
+
t.column :source, :string
|
71
|
+
t.text :external_data
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def remove_reset_password_portlet
|
76
|
+
Cms::Portlet.connection.execute("UPDATE cms_portlets SET type = 'DeprecatedPlaceholder' WHERE type = 'ResetPasswordPortlet'")
|
77
|
+
end
|
78
|
+
|
79
|
+
def add_devise_users
|
80
|
+
change_table(:cms_users) do |t|
|
81
|
+
t.string :encrypted_password, :null => false, :default => ""
|
82
|
+
t.rename :reset_token, :reset_password_token
|
83
|
+
t.datetime :reset_password_sent_at
|
84
|
+
t.rename :remember_token_expires_at, :remember_created_at
|
85
|
+
t.remove :remember_token
|
86
|
+
t.remove :crypted_password
|
87
|
+
end
|
88
|
+
|
89
|
+
add_index :cms_users, :email, :unique => true
|
90
|
+
add_index :cms_users, :reset_password_token, :unique => true
|
91
|
+
end
|
62
92
|
# In 4.x, all core tables MUST start with cms_. See https://github.com/browsermedia/browsercms/issues/639
|
63
93
|
def apply_cms_namespace_to_all_core_tables
|
64
94
|
unversioned_tables.each do |table_name|
|
@@ -30,10 +30,10 @@ All of the existing simple_form input mappings are available. See http://simple-
|
|
30
30
|
Here are some examples showing how to use the CMS specific inputs.
|
31
31
|
|
32
32
|
```
|
33
|
-
<%= f.input :name
|
33
|
+
<%= f.input :name %>
|
34
34
|
```
|
35
35
|
|
36
|
-
Generates the 'name' field
|
36
|
+
Generates the 'name' field as a text field.
|
37
37
|
|
38
38
|
```
|
39
39
|
<%= f.input :expires_on, as: :date_picker %>
|
data/doc/release_notes.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
|
-
# v4.0
|
1
|
+
# v4.0.0.beta
|
2
2
|
|
3
|
+
* List Portlet [#678] - A convenient way to find content without custom coding.
|
4
|
+
* NameInput [#682] - Improved :name input allows for consistent name fields look/feel. New content will be generated with it.
|
5
|
+
* [Fixes #684] Forgot Password
|
6
|
+
|
7
|
+
* /cms/forgot-password doesn't exist
|
8
|
+
* Reenable the forgot password link (/forgot-password)
|
9
|
+
* The edit_password page (pulled from email) doesn't work when followed.
|
10
|
+
|
11
|
+
## [#678] List Portlet
|
12
|
+
|
13
|
+
This portlet is provides a configurable means to query for and display content without coding, similar to a greatly simplified Drupal views. The intent is to handle easy cases of finding a few content items without needing to create a full portlet. The following configuration options are supported:
|
14
|
+
|
15
|
+
1. Content Type - User can select any available content type to list.
|
16
|
+
2. Limit - Restrict the max results to some number (i.e. 5). Can be left blank to find all.
|
17
|
+
3. Order - The results list can be ordered based on fields specific to each content type.
|
18
|
+
4. Reverse order - Change the sorting order (asc to desc).
|
19
|
+
5. View As - Results can be shown as a list or a table. Views can be customized as well.
|
20
|
+
|
21
|
+
### Customizable Views
|
22
|
+
|
23
|
+
Each list portlet can also have its own specific view that overrides the default list or table view. Developers can add a new file in a specific location, based on the name of the portlet. This view will then be used when showing the portlet. The exact path for each portlet is displayed in the sidebar. If using a table view, this will almost always need to be overriden since there is no way to configure which columns to show in the portlet.
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# v4.0.0.alpha
|
28
|
+
|
29
|
+
Try it! gem install browsercms --pre
|
30
|
+
|
31
|
+
See (and please help with!) current bug list here: https://github.com/browsermedia/browsercms/issues?milestone=22&state=open
|
3
32
|
|
4
33
|
## Major Features
|
5
34
|
|
@@ -185,6 +214,14 @@ There is now a core API for handling users that are authenticated/authorized aga
|
|
185
214
|
|
186
215
|
A sample implementation of an authentication strategy can be found in lib/cms/authentication/test_password_strategy. Strategies are implemented as Devise Strategies and should either login or pass to the next strategy.
|
187
216
|
|
217
|
+
Don't forget to enable your new strategy in config/initializers/devise.rb
|
218
|
+
```
|
219
|
+
# Add test_password strategy BEFORE other CMS authentication strategies
|
220
|
+
config.warden do |manager|
|
221
|
+
manager.default_strategies(:scope => :cms_user).unshift :my_custom_strategy
|
222
|
+
end
|
223
|
+
```
|
224
|
+
|
188
225
|
This implementation is intended to replace CAS based strategies used in BrowserCMS 3.x. It provides the ability to style the login page directly, and avoid having an external CAS server software.
|
189
226
|
|
190
227
|
## Upgrading
|
data/lib/cms/acts/cms_user.rb
CHANGED
@@ -100,11 +100,11 @@ module Cms
|
|
100
100
|
# Return a list of the sections associated with this user that can be viewed.
|
101
101
|
# Overridden from user so that able_to_view? will work correctly.
|
102
102
|
def viewable_sections
|
103
|
-
@viewable_sections ||= Cms::Section.
|
103
|
+
@viewable_sections ||= Cms::Section.includes(:groups).where(["#{Cms::Group.table_name}.id in (?)", cms_groups.collect(&:id)])
|
104
104
|
end
|
105
105
|
|
106
106
|
def permissions
|
107
|
-
@permissions ||= Cms::Permission.
|
107
|
+
@permissions ||= Cms::Permission.includes(:groups).where(["#{Cms::Group.table_name}.id in (?)", cms_groups.collect(&:id)])
|
108
108
|
end
|
109
109
|
|
110
110
|
def able_to_edit?(section)
|
@@ -16,4 +16,13 @@ module Cms
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
Warden::Strategies.add(:test_password, Cms::Authentication::TestPasswordStrategy)
|
19
|
+
Warden::Strategies.add(:test_password, Cms::Authentication::TestPasswordStrategy)
|
20
|
+
|
21
|
+
# NOTE: To enable a custom password strategy for BrowserCMS you must also add it to to the devise configuration.
|
22
|
+
#
|
23
|
+
# For example enable the test_password strategy above by adding the following to config/initializers/devise.rb
|
24
|
+
|
25
|
+
# # Add test_password strategy BEFORE other CMS authentication strategies
|
26
|
+
# config.warden do |manager|
|
27
|
+
# manager.default_strategies(:scope => :cms_user).unshift :test_password
|
28
|
+
# end
|
@@ -5,19 +5,22 @@ module Cms
|
|
5
5
|
def self.default_naming_for(klass)
|
6
6
|
klass.name.demodulize.titleize
|
7
7
|
end
|
8
|
+
|
8
9
|
def self.included(model_class)
|
9
10
|
model_class.extend(MacroMethods)
|
10
11
|
end
|
12
|
+
|
11
13
|
module MacroMethods
|
12
14
|
def connectable?
|
13
15
|
!!@is_connectable
|
14
16
|
end
|
17
|
+
|
15
18
|
def is_connectable(options={})
|
16
19
|
@is_connectable = true
|
17
20
|
extend ClassMethods
|
18
21
|
include InstanceMethods
|
19
22
|
|
20
|
-
attr_accessor :connect_to_page_id, :connect_to_container
|
23
|
+
attr_accessor :connect_to_page_id, :connect_to_container, :connected_page
|
21
24
|
#attr_accessible :connect_to_page_id, :connect_to_container,:connected_page
|
22
25
|
|
23
26
|
has_many :connectors, :as => :connectable, :class_name => 'Cms::Connector'
|
@@ -25,7 +28,7 @@ module Cms
|
|
25
28
|
attr_accessor :updated_by_page
|
26
29
|
|
27
30
|
after_create :connect_to_page
|
28
|
-
after_save :update_connected_pages, :unless
|
31
|
+
after_save :update_connected_pages, :unless => :skip_callbacks
|
29
32
|
|
30
33
|
|
31
34
|
end
|
@@ -35,19 +38,26 @@ module Cms
|
|
35
38
|
def content_block_type
|
36
39
|
::ActiveModel::Naming.singular(self)
|
37
40
|
end
|
41
|
+
|
38
42
|
def display_name
|
39
43
|
Connecting.default_naming_for(self)
|
40
44
|
end
|
45
|
+
|
41
46
|
def display_name_plural
|
42
47
|
display_name.pluralize
|
43
|
-
end
|
48
|
+
end
|
44
49
|
end
|
45
50
|
module InstanceMethods
|
46
51
|
|
47
52
|
# Returns a machine readable key that identifies the type of content this is.
|
48
53
|
# Should match the key passed to ContentType.find_by_key
|
49
54
|
def content_name
|
50
|
-
self.class.name
|
55
|
+
class_name = self.class.name
|
56
|
+
if class_name.starts_with?("Cms::")
|
57
|
+
class_name.demodulize.underscore
|
58
|
+
else
|
59
|
+
class_name.underscore
|
60
|
+
end
|
51
61
|
end
|
52
62
|
|
53
63
|
def connected_pages
|
@@ -70,7 +80,7 @@ module Cms
|
|
70
80
|
def display_name_plural
|
71
81
|
self.class.display_name_plural
|
72
82
|
end
|
73
|
-
|
83
|
+
|
74
84
|
def connect_to_page
|
75
85
|
unless connect_to_page_id.blank? || connect_to_container.blank?
|
76
86
|
#Note that we are setting connected_page so that page can look at that
|
@@ -85,6 +95,7 @@ module Cms
|
|
85
95
|
def supports_inline_editing?
|
86
96
|
true
|
87
97
|
end
|
98
|
+
|
88
99
|
#
|
89
100
|
# After blocks are updated, all pages they are connected to should also be updated,
|
90
101
|
# connecting the page to the new version of the block, as well as putting the pages into
|
@@ -105,17 +116,17 @@ module Cms
|
|
105
116
|
if p != updated_by_page
|
106
117
|
#This just creates a new version of the page
|
107
118
|
action = deleted? ? "Deleted" : "Edited"
|
108
|
-
p.update_attributes(:version_comment => "#{self.class.name.demodulize} ##{id} was #{action}", :publish_on_save=>false)
|
119
|
+
p.update_attributes(:version_comment => "#{self.class.name.demodulize} ##{id} was #{action}", :publish_on_save => false)
|
109
120
|
|
110
121
|
#The previous step will copy over a connector pointing to the previous version of this connectable
|
111
122
|
#We need to change that to point at the new version of this connectable
|
112
123
|
connectors_for_page = p.connectors
|
113
|
-
# puts "cfp #{connectors_for_page}"
|
124
|
+
# puts "cfp #{connectors_for_page}"
|
114
125
|
page_draft_version = p.draft.version
|
115
126
|
cnn = connectors_for_page.for_page_version(page_draft_version)
|
116
|
-
# puts "Connectors for page version #{page_draft_version} are #{cnn.all}"
|
127
|
+
# puts "Connectors for page version #{page_draft_version} are #{cnn.all}"
|
117
128
|
connectors = cnn.for_connectable(self)
|
118
|
-
# puts "Found connectors #{connectors.all}"
|
129
|
+
# puts "Found connectors #{connectors.all}"
|
119
130
|
connectors.each do |con|
|
120
131
|
con.update_attribute(:connectable_version, draft_version)
|
121
132
|
end
|