rich_cms 2.0.6 → 2.0.7

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.
@@ -1,7 +1,7 @@
1
1
  if (typeof(RaccoonTip) == "undefined") {
2
2
 
3
3
  // *
4
- // * RaccoonTip 1.0.7 (Uncompressed)
4
+ // * RaccoonTip 1.0.8 (Uncompressed)
5
5
  // * A lightweight jQuery based balloon tip library
6
6
  // *
7
7
  // * This library requires jQuery (http://jquery.com)
@@ -10,14 +10,14 @@ if (typeof(RaccoonTip) == "undefined") {
10
10
  // * Except otherwise noted, RaccoonTip is licensed under
11
11
  // * http://creativecommons.org/licenses/by-sa/3.0
12
12
  // *
13
- // * $Date: 2010-10-02 00:00:01 +0100 (Sat, 02 October 2010) $
13
+ // * $Date: 2010-10-17 13:37:39 +0100 (Sun, 17 October 2010) $
14
14
  // *
15
15
 
16
16
  RaccoonTip = (function() {
17
17
  var html = '<div id="raccoon_tip" style="display: none"><div class="rt_tip"></div><div class="rt_content"></div></div>';
18
18
  var css = '<style>#raccoon_tip{*padding:14px;position:absolute;z-index:9999}#raccoon_tip .rt_tip{width:0;font-size:0;line-height:0;position:absolute;filter:chroma(color=pink)}#raccoon_tip.rt_bottom_right{margin-left:-28px;padding-top:14px}#raccoon_tip.rt_bottom_right .rt_tip{top:0;left:14px;border-bottom-width:14px;border-bottom-style:solid;border-bottom-color:#f9e98e;border-right-width:14px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_bottom_middle{padding-top:14px}#raccoon_tip.rt_bottom_middle .rt_tip{top:0;left:50%;margin-left:-7px;border-bottom-width:14px;border-bottom-style:solid;border-bottom-color:#f9e98e;border-left-width:7px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink;border-right-width:7px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_bottom_left{margin-left:28px;padding-top:14px}#raccoon_tip.rt_bottom_left .rt_tip{top:0;right:14px;border-bottom-width:14px;border-bottom-style:solid;border-bottom-color:#f9e98e;border-left-width:14px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink}#raccoon_tip.rt_middle_left{margin-left:-7px;padding-right:14px}#raccoon_tip.rt_middle_left .rt_tip{top:50%;right:0;margin-top:-7px;border-left-width:14px;border-left-style:solid;border-left-color:#f9e98e;border-top-width:7px;border-top-style:solid;border-top-color:transparent;*border-top-color:pink;border-bottom-width:7px;border-bottom-style:solid;border-bottom-color:transparent;*border-bottom-color:pink}#raccoon_tip.rt_top_left{margin-left:28px;padding-bottom:14px}#raccoon_tip.rt_top_left .rt_tip{bottom:0;right:14px;border-top-width:14px;border-top-style:solid;border-top-color:#f9e98e;border-left-width:14px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink}#raccoon_tip.rt_top_middle{padding-bottom:14px}#raccoon_tip.rt_top_middle .rt_tip{bottom:0;left:50%;margin-left:-7px;border-top-width:14px;border-top-style:solid;border-top-color:#f9e98e;border-left-width:7px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink;border-right-width:7px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_top_right{margin-left:-28px;padding-bottom:14px}#raccoon_tip.rt_top_right .rt_tip{bottom:0;left:14px;border-top-width:14px;border-top-style:solid;border-top-color:#f9e98e;border-right-width:14px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_middle_right{margin-left:7px;padding-left:14px}#raccoon_tip.rt_middle_right .rt_tip{top:50%;left:0;margin-top:-7px;border-right-width:14px;border-right-style:solid;border-right-color:#f9e98e;border-top-width:7px;border-top-style:solid;border-top-color:transparent;*border-top-color:pink;border-bottom-width:7px;border-bottom-style:solid;border-bottom-color:transparent;*border-bottom-color:pink}#raccoon_tip .rt_content{padding:6px 12px 8px 12px;overflow:hidden;background:#fbf7aa;border-width:10px;border-style:solid;border-color:#f9e98e;*border-width:7px;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;box-shadow:rgba(0, 0, 0, 0.1) 0 1px 3px;-moz-box-shadow:rgba(0, 0, 0, 0.1) 0 1px 3px;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 1px 3px}#raccoon_tip .rt_content,#raccoon_tip .rt_content a{color:#a27d35;text-shadow:none}#raccoon_tip .rt_content a{outline:0}</style>';
19
19
 
20
- var default_options = {event: "click", duration: "fast", position: "bottom_right", beforeShow: function() {}, afterHide: function() {}}, opts = null;
20
+ var default_options = {event: "click", duration: "fast", position: "bottom_right", beforeShow: function() {}, canHide: function() { return true; }, afterHide: function() {}}, opts = null;
21
21
  var displaying = false, mouseover = false;
22
22
 
23
23
  var register = function(target, content, options) {
@@ -43,7 +43,7 @@ RaccoonTip = (function() {
43
43
  var setup = function() {
44
44
  if (!$("#raccoon_tip").length) {
45
45
  $("body").mouseup(function(event) {
46
- if (!displaying && !mouseover) {
46
+ if (!displaying && !mouseover && opts.canHide.apply()) {
47
47
  hide();
48
48
  }
49
49
  });
@@ -163,7 +163,7 @@ RaccoonTip = (function() {
163
163
  };
164
164
 
165
165
  return {
166
- version: "1.0.7",
166
+ version: "1.0.8",
167
167
  init: function() {
168
168
  if (typeof(onRaccoonTipReady) == "function") {
169
169
  onRaccoonTipReady();
@@ -1,7 +1,9 @@
1
1
 
2
2
  Rich.Cms.Editor = (function() {
3
- var content_class = "rich_cms_content", mark_class = "marked", edit_panel = "#rich_cms_panel",
4
- editable_content = {}, content_items = "";
3
+ var content_class = "rich_cms_content", mark_class = "marked", edit_panel = "#rich_cms_panel",
4
+ editable_content = {}, content_items = "",
5
+ cleditor_images_path = "/images/rich/cms/cleditor",
6
+ cleditor_css = '<style>.cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white} .cleditorMain iframe {border:none; margin:0; padding:0} .cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */} .cleditorToolbar {background: url("' + cleditor_images_path + '/toolbar.gif") repeat} .cleditorGroup {float:left; height:26px} .cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url("' + cleditor_images_path + '/buttons.gif")} .cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)} .cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC} .cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000} .cleditorList div {padding:2px 4px 2px 4px} .cleditorList p, .cleditorList h1, .cleditorList h2, .cleditorList h3, .cleditorList h4, .cleditorList h5, .cleditorList h6, .cleditorList font {padding:0; margin:0; background-color:Transparent} .cleditorColor {width:150px; padding:1px 0 0 1px} .cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0} .cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt} .cleditorPrompt input, .cleditorPrompt textarea {font:8.5pt Arial,Verdana;} .cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}</style>';
5
7
 
6
8
  var register = function(hash) {
7
9
  $.extend(editable_content, hash);
@@ -14,8 +16,14 @@ Rich.Cms.Editor = (function() {
14
16
  RaccoonTip.close();
15
17
  });
16
18
 
17
- RaccoonTip.register("." + content_class + "." + mark_class, "#rich_cms_panel", {beforeShow: edit, afterHide : function(content) { content.hide(); }});
19
+ RaccoonTip.register("." + content_class + "." + mark_class, "#rich_cms_panel", {
20
+ beforeShow: edit,
21
+ canHide: function() { return !$("#cleditor_input").length },
22
+ afterHide: function(content) { content.hide(); }
23
+ });
24
+
18
25
  bindSeatHolders();
26
+ injectCleditorCss();
19
27
 
20
28
  $.registerAjaxFormHandler({
21
29
  "rich_cms_content": afterUpdate
@@ -26,6 +34,13 @@ Rich.Cms.Editor = (function() {
26
34
  RaccoonTip.register("." + content_class + "." + mark_class + ".sh_hint", "#rich_cms_panel", {event: "focus", beforeShow: edit, afterHide : function(content) { content.hide(); }});
27
35
  };
28
36
 
37
+ var injectCleditorCss = function() {
38
+ if (!$("head").length) {
39
+ $(document.body).before("<head></head>");
40
+ }
41
+ $(cleditor_css).prependTo("head");
42
+ };
43
+
29
44
  var mark = function(event) {
30
45
  event.preventDefault();
31
46
 
@@ -44,6 +59,10 @@ Rich.Cms.Editor = (function() {
44
59
  $(content_items + ".block").removeClass("block");
45
60
  $(edit_panel).hide();
46
61
  }
62
+
63
+ if (typeof(SeatHolder) != "undefined") {
64
+ SeatHolder.react(!markedContentItems.length);
65
+ }
47
66
  };
48
67
 
49
68
  var edit = function() {
@@ -51,17 +70,15 @@ Rich.Cms.Editor = (function() {
51
70
  var label = $("#rich_cms_panel .edit form fieldset.inputs label");
52
71
  var inputs = $("#rich_cms_panel .edit form fieldset.inputs");
53
72
 
54
- var text = content_item.is("textarea") || content_item.hasClass("block");
55
73
  var attrs = content_item.get(0).attributes;
56
-
57
74
  var selector = $.grep($.keys(editable_content), function(s) {
58
75
  return content_item.is(s);
59
76
  })[0];
60
77
  var specs = editable_content[selector];
61
78
 
62
- label.html($.map(specs.keys, function(key) { return content_item.attr(key); }).join(", "));
79
+ label.html("Editing:&nbsp; " + $.map(specs.keys, function(key) { return "<strong>" + content_item.attr(key) + "</strong>"; }).join(", "));
63
80
 
64
- inputs.find(":input").remove();
81
+ inputs.find(":input,div.cleditorMain").remove();
65
82
  inputs.append("<input name='content_item[__selector__]' type='hidden' value='" + selector + "'/>");
66
83
 
67
84
  $.each(attrs, function(index, attribute) {
@@ -72,13 +89,18 @@ Rich.Cms.Editor = (function() {
72
89
  var value = content_item.attr(attr);
73
90
 
74
91
  if (attr == specs.value) {
75
- if (text) {
76
- inputs.append("<textarea name='" + name + "'>" + value + "</textarea>");
77
- } else {
78
- inputs.append("<input name='" + name + "' type='text' value='" + value + "'/>");
92
+ var editable_input_type = content_item.attr("data-editable_input_type") || (content_item.is("textarea") || content_item.hasClass("block") ? "text" : "string");
93
+
94
+ switch (editable_input_type) {
95
+ case "string":
96
+ inputs.append("<input name='" + name + "' type='text' value='" + value + "'/>"); break;
97
+ case "text":
98
+ inputs.append("<textarea name='" + name + "'>" + value + "</textarea>"); break;
99
+ case "html":
100
+ inputs.append("<textarea id='cleditor_input' name='" + name + "' style='width: 500px; height: 300px'>" + value + "</textarea>"); break;
79
101
  }
80
102
  } else {
81
- inputs.append("<input name='" + name + "' type='hidden' value='" + value + "'/>");
103
+ inputs.append("<input name='" + name + "' type='hidden' value='" + value + "'/>");
82
104
  }
83
105
  }
84
106
  });
@@ -89,6 +111,15 @@ Rich.Cms.Editor = (function() {
89
111
  }
90
112
 
91
113
  $(edit_panel).show();
114
+
115
+ setTimeout(function() {
116
+ if ($("#cleditor_input").length) {
117
+ $("#cleditor_input").cleditor({
118
+ width : 500,
119
+ height: 300
120
+ })[0].focus();
121
+ }
122
+ }, 250);
92
123
  };
93
124
 
94
125
  var afterUpdate = function(form, response) {
@@ -4,6 +4,7 @@ var onRaccoonTipReady = function() {
4
4
  //= require jquery/extensions/modules
5
5
  //= require jquery/extensions/object
6
6
  //= require jquery/extensions/browser_detect
7
+ //= require jquery/cleditor
7
8
 
8
9
  //= require rich
9
10
  //= require rich/cms
@@ -3,6 +3,13 @@
3
3
  min-width: 200px
4
4
  padding-right: 5px
5
5
 
6
+ .edit
7
+ form
8
+ .inputs
9
+ label
10
+ padding-top: 2px
11
+ padding-bottom: 5px
12
+
6
13
  form
7
14
  fieldset, ol
8
15
  margin: 0
@@ -55,6 +55,8 @@ module Rich
55
55
  default = "< #{default} >"
56
56
  keys = @group.keys << @group.value.to_s
57
57
  data = @object.attributes.reject{|k, v| !keys.include?(k.to_s)}
58
+
59
+ data[:editable_input_type] = options[:as] if %w(string text html).include? options[:as].to_s.downcase
58
60
 
59
61
  if class_name = @group.selector.match(/^\.\w+$/)
60
62
  (options[:html] ||= {}).store :class, [class_name.to_s.gsub(/^\./, ""), options[:html].try(:fetch, :class, nil)].compact.join(" ")
@@ -23,6 +23,19 @@ module Rich
23
23
 
24
24
  ::Jzip::Engine.add_template_location({File.join(File.dirname(__FILE__), "..", "..", "assets", "jzip") => File.join(RAILS_ROOT, "public", "javascripts")})
25
25
  ::Sass::Plugin.add_template_location( File.join(File.dirname(__FILE__), "..", "..", "assets", "sass"), File.join(RAILS_ROOT, "public", "stylesheets") )
26
+
27
+ copy_assets
28
+ end
29
+
30
+ def copy_assets
31
+ return if RAILS_ENV == "test"
32
+
33
+ source_dir = File.join File.dirname(__FILE__), "..", "..", "assets", "images", "."
34
+ target_dir = File.join RAILS_ROOT, "public", "images", "rich", "cms"
35
+
36
+ FileUtils.rm_r target_dir if File.exists? target_dir
37
+ FileUtils.mkdir_p target_dir
38
+ FileUtils.cp_r source_dir, target_dir
26
39
  end
27
40
 
28
41
  def current_controller=(current_controller)
data/lib/rich_cms.rb CHANGED
@@ -1,9 +1,12 @@
1
-
1
+ require "authlogic"
2
2
  require "jzip"
3
3
  require "sass/plugin"
4
4
 
5
+ require "formtastic"
6
+ ActionView::Base.send :include, Formtastic::SemanticFormHelper
7
+
5
8
  require "config/routes"
6
9
  require "rich/cms/actionpack"
7
10
  require "rich/cms/engine"
8
11
  require "rich/cms/content/group"
9
- require "rich/cms/content/item"
12
+ require "rich/cms/content/item"
data/rich_cms.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rich_cms}
8
- s.version = "2.0.6"
8
+ s.version = "2.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Engel"]
12
- s.date = %q{2010-10-08}
12
+ s.date = %q{2010-10-20}
13
13
  s.description = %q{Rich-CMS is a module of E9s (http://github.com/archan937/e9s) which provides a frontend for your CMS content. You can use this gem to manage CMS content or translations (in an internationalized application). The installation and setup process is very easily done. You will have to register content at the Rich-CMS engine and also you will have to specify the authentication mechanism. Both are one-liners.}
14
14
  s.email = %q{paul.engel@holder.nl}
15
15
  s.extra_rdoc_files = [
@@ -36,6 +36,9 @@ Gem::Specification.new do |s|
36
36
  "lib/app/views/rich/cms/dock/panel/_edit.html.erb",
37
37
  "lib/app/views/rich/cms/dock/panel/_login.html.erb",
38
38
  "lib/app/views/rich_cms.html.erb",
39
+ "lib/assets/images/cleditor/buttons.gif",
40
+ "lib/assets/images/cleditor/toolbar.gif",
41
+ "lib/assets/jzip/jquery/cleditor.js",
39
42
  "lib/assets/jzip/jquery/core.jz",
40
43
  "lib/assets/jzip/jquery/extensions/ajaxify.js",
41
44
  "lib/assets/jzip/jquery/extensions/browser_detect.js",
@@ -106,20 +109,20 @@ Gem::Specification.new do |s|
106
109
 
107
110
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
108
111
  s.add_runtime_dependency(%q<authlogic>, [">= 0"])
109
- s.add_runtime_dependency(%q<jzip>, [">= 1.0.10"])
112
+ s.add_runtime_dependency(%q<formtastic>, ["= 1.0.1"])
110
113
  s.add_runtime_dependency(%q<haml>, [">= 3"])
111
- s.add_runtime_dependency(%q<formtastic>, ["= 0.9.7"])
114
+ s.add_runtime_dependency(%q<jzip>, [">= 1.0.10"])
112
115
  else
113
116
  s.add_dependency(%q<authlogic>, [">= 0"])
114
- s.add_dependency(%q<jzip>, [">= 1.0.10"])
117
+ s.add_dependency(%q<formtastic>, ["= 1.0.1"])
115
118
  s.add_dependency(%q<haml>, [">= 3"])
116
- s.add_dependency(%q<formtastic>, ["= 0.9.7"])
119
+ s.add_dependency(%q<jzip>, [">= 1.0.10"])
117
120
  end
118
121
  else
119
122
  s.add_dependency(%q<authlogic>, [">= 0"])
120
- s.add_dependency(%q<jzip>, [">= 1.0.10"])
123
+ s.add_dependency(%q<formtastic>, ["= 1.0.1"])
121
124
  s.add_dependency(%q<haml>, [">= 3"])
122
- s.add_dependency(%q<formtastic>, ["= 0.9.7"])
125
+ s.add_dependency(%q<jzip>, [">= 1.0.10"])
123
126
  end
124
127
  end
125
128
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich_cms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 6
10
- version: 2.0.6
9
+ - 7
10
+ version: 2.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Engel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-08 00:00:00 +02:00
18
+ date: 2010-10-20 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -33,19 +33,19 @@ dependencies:
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: jzip
36
+ name: formtastic
37
37
  prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - ">="
41
+ - - "="
42
42
  - !ruby/object:Gem::Version
43
- hash: 3
43
+ hash: 21
44
44
  segments:
45
45
  - 1
46
46
  - 0
47
- - 10
48
- version: 1.0.10
47
+ - 1
48
+ version: 1.0.1
49
49
  type: :runtime
50
50
  version_requirements: *id002
51
51
  - !ruby/object:Gem::Dependency
@@ -63,19 +63,19 @@ dependencies:
63
63
  type: :runtime
64
64
  version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
66
- name: formtastic
66
+ name: jzip
67
67
  prerelease: false
68
68
  requirement: &id004 !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements:
71
- - - "="
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
- hash: 53
73
+ hash: 3
74
74
  segments:
75
+ - 1
75
76
  - 0
76
- - 9
77
- - 7
78
- version: 0.9.7
77
+ - 10
78
+ version: 1.0.10
79
79
  type: :runtime
80
80
  version_requirements: *id004
81
81
  description: Rich-CMS is a module of E9s (http://github.com/archan937/e9s) which provides a frontend for your CMS content. You can use this gem to manage CMS content or translations (in an internationalized application). The installation and setup process is very easily done. You will have to register content at the Rich-CMS engine and also you will have to specify the authentication mechanism. Both are one-liners.
@@ -107,6 +107,9 @@ files:
107
107
  - lib/app/views/rich/cms/dock/panel/_edit.html.erb
108
108
  - lib/app/views/rich/cms/dock/panel/_login.html.erb
109
109
  - lib/app/views/rich_cms.html.erb
110
+ - lib/assets/images/cleditor/buttons.gif
111
+ - lib/assets/images/cleditor/toolbar.gif
112
+ - lib/assets/jzip/jquery/cleditor.js
110
113
  - lib/assets/jzip/jquery/core.jz
111
114
  - lib/assets/jzip/jquery/extensions/ajaxify.js
112
115
  - lib/assets/jzip/jquery/extensions/browser_detect.js