browsercms 3.5.0.rc3 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,85 +1,75 @@
1
- class Cms::SectionsController < Cms::BaseController
1
+ module Cms
2
+ class SectionsController < Cms::BaseController
2
3
 
3
- before_filter :load_parent, :only => [:new, :create]
4
- before_filter :load_section, :only => [:edit, :update, :destroy, :move]
5
- before_filter :set_toolbar_tab
6
-
7
- helper_method :public_groups
8
- helper_method :cms_groups
4
+ before_filter :load_parent, :only => [:new, :create]
5
+ before_filter :load_section, :only => [:edit, :update, :destroy, :move]
6
+ before_filter :set_toolbar_tab
9
7
 
10
- def index
11
- redirect_to cms.sitemap_path
12
- end
8
+ helper_method :public_groups
9
+ helper_method :cms_groups
13
10
 
14
- def show
15
- redirect_to cms.sitemap_path
16
- end
17
-
18
- def new
19
- @section = @parent.build_section
20
- @section.groups = @parent.groups
21
- end
22
-
23
- def create
24
- @section = Cms::Section.new(params[:section])
25
- @section.parent = @parent
26
- @section.groups = @section.parent.groups unless current_user.able_to?(:administrate)
27
- if @section.save
28
- flash[:notice] = "Section '#{@section.name}' was created"
29
- redirect_to @section
30
- else
31
- render :action => 'new'
32
- end
33
- end
11
+ def index
12
+ redirect_to cms.sitemap_path
13
+ end
34
14
 
35
- def edit
36
- end
37
-
38
- def update
39
- params[:section].delete('group_ids') if params[:section] && !current_user.able_to?(:administrate)
40
- @section.attributes = params[:section]
41
- if @section.save
42
- flash[:notice] = "Section '#{@section.name}' was updated"
43
- redirect_to @section
44
- else
45
- render :action => 'edit'
46
- end
47
- end
48
-
49
- def destroy
50
- respond_to do |format|
51
- if @section.deletable? && @section.destroy
52
- message = "Section '#{@section.name}' was deleted."
53
- format.html { flash[:notice] = message; redirect_to(sitemap_url) }
54
- format.json { render :json => {:success => true, :message => message } }
15
+ def show
16
+ redirect_to cms.sitemap_path
17
+ end
18
+
19
+ def new
20
+ @section = @parent.build_section
21
+ @section.groups = @parent.groups
22
+ end
23
+
24
+ def create
25
+ @section = Cms::Section.new(params[:section])
26
+ @section.parent = @parent
27
+ @section.groups = @section.parent.groups unless current_user.able_to?(:administrate)
28
+ if @section.save
29
+ flash[:notice] = "Section '#{@section.name}' was created"
30
+ redirect_to @section
55
31
  else
56
- message = "Section '#{@section.name}' could not be deleted"
57
- format.html { flash[:error] = message; redirect_to(sitemap_url) }
58
- format.json { render :json => {:success => false, :message => message } }
32
+ render :action => 'new'
59
33
  end
60
34
  end
61
- end
62
-
63
- def move
64
- if params[:section_id]
65
- @move_to = Section.find(params[:section_id])
66
- else
67
- @move_to = Section.root.first
35
+
36
+ def edit
37
+ end
38
+
39
+ def update
40
+ params[:section].delete('group_ids') if params[:section] && !current_user.able_to?(:administrate)
41
+ @section.attributes = params[:section]
42
+ if @section.save
43
+ flash[:notice] = "Section '#{@section.name}' was updated"
44
+ redirect_to @section
45
+ else
46
+ render :action => 'edit'
47
+ end
68
48
  end
69
- end
70
49
 
