liquid_cms 0.2.1.1 → 0.2.2.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.
Files changed (130) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/README.rdoc +15 -1
  3. data/TODO.rdoc +0 -2
  4. data/app/controllers/cms/assets_controller.rb +20 -6
  5. data/app/controllers/cms/components_controller.rb +11 -3
  6. data/app/controllers/cms/pages_controller.rb +15 -4
  7. data/app/helpers/cms/common_helper.rb +31 -31
  8. data/app/liquid/cms_paperclip_extension.rb +75 -3
  9. data/app/models/cms/asset.rb +1 -1
  10. data/app/models/cms/component.rb +3 -3
  11. data/app/views/cms/assets/_form.html.erb +1 -1
  12. data/app/views/cms/assets/update.js.rjs +1 -0
  13. data/app/views/cms/components/update.js.rjs +1 -0
  14. data/app/views/cms/pages/_form.html.erb +1 -1
  15. data/app/views/cms/pages/update.js.rjs +1 -0
  16. data/app/views/layouts/cms.html.erb +4 -3
  17. data/generators/liquid_cms/liquid_cms_generator.rb +1 -0
  18. data/generators/liquid_cms/templates/config/locales/cms/en.yml +4 -0
  19. data/generators/liquid_cms/templates/migration_rev2.rb +13 -0
  20. data/generators/liquid_cms/templates/public/cms/codemirror/LICENSE +16 -20
  21. data/generators/liquid_cms/templates/public/cms/codemirror/lib/codemirror.css +68 -0
  22. data/generators/liquid_cms/templates/public/cms/codemirror/lib/codemirror.js +2197 -0
  23. data/generators/liquid_cms/templates/public/cms/codemirror/lib/overlay.js +51 -0
  24. data/generators/liquid_cms/templates/public/cms/codemirror/lib/runmode.js +27 -0
  25. data/generators/liquid_cms/templates/public/cms/codemirror/mode/clike/clike.js +247 -0
  26. data/generators/liquid_cms/templates/public/cms/codemirror/mode/clike/index.html +102 -0
  27. data/generators/liquid_cms/templates/public/cms/codemirror/mode/clojure/clojure.js +207 -0
  28. data/generators/liquid_cms/templates/public/cms/codemirror/mode/clojure/index.html +85 -0
  29. data/generators/liquid_cms/templates/public/cms/codemirror/mode/coffeescript/LICENSE +22 -0
  30. data/generators/liquid_cms/templates/public/cms/codemirror/mode/coffeescript/coffeescript.js +325 -0
  31. data/generators/liquid_cms/templates/public/cms/codemirror/mode/coffeescript/index.html +722 -0
  32. data/generators/liquid_cms/templates/public/cms/codemirror/mode/css/css.js +124 -0
  33. data/generators/liquid_cms/templates/public/cms/codemirror/mode/css/index.html +56 -0
  34. data/generators/liquid_cms/templates/public/cms/codemirror/mode/diff/diff.css +3 -0
  35. data/generators/liquid_cms/templates/public/cms/codemirror/mode/diff/diff.js +13 -0
  36. data/generators/liquid_cms/templates/public/cms/codemirror/mode/diff/index.html +99 -0
  37. data/generators/liquid_cms/templates/public/cms/codemirror/mode/haskell/haskell.js +242 -0
  38. data/generators/liquid_cms/templates/public/cms/codemirror/mode/haskell/index.html +60 -0
  39. data/generators/liquid_cms/templates/public/cms/codemirror/mode/htmlmixed/htmlmixed.js +79 -0
  40. data/generators/liquid_cms/templates/public/cms/codemirror/mode/htmlmixed/index.html +52 -0
  41. data/generators/liquid_cms/templates/public/cms/codemirror/mode/javascript/index.html +78 -0
  42. data/generators/liquid_cms/templates/public/cms/codemirror/mode/javascript/javascript.js +352 -0
  43. data/generators/liquid_cms/templates/public/cms/codemirror/mode/jinja2/index.html +38 -0
  44. data/generators/liquid_cms/templates/public/cms/codemirror/mode/jinja2/jinja2.js +42 -0
  45. data/generators/liquid_cms/templates/public/cms/codemirror/mode/lua/index.html +72 -0
  46. data/generators/liquid_cms/templates/public/cms/codemirror/mode/lua/lua.js +140 -0
  47. data/generators/liquid_cms/templates/public/cms/codemirror/mode/markdown/index.html +340 -0
  48. data/generators/liquid_cms/templates/public/cms/codemirror/mode/markdown/markdown.css +10 -0
  49. data/generators/liquid_cms/templates/public/cms/codemirror/mode/markdown/markdown.js +230 -0
  50. data/generators/liquid_cms/templates/public/cms/codemirror/mode/ntriples/index.html +33 -0
  51. data/generators/liquid_cms/templates/public/cms/codemirror/mode/ntriples/ntriples.js +172 -0
  52. data/generators/liquid_cms/templates/public/cms/codemirror/mode/pascal/LICENSE +7 -0
  53. data/generators/liquid_cms/templates/public/cms/codemirror/mode/pascal/index.html +49 -0
  54. data/generators/liquid_cms/templates/public/cms/codemirror/mode/pascal/pascal.js +138 -0
  55. data/generators/liquid_cms/templates/public/cms/codemirror/mode/php/index.html +49 -0
  56. data/generators/liquid_cms/templates/public/cms/codemirror/mode/php/php.js +116 -0
  57. data/generators/liquid_cms/templates/public/cms/codemirror/mode/plsql/index.html +63 -0
  58. data/generators/liquid_cms/templates/public/cms/codemirror/mode/plsql/plsql.js +217 -0
  59. data/generators/liquid_cms/templates/public/cms/codemirror/mode/python/LICENSE.txt +21 -0
  60. data/generators/liquid_cms/templates/public/cms/codemirror/mode/python/index.html +123 -0
  61. data/generators/liquid_cms/templates/public/cms/codemirror/mode/python/python.js +320 -0
  62. data/generators/liquid_cms/templates/public/cms/codemirror/mode/r/LICENSE +24 -0
  63. data/generators/liquid_cms/templates/public/cms/codemirror/mode/r/index.html +74 -0
  64. data/generators/liquid_cms/templates/public/cms/codemirror/mode/r/r.js +141 -0
  65. data/generators/liquid_cms/templates/public/cms/codemirror/mode/rst/index.html +526 -0
  66. data/generators/liquid_cms/templates/public/cms/codemirror/mode/rst/rst.css +75 -0
  67. data/generators/liquid_cms/templates/public/cms/codemirror/mode/rst/rst.js +333 -0
  68. data/generators/liquid_cms/templates/public/cms/codemirror/mode/ruby/LICENSE +24 -0
  69. data/generators/liquid_cms/templates/public/cms/codemirror/mode/ruby/index.html +172 -0
  70. data/generators/liquid_cms/templates/public/cms/codemirror/mode/ruby/ruby.js +195 -0
  71. data/generators/liquid_cms/templates/public/cms/codemirror/mode/scheme/index.html +65 -0
  72. data/generators/liquid_cms/templates/public/cms/codemirror/mode/scheme/scheme.js +202 -0
  73. data/generators/liquid_cms/templates/public/cms/codemirror/mode/smalltalk/index.html +56 -0
  74. data/generators/liquid_cms/templates/public/cms/codemirror/mode/smalltalk/smalltalk.js +122 -0
  75. data/generators/liquid_cms/templates/public/cms/codemirror/mode/sparql/index.html +41 -0
  76. data/generators/liquid_cms/templates/public/cms/codemirror/mode/sparql/sparql.js +143 -0
  77. data/generators/liquid_cms/templates/public/cms/codemirror/mode/stex/index.html +96 -0
  78. data/generators/liquid_cms/templates/public/cms/codemirror/mode/stex/stex.js +167 -0
  79. data/generators/liquid_cms/templates/public/cms/codemirror/mode/velocity/index.html +103 -0
  80. data/generators/liquid_cms/templates/public/cms/codemirror/mode/velocity/velocity.js +146 -0
  81. data/generators/liquid_cms/templates/public/cms/codemirror/mode/xml/index.html +42 -0
  82. data/generators/liquid_cms/templates/public/cms/codemirror/mode/xml/xml.js +231 -0
  83. data/generators/liquid_cms/templates/public/cms/codemirror/mode/xmlpure/index.html +60 -0
  84. data/generators/liquid_cms/templates/public/cms/codemirror/mode/xmlpure/xmlpure.js +481 -0
  85. data/generators/liquid_cms/templates/public/cms/codemirror/mode/yaml/index.html +68 -0
  86. data/generators/liquid_cms/templates/public/cms/codemirror/mode/yaml/yaml.js +95 -0
  87. data/generators/liquid_cms/templates/public/cms/codemirror/theme/cobalt.css +17 -0
  88. data/generators/liquid_cms/templates/public/cms/codemirror/theme/default.css +19 -0
  89. data/generators/liquid_cms/templates/public/cms/codemirror/theme/eclipse.css +24 -0
  90. data/generators/liquid_cms/templates/public/cms/codemirror/theme/elegant.css +9 -0
  91. data/generators/liquid_cms/templates/public/cms/codemirror/theme/neat.css +8 -0
  92. data/generators/liquid_cms/templates/public/cms/codemirror/theme/night.css +20 -0
  93. data/generators/liquid_cms/templates/public/cms/javascripts/cms.js +1 -1
  94. data/generators/liquid_cms/templates/public/cms/javascripts/codemirror_custom.js +96 -0
  95. data/generators/liquid_cms/templates/public/cms/stylesheets/codemirror_changes.css +26 -0
  96. data/generators/liquid_cms/templates/public/cms/stylesheets/liquid.css +7 -0
  97. data/generators/liquid_cms/templates/public/cms/stylesheets/simple_form.css +0 -8
  98. data/lib/liquid_cms/version.rb +1 -1
  99. data/liquid_cms.gemspec +0 -1
  100. data/test/functional/assets_controller_test.rb +35 -20
  101. data/test/functional/components_controller_test.rb +15 -5
  102. data/test/functional/pages_controller_test.rb +19 -6
  103. data/test/rails_app/config/environment.rb +1 -1
  104. data/test/rails_app/config/locales/cms/en.yml +19 -4
  105. data/test/rails_app/db/migrate/20110511161859_create_liquid_cms_upgrade_rev2.rb +13 -0
  106. data/test/unit/asset_test.rb +1 -1
  107. metadata +100 -58
  108. data/generators/liquid_cms/templates/public/cms/codemirror/css/csscolors.css +0 -55
  109. data/generators/liquid_cms/templates/public/cms/codemirror/css/docs.css +0 -158
  110. data/generators/liquid_cms/templates/public/cms/codemirror/css/font.js +0 -15
  111. data/generators/liquid_cms/templates/public/cms/codemirror/css/jscolors.css +0 -59
  112. data/generators/liquid_cms/templates/public/cms/codemirror/css/sparqlcolors.css +0 -43
  113. data/generators/liquid_cms/templates/public/cms/codemirror/css/xmlcolors.css +0 -55
  114. data/generators/liquid_cms/templates/public/cms/codemirror/js/codemirror.js +0 -582
  115. data/generators/liquid_cms/templates/public/cms/codemirror/js/editor.js +0 -1671
  116. data/generators/liquid_cms/templates/public/cms/codemirror/js/highlight.js +0 -68
  117. data/generators/liquid_cms/templates/public/cms/codemirror/js/mirrorframe.js +0 -81
  118. data/generators/liquid_cms/templates/public/cms/codemirror/js/parsecss.js +0 -161
  119. data/generators/liquid_cms/templates/public/cms/codemirror/js/parsedummy.js +0 -32
  120. data/generators/liquid_cms/templates/public/cms/codemirror/js/parsehtmlmixed.js +0 -93
  121. data/generators/liquid_cms/templates/public/cms/codemirror/js/parsejavascript.js +0 -359
  122. data/generators/liquid_cms/templates/public/cms/codemirror/js/parsesparql.js +0 -162
  123. data/generators/liquid_cms/templates/public/cms/codemirror/js/parsexml.js +0 -291
  124. data/generators/liquid_cms/templates/public/cms/codemirror/js/select.js +0 -699
  125. data/generators/liquid_cms/templates/public/cms/codemirror/js/stringstream.js +0 -159
  126. data/generators/liquid_cms/templates/public/cms/codemirror/js/tokenize.js +0 -57
  127. data/generators/liquid_cms/templates/public/cms/codemirror/js/tokenizejavascript.js +0 -174
  128. data/generators/liquid_cms/templates/public/cms/codemirror/js/undo.js +0 -413
  129. data/generators/liquid_cms/templates/public/cms/codemirror/js/unittests.js +0 -44
  130. data/generators/liquid_cms/templates/public/cms/codemirror/js/util.js +0 -133
