browsercms 3.5.3 → 3.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/bcms/ckeditor_load.js.erb +34 -31
- data/app/helpers/cms/page_helper.rb +6 -1
- data/app/views/layouts/cms/_head.html.erb +2 -1
- data/db/migrate/20120813180110_browsercms354.rb +9 -0
- data/doc/release_notes.md +5 -0
- data/lib/cms/configuration.rb +2 -1
- data/lib/cms/version.rb +1 -1
- metadata +6 -5
@@ -1,48 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
// Replace any <textarea class="editor"> with a ckeditor widget.
|
2
|
+
//
|
3
|
+
// Note: Uses noConflict version of jquery to avoid possible issues with loading ckeditor.
|
4
|
+
jQuery(function ($) {
|
5
|
+
$('textarea.editor').each(function (e) {
|
6
|
+
if (editorEnabled()) {
|
7
|
+
loadEditor(this.id);
|
8
|
+
}
|
9
|
+
});
|
7
10
|
});
|
8
11
|
|
9
12
|
function editorEnabled() {
|
10
|
-
|
13
|
+
return $.cookie('editorEnabled') ? $.cookie('editorEnabled') == "true" : true;
|
11
14
|
}
|
12
15
|
|
13
16
|
function disableEditor(id) {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
if (typeof(CKEDITOR) != "undefined" && CKEDITOR.instances[id] != null) {
|
18
|
+
$('#' + id).val(CKEDITOR.instances[id].getData()).show();
|
19
|
+
CKEDITOR.instances[id].destroy();
|
20
|
+
$.cookie('editorEnabled', false, { expires:90, path:'/' });
|
21
|
+
}
|
19
22
|
}
|
20
23
|
|
21
24
|
function enableEditor(id) {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
if (typeof(CKEDITOR) != "undefined" && CKEDITOR.instances[id] != null) {
|
26
|
+
CKEDITOR.instances[id].setData($('#' + id).val());
|
27
|
+
$('#' + id).hide();
|
28
|
+
$.cookie('editorEnabled', true, { expires:90, path:'/' });
|
29
|
+
}
|
27
30
|
}
|
28
31
|
|
29
32
|
function toggleEditor(id, status) {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
loadEditor(id);
|
34
|
+
if (status == 'Simple Text' || status.value == 'disabled') {
|
35
|
+
disableEditor(id);
|
36
|
+
} else {
|
37
|
+
enableEditor(id);
|
38
|
+
}
|
36
39
|
}
|
37
40
|
|
38
41
|
function loadEditor(id) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
if (typeof(CKEDITOR) != "undefined") {
|
43
|
+
if (CKEDITOR.instances[id] == null) {
|
44
|
+
CKEDITOR.replace(id, { customConfig:'<%= asset_path(Rails.application.config.cms.ckeditor.configuration_file) %>' });
|
45
|
+
}
|
46
|
+
$.cookie('editorEnabled', true, { expires:90, path:'/' });
|
47
|
+
return true;
|
48
|
+
} else {
|
49
|
+
return false;
|
42
50
|
}
|
43
|
-
$.cookie('editorEnabled', true, { expires: 90, path: '/' })
|
44
|
-
return true
|
45
|
-
} else {
|
46
|
-
return false
|
47
|
-
}
|
48
51
|
}
|
@@ -4,8 +4,13 @@ module Cms
|
|
4
4
|
# Return the JS file to load the configured default WYSIWYG editor
|
5
5
|
#
|
6
6
|
# Ideally, this could be improved if sprockets allows for dynamically determining which js library to use.
|
7
|
+
# @return [Array] Names of the JS files need to load the editor.
|
7
8
|
def cms_content_editor
|
8
|
-
|
9
|
+
if Cms.content_editor.is_a?(Array)
|
10
|
+
Cms.content_editor
|
11
|
+
else
|
12
|
+
"bcms/#{Cms.content_editor}" # Handles existing FCKEditor behavior
|
13
|
+
end
|
9
14
|
end
|
10
15
|
|
11
16
|
# Outputs the title for this page. Used by both internal CMS pages, as well as page templates. If not explicitily set,
|
@@ -4,7 +4,8 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
5
5
|
<title><%= @page_title %></title>
|
6
6
|
<%= stylesheet_link_tag 'cms/application', 'cms/date_picker', 'cms/sitemap', 'cms/taglist' %>
|
7
|
-
<%= javascript_include_tag "cms/application"
|
7
|
+
<%= javascript_include_tag "cms/application" %>
|
8
|
+
<%= javascript_include_tag *cms_content_editor %>
|
8
9
|
<%= csrf_meta_tags %>
|
9
10
|
<script type="text/javascript">
|
10
11
|
jQuery(function($){
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Browsercms354 < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
# Attachments should not be overly specific, since it prevents joins from working.
|
4
|
+
["Cms::ImageBlock", "Cms::FileBlock"].each do |old_type|
|
5
|
+
Cms::Attachment.unscoped.update_all({:attachable_type => "Cms::AbstractFileBlock"}, {:attachable_type => old_type})
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
data/doc/release_notes.md
CHANGED
data/lib/cms/configuration.rb
CHANGED
@@ -11,7 +11,8 @@ module Cms
|
|
11
11
|
#
|
12
12
|
# bcms modules can changes this by overriding it in their configuration.
|
13
13
|
def content_editor
|
14
|
-
|
14
|
+
# CKEditor is the default.
|
15
|
+
@wysiwig_editor ||= ['bcms/ckeditor_load', 'ckeditor-jquery']
|
15
16
|
end
|
16
17
|
|
17
18
|
def content_editor=(editor)
|
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.
|
4
|
+
version: 3.5.4
|
5
5
|
prerelease:
|
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-
|
12
|
+
date: 2012-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.6.
|
75
|
+
version: 3.6.4
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - ~>
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 3.6.
|
83
|
+
version: 3.6.4
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: jquery-rails
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -643,6 +643,7 @@ files:
|
|
643
643
|
- db/migrate/20111130221145_browsercms340.rb
|
644
644
|
- db/migrate/20120329144406_browsercms350.rb
|
645
645
|
- db/migrate/20120717182827_browsercms353.rb
|
646
|
+
- db/migrate/20120813180110_browsercms354.rb
|
646
647
|
- db/schema.rb
|
647
648
|
- db/seeds.rb
|
648
649
|
- doc/design/blue_button.psd
|
@@ -775,7 +776,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
775
776
|
version: '0'
|
776
777
|
segments:
|
777
778
|
- 0
|
778
|
-
hash:
|
779
|
+
hash: 250022716012071557
|
779
780
|
requirements: []
|
780
781
|
rubyforge_project:
|
781
782
|
rubygems_version: 1.8.24
|