71
- # Generates XML for Browsing files/pages/etc.
72
- # @todo This MIGHT best live in the FCKeditor module, since it's XML format is highly coupled to that module's needs.
73
- def file_browser
74
- @section = Cms::Section.find_by_name_path(params[:CurrentFolder])
75
- if request.post? && params[:NewFile]
76
- handle_file_browser_upload
77
- else
78
- render_file_browser
50
+ def destroy
51
+ respond_to do |format|
52
+ if @section.deletable? && @section.destroy
53
+ message = "Section '#{@section.name}' was deleted."
54
+ format.html { flash[:notice] = message; redirect_to(sitemap_url) }
55
+ format.json { render :json => {:success => true, :message => message} }
56
+ else
57
+ message = "Section '#{@section.name}' could not be deleted"
58
+ format.html { flash[:error] = message; redirect_to(sitemap_url) }
59
+ format.json { render :json => {:success => false, :message => message} }
60
+ end
61
+ end
79
62
  end
80
- end
81
-
82
- protected
63
+
64
+ def move
65
+ if params[:section_id]
66
+ @move_to = Section.find(params[:section_id])
67
+ else
68
+ @move_to = Section.root.first
69
+ end
70
+ end
71
+
72
+ protected
83
73
  def load_parent
84
74
  @parent = Cms::Section.find(params[:section_id])
85
75
  raise Cms::Errors::AccessDenied unless current_user.able_to_edit?(@parent)
@@ -90,33 +80,6 @@ class Cms::SectionsController < Cms::BaseController
90
80
  raise Cms::Errors::AccessDenied unless current_user.able_to_edit?(@section)
91
81
  end
92
82
 
