YurtCMS 0.2.0 → 0.3.1

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/lib/yurtcms.rb CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  require 'yaml'
3
3
 
4
+
4
5
  class YurtCMS
5
6
  attr_reader :data_store, :web_root, :includes, :metatags, :partial, :ext
6
7
  def initialize yurt_root
@@ -132,12 +133,19 @@
132
133
  Dir.delete( f )
133
134
  end
134
135
  else
136
+ metadata = YAML.load( File.open( f ) )
137
+
135
138
  File.delete( f )
136
- [ :path_to_metatags,
137
- :path_to_content,
138
- :path_to_placeholder ].each do |p|
139
- f = send( p, obj )
140
- File.delete( f )
139
+
140
+ if metadata['partial'] == 'y'
141
+ File.delete( path_to_content( obj ) )
142
+ else
143
+ [ :path_to_metatags,
144
+ :path_to_content,
145
+ :path_to_placeholder ].each do |p|
146
+ f = send( p, obj )
147
+ File.delete( f )
148
+ end
141
149
  end
142
150
  end
143
151
  end
@@ -165,11 +173,11 @@
165
173
  path = merge( input.path, sanitize_filename( input.filename ) )
166
174
 
167
175
  write_file( path_to_orig_content( path ), make_content_as_yaml( input ) )
168
- write_file( path_to_placeholder( path ), make_placeholder( path, input.template ) )
169
176
  write_file( path_to_content( path ), parse_content( input.content ) )
170
177
 
171
178
  if input.partial != "y"
172
179
  write_file( path_to_metatags( path ), make_metatags( input ) )
180
+ write_file( path_to_placeholder( path ), make_placeholder( path, input.template ) )
173
181
  end
174
182
  end
175
183
  end
data/site/yurt/index.html CHANGED
@@ -51,21 +51,24 @@
51
51
  }
52
52
 
53
53
  function dispatch(url) {
54
+ Element.show('spinner');
54
55
  url = url + "/" + resource;
55
56
  var pars = '';
56
57
  var target = 'workspace';
57
- var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
58
+ var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, evalScripts: true});
58
59
  hideMenus();
59
60
  }
60
61
 
61
62
  function dispatch_post(url,formname) {
63
+ Element.show('spinner');
62
64
  var pars = Form.serialize(formname);
63
65
  var target = 'workspace';
64
- var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});
66
+ var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});
65
67
  hideMenus();
66
68
  }
67
69
 
68
70
  function openFolder(url) {
71
+ Element.show('spinner');
69
72
  url = url + "/" + resource;
70
73
  var pars = '';
71
74
  var target;
@@ -80,13 +83,14 @@
80
83
  }
81
84
 
82
85
  function preview(content) {
86
+ Element.show('spinner');
83
87
  // use an argument looking like this: document.forms["newfile"].content.value
84
88
 
85
89
  var url = "/yurt/yurt.cgi/preview/"
86
90
  var pars = 'c=' + escape( content );
87
91
  var target = 'nf_preview';
88
92
 
89
- var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});
93
+ var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});
90
94
  }
91
95
 
92
96
  function hideMenus() {
@@ -130,6 +134,7 @@
130
134
  <li><a href="/yurt/yurt.cgi/edit" class="first" onclick="dispatch(this.href); return false;">Edit file...</a></li>
131
135
  <li><a href="/yurt/yurt.cgi/delete" onclick="dispatch(this.href); return false;">Delete</a></li>
132
136
  </ul>
137
+ <div id="spinner" style="display: none;"><img src="/yurt/media/images/spinner.gif" width="16" height="16" border="0" alt="" /></div>
133
138
  </body>
134
139
  </html>
135
140
 
@@ -25,7 +25,7 @@
25
25
 
26
26
  .listing {
27
27
  list-style: none;
28
- font-family: Geneva;
28
+ font-family: Geneva, verdana;
29
29
  }
30
30
 
31
31
  #filelist li, #filelist ul {
@@ -102,13 +102,14 @@
102
102
  background-color: #ddddd8;
103
103
  border-top: 1px solid #000;
104
104
  padding: 0.3em;
105
+ font-family: Geneva, verdana, sans-serif;
105
106
  }
106
107
 
