bcms_fckeditor 1.0.4 → 1.1.0
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/README.markdown +21 -20
- data/lib/bcms_fckeditor.rb +1 -88
- data/lib/bcms_fckeditor/engine.rb +18 -0
- data/lib/bcms_fckeditor/routes.rb +2 -2
- data/lib/bcms_fckeditor/section_controller_extensions.rb +86 -0
- data/lib/bcms_fckeditor/version.rb +3 -0
- data/lib/generators/bcms_fckeditor/install/USAGE +10 -0
- data/lib/generators/bcms_fckeditor/install/install_generator.rb +18 -0
- data/lib/generators/bcms_fckeditor/install/templates/fckstyles.xml +111 -0
- data/test/fixtures/content_type_groups.yml +13 -0
- data/test/fixtures/content_types.yml +50 -0
- data/test/fixtures/group_permissions.yml +16 -0
- data/test/fixtures/group_type_permissions.yml +11 -0
- data/test/fixtures/group_types.yml +25 -0
- data/test/fixtures/groups.yml +25 -0
- data/test/fixtures/permissions.yml +28 -0
- data/test/fixtures/user_group_memberships.yml +11 -0
- data/test/fixtures/users.yml +15 -0
- data/test/integration/cms/fckeditor_test.rb +1 -1
- data/test/performance/browsing_test.rb +2 -2
- data/test/test_helper.rb +2 -4
- metadata +76 -73
- data/README +0 -243
- data/rails/init.rb +0 -7
data/README.markdown
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
# BrowserCMS FCKEditor WYSIWIG editor module
|
2
2
|
|
3
|
-
Installing this module will
|
3
|
+
Installing this module will change the WYSIWIG editor from the default CKEditor to FCKEditor for html editing.
|
4
4
|
|
5
|
-
##
|
6
|
-
1. Install the module
|
7
|
-
2. Configure the styles to match your needs
|
5
|
+
## Features
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
>sudo gem install bcms_fckeditor
|
7
|
+
* Upload Images through the Browse UI
|
8
|
+
* Create new sections through Browse UI
|
12
9
|
|
13
|
-
|
14
|
-
config.gem 'bcms_fckeditor'
|
15
|
-
to {RAILS_ROOT}/config/environment.rb
|
10
|
+
## Installation
|
16
11
|
|
17
|
-
|
18
|
-
>script/generate browser_cms
|
12
|
+
Run the following from your shell.
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
$ gem install bcms_fckeditor
|
15
|
+
$ cd name_of_project
|
16
|
+
$ rails g cms:install bcms_fckeditor
|
23
17
|
|
24
|
-
|
18
|
+
## Configuration
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
One of the files the gem will add to your application is /public/bcms_config/fckeditor/fckstyles.xml
|
21
|
+
You can change the styles that are directly available in the editor by changing this file.
|
22
|
+
It is put in this directory to allow you to edit it without worry that it will be overwritten by the gem.
|
29
23
|
|
30
|
-
|
24
|
+
## Uploading images and adding sections
|
25
|
+
|
26
|
+
It is possible to upload images while navigating the server using FCKeditor's file browser. Adding images this way, is essentially the same as adding a new ImageBlock through the CMS's UI. So, if an image is uploded through the file browser, a new ImageBlock will be created with it's corresponding attachment.
|
27
|
+
|
28
|
+
It is also possible to add new 'folders' through the file browser (which are just hidden sections in BrowserCMS's parlance) and can be used to organize uploaded images.
|
29
|
+
|
30
|
+
## Tips for building your own WYSIWIG module
|
31
|
+
If you would prefer to build your own WYSIWIG module, you will need to tell the CMS to use your javascript instead of the FCKEditor (or CKEditor) javascript. Review the BcmsFckeditor::Engine for details on how to do this (lib/bcms_fckeditor/engine.rb)
|
data/lib/bcms_fckeditor.rb
CHANGED
@@ -1,89 +1,2 @@
|
|
1
|
+
require 'bcms_fckeditor/engine'
|
1
2
|
require 'bcms_fckeditor/routes'
|
2
|
-
Cms.wysiwig_js = ['/bcms/fckeditor/fckeditor.js', '/bcms/fckeditor/editor.js']
|
3
|
-
|
4
|
-
# FCKeditor's file browser functionality is handled by Cms::SectionController#file_browser.
|
5
|
-
# However, the current implementation does not handle file uploads or cerating
|
6
|
-
# new sections or 'folders'.
|
7
|
-
# This patch implements a FCKeditor connector that plays well with BrowserCMS.
|
8
|
-
Cms::SectionsController.class_eval do
|
9
|
-
|
10
|
-
protect_from_forgery :except => :file_browser
|
11
|
-
|
12
|
-
# All requests generated by the file browser are handled by this controller
|
13
|
-
# action. Currently, there are 3 commands implemented:
|
14
|
-
# a) Uploading a new image, which creates a new ImageBlock
|
15
|
-
# b) Creating a new CMS Section
|
16
|
-
# c) Displaying file browser contents
|
17
|
-
def file_browser
|
18
|
-
@section = Section.find_by_name_path(params[:CurrentFolder])
|
19
|
-
if request.post? && params[:NewFile]
|
20
|
-
handle_file_browser_upload
|
21
|
-
elsif params[:NewFolderName]
|
22
|
-
create_section
|
23
|
-
else
|
24
|
-
render_file_browser
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
protected
|
29
|
-
|
30
|
-
# Sections created through FCKeditor's file browser, are assigned to groups
|
31
|
-
# "guest", "cms-admin" and "content-editor" and are hidden from menus by
|
32
|
-
# default.
|
33
|
-
def create_section
|
34
|
-
section_path = build_path(params[:NewFolderName].to_slug)
|
35
|
-
|
36
|
-
begin
|
37
|
-
Section.create!(:name => params[:NewFolderName],
|
38
|
-
:path => section_path,
|
39
|
-
:parent_id => @section.id,
|
40
|
-
:group_ids => [1, 2, 3],
|
41
|
-
:hidden => true)
|
42
|
-
result = "0"
|
43
|
-
rescue Exception => e
|
44
|
-
result = build_error_string(e)
|
45
|
-
end
|
46
|
-
|
47
|
-
render_response(result)
|
48
|
-
end
|
49
|
-
|
50
|
-
# According to FCKeditor's documentation, server side connectors should rename
|
51
|
-
# a file when a file with the same name exists on the filesystem.
|
52
|
-
# This connector does not behave that way. If a filename exists, an error is
|
53
|
-
# returned. The rationale behind this decision is that uploading a file through the
|
54
|
-
# FCKeditor's file browser is essentially just another interface to creating a FileBlock
|
55
|
-
# or an ImageBlock.
|
56
|
-
def handle_file_browser_upload
|
57
|
-
upfile = params[:NewFile]
|
58
|
-
klass = params[:Type] == "File" ? FileBlock : ImageBlock
|
59
|
-
file_path = build_path(upfile.original_filename)
|
60
|
-
|
61
|
-
begin
|
62
|
-
klass.create!(:attachment_section => @section,
|
63
|
-
:attachment_file => upfile,
|
64
|
-
:attachment_file_path => file_path,
|
65
|
-
:publish_on_save => true,
|
66
|
-
:name => upfile.original_filename.capitalize)
|
67
|
-
result = "0"
|
68
|
-
rescue Exception => e
|
69
|
-
result = build_error_string(e)
|
70
|
-
end
|
71
|
-
|
72
|
-
render_response(result)
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def build_error_string(e)
|
78
|
-
"1, '#{escape_javascript(e.message.to_sentence)}'"
|
79
|
-
end
|
80
|
-
|
81
|
-
def build_path(resource_name)
|
82
|
-
"%s%s%s" % [@section.path, @section.path == "/" ? "" : "/", resource_name]
|
83
|
-
end
|
84
|
-
|
85
|
-
def render_response(result)
|
86
|
-
result_string = %Q{<script type="text/javascript">window.parent.frames['frmUpload'].OnUploadCompleted(#{result});</script>}
|
87
|
-
render :text => result_string, :layout => false
|
88
|
-
end
|
89
|
-
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'browsercms'
|
2
|
+
module BcmsFckeditor
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
include Cms::Module
|
5
|
+
|
6
|
+
js_files = config.action_view.javascript_expansions[:bcms_core]
|
7
|
+
if js_files.include?(Cms.wysiwig_js)
|
8
|
+
js_files.delete(Cms.wysiwig_js)
|
9
|
+
js_files << '/bcms/fckeditor/fckeditor.js'
|
10
|
+
js_files << '/bcms/fckeditor/editor.js'
|
11
|
+
end
|
12
|
+
|
13
|
+
initializer "bcms_fckeditor", :after=>'disable_dependency_loading' do
|
14
|
+
require 'bcms_fckeditor/section_controller_extensions'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# FCKeditor's file browser functionality is handled by Cms::SectionController#file_browser.
|
2
|
+
# However, the current implementation does not handle file uploads or cerating
|
3
|
+
# new sections or 'folders'.
|
4
|
+
# This patch implements a FCKeditor connector that plays well with BrowserCMS.
|
5
|
+
Cms::SectionsController.class_eval do
|
6
|
+
|
7
|
+
protect_from_forgery :except => :file_browser
|
8
|
+
|
9
|
+
# All requests generated by the file browser are handled by this controller
|
10
|
+
# action. Currently, there are 3 commands implemented:
|
11
|
+
# a) Uploading a new image, which creates a new ImageBlock
|
12
|
+
# b) Creating a new CMS Section
|
13
|
+
# c) Displaying file browser contents
|
14
|
+
def file_browser
|
15
|
+
@section = Section.find_by_name_path(params[:CurrentFolder])
|
16
|
+
if request.post? && params[:NewFile]
|
17
|
+
handle_file_browser_upload
|
18
|
+
elsif params[:NewFolderName]
|
19
|
+
create_section
|
20
|
+
else
|
21
|
+
render_file_browser
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
# Sections created through FCKeditor's file browser, are assigned to groups
|
28
|
+
# "guest", "cms-admin" and "content-editor" and are hidden from menus by
|
29
|
+
# default.
|
30
|
+
def create_section
|
31
|
+
section_path = build_path(params[:NewFolderName].to_slug)
|
32
|
+
|
33
|
+
begin
|
34
|
+
Section.create!(:name => params[:NewFolderName],
|
35
|
+
:path => section_path,
|
36
|
+
:parent_id => @section.id,
|
37
|
+
:group_ids => [1, 2, 3],
|
38
|
+
:hidden => true)
|
39
|
+
result = "0"
|
40
|
+
rescue Exception => e
|
41
|
+
result = build_error_string(e)
|
42
|
+
end
|
43
|
+
|
44
|
+
render_response(result)
|
45
|
+
end
|
46
|
+
|
47
|
+
# According to FCKeditor's documentation, server side connectors should rename
|
48
|
+
# a file when a file with the same name exists on the filesystem.
|
49
|
+
# This connector does not behave that way. If a filename exists, an error is
|
50
|
+
# returned. The rationale behind this decision is that uploading a file through the
|
51
|
+
# FCKeditor's file browser is essentially just another interface to creating a FileBlock
|
52
|
+
# or an ImageBlock.
|
53
|
+
def handle_file_browser_upload
|
54
|
+
upfile = params[:NewFile]
|
55
|
+
klass = params[:Type] == "File" ? FileBlock : ImageBlock
|
56
|
+
file_path = build_path(upfile.original_filename)
|
57
|
+
|
58
|
+
begin
|
59
|
+
klass.create!(:attachment_section => @section,
|
60
|
+
:attachment_file => upfile,
|
61
|
+
:attachment_file_path => file_path,
|
62
|
+
:publish_on_save => true,
|
63
|
+
:name => upfile.original_filename.capitalize)
|
64
|
+
result = "0"
|
65
|
+
rescue Exception => e
|
66
|
+
result = build_error_string(e)
|
67
|
+
end
|
68
|
+
|
69
|
+
render_response(result)
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def build_error_string(e)
|
75
|
+
"1, '#{escape_javascript(e.message.to_sentence)}'"
|
76
|
+
end
|
77
|
+
|
78
|
+
def build_path(resource_name)
|
79
|
+
"%s%s%s" % [@section.path, @section.path == "/" ? "" : "/", resource_name]
|
80
|
+
end
|
81
|
+
|
82
|
+
def render_response(result)
|
83
|
+
result_string = %Q{<script type="text/javascript">window.parent.frames['frmUpload'].OnUploadCompleted(#{result});</script>}
|
84
|
+
render :text => result_string, :layout => false
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cms/module_installation'
|
2
|
+
|
3
|
+
class BcmsFckeditor::InstallGenerator < Cms::ModuleInstallation
|
4
|
+
|
5
|
+
# If migrations are needed later, they need to be moved into the lib/generators/bcms_fckeditor/install/template dir
|
6
|
+
# since there can only be a single source root.
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
|
9
|
+
# add_migrations_directory_to_source_root __FILE__
|
10
|
+
# Add migrations to be copied, by uncommenting the following file and editing as needed.
|
11
|
+
# copy_migration_file 'DATESTAMP_create_name_of_content_block.rb'
|
12
|
+
|
13
|
+
def copy_public_files
|
14
|
+
# Copy the default 'styles' file into the project, so developers can override
|
15
|
+
copy_file 'fckstyles.xml', 'public/bcms_config/fckeditor/fckstyles.xml'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
2
|
+
<!--
|
3
|
+
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
4
|
+
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
|
5
|
+
*
|
6
|
+
* == BEGIN LICENSE ==
|
7
|
+
*
|
8
|
+
* Licensed under the terms of any of the following licenses at your
|
9
|
+
* choice:
|
10
|
+
*
|
11
|
+
* - GNU General Public License Version 2 or later (the "GPL")
|
12
|
+
* http://www.gnu.org/licenses/gpl.html
|
13
|
+
*
|
14
|
+
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
15
|
+
* http://www.gnu.org/licenses/lgpl.html
|
16
|
+
*
|
17
|
+
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
18
|
+
* http://www.mozilla.org/MPL/MPL-1.1.html
|
19
|
+
*
|
20
|
+
* == END LICENSE ==
|
21
|
+
*
|
22
|
+
* This is the sample style definitions file. It makes the styles combo
|
23
|
+
* completely customizable.
|
24
|
+
*
|
25
|
+
* See FCKConfig.StylesXmlPath in the configuration file.
|
26
|
+
-->
|
27
|
+
<Styles>
|
28
|
+
|
29
|
+
<!-- Block Styles -->
|
30
|
+
|
31
|
+
<!--
|
32
|
+
# These styles are already available in the "Format" combo, so they are not
|
33
|
+
# needed here by default.
|
34
|
+
|
35
|
+
<Style name="Heading 1" element="h1" />
|
36
|
+
<Style name="Heading 2" element="h2" />
|
37
|
+
<Style name="Heading 3" element="h3" />
|
38
|
+
<Style name="Heading 4" element="h4" />
|
39
|
+
<Style name="Heading 5" element="h5" />
|
40
|
+
<Style name="Heading 6" element="h6" />
|
41
|
+
<Style name="Paragraph" element="p" />
|
42
|
+
<Style name="Document Block" element="div" />
|
43
|
+
<Style name="Preformatted Text" element="pre" />
|
44
|
+
<Style name="Address" element="address" />
|
45
|
+
-->
|
46
|
+
|
47
|
+
<!-- Inline Styles -->
|
48
|
+
|
49
|
+
<!--
|
50
|
+
# These are core styles available as toolbar buttons.
|
51
|
+
|
52
|
+
<Style name="Bold" element="b">
|
53
|
+
<Override element="strong" />
|
54
|
+
</Style>
|
55
|
+
<Style name="Italic" element="i">
|
56
|
+
<Override element="em" />
|
57
|
+
</Style>
|
58
|
+
<Style name="Underline" element="u" />
|
59
|
+
<Style name="Strikethrough" element="strike" />
|
60
|
+
<Style name="Subscript" element="sub" />
|
61
|
+
<Style name="Superscript" element="sup" />
|
62
|
+
-->
|
63
|
+
|
64
|
+
<Style name="Marker: Yellow" element="span">
|
65
|
+
<Style name="background-color" value="Yellow" />
|
66
|
+
</Style>
|
67
|
+
<Style name="Marker: Green" element="span">
|
68
|
+
<Style name="background-color" value="Lime" />
|
69
|
+
</Style>
|
70
|
+
|
71
|
+
<Style name="Big" element="big" />
|
72
|
+
<Style name="Small" element="small" />
|
73
|
+
<Style name="Typewriter" element="tt" />
|
74
|
+
|
75
|
+
<Style name="Computer Code" element="code" />
|
76
|
+
<Style name="Keyboard Phrase" element="kbd" />
|
77
|
+
<Style name="Sample Text" element="samp" />
|
78
|
+
<Style name="Variable" element="var" />
|
79
|
+
|
80
|
+
<Style name="Deleted Text" element="del" />
|
81
|
+
<Style name="Inserted Text" element="ins" />
|
82
|
+
|
83
|
+
<Style name="Cited Work" element="cite" />
|
84
|
+
<Style name="Inline Quotation" element="q" />
|
85
|
+
|
86
|
+
<Style name="Language: RTL" element="span">
|
87
|
+
<Attribute name="dir" value="rtl" />
|
88
|
+
</Style>
|
89
|
+
<Style name="Language: LTR" element="span">
|
90
|
+
<Attribute name="dir" value="ltr" />
|
91
|
+
</Style>
|
92
|
+
<Style name="Language: RTL Strong" element="bdo">
|
93
|
+
<Attribute name="dir" value="rtl" />
|
94
|
+
</Style>
|
95
|
+
<Style name="Language: LTR Strong" element="bdo">
|
96
|
+
<Attribute name="dir" value="ltr" />
|
97
|
+
</Style>
|
98
|
+
|
99
|
+
<!-- Object Styles -->
|
100
|
+
|
101
|
+
<Style name="Image on Left" element="img">
|
102
|
+
<Attribute name="style" value="padding: 5px; margin-right: 5px" />
|
103
|
+
<Attribute name="border" value="2" />
|
104
|
+
<Attribute name="align" value="left" />
|
105
|
+
</Style>
|
106
|
+
<Style name="Image on Right" element="img">
|
107
|
+
<Attribute name="style" value="padding: 5px; margin-left: 5px" />
|
108
|
+
<Attribute name="border" value="2" />
|
109
|
+
<Attribute name="align" value="right" />
|
110
|
+
</Style>
|
111
|
+
</Styles>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
content_type_group_1:
|
3
|
+
name: Core
|
4
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
5
|
+
id: 1
|
6
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
7
|
+
|
8
|
+
content_type_group_2:
|
9
|
+
name: Categorization
|
10
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
11
|
+
id: 2
|
12
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
13
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
content_type_1:
|
3
|
+
name: CategoryType
|
4
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
5
|
+
id: 1
|
6
|
+
content_type_group_id: 2
|
7
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
8
|
+
|
9
|
+
content_type_2:
|
10
|
+
name: Category
|
11
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
12
|
+
id: 2
|
13
|
+
content_type_group_id: 2
|
14
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
15
|
+
|
16
|
+
content_type_3:
|
17
|
+
name: HtmlBlock
|
18
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
19
|
+
id: 3
|
20
|
+
content_type_group_id: 1
|
21
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
22
|
+
|
23
|
+
content_type_4:
|
24
|
+
name: Portlet
|
25
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
26
|
+
id: 4
|
27
|
+
content_type_group_id: 1
|
28
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
29
|
+
|
30
|
+
content_type_5:
|
31
|
+
name: FileBlock
|
32
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
33
|
+
id: 5
|
34
|
+
content_type_group_id: 1
|
35
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
36
|
+
|
37
|
+
content_type_6:
|
38
|
+
name: ImageBlock
|
39
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
40
|
+
id: 6
|
41
|
+
content_type_group_id: 1
|
42
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
43
|
+
|
44
|
+
content_type_7:
|
45
|
+
name: Tag
|
46
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
47
|
+
id: 7
|
48
|
+
content_type_group_id: 2
|
49
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
50
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
group_permission_1:
|
3
|
+
permission_id: 1
|
4
|
+
id: 1
|
5
|
+
group_id: 2
|
6
|
+
|
7
|
+
group_permission_2:
|
8
|
+
permission_id: 2
|
9
|
+
id: 2
|
10
|
+
group_id: 3
|
11
|
+
|
12
|
+
group_permission_3:
|
13
|
+
permission_id: 3
|
14
|
+
id: 3
|
15
|
+
group_id: 3
|
16
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
group_type_1:
|
3
|
+
name: Guest
|
4
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
5
|
+
cms_access: false
|
6
|
+
id: 1
|
7
|
+
guest: true
|
8
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
9
|
+
|
10
|
+
group_type_2:
|
11
|
+
name: Registered Public User
|
12
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
13
|
+
cms_access: false
|
14
|
+
id: 2
|
15
|
+
guest: false
|
16
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
17
|
+
|
18
|
+
group_type_3:
|
19
|
+
name: CMS User
|
20
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
21
|
+
cms_access: true
|
22
|
+
id: 3
|
23
|
+
guest: false
|
24
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
group_1:
|
3
|
+
name: Guest
|
4
|
+
group_type_id: 1
|
5
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
6
|
+
code: guest
|
7
|
+
id: 1
|
8
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
9
|
+
|
10
|
+
group_2:
|
11
|
+
name: Cms Administrators
|
12
|
+
group_type_id: 3
|
13
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
14
|
+
code: cms-admin
|
15
|
+
id: 2
|
16
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
17
|
+
|
18
|
+
group_3:
|
19
|
+
name: Content Editors
|
20
|
+
group_type_id: 3
|
21
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
22
|
+
code: content-editor
|
23
|
+
id: 3
|
24
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
25
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
permission_1:
|
3
|
+
name: administrate
|
4
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
5
|
+
id: 1
|
6
|
+
for_module:
|
7
|
+
description: Allows users to administer the CMS, including adding users and groups.
|
8
|
+
full_name: Administrate CMS
|
9
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
10
|
+
|
11
|
+
permission_2:
|
12
|
+
name: edit_content
|
13
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
14
|
+
id: 2
|
15
|
+
for_module:
|
16
|
+
description: Allows users to Add, Edit and Delete both Pages and Blocks. Can Save (but not Publish) and Assign them as well.
|
17
|
+
full_name: Edit Content
|
18
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
19
|
+
|
20
|
+
permission_3:
|
21
|
+
name: publish_content
|
22
|
+
updated_at: Wed Mar 04 22:55:28 UTC 2009
|
23
|
+
id: 3
|
24
|
+
for_module:
|
25
|
+
description: Allows users to Save and Publish, Hide and Archive both Pages and Blocks.
|
26
|
+
full_name: Publish Content
|
27
|
+
created_at: Wed Mar 04 22:55:28 UTC 2009
|
28
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# auto-generated by rake db:fixtures:dump, DO NOT EDIT BY HAND!
|
2
|
+
user_1:
|
3
|
+
salt: d193b3629a4805ec6a9cabf2d5336aed56ec4533
|
4
|
+
updated_at: Wed Mar 04 22:55:27 UTC 2009
|
5
|
+
expires_at:
|
6
|
+
crypted_password: 763ef0d40c98bff03ab3762e0865c12bd76f4607
|
7
|
+
remember_token_expires_at:
|
8
|
+
id: 1
|
9
|
+
remember_token:
|
10
|
+
first_name: CMS
|
11
|
+
login: cmsadmin
|
12
|
+
last_name: Administrator
|
13
|
+
email: cmsadmin@example.com
|
14
|
+
created_at: Wed Mar 04 22:55:27 UTC 2009
|
15
|
+
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'performance_test_help'
|
2
|
+
require 'rails/performance_test_help'
|
3
3
|
|
4
4
|
# Profiling results for each test method are written to tmp/performance.
|
5
|
-
class BrowsingTest <
|
5
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
6
6
|
def test_homepage
|
7
7
|
get '/'
|
8
8
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path(
|
3
|
-
require 'test_help'
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
4
|
require 'action_view/test_case'
|
5
|
-
require 'mocha'
|
6
|
-
require 'redgreen'
|
7
5
|
|
8
6
|
class ActiveSupport::TestCase
|
9
7
|
# Transactional fixtures accelerate your tests by wrapping each test method
|
metadata
CHANGED
@@ -1,54 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_fckeditor
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 1.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- BrowserMedia
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-03-11 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: browsercms
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70193213614280 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 1
|
33
|
-
- 0
|
34
|
-
version: 3.1.0
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.3.0
|
35
22
|
type: :runtime
|
36
|
-
|
37
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70193213614280
|
25
|
+
description: A BrowserCMS module that makes FCKEditor the default html editor.
|
38
26
|
email: github@browsermedia.com
|
39
27
|
executables: []
|
40
|
-
|
41
28
|
extensions: []
|
42
|
-
|
43
|
-
extra_rdoc_files:
|
29
|
+
extra_rdoc_files:
|
44
30
|
- LICENSE.txt
|
45
|
-
- README
|
46
31
|
- README.markdown
|
47
|
-
files:
|
48
|
-
- lib/bcms_fckeditor.rb
|
49
|
-
- lib/bcms_fckeditor/routes.rb
|
50
|
-
- public/bcms/fckeditor/README
|
51
|
-
- public/bcms/fckeditor/editor.js
|
32
|
+
files:
|
52
33
|
- public/bcms/fckeditor/editor/css/behaviors/disablehandles.htc
|
53
34
|
- public/bcms/fckeditor/editor/css/behaviors/showtableborders.htc
|
54
35
|
- public/bcms/fckeditor/editor/css/fck_editorarea.css
|
@@ -75,53 +56,53 @@ files:
|
|
75
56
|
- public/bcms/fckeditor/editor/dialog/common/images/locked.gif
|
76
57
|
- public/bcms/fckeditor/editor/dialog/common/images/reset.gif
|
77
58
|
- public/bcms/fckeditor/editor/dialog/common/images/unlocked.gif
|
78
|
-
- public/bcms/fckeditor/editor/dialog/fck_about.html
|
79
59
|
- public/bcms/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif
|
80
60
|
- public/bcms/fckeditor/editor/dialog/fck_about/logo_fredck.gif
|
81
61
|
- public/bcms/fckeditor/editor/dialog/fck_about/sponsors/spellchecker_net.gif
|
62
|
+
- public/bcms/fckeditor/editor/dialog/fck_about.html
|
82
63
|
- public/bcms/fckeditor/editor/dialog/fck_anchor.html
|
83
64
|
- public/bcms/fckeditor/editor/dialog/fck_button.html
|
84
65
|
- public/bcms/fckeditor/editor/dialog/fck_checkbox.html
|
85
66
|
- public/bcms/fckeditor/editor/dialog/fck_colorselector.html
|
86
67
|
- public/bcms/fckeditor/editor/dialog/fck_div.html
|
87
|
-
- public/bcms/fckeditor/editor/dialog/fck_docprops.html
|
88
68
|
- public/bcms/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html
|
89
|
-
- public/bcms/fckeditor/editor/dialog/
|
69
|
+
- public/bcms/fckeditor/editor/dialog/fck_docprops.html
|
90
70
|
- public/bcms/fckeditor/editor/dialog/fck_flash/fck_flash.js
|
91
71
|
- public/bcms/fckeditor/editor/dialog/fck_flash/fck_flash_preview.html
|
72
|
+
- public/bcms/fckeditor/editor/dialog/fck_flash.html
|
92
73
|
- public/bcms/fckeditor/editor/dialog/fck_form.html
|
93
74
|
- public/bcms/fckeditor/editor/dialog/fck_hiddenfield.html
|
94
|
-
- public/bcms/fckeditor/editor/dialog/fck_image.html
|
95
75
|
- public/bcms/fckeditor/editor/dialog/fck_image/fck_image.js
|
96
76
|
- public/bcms/fckeditor/editor/dialog/fck_image/fck_image_preview.html
|
97
|
-
- public/bcms/fckeditor/editor/dialog/
|
77
|
+
- public/bcms/fckeditor/editor/dialog/fck_image.html
|
98
78
|
- public/bcms/fckeditor/editor/dialog/fck_link/fck_link.js
|
79
|
+
- public/bcms/fckeditor/editor/dialog/fck_link.html
|
99
80
|
- public/bcms/fckeditor/editor/dialog/fck_listprop.html
|
100
81
|
- public/bcms/fckeditor/editor/dialog/fck_paste.html
|
101
82
|
- public/bcms/fckeditor/editor/dialog/fck_radiobutton.html
|
102
83
|
- public/bcms/fckeditor/editor/dialog/fck_replace.html
|
103
|
-
- public/bcms/fckeditor/editor/dialog/fck_select.html
|
104
84
|
- public/bcms/fckeditor/editor/dialog/fck_select/fck_select.js
|
85
|
+
- public/bcms/fckeditor/editor/dialog/fck_select.html
|
105
86
|
- public/bcms/fckeditor/editor/dialog/fck_smiley.html
|
106
87
|
- public/bcms/fckeditor/editor/dialog/fck_source.html
|
107
88
|
- public/bcms/fckeditor/editor/dialog/fck_specialchar.html
|
108
|
-
- public/bcms/fckeditor/editor/dialog/fck_spellerpages.html
|
109
89
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html
|
110
|
-
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
|
111
90
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html
|
91
|
+
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
|
112
92
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm
|
113
93
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
|
114
94
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl
|
115
|
-
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js
|
116
95
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html
|
96
|
+
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js
|
117
97
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css
|
118
98
|
- public/bcms/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js
|
99
|
+
- public/bcms/fckeditor/editor/dialog/fck_spellerpages.html
|
119
100
|
- public/bcms/fckeditor/editor/dialog/fck_table.html
|
120
101
|
- public/bcms/fckeditor/editor/dialog/fck_tablecell.html
|
121
|
-
- public/bcms/fckeditor/editor/dialog/fck_template.html
|
122
102
|
- public/bcms/fckeditor/editor/dialog/fck_template/images/template1.gif
|
123
103
|
- public/bcms/fckeditor/editor/dialog/fck_template/images/template2.gif
|
124
104
|
- public/bcms/fckeditor/editor/dialog/fck_template/images/template3.gif
|
105
|
+
- public/bcms/fckeditor/editor/dialog/fck_template.html
|
125
106
|
- public/bcms/fckeditor/editor/dialog/fck_textarea.html
|
126
107
|
- public/bcms/fckeditor/editor/dialog/fck_textfield.html
|
127
108
|
- public/bcms/fckeditor/editor/dtd/fck_dtd_test.html
|
@@ -355,6 +336,7 @@ files:
|
|
355
336
|
- public/bcms/fckeditor/editor/skins/silver/images/toolbar.expand.gif
|
356
337
|
- public/bcms/fckeditor/editor/skins/silver/images/toolbar.separator.gif
|
357
338
|
- public/bcms/fckeditor/editor/skins/silver/images/toolbar.start.gif
|
339
|
+
- public/bcms/fckeditor/editor.js
|
358
340
|
- public/bcms/fckeditor/fckconfig.js
|
359
341
|
- public/bcms/fckeditor/fckdebug.html
|
360
342
|
- public/bcms/fckeditor/fckdialog.html
|
@@ -363,52 +345,73 @@ files:
|
|
363
345
|
- public/bcms/fckeditor/fckeditor.original.html
|
364
346
|
- public/bcms/fckeditor/fckpackager.xml
|
365
347
|
- public/bcms/fckeditor/fcktemplates.xml
|
366
|
-
- public/
|
367
|
-
- rails/init.rb
|
348
|
+
- public/bcms/fckeditor/README
|
368
349
|
- LICENSE.txt
|
369
|
-
- README
|
370
350
|
- README.markdown
|
351
|
+
- public/bcms_config/fckeditor/fckstyles.xml
|
352
|
+
- lib/bcms_fckeditor/engine.rb
|
353
|
+
- lib/bcms_fckeditor/routes.rb
|
354
|
+
- lib/bcms_fckeditor/section_controller_extensions.rb
|
355
|
+
- lib/bcms_fckeditor/version.rb
|
356
|
+
- lib/bcms_fckeditor.rb
|
357
|
+
- lib/generators/bcms_fckeditor/install/install_generator.rb
|
358
|
+
- lib/generators/bcms_fckeditor/install/templates/fckstyles.xml
|
359
|
+
- lib/generators/bcms_fckeditor/install/USAGE
|
371
360
|
- test/custom_assertions.rb
|
361
|
+
- test/fixtures/content_type_groups.yml
|
362
|
+
- test/fixtures/content_types.yml
|
363
|
+
- test/fixtures/group_permissions.yml
|
364
|
+
- test/fixtures/group_type_permissions.yml
|
365
|
+
- test/fixtures/group_types.yml
|
366
|
+
- test/fixtures/groups.yml
|
367
|
+
- test/fixtures/permissions.yml
|
368
|
+
- test/fixtures/user_group_memberships.yml
|
369
|
+
- test/fixtures/users.yml
|
372
370
|
- test/integration/cms/fckeditor_test.rb
|
373
371
|
- test/performance/browsing_test.rb
|
374
372
|
- test/test_helper.rb
|
375
373
|
- test/test_logging.rb
|
376
|
-
has_rdoc: true
|
377
374
|
homepage: http://github.com/browsermedia/bcms_fckeditor
|
378
375
|
licenses: []
|
379
|
-
|
380
376
|
post_install_message:
|
381
|
-
rdoc_options:
|
382
|
-
|
383
|
-
require_paths:
|
377
|
+
rdoc_options: []
|
378
|
+
require_paths:
|
384
379
|
- lib
|
385
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
380
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
386
381
|
none: false
|
387
|
-
requirements:
|
388
|
-
- -
|
389
|
-
- !ruby/object:Gem::Version
|
390
|
-
|
391
|
-
segments:
|
382
|
+
requirements:
|
383
|
+
- - ! '>='
|
384
|
+
- !ruby/object:Gem::Version
|
385
|
+
version: '0'
|
386
|
+
segments:
|
392
387
|
- 0
|
393
|
-
|
394
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
388
|
+
hash: 1339984102779264558
|
389
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
395
390
|
none: false
|
396
|
-
requirements:
|
397
|
-
- -
|
398
|
-
- !ruby/object:Gem::Version
|
399
|
-
|
400
|
-
segments:
|
391
|
+
requirements:
|
392
|
+
- - ! '>='
|
393
|
+
- !ruby/object:Gem::Version
|
394
|
+
version: '0'
|
395
|
+
segments:
|
401
396
|
- 0
|
402
|
-
|
397
|
+
hash: 1339984102779264558
|
403
398
|
requirements: []
|
404
|
-
|
405
399
|
rubyforge_project: bcms_fckeditor
|
406
|
-
rubygems_version: 1.
|
400
|
+
rubygems_version: 1.8.10
|
407
401
|
signing_key:
|
408
402
|
specification_version: 3
|
409
|
-
summary: A WYSIWIG editor for
|
410
|
-
test_files:
|
403
|
+
summary: A WYSIWIG editor for BrowserCms
|
404
|
+
test_files:
|
411
405
|
- test/custom_assertions.rb
|
406
|
+
- test/fixtures/content_type_groups.yml
|
407
|
+
- test/fixtures/content_types.yml
|
408
|
+
- test/fixtures/group_permissions.yml
|
409
|
+
- test/fixtures/group_type_permissions.yml
|
410
|
+
- test/fixtures/group_types.yml
|
411
|
+
- test/fixtures/groups.yml
|
412
|
+
- test/fixtures/permissions.yml
|
413
|
+
- test/fixtures/user_group_memberships.yml
|
414
|
+
- test/fixtures/users.yml
|
412
415
|
- test/integration/cms/fckeditor_test.rb
|
413
416
|
- test/performance/browsing_test.rb
|
414
417
|
- test/test_helper.rb
|
data/README
DELETED
@@ -1,243 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb" templates
|
7
|
-
that are primarily responsible for inserting pre-built data in between HTML tags.
|
8
|
-
The model contains the "smart" domain objects (such as Account, Product, Person,
|
9
|
-
Post) that holds all the business logic and knows how to persist themselves to
|
10
|
-
a database. The controller handles the incoming requests (such as Save New Account,
|
11
|
-
Update Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
-
|
13
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
-
layer entitled Active Record. This layer allows you to present the data from
|
15
|
-
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods. You can read more about Active Record in
|
17
|
-
link:files/vendor/rails/activerecord/README.html.
|
18
|
-
|
19
|
-
The controller and view are handled by the Action Pack, which handles both
|
20
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
-
are bundled in a single package due to their heavy interdependence. This is
|
22
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
-
more separate. Each of these packages can be used independently outside of
|
24
|
-
Rails. You can read more about Action Pack in
|
25
|
-
link:files/vendor/rails/actionpack/README.html.
|
26
|
-
|
27
|
-
|
28
|
-
== Getting Started
|
29
|
-
|
30
|
-
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
|
-
and your application name. Ex: rails myapp
|
32
|
-
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
33
|
-
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
|
-
4. Follow the guidelines to start developing your application
|
35
|
-
|
36
|
-
|
37
|
-
== Web Servers
|
38
|
-
|
39
|
-
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
|
40
|
-
with a variety of other web servers.
|
41
|
-
|
42
|
-
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
43
|
-
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
44
|
-
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
45
|
-
More info at: http://mongrel.rubyforge.org
|
46
|
-
|
47
|
-
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
|
48
|
-
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
|
49
|
-
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
|
50
|
-
|
51
|
-
== Apache .htaccess example for FCGI/CGI
|
52
|
-
|
53
|
-
# General Apache options
|
54
|
-
AddHandler fastcgi-script .fcgi
|
55
|
-
AddHandler cgi-script .cgi
|
56
|
-
Options +FollowSymLinks +ExecCGI
|
57
|
-
|
58
|
-
# If you don't want Rails to look in certain directories,
|
59
|
-
# use the following rewrite rules so that Apache won't rewrite certain requests
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
63
|
-
# RewriteRule .* - [L]
|
64
|
-
|
65
|
-
# Redirect all requests not available on the filesystem to Rails
|
66
|
-
# By default the cgi dispatcher is used which is very slow
|
67
|
-
#
|
68
|
-
# For better performance replace the dispatcher with the fastcgi one
|
69
|
-
#
|
70
|
-
# Example:
|
71
|
-
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
72
|
-
RewriteEngine On
|
73
|
-
|
74
|
-
# If your Rails application is accessed via an Alias directive,
|
75
|
-
# then you MUST also set the RewriteBase in this htaccess file.
|
76
|
-
#
|
77
|
-
# Example:
|
78
|
-
# Alias /myrailsapp /path/to/myrailsapp/public
|
79
|
-
# RewriteBase /myrailsapp
|
80
|
-
|
81
|
-
RewriteRule ^$ index.html [QSA]
|
82
|
-
RewriteRule ^([^.]+)$ $1.html [QSA]
|
83
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
84
|
-
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
85
|
-
|
86
|
-
# In case Rails experiences terminal errors
|
87
|
-
# Instead of displaying this message you can supply a file here which will be rendered instead
|
88
|
-
#
|
89
|
-
# Example:
|
90
|
-
# ErrorDocument 500 /500.html
|
91
|
-
|
92
|
-
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
93
|
-
|
94
|
-
|
95
|
-
== Debugging Rails
|
96
|
-
|
97
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
98
|
-
will help you debug it and get it back on the rails.
|
99
|
-
|
100
|
-
First area to check is the application log files. Have "tail -f" commands running
|
101
|
-
on the server.log and development.log. Rails will automatically display debugging
|
102
|
-
and runtime information to these files. Debugging info will also be shown in the
|
103
|
-
browser on requests from 127.0.0.1.
|
104
|
-
|
105
|
-
You can also log your own messages directly into the log file from your code using
|
106
|
-
the Ruby logger class from inside your controllers. Example:
|
107
|
-
|
108
|
-
class WeblogController < ActionController::Base
|
109
|
-
def destroy
|
110
|
-
@weblog = Weblog.find(params[:id])
|
111
|
-
@weblog.destroy
|
112
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
The result will be a message in your log file along the lines of:
|
117
|
-
|
118
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
119
|
-
|
120
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
121
|
-
|
122
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
123
|
-
|
124
|
-
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
125
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
126
|
-
|
127
|
-
These two online (and free) books will bring you up to speed on the Ruby language
|
128
|
-
and also on programming in general.
|
129
|
-
|
130
|
-
|
131
|
-
== Debugger
|
132
|
-
|
133
|
-
Debugger support is available through the debugger command when you start your Mongrel or
|
134
|
-
Webrick server with --debugger. This means that you can break out of execution at any point
|
135
|
-
in the code, investigate and change the model, AND then resume execution!
|
136
|
-
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
137
|
-
Example:
|
138
|
-
|
139
|
-
class WeblogController < ActionController::Base
|
140
|
-
def index
|
141
|
-
@posts = Post.find(:all)
|
142
|
-
debugger
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
So the controller will accept the action, run the first line, then present you
|
147
|
-
with a IRB prompt in the server window. Here you can do things like:
|
148
|
-
|
149
|
-
>> @posts.inspect
|
150
|
-
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
151
|
-
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
152
|
-
>> @posts.first.title = "hello from a debugger"
|
153
|
-
=> "hello from a debugger"
|
154
|
-
|
155
|
-
...and even better is that you can examine how your runtime objects actually work:
|
156
|
-
|
157
|
-
>> f = @posts.first
|
158
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
159
|
-
>> f.
|
160
|
-
Display all 152 possibilities? (y or n)
|
161
|
-
|
162
|
-
Finally, when you're ready to resume execution, you enter "cont"
|
163
|
-
|
164
|
-
|
165
|
-
== Console
|
166
|
-
|
167
|
-
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
168
|
-
Here you'll have all parts of the application configured, just like it is when the
|
169
|
-
application is running. You can inspect domain models, change values, and save to the
|
170
|
-
database. Starting the script without arguments will launch it in the development environment.
|
171
|
-
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
172
|
-
|
173
|
-
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
174
|
-
|
175
|
-
== dbconsole
|
176
|
-
|
177
|
-
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
178
|
-
You would be connected to the database with the credentials defined in database.yml.
|
179
|
-
Starting the script without arguments will connect you to the development database. Passing an
|
180
|
-
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
181
|
-
Currently works for mysql, postgresql and sqlite.
|
182
|
-
|
183
|
-
== Description of Contents
|
184
|
-
|
185
|
-
app
|
186
|
-
Holds all the code that's specific to this particular application.
|
187
|
-
|
188
|
-
app/controllers
|
189
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
190
|
-
automated URL mapping. All controllers should descend from ApplicationController
|
191
|
-
which itself descends from ActionController::Base.
|
192
|
-
|
193
|
-
app/models
|
194
|
-
Holds models that should be named like post.rb.
|
195
|
-
Most models will descend from ActiveRecord::Base.
|
196
|
-
|
197
|
-
app/views
|
198
|
-
Holds the template files for the view that should be named like
|
199
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
200
|
-
syntax.
|
201
|
-
|
202
|
-
app/views/layouts
|
203
|
-
Holds the template files for layouts to be used with views. This models the common
|
204
|
-
header/footer method of wrapping views. In your views, define a layout using the
|
205
|
-
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
206
|
-
call <% yield %> to render the view using this layout.
|
207
|
-
|
208
|
-
app/helpers
|
209
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
210
|
-
for you automatically when using script/generate for controllers. Helpers can be used to
|
211
|
-
wrap functionality for your views into methods.
|
212
|
-
|
213
|
-
config
|
214
|
-
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
215
|
-
|
216
|
-
db
|
217
|
-
Contains the database schema in schema.rb. db/migrate contains all
|
218
|
-
the sequence of Migrations for your schema.
|
219
|
-
|
220
|
-
doc
|
221
|
-
This directory is where your application documentation will be stored when generated
|
222
|
-
using <tt>rake doc:app</tt>
|
223
|
-
|
224
|
-
lib
|
225
|
-
Application specific libraries. Basically, any kind of custom code that doesn't
|
226
|
-
belong under controllers, models, or helpers. This directory is in the load path.
|
227
|
-
|
228
|
-
public
|
229
|
-
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
230
|
-
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
231
|
-
set as the DOCUMENT_ROOT of your web server.
|
232
|
-
|
233
|
-
script
|
234
|
-
Helper scripts for automation and generation.
|
235
|
-
|
236
|
-
test
|
237
|
-
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
238
|
-
test files will be generated for you and placed in this directory.
|
239
|
-
|
240
|
-
vendor
|
241
|
-
External libraries that the application depends on. Also includes the plugins subdirectory.
|
242
|
-
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
243
|
-
This directory is in the load path.
|
data/rails/init.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
gem_root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
2
|
-
Cms.add_to_rails_paths gem_root
|
3
|
-
Cms.add_generator_paths gem_root, "db/migrate/[0-9]*_*.rb"
|
4
|
-
Cms.add_generator_paths gem_root, "public/bcms/fckeditor/**/*"
|
5
|
-
if (!File.exists?("#{RAILS_ROOT}/public/bcms_config/fckeditor/fckstyles.xml"))
|
6
|
-
Cms.add_generator_paths gem_root, "public/bcms_config/fckeditor/fckstyles.xml"
|
7
|
-
end
|