93
- def handle_file_browser_upload
94
- begin
95
- case params[:Type].downcase
96
- when "file"
97
- FileBlock.create!(:section => @section, :file => params[:NewFile])
98
- when "image"
99
- ImageBlock.create!(:section => @section, :file => params[:NewFile])
100
- end
101
- result = "0"
102
- rescue Exception => e
103
- result = "1,'#{escape_javascript(e.message)}'"
104
- end
105
- render :text => %Q{<script type="text/javascript">window.parent.frames['frmUpload'].OnUploadCompleted(#{result});</script>}, :layout => false
106
- end
107
-
108
- def render_file_browser
109
- @files = case params[:Type].downcase
110
- when "file"
111
- FileBlock.by_section(@section)
112
- when "image"
113
- ImageBlock.by_section(@section)
114
- else
115
- @section.pages
116
- end
117
- render 'cms/sections/file_browser', :layout => false, :format=>:xml
118
- end
119
-
120
83
  def public_groups
121
84
  @public_groups ||= Cms::Group.public.all(:order => "#{Cms::Group.table_name}.name")
122
85
  end
@@ -128,4 +91,5 @@ class Cms::SectionsController < Cms::BaseController
128
91
  def set_toolbar_tab
129
92
  @toolbar_tab = :sitemap
130
93
  end
131
- end
94
+ end
95
+ end
@@ -7,7 +7,7 @@ module Cms
7
7
  validates_presence_of :name
8
8
 
9
9
  scope :by_section, lambda { |section| {
10
- :include => {:attachment => :section_node},
10
+ :include => {:attachments => :section_node},
11
11
  :conditions => ["#{SectionNode.table_name}.ancestry = ?", section.node.ancestry_path]}
12
12
  }
13
13
 
@@ -17,6 +17,11 @@ module Cms
17
17
  file.parent
18
18
  end
19
19
 
20
+ # Exists here so FileBrowser can polymorphically call file_size on Page, Images, Files, etc.
21
+ def file_size
22
+ file.size.round_bytes
23
+ end
24
+
20
25
  def path
21
26
  file.url
22
27
  end
@@ -7,6 +7,8 @@ module Cms
7
7
 
8
8
  include DefaultAccessible
9
9
 
10
+ attr_accessible :category_type
11
+
10
12
  validates_presence_of :category_type_id, :name
11
13
  validates_uniqueness_of :name, :scope => :category_type_id
12
14
 
@@ -1,10 +1,11 @@
1
1
  module Cms
2
2
  class Connector < ActiveRecord::Base
3
- include DefaultAccessible
4
3
 
5
4
  belongs_to :page, :class_name => 'Cms::Page'
6
5
  belongs_to :connectable, :polymorphic => true
7
- attr_accessible :connectable
6
+
7
+ include DefaultAccessible
8
+ attr_accessible :connectable, :page_version, :connectable_version, :container # Need to be explicit due to seed data loading
8
9
 
9
10
  acts_as_list :scope => "#{Connector.table_name}.page_id = \#{page_id} and #{Cms::Connector.table_name}.page_version = \#{page_version} and #{Cms::Connector.table_name}.container = '\#{container}'"
10
11
  alias :move_up :move_higher
@@ -1,7 +1,7 @@
1
1
  module Cms
2
2
  class ContentType < ActiveRecord::Base
3
3
 
4
- attr_accessible :name, :group_name
4
+ attr_accessible :name, :group_name, :content_type_group
5
5
 
6
6
  attr_accessor :group_name
7
7
  belongs_to :content_type_group, :class_name => 'Cms::ContentTypeGroup'
@@ -17,6 +17,7 @@ class Cms::Page < ActiveRecord::Base
17
17
  has_many :tasks
18
18
 
19
19
  include Cms::DefaultAccessible
20
+ attr_accessible :name, :path, :template_file_name, :hidden, :cacheable # Needs to be explicit so seed data will work.
20
21
 
21
22
  scope :named, lambda { |name| {:conditions => ["#{table_name}.name = ?", name]} }
22
23
  scope :with_path, lambda { |path| {:conditions => ["#{table_name}.path = ?", path]} }
@@ -210,8 +211,9 @@ class Cms::Page < ActiveRecord::Base
210
211
  super(version)
211
212
  end
212
213
 
214
+ # Pages have no size (for the purposes of FCKEditor)
213
215
  def file_size
214
- "?"
216
+ "NA"
215
217
  end
216
218
 
217
219
  def public?
@@ -12,7 +12,7 @@ module Cms
12
12
  VISIBLE_NODE_TYPES = [SECTION, PAGE, LINK]
13
13
 
14
14
  include DefaultAccessible
15
- attr_accessible :allow_groups, :group_ids
15
+ attr_accessible :allow_groups, :group_ids, :name, :path, :root, :hidden
16
16
 
17
17
  include Cms::Addressable
18
18
  include Cms::Addressable::NodeAccessors
@@ -43,6 +43,10 @@ module Cms
43
43
  @controller.instance_variable_get("@template").content_for(name, content, &block)
44
44
  end
45
45
 
46
+ # Returns the routes for the Cms::Engine for view that need to access them.
47
+ def cms
48
+ Cms::Engine.routes.url_helpers
49
+ end
46
50
  end
47
51
 
48
52
 
@@ -1,5 +1,5 @@
1
1
  <div id="file_block_<%= @content_block.id %>" class="file_block">
2
2
  <%= image_tag "cms/icons/file_types/#{@content_block.file.icon}.png", :alt=>@content_block.file.icon %>
3
3
  <%= link_to @content_block.name, attachment_path_for(@content_block.file) %>
4
- <%= @content_block.file.data_file_size.round_bytes %>
4
+ <%= @content_block.file_size %>
5
5
  </div>
@@ -1,5 +1,5 @@
1
1
  <div class="email-page-portlet">
2
- <%= form_for @email_message, :url => handler_path(@portlet, "deliver") do |f| %>
2
+ <%= 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>
data/bin/bcms CHANGED
@@ -109,6 +109,12 @@ TEXT
109
109
  puts "BrowserCMS has been installed. Run rake db:install to add the tables then restart your server."
110
110
  end
111
111
 
112
+ desc 'install_db', "Adds just migrations and seed data to the project."
113
+ def install_db
114
+ install_migrations
115
+ install_cms_seed_data
116
+ end
117
+
112
118
  private
113
119
 
114
120
  def prefix_cms_tables
data/config/routes.rb CHANGED
@@ -46,7 +46,6 @@ Cms::Engine.routes.draw do
46
46
  put :complete
47
47
  end
48
48
  end
49
- match '/sections/file_browser.xml', :to => 'sections#file_browser', :format => "xml", :as=>'file_browser'
50
49
  resources :sections do
51
50
  resources :links, :pages
52
51
  end
@@ -66,7 +65,7 @@ Cms::Engine.routes.draw do
66
65
  match '/content_library', :to=>'html_blocks#index', :as=>'content_library'
67
66
  content_blocks :html_blocks
68
67
  content_blocks :portlets
69
- post '/portlet/:id/:handler', :to=>"portlet#execute_handler", :as=>"handler"
68
+ post '/portlet/:id/:handler', :to=>"portlet#execute_handler", :as=>"portlet_handler"
70
69
 
71
70
  content_blocks :file_blocks
72
71
  content_blocks :image_blocks
data/doc/release_notes.md CHANGED
@@ -1,64 +1,4 @@
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
-
39
- v3.5.0.rc2
40
- ==========
41
-
42
- * Fixed issue where named page routes couldn't be found in portlet views
43
- * Fixed issue where page routes can't be created in seed data.
44
- * Confirmed that X-Sendfile works
45
-
46
- X-Sendfile
47
- ----------
48
-
49
- One way to improve the performance of BrowserCMS is to enable X-Sendfile. Used in conjunction with Web servers like Apache and Nginx, X-Sendfile will allow web servers to handle serving files that have been uploaded into the CMS. Web servers are very well optimized for sending static files, and doing so takes load off the Ruby processes reducing bottlenecks.
50
-
51
- To enable X-Sendfile in your application, uncomment one of the following two lines depending on which web server you are using.
52
-
53
- ```
54
- # In config/environments/production.rb
55
- config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
56
- config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
57
- ```
58
-
59
- You will then need to configure your web server to handle X-Sendfile requests. See documentation for [Apache](https://tn123.org/mod_xsendfile/) and [Nginx](http://wiki.nginx.org/XSendfile) for details.
60
-
61
- v3.5.0.rc1
1
+ v3.5.0
62
2
  ======
63
3
 
64
4
  This release includes a number of new features, including:
@@ -104,7 +44,54 @@ To better support deploying BrowserCMS to Heroku, we have put together a new gui
104
44
 
105
45
  As a side note, the CMS should work with Postgresql as well, based on our testing with Heroku (which uses Postgres by default).
106
46
 
107
- Notable Fixes
47
+ Admin Links
48
+ ==========
49
+ In an engine, you can do the following:
50
+
51
+ ```
52
+ # In lib/bcms_your_module/engine.rb
53
+ initializer 'bcms_your_module.add_menu_item' do |app|
54
+ app.config.cms.tools_menu << {:menu_section => 'widgets',
55
+ :name => 'List of Widgets',
56
+ :engine=>'bcms_your_module',
57
+ :route_name => 'widgets_path'
58
+ }
59
+ end
60
+
61
+ # In app/controllers/bcms_your_module/widget_controller.rb
62
+ class BcmsYourModule::WidgetsController < Cms::BaseController
63
+
64
+ layout 'cms/administration'
65
+ check_permissions :administrate
66
+
67
+ def index
68
+ @menu_section = 'widgets'
69
+ # Do something interesting
70
+ end
71
+ end
72
+
73
+ # In config/routes.rb
74
+ BcmsYourModule::Engine.routes.draw do
75
+ get '/widgets' => 'widgets#index', :as =>:widgets
76
+ end
77
+ ```
78
+
79
+ X-Sendfile
80
+ ----------
81
+
82
+ One way to improve the performance of BrowserCMS is to enable X-Sendfile. Used in conjunction with Web servers like Apache and Nginx, X-Sendfile will allow web servers to handle serving files that have been uploaded into the CMS. Web servers are very well optimized for sending static files, and doing so takes load off the Ruby processes reducing bottlenecks.
83
+
84
+ To enable X-Sendfile in your application, uncomment one of the following two lines depending on which web server you are using.
85
+
86
+ ```
87
+ # In config/environments/production.rb
88
+ config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
89
+ config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
90
+ ```
91
+
92
+ You will then need to configure your web server to handle X-Sendfile requests. See documentation for [Apache](https://tn123.org/mod_xsendfile/) and [Nginx](http://wiki.nginx.org/XSendfile) for details.
93
+
94
+ Other Notable Fixes
108
95
  -------------
109
96
 
110
97
  * [#493] Add Mobile capability
@@ -114,8 +101,13 @@ Notable Fixes
114
101
  * [#508] Remove fancy file upload (probably unused and wasn't working anyway)
115
102
  * [#519] Better support for Amazon/AWS S3
116
103
  * [#521] Remove SITE_DOMAIN constant in favor of more conventional rails configuration methods
104
+ * Add new migration methods to make it easier for modules to namespace their blocks.
105
+ * Allow modules to add new links to the Admin tab without overriding views.
106
+ * Fixed issue where named page routes couldn't be found in portlet views
107
+ * Fixed issue where page routes can't be created in seed data.
108
+ * Confirmed that X-Sendfile works
117
109
 
118
- See the [detailed changelog](https://github.com/browsermedia/browsercms/compare/v3.4.0...v3.5.0.rc1) for more info.
110
+ See the [detailed changelog](https://github.com/browsermedia/browsercms/compare/v3.4.0...v3.5.0) for more info.
119
111
 
120
112
  v3.4.2
121
113
  ======
data/lib/cms/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # Allows the precise version of BrowserCMS to be determined programatically.
3
3
  #
4
4
  module Cms
5
- VERSION = "3.5.0.rc3"
5
+ VERSION = "3.5.0"
6
6
 
7
7
  # Return the current version of the CMS.
8
8
  def self.version
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0.rc3
5
- prerelease: 6
4
+ version: 3.5.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - BrowserMedia
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000 Z
12
+ date: 2012-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -573,7 +573,6 @@ files:
573
573
  - app/views/cms/sections/_section.html.erb
574
574
  - app/views/cms/sections/destroy.js.rjs
575
575
  - app/views/cms/sections/edit.html.erb
576
- - app/views/cms/sections/file_browser.xml.builder
577
576
  - app/views/cms/sections/index.html.erb
578
577
  - app/views/cms/sections/new.html.erb
579
578
  - app/views/cms/sessions/new.html.erb
@@ -761,9 +760,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
761
760
  required_rubygems_version: !ruby/object:Gem::Requirement
762
761
  none: false
763
762
  requirements:
764
- - - ! '>'
763
+ - - ! '>='
765
764
  - !ruby/object:Gem::Version
766
- version: 1.3.1
765
+ version: '0'
766
+ segments:
767
+ - 0
768
+ hash: 1483783289705216682
767
769
  requirements: []
768
770
  rubyforge_project:
769
771
  rubygems_version: 1.8.24
@@ -1,14 +0,0 @@
1
- xml.instruct!
2
- xml.tag! 'Connector', "command" => params["Command"], "resourceType" => params["Type"] do
3
- xml.tag! 'CurrentFolder', "path" => params[:CurrentFolder], "url" => params[:CurrentFolder]
4
- xml.tag! 'Folders' do
5
- for section in @section.sections do
6
- xml.tag! 'Folder', "name" => section.name
7
- end
8
- end
9
- xml.tag! 'Files' do
10
- for file in @files do
11
- xml.tag! 'File', "name" => file.name, "url" => file.path, "size" => file.file_size
12
- end
13
- end
14
- end