107
108
  .actions {
108
109
  margin: 0;
109
110
  padding: 0;
110
111
  list-style: none;
111
- font-family: chicago;
112
+ font-family: chicago, verdana, sans-serif;
112
113
  font-size: 0.9em;
113
114
  width: 140px;
114
115
  background-color: #eeeeec;
@@ -153,3 +154,31 @@
153
154
  #directory_actions, #file_actions {
154
155
  position: absolute;
155
156
  }
157
+
158
+ #spinner {
159
+ position: absolute;
160
+ left: 70px;
161
+ top: 106px;
162
+ }
163
+
164
+ #nf_help table {
165
+ border-collapse: collapse;
166
+ }
167
+
168
+ #nf_help th {
169
+ font-size: 1.5em;
170
+ border: 1px solid black;
171
+ padding: 0.5em;
172
+ margin: 0;
173
+ }
174
+
175
+ #nf_help td {
176
+ border: 1px solid black;
177
+ padding: 1em;
178
+ margin: 0;
179
+ }
180
+
181
+ #nf_help td.code {
182
+ font-family: monospace;
183
+ }
184
+
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/site/yurt/yurt.cgi CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'yurtcms'
4
4
  require 'camping'
5
- require 'BlueCloth'
5
+ require 'bluecloth'
6
6
 
7
7
  Camping.goes :Yurt
8
8
 
@@ -53,7 +53,6 @@ module Yurt::Controllers
53
53
  class New_File < R '/new_file/([\w\/\.\-\_]*)'
54
54
  def get path
55
55
  @y = get_yurtcms
56
- @p = @y.sanitize_path( path )
57
56
 
58
57
  @f = Hash.new
59
58
  @f['title'] = "page_title"
@@ -62,6 +61,7 @@ module Yurt::Controllers
62
61
  @f['content'] = ""
63
62
  @f['filename'] = "file_name"
64
63
  @f['partial'] = ""
64
+ @f['path'] = @y.sanitize_path( path )
65
65
 
66
66
  render :new_file
67
67
  end
@@ -164,17 +164,18 @@ module Yurt::Views
164
164
  text " x[x.length] = '" +@p + "/" + file + "';"
165
165
  end
166
166
  text " new EventDispenser(x);"
167
+ text " Element.hide('spinner');"
167
168
  end
168
169
  end
169
170
 
170
171
  def new_file