@@ -1,291 +0,0 @@
1
- /* This file defines an XML parser, with a few kludges to make it
2
- * useable for HTML. autoSelfClosers defines a set of tag names that
3
- * are expected to not have a closing tag, and doNotIndent specifies
4
- * the tags inside of which no indentation should happen (see Config
5
- * object). These can be disabled by passing the editor an object like
6
- * {useHTMLKludges: false} as parserConfig option.
7
- */
8
-
9
- var XMLParser = Editor.Parser = (function() {
10
- var Kludges = {
11
- autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
12
- "meta": true, "col": true, "frame": true, "base": true, "area": true},
13
- doNotIndent: {"pre": true, "!cdata": true}
14
- };
15
- var NoKludges = {autoSelfClosers: {}, doNotIndent: {"!cdata": true}};
16
- var UseKludges = Kludges;
17
- var alignCDATA = false;
18
-
19
- // Simple stateful tokenizer for XML documents. Returns a
20
- // MochiKit-style iterator, with a state property that contains a
21
- // function encapsulating the current state. See tokenize.js.
22
- var tokenizeXML = (function() {
23
- function inText(source, setState) {
24
- var ch = source.next();
25
- if (ch == "<") {
26
- if (source.equals("!")) {
27
- source.next();
28
- if (source.equals("[")) {
29
- if (source.lookAhead("[CDATA[", true)) {
30
- setState(inBlock("xml-cdata", "]]>"));
31
- return null;
32
- }
33
- else {
34
- return "xml-text";
35
- }
36
- }
37
- else if (source.lookAhead("--", true)) {
38
- setState(inBlock("xml-comment", "-->"));
39
- return null;
40
- }
41
- else if (source.lookAhead("DOCTYPE", true)) {
42
- source.nextWhileMatches(/[\w\._\-]/);
43
- setState(inBlock("xml-doctype", ">"));
44
- return "xml-doctype";
45
- }
46
- else {
47
- return "xml-text";
48
- }
49
- }
50
- else if (source.equals("?")) {
51
- source.next();
52
- source.nextWhileMatches(/[\w\._\-]/);
53
- setState(inBlock("xml-processing", "?>"));
54
- return "xml-processing";
55
- }
56
- else {
57
- if (source.equals("/")) source.next();
58
- setState(inTag);
59
- return "xml-punctuation";
60
- }
61
- }
62
- else if (ch == "&") {
63
- while (!source.endOfLine()) {
64
- if (source.next() == ";")
65
- break;
66
- }
67
- return "xml-entity";
68
- }
69
- else {
70
- source.nextWhileMatches(/[^&<\n]/);
71
- return "xml-text";
72
- }
73
- }
74
-
75
- function inTag(source, setState) {
76
- var ch = source.next();
77
- if (ch == ">") {
78
- setState(inText);
79
- return "xml-punctuation";
80
- }
81
- else if (/[?\/]/.test(ch) && source.equals(">")) {
82
- source.next();
83
- setState(inText);
84
- return "xml-punctuation";
85
- }
86
- else if (ch == "=") {
87
- return "xml-punctuation";
88
- }
89
- else if (/[\'\"]/.test(ch)) {
90
- setState(inAttribute(ch));
91
- return null;
92
- }
93
- else {
94
- source.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/);
95
- return "xml-name";
96
- }
97
- }
98
-
99
- function inAttribute(quote) {
100
- return function(source, setState) {
101
- while (!source.endOfLine()) {
102
- if (source.next() == quote) {
103
- setState(inTag);
104
- break;
105
- }
106
- }
107
- return "xml-attribute";
108
- };
109
- }
110
-
111
- function inBlock(style, terminator) {
112
- return function(source, setState) {
113
- while (!source.endOfLine()) {
114
- if (source.lookAhead(terminator, true)) {
115
- setState(inText);
116
- break;
117
- }
118
- source.next();
119
- }
120
- return style;
121
- };
122
- }
123
-
124
- return function(source, startState) {
125
- return tokenizer(source, startState || inText);
126
- };
127
- })();
128
-
129
- // The parser. The structure of this function largely follows that of
130
- // parseJavaScript in parsejavascript.js (there is actually a bit more
131
- // shared code than I'd like), but it is quite a bit simpler.
132
- function parseXML(source) {
133
- var tokens = tokenizeXML(source), token;
134
- var cc = [base];
135
- var tokenNr = 0, indented = 0;
136
- var currentTag = null, context = null;
137
- var consume;
138
-
139
- function push(fs) {
140
- for (var i = fs.length - 1; i >= 0; i--)
141
- cc.push(fs[i]);
142
- }
143
- function cont() {
144
- push(arguments);
145
- consume = true;
146
- }
147
- function pass() {
148
- push(arguments);
149
- consume = false;
150
- }
151
-
152
- function markErr() {
153
- token.style += " xml-error";
154
- }
155
- function expect(text) {
156
- return function(style, content) {
157
- if (content == text) cont();
158
- else {markErr(); cont(arguments.callee);}
159
- };
160
- }
161
-
162
- function pushContext(tagname, startOfLine) {
163
- var noIndent = UseKludges.doNotIndent.hasOwnProperty(tagname) || (context && context.noIndent);
164
- context = {prev: context, name: tagname, indent: indented, startOfLine: startOfLine, noIndent: noIndent};
165
- }
166
- function popContext() {
167
- context = context.prev;
168
- }
169
- function computeIndentation(baseContext) {
170
- return function(nextChars, current) {
171
- var context = baseContext;
172
- if (context && context.noIndent)
173
- return current;
174
- if (alignCDATA && /<!\[CDATA\[/.test(nextChars))
175
- return 0;
176
- if (context && /^<\//.test(nextChars))
177
- context = context.prev;
178
- while (context && !context.startOfLine)
179
- context = context.prev;
180
- if (context)
181
- return context.indent + indentUnit;
182
- else
183
- return 0;
184
- };
185
- }
186
-
187
- function base() {
188
- return pass(element, base);
189
- }
190
- var harmlessTokens = {"xml-text": true, "xml-entity": true, "xml-comment": true, "xml-processing": true, "xml-doctype": true};
191
- function element(style, content) {
192
- if (content == "<") cont(tagname, attributes, endtag(tokenNr == 1));
193
- else if (content == "</") cont(closetagname, expect(">"));
194
- else if (style == "xml-cdata") {
195
- if (!context || context.name != "!cdata") pushContext("!cdata");
196
- if (/\]\]>$/.test(content)) popContext();
197
- cont();
198
- }
199
- else if (harmlessTokens.hasOwnProperty(style)) cont();
200
- else {markErr(); cont();}
201
- }
202
- function tagname(style, content) {
203
- if (style == "xml-name") {
204
- currentTag = content.toLowerCase();
205
- token.style = "xml-tagname";
206
- cont();
207
- }
208
- else {
209
- currentTag = null;
210
- pass();
211
- }
212
- }
213
- function closetagname(style, content) {
214
- if (style == "xml-name") {
215
- token.style = "xml-tagname";
216
- if (context && content.toLowerCase() == context.name) popContext();
217
- else markErr();
218
- }
219
- cont();
220
- }
221
- function endtag(startOfLine) {
222
- return function(style, content) {
223
- if (content == "/>" || (content == ">" && UseKludges.autoSelfClosers.hasOwnProperty(currentTag))) cont();
224
- else if (content == ">") {pushContext(currentTag, startOfLine); cont();}
225
- else {markErr(); cont(arguments.callee);}
226
- };
227
- }
228
- function attributes(style) {
229
- if (style == "xml-name") {token.style = "xml-attname"; cont(attribute, attributes);}
230
- else pass();
231
- }
232
- function attribute(style, content) {
233
- if (content == "=") cont(value);
234
- else if (content == ">" || content == "/>") pass(endtag);
235
- else pass();
236
- }
237
- function value(style) {
238
- if (style == "xml-attribute") cont(value);
239
- else pass();
240
- }
241
-
242
- return {
243
- indentation: function() {return indented;},
244
-
245
- next: function(){
246
- token = tokens.next();
247
- if (token.style == "whitespace" && tokenNr == 0)
248
- indented = token.value.length;
249
- else
250
- tokenNr++;
251
- if (token.content == "\n") {
252
- indented = tokenNr = 0;
253
- token.indentation = computeIndentation(context);
254
- }
255
-
256
- if (token.style == "whitespace" || token.type == "xml-comment")
257
- return token;
258
-
259
- while(true){
260
- consume = false;
261
- cc.pop()(token.style, token.content);
262
- if (consume) return token;
263
- }
264
- },
265
-
266
- copy: function(){
267
- var _cc = cc.concat([]), _tokenState = tokens.state, _context = context;
268
- var parser = this;
269
-
270
- return function(input){
271
- cc = _cc.concat([]);
272
- tokenNr = indented = 0;
273
- context = _context;
274
- tokens = tokenizeXML(input, _tokenState);
275
- return parser;
276
- };
277
- }
278
- };
279
- }
280
-
281
- return {
282
- make: parseXML,
283
- electricChars: "/",
284
- configure: function(config) {
285
- if (config.useHTMLKludges != null)
286
- UseKludges = config.useHTMLKludges ? Kludges : NoKludges;
287
- if (config.alignCDATA)
288
- alignCDATA = config.alignCDATA;
289
- }
290
- };
291
- })();