cleditor-rails 0.0.2

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.
@@ -0,0 +1,104 @@
1
+ /**
2
+ @preserve CLEditor Advanced Table Plugin v1.0.0
3
+ http://premiumsoftware.net/cleditor
4
+ requires CLEditor v1.2.2 or later
5
+
6
+ Copyright 2010, Sergio Drago
7
+ Dual licensed under the MIT or GPL Version 2 licenses.
8
+
9
+ Based on Chris Landowski's Table Plugin v1.0.2
10
+ */
11
+
12
+ // ==ClosureCompiler==
13
+ // @compilation_level SIMPLE_OPTIMIZATIONS
14
+ // @output_file_name jquery.cleditor.advancedtable.min.js
15
+ // ==/ClosureCompiler==
16
+
17
+ (function($) {
18
+
19
+ // Define the table button
20
+ $.cleditor.buttons.table = {
21
+ name: "table",
22
+ image: "table.gif",
23
+ title: "Insert Table",
24
+ command: "inserthtml",
25
+ popupName: "table",
26
+ popupClass: "cleditorPrompt",
27
+ popupContent:
28
+ "<table cellpadding=0 cellspacing=0><tr>" +
29
+ "<td style=\"padding-right:6px;\">Cols:<br /><input type=text value=4 size=12 /></td>" +
30
+ "<td style=\"padding-right:6px;\">Rows:<br /><input type=text value=4 size=12 /></td>" +
31
+ "</tr><tr>" +
32
+ "<td style=\"padding-right:6px;\">Cell Spacing:<br /><input type=text value=2 size=12 /></td>" +
33
+ "<td style=\"padding-right:6px;\">Cell Padding:<br /><input type=text value=2 size=12 /></td>" +
34
+ "</tr><tr>" +
35
+ "<td style=\"padding-right:6px;\">Border:<br /><input type=text value=1 size=12 /></td>" +
36
+ "<td style=\"padding-right:6px;\">Style (CSS):<br /><input type=text size=12 /></td>" +
37
+ "</tr></table><br /><input type=button value=Submit />",
38
+ buttonClick: tableButtonClick
39
+ };
40
+
41
+ // Add the button to the default controls
42
+ $.cleditor.defaultOptions.controls = $.cleditor.defaultOptions.controls
43
+ .replace("rule ", "rule table ");
44
+
45
+ // Table button click event handler
46
+ function tableButtonClick(e, data) {
47
+
48
+ // Wire up the submit button click event handler
49
+ $(data.popup).children(":button")
50
+ .unbind("click")
51
+ .bind("click", function(e) {
52
+
53
+ // Get the editor
54
+ var editor = data.editor;
55
+
56
+ // Get the column and row count
57
+ var $text = $(data.popup).find(":text"),
58
+ cols = parseInt($text[0].value),
59
+ rows = parseInt($text[1].value),
60
+ spacing = parseInt($text[2].value),
61
+ padding = parseInt($text[3].value),
62
+ border = parseInt($text[4].value),
63
+ styles = $text[5].value;
64
+
65
+ if (parseInt(cols) < 1 || !parseInt(cols)) cols = 0;
66
+ if (parseInt(rows) < 1 || !parseInt(rows)) rows = 0;
67
+ if (parseInt(spacing) < 1 || !parseInt(spacing)) spacing = 0;
68
+ if (parseInt(padding) < 1 || !parseInt(padding)) padding = 0;
69
+ if (parseInt(border) < 1 || !parseInt(border)) border = 0;
70
+
71
+ // Build the html
72
+ var html;
73
+ if (cols > 0 && rows > 0) {
74
+ html = "<table border=" + border + " cellpadding=" + padding +
75
+ " cellspacing=" + spacing +
76
+ (styles ? ' style="' + styles + '"' : "") + ">";
77
+ for (y = 0; y < rows; y++) {
78
+ html += "<tr>";
79
+ for (x = 0; x < cols; x++)
80
+ html += "<td>" + x + "," + y + "</td>";
81
+ html += "</tr>";
82
+ }
83
+ html += "</table><br />";
84
+ }
85
+
86
+ // Insert the html
87
+ if (html)
88
+ editor.execCommand(data.command, html, null, data.button);
89
+
90
+ // Reset the text, hide the popup and set focus
91
+ $text[0].value = "4";
92
+ $text[1].value = "4";
93
+ $text[2].value = "2";
94
+ $text[3].value = "2";
95
+ $text[4].value = "1";
96
+ $text[5].value = "";
97
+ editor.hidePopups();
98
+ editor.focus();
99
+
100
+ });
101
+
102
+ }
103
+
104
+ })(jQuery);
@@ -0,0 +1,24 @@
1
+ .cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white}
2
+ .cleditorMain iframe {border:none; margin:0; padding:0}
3
+ .cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */}
4
+ .cleditorToolbar {background: url('/assets/cleditor/toolbar.gif') repeat}
5
+ .cleditorGroup {float:left; height:26px}
6
+ .cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('/assets/cleditor/buttons.gif')}
7
+ .cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)}
8
+ .cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC}
9
+ .cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}
10
+ .cleditorList div {padding:2px 4px 2px 4px}
11
+ .cleditorList p,
12
+ .cleditorList h1,
13
+ .cleditorList h2,
14
+ .cleditorList h3,
15
+ .cleditorList h4,
16
+ .cleditorList h5,
17
+ .cleditorList h6,
18
+ .cleditorList font {padding:0; margin:0; background-color:Transparent}
19
+ .cleditorColor {width:150px; padding:1px 0 0 1px}
20
+ .cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0}
21
+ .cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt}
22
+ .cleditorPrompt input,
23
+ .cleditorPrompt textarea {font:8.5pt Arial,Verdana;}
24
+ .cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cleditor-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ivan Novosad
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ description: CLEeditor for rails
31
+ email:
32
+ - ivan.novosad@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/cleditor-rails/version.rb
38
+ - lib/cleditor-rails.rb
39
+ - vendor/assets/images/cleditor/buttons.gif
40
+ - vendor/assets/images/cleditor/table.gif
41
+ - vendor/assets/images/cleditor/toolbar.gif
42
+ - vendor/assets/javascripts/cleditor/cleditor.js
43
+ - vendor/assets/javascripts/cleditor/jquery.cleditor.advancedtable.js
44
+ - vendor/assets/stylesheets/cleditor/cleditor.css
45
+ - LICENSE
46
+ - README.md
47
+ homepage: ''
48
+ licenses: []
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 1.8.22
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: CLEeditor for rails
71
+ test_files: []