171
172
  text %Q(
172
- <form action="/yurt/yurt.cgi/new_file/" method="post" name="newfile" class="dialog_box" id="newfile">
173
+ <form action="/yurt/yurt.cgi/new_file/" method="post" name="newfile" class="dialog_box" id="newfile" onsubmit="dispatch_post('/yurt/yurt.cgi/new_file/', 'newfile');return false;">
173
174
  <fieldset>
174
175
  <legend>
175
- <a href="#" onclick="toggleTabs('nf_dialog', 'nf_preview', 'nf_help');">New File</a> |
176
- <a href="#" onclick="toggleTabs('nf_preview', 'nf_dialog', 'nf_help');preview(document.forms['newfile'].content.value);">Preview</a> |
177
- <a href="#" onclick="toggleTabs('nf_help', 'nf_dialog', 'nf_preview');">Help</a>
176
+ <a href="#" onclick="toggleTabs('nf_dialog', 'nf_preview', 'nf_help');return false;">New File</a> |
177
+ <a href="#" onclick="toggleTabs('nf_preview', 'nf_dialog', 'nf_help');preview(document.forms['newfile'].content.value);return false;">Preview</a> |
178
+ <a href="#" onclick="toggleTabs('nf_help', 'nf_dialog', 'nf_preview');return false;">Help</a>
178
179
  </legend>
179
180
  <div id="nf_dialog" class="dialog">
180
181
  <label><input type="text" name="filename" value="#{ @f['filename'] }" /> File name</label>
@@ -187,31 +188,154 @@ module Yurt::Views
187
188
  </div>
188
189
  <textarea name="content" class="contentarea">#{ @f['content'] }</textarea>
189
190
  <input type="hidden" name="path" value="#{@f['path']}" />
190
- <input type="button" name="add" value="Add" onclick="dispatch_post('/yurt/yurt.cgi/new_file/', 'newfile')" />
191
+ <input type="button" name="add" value="Save" onclick="dispatch_post('/yurt/yurt.cgi/new_file/', 'newfile')" />
191
192
  <input type="button" name="cancel" value="Cancel" onclick="dispatch('/yurt/yurt.cgi/cancel')" />
192
193
  </div>
193
194
  <div id="nf_preview" class="preview" style="display: none;">
194
195
  </div>
195
196
  <div id="nf_help" class="help" style="display: none;">
196
- <p>A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line � a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
197
+ <p>The following chart will assist you as you're entering content.</p>
198
+ <table>
199
+ <tr>
200
+ <th>To Get:</th>
201
+ <th>Type:</th>
202
+ </tr>
203
+ <tr>
204
+ <td>A paragraph.</td>
205
+ <td>- one or more consecutive lines of text, followed by one or more blank lines.</td>
206
+ </tr>
207
+ <tr>
208
+ <td><h1>Heading 1</h1></td>
209
+ <td class="code"># Heading 1</td>
210
+ </tr>
211
+ <tr>
212
+ <td><h2>Heading 2</h2></td>
213
+ <td class="code">## Heading 2</td>
214
+ </tr>
215
+ <tr>
216
+ <td><h3>Heading 3</h3></td>
217
+ <td class="code">### Heading 3</td>
218
+ </tr>
219
+ <tr>
220
+ <td><h4>Heading 4</h4></td>
221
+ <td class="code">#### Heading 4</td>
222
+ </tr>
223
+ <tr>
224
+ <td><h5>Heading 5</h5></td>
225
+ <td class="code">##### Heading 5</td>
226
+ </tr>
227
+ <tr>
228
+ <td><h6>Heading 6</h6></td>
229
+ <td class="code">###### Heading 6</td>
230
+ </tr>
231
+ <tr>
232
+ <td><blockquote>
233
+ Insert a blockquote
234
+ </blockquote></td>
235
+ <td class="code">&gt; one or more consecutive lines that start with '&gt; ', followed by one or more blank lines.</td>
236
+ </tr>
237
+ <tr>
238
+ <td><ul>
239
+ <li>bullet list</li>
240
+ <li>bullet list</li>
241
+ </ul></td>
242
+ <td class="code">* bullet list<br />* bullet list</td>
243
+ </tr>
244
+ <tr>
245
+ <td><ol>
246
+ <li>numbered list</li>
247
+ <li>numbered list</li>
248
+ </ol></td>
249
+ <td class="code">1. numbered list<br />2. numbered list</td>
250
+ </tr>
251
+ <tr>
252
+ <td><hr /></td>
253
+ <td class="code">---- (3 or more hyphens)</td>
254
+ </tr>
255
+ <tr>
256
+ <td><a href="#">A link</a></td>
257
+ <td class="code">[A link](url goes here)</td>
258
+ </tr>
259
+ <tr>
260
+ <td><em>Italics</em></td>
261
+ <td class="code">*Italics*</td>
262
+ </tr>
263
+ <tr>
264
+ <td><strong>Bold</strong></td>
265
+ <td class="code">**Bold**</td>
266
+ </tr>
267
+ <tr>
268
+ <td>adding an image</td>
269
+ <td class="code">![alt text](path/to/image.jpg)</td>
270
+ </tr>
271
+ <tr>
272
+ <td colspan="2">In unusual circumstances, you might need some of the characters that were used above in it's literal sense. To get them, consult the following chart.</td>
273
+ </tr>
274
+ <tr>
275
+ <td>\\</td>
276
+ <td class="code">\\\\</td>
277
+ </tr>
278
+ <tr>
279
+ <td>`</td>
280
+ <td class="code">\\`</td>
281
+ </tr>
282
+ <tr>
283
+ <td>*</td>
284
+ <td class="code">\\*</td>
285
+ </tr>
286
+ <tr>
287
+ <td>_</td>
288
+ <td class="code">\\_</td>
289
+ </tr>
290
+ <tr>
291
+ <td>#</td>
292
+ <td class="code">\\#</td>
293
+ </tr>
294
+ <tr>
295
+ <td>.</td>
296
+ <td class="code">\\. (this is extremely rare)</td>
297
+ </tr>
298
+ <tr>
299
+ <td>!</td>
300
+ <td class="code">\\!</td>
301
+ </tr>
302
+ <tr>
303
+ <td>{}</td>
304
+ <td class="code">\\{\\}</td>
305
+ </tr>
306
+ <tr>
307
+ <td>()</td>
308
+ <td class="code">\\(\\)</td>
309
+ </tr>
310
+ <tr>
311
+ <td>[]</td>
312
+ <td class="code">\\[\\]</td>
313
+ </tr>
314
+ <tr>
315
+ <td colspan="2">If you need a more complete understanding of the Markdown syntax used in here, please consult <a href="http://daringfireball.net/projects/markdown/syntax" target="_new">the original Markdown syntax guide</a>.</td>
316
+ </tr>
317
+ </table>
197
318
  </div>
198
319
  </fieldset>
199
320
  </form>
200
- )
321
+ )
322
+ script do
323
+ text " Element.hide('spinner');"
324
+ end
201
325
  end
202
326
 
203
327
  def new_folder
204
328
  text %Q(
205
- <form action="/yurt/yurt.cgi/new_folder/" method="post" name="newfolder" class="dialog_box" id="newfolder">
329
+ <form action="/yurt/yurt.cgi/new_folder/" method="post" name="newfolder" class="dialog_box" id="newfolder" onsubmit="dispatch_post('/yurt/yurt.cgi/new_folder/', 'newfolder');return false;">
206
330
  <fieldset>
207
331
  <legend>
208
- <a href="#" onclick="toggleTabs('nf_dialog', 'nf_help');">New Folder</a> |
209
- <a href="#" onclick="toggleTabs('nf_help', 'nf_dialog');">Help</a>
332
+ <a href="#" onclick="toggleTabs('nf_dialog', 'nf_help');return false;">New Folder</a> |
333
+ <a href="#" onclick="toggleTabs('nf_help', 'nf_dialog');return false;">Help</a>
210
334
  </legend>
211
335
  <div id="nf_dialog" class="dialog">
212
336
  <label><input type="text" name="foldername" value="" /> Folder name</label>
213
337
  <input type="hidden" name="path" value="#{@p}" />
214
- <input type="button" name="add" value="Add" onclick="dispatch_post('/yurt/yurt.cgi/new_folder/', 'newfolder')" />
338
+ <input type="button" name="add" value="Save" onclick="dispatch_post('/yurt/yurt.cgi/new_folder/', 'newfolder')" />
215
339
  <input type="button" name="cancel" value="Cancel" onclick="dispatch('/yurt/yurt.cgi/cancel')" />
216
340
  </div>
217
341
  <div id="nf_help" class="help" style="display: none;">
@@ -220,26 +344,44 @@ module Yurt::Views
220
344
  </fieldset>
221
345
  </form>
222
346
  )
347
+ script do
348
+ text " Element.hide('spinner');"
349
+ end
223
350
  end
224
351
 
225
352
  def preview
226
353
  text @p
354
+ script do
355
+ text " Element.hide('spinner');"
356
+ end
227
357
  end
228
358
 
229
359
  def folder_created
230
360
  text %q(<p>The folder was successfully created.</p>)
361
+ script do
362
+ text " Element.hide('spinner');"
363
+ end
231
364
  end
232
365
 
233
366
  def file_created
234
367
  text %q(<p>The file was successfully created.</p>)
368
+ script do
369
+ text " Element.hide('spinner');"
370
+ end
235
371
  end
236
372
 
237
373
  def delete
238
374
  text %q(<p>The Deletion was successful.</p>)
375
+ script do
376
+ text " Element.hide('spinner');"
377
+ end
239
378
  end
240
379
 
241
380
  def cancel
242
381
  text " "
382
+ script do
383
+ text " Element.hide('spinner');"
384
+ end
243
385
  end
244
386
 
245
387
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: YurtCMS
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2006-10-11 00:00:00 -04:00
6
+ version: 0.3.1
7
+ date: 2006-11-13 00:00:00 -05:00
8
8
  summary: The Web CMS that does less!
9
9
  require_paths:
10
10
  - lib
@@ -68,6 +68,7 @@ files:
68
68
  - site/yurt/media/images/directory.png
69
69
  - site/yurt/media/images/file.png
70
70
  - site/yurt/media/images/pane_bg.gif
71
+ - site/yurt/media/images/spinner.gif
71
72
  - site/yurt/media/js/prototype.js
72
73
  - test/cms_filesystem.rb
73
74
  - test/cms_strings.rb