grandstand 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.markdown +43 -0
  3. data/README.txt +0 -0
  4. data/Rakefile +7 -1
  5. data/VERSION +1 -1
  6. data/app/controllers/galleries_controller.rb +2 -2
  7. data/app/controllers/{admin → grandstand}/galleries_controller.rb +9 -13
  8. data/app/controllers/{admin → grandstand}/images_controller.rb +6 -9
  9. data/app/controllers/{admin → grandstand}/main_controller.rb +8 -8
  10. data/app/controllers/{admin → grandstand}/pages_controller.rb +9 -9
  11. data/app/controllers/grandstand/posts_controller.rb +64 -0
  12. data/app/controllers/{admin → grandstand}/sessions_controller.rb +8 -8
  13. data/app/controllers/grandstand/templates_controller.rb +8 -0
  14. data/app/controllers/{admin → grandstand}/users_controller.rb +10 -10
  15. data/app/controllers/posts_controller.rb +1 -1
  16. data/app/helpers/galleries_helper.rb +2 -0
  17. data/app/helpers/grandstand/galleries_helper.rb +2 -0
  18. data/app/helpers/grandstand/images_helpers.rb +2 -0
  19. data/app/helpers/grandstand/main_helper.rb +74 -0
  20. data/app/helpers/grandstand/pages_helper.rb +2 -0
  21. data/app/helpers/grandstand/posts_helper.rb +2 -0
  22. data/app/helpers/grandstand/sessions_helper.rb +2 -0
  23. data/app/helpers/grandstand/templates_helper.rb +2 -0
  24. data/app/helpers/grandstand/users_helper.rb +2 -0
  25. data/app/models/{gallery.rb → grandstand/gallery.rb} +2 -2
  26. data/app/models/{image.rb → grandstand/image.rb} +10 -9
  27. data/app/models/{page.rb → grandstand/page.rb} +1 -1
  28. data/app/models/grandstand/page_section.rb +6 -0
  29. data/app/models/{post.rb → grandstand/post.rb} +14 -2
  30. data/app/models/{template.rb → grandstand/template.rb} +2 -2
  31. data/app/models/{user.rb → grandstand/user.rb} +1 -1
  32. data/app/stylesheets/application.less +103 -10
  33. data/app/stylesheets/global.less +47 -30
  34. data/app/stylesheets/login.less +1 -1
  35. data/app/stylesheets/wysiwyg.less +77 -65
  36. data/app/views/{admin → grandstand}/galleries/_form.html.erb +2 -2
  37. data/app/views/grandstand/galleries/_gallery.html.erb +16 -0
  38. data/app/views/grandstand/galleries/_list.html.erb +17 -0
  39. data/app/views/grandstand/galleries/delete.html.erb +8 -0
  40. data/app/views/grandstand/galleries/edit.html.erb +8 -0
  41. data/app/views/grandstand/galleries/editor.html.erb +33 -0
  42. data/app/views/grandstand/galleries/index.html.erb +14 -0
  43. data/app/views/grandstand/galleries/new.html.erb +8 -0
  44. data/app/views/grandstand/galleries/show.html.erb +19 -0
  45. data/app/views/{admin → grandstand}/images/_form.html.erb +2 -2
  46. data/app/views/grandstand/images/delete.html.erb +8 -0
  47. data/app/views/grandstand/images/edit.html.erb +8 -0
  48. data/app/views/grandstand/images/new.html.erb +8 -0
  49. data/app/views/grandstand/images/show.html.erb +33 -0
  50. data/app/views/{admin → grandstand}/images/upload.html.erb +2 -2
  51. data/app/views/grandstand/main/index.html.erb +10 -0
  52. data/app/views/{admin → grandstand}/pages/_form.html.erb +2 -2
  53. data/app/views/grandstand/pages/_left.html.erb +3 -0
  54. data/app/views/{admin → grandstand}/pages/_row.html.erb +3 -3
  55. data/app/views/{admin → grandstand}/pages/delete.html.erb +2 -2
  56. data/app/views/{admin → grandstand}/pages/edit.html.erb +2 -2
  57. data/app/views/{admin → grandstand}/pages/index.html.erb +1 -1
  58. data/app/views/{admin → grandstand}/pages/new.html.erb +2 -2
  59. data/app/views/{admin → grandstand}/pages/show.html.erb +1 -1
  60. data/app/views/grandstand/posts/_form.html.erb +15 -0
  61. data/app/views/grandstand/posts/_left.html.erb +3 -0
  62. data/app/views/grandstand/posts/_list.html.erb +26 -0
  63. data/app/views/{admin → grandstand}/posts/delete.html.erb +2 -2
  64. data/app/views/grandstand/posts/edit.html.erb +8 -0
  65. data/app/views/{admin → grandstand}/posts/index.html.erb +1 -1
  66. data/app/views/grandstand/posts/new.html.erb +8 -0
  67. data/app/views/grandstand/posts/preview.html.erb +9 -0
  68. data/app/views/grandstand/posts/show.html.erb +8 -0
  69. data/app/views/{admin → grandstand}/sessions/forgot.html.erb +2 -2
  70. data/app/views/{admin → grandstand}/sessions/show.html.erb +2 -2
  71. data/app/views/grandstand/shared/_flash.html.erb +3 -0
  72. data/app/views/{admin → grandstand}/users/_form.html.erb +2 -2
  73. data/app/views/grandstand/users/_left.html.erb +3 -0
  74. data/app/views/{admin → grandstand}/users/delete.html.erb +2 -2
  75. data/app/views/grandstand/users/edit.html.erb +8 -0
  76. data/app/views/{admin → grandstand}/users/index.html.erb +3 -3
  77. data/app/views/grandstand/users/new.html.erb +8 -0
  78. data/app/views/grandstand/users/show.html.erb +12 -0
  79. data/app/views/layouts/grandstand.html.erb +76 -0
  80. data/app/views/layouts/grandstand_login.html.erb +17 -0
  81. data/app/views/layouts/{admin_xhr.html.erb → grandstand_xhr.html.erb} +0 -0
  82. data/app/views/posts/show.html.erb +2 -2
  83. data/{lib/grandstand → config}/routes.rb +9 -7
  84. data/grandstand.gemspec +139 -122
  85. data/lib/grandstand.rb +50 -19
  86. data/lib/grandstand/application.rb +27 -35
  87. data/lib/grandstand/controller.rb +4 -6
  88. data/lib/grandstand/form_builder.rb +19 -0
  89. data/lib/grandstand/helper.rb +1 -47
  90. data/lib/grandstand/session.rb +2 -11
  91. data/lib/grandstand/stylesheets_controller.rb +14 -0
  92. data/public/{admin → grandstand}/images/background-input.gif +0 -0
  93. data/public/{admin → grandstand}/images/background-progress-bar.png +0 -0
  94. data/public/{admin → grandstand}/images/background-progress-complete.gif +0 -0
  95. data/public/{admin → grandstand}/images/background-progress.gif +0 -0
  96. data/public/grandstand/images/galleries-empty.png +0 -0
  97. data/public/{admin → grandstand}/images/icons/add.png +0 -0
  98. data/public/{admin → grandstand}/images/icons/collapse.png +0 -0
  99. data/public/{admin → grandstand}/images/icons/delete.png +0 -0
  100. data/public/{admin → grandstand}/images/icons/edit.png +0 -0
  101. data/public/{admin → grandstand}/images/icons/editor/bold.png +0 -0
  102. data/public/{admin → grandstand}/images/icons/editor/gallery.png +0 -0
  103. data/public/{admin → grandstand}/images/icons/editor/image-center.png +0 -0
  104. data/public/{admin → grandstand}/images/icons/editor/image-left.png +0 -0
  105. data/public/{admin → grandstand}/images/icons/editor/image-right.png +0 -0
  106. data/public/{admin → grandstand}/images/icons/editor/image.png +0 -0
  107. data/public/{admin → grandstand}/images/icons/editor/italic.png +0 -0
  108. data/public/{admin → grandstand}/images/icons/editor/ordered-list.png +0 -0
  109. data/public/{admin → grandstand}/images/icons/editor/quote.png +0 -0
  110. data/public/{admin → grandstand}/images/icons/editor/source.png +0 -0
  111. data/public/{admin → grandstand}/images/icons/editor/strikethrough.png +0 -0
  112. data/public/{admin → grandstand}/images/icons/editor/underline.png +0 -0
  113. data/public/{admin → grandstand}/images/icons/editor/unordered-list.png +0 -0
  114. data/public/{admin → grandstand}/images/icons/error.png +0 -0
  115. data/public/{admin → grandstand}/images/icons/expand.png +0 -0
  116. data/public/{admin → grandstand}/images/icons/galleries.png +0 -0
  117. data/public/{admin → grandstand}/images/icons/gallery.png +0 -0
  118. data/public/{admin → grandstand}/images/icons/image.png +0 -0
  119. data/public/{admin → grandstand}/images/icons/okay.png +0 -0
  120. data/public/{admin → grandstand}/images/icons/pages.png +0 -0
  121. data/public/{admin → grandstand}/images/icons/posts.png +0 -0
  122. data/public/grandstand/images/icons/processing.gif +0 -0
  123. data/public/{admin → grandstand}/images/icons/upload.png +0 -0
  124. data/public/{admin → grandstand}/images/icons/users.png +0 -0
  125. data/public/{admin → grandstand}/images/logo.png +0 -0
  126. data/public/{admin → grandstand}/images/spinner-dark.gif +0 -0
  127. data/public/{admin → grandstand}/images/uploader.swf +0 -0
  128. data/public/{admin → grandstand}/javascripts/application.js +139 -54
  129. data/public/grandstand/javascripts/jquery.js +414 -0
  130. data/public/{admin → grandstand}/javascripts/mustache.js +0 -0
  131. data/public/grandstand/javascripts/preview.js +9 -0
  132. data/public/{admin → grandstand}/javascripts/selection.js +77 -57
  133. data/public/{admin → grandstand}/javascripts/string.js +7 -6
  134. data/public/grandstand/javascripts/wysiwyg.js +311 -0
  135. data/public/{admin → grandstand}/stylesheets/wysiwyg-content.css +15 -2
  136. metadata +207 -126
  137. data/README +0 -7
  138. data/app/controllers/admin/posts_controller.rb +0 -48
  139. data/app/controllers/admin/templates_controller.rb +0 -6
  140. data/app/helpers/admin/main_helper.rb +0 -31
  141. data/app/helpers/admin/pages_helper.rb +0 -2
  142. data/app/helpers/admin/posts_helper.rb +0 -2
  143. data/app/helpers/admin/sessions_helper.rb +0 -2
  144. data/app/helpers/admin/templates_helper.rb +0 -2
  145. data/app/helpers/admin/users_helper.rb +0 -2
  146. data/app/models/page_section.rb +0 -6
  147. data/app/stylesheets/_dialogs.less +0 -85
  148. data/app/views/admin/galleries/_gallery.html.erb +0 -16
  149. data/app/views/admin/galleries/_list.html.erb +0 -17
  150. data/app/views/admin/galleries/delete.html.erb +0 -8
  151. data/app/views/admin/galleries/edit.html.erb +0 -8
  152. data/app/views/admin/galleries/editor.html.erb +0 -13
  153. data/app/views/admin/galleries/editor_with_images.html.erb +0 -19
  154. data/app/views/admin/galleries/index.html.erb +0 -13
  155. data/app/views/admin/galleries/new.html.erb +0 -8
  156. data/app/views/admin/galleries/show.html.erb +0 -15
  157. data/app/views/admin/images/delete.html.erb +0 -8
  158. data/app/views/admin/images/edit.html.erb +0 -8
  159. data/app/views/admin/images/new.html.erb +0 -8
  160. data/app/views/admin/main/index.html.erb +0 -10
  161. data/app/views/admin/pages/_left.html.erb +0 -3
  162. data/app/views/admin/posts/_form.html.erb +0 -29
  163. data/app/views/admin/posts/_left.html.erb +0 -3
  164. data/app/views/admin/posts/_list.html.erb +0 -22
  165. data/app/views/admin/posts/edit.html.erb +0 -10
  166. data/app/views/admin/posts/new.html.erb +0 -10
  167. data/app/views/admin/posts/show.html.erb +0 -4
  168. data/app/views/admin/shared/_flash.html.erb +0 -3
  169. data/app/views/admin/users/_left.html.erb +0 -3
  170. data/app/views/admin/users/edit.html.erb +0 -8
  171. data/app/views/admin/users/new.html.erb +0 -8
  172. data/app/views/admin/users/show.html.erb +0 -12
  173. data/app/views/layouts/admin.html.erb +0 -80
  174. data/app/views/layouts/admin_login.html.erb +0 -17
  175. data/lib/grandstand/controller/development.rb +0 -15
  176. data/public/admin/javascripts/jquery.js +0 -404
  177. data/public/admin/javascripts/wysiwyg.js +0 -335
  178. data/public/admin/stylesheets/application.css +0 -1
  179. data/public/admin/stylesheets/global.css +0 -1
  180. data/public/admin/stylesheets/login.css +0 -1
  181. data/public/admin/stylesheets/wysiwyg.css +0 -1
@@ -222,8 +222,8 @@ String.prototype.clean = function() {
222
222
  9830: "diams",
223
223
  34: "quot",
224
224
  38: "amp",
225
- 60: "lt",
226
- 62: "gt",
225
+ // 60: "lt",
226
+ // 62: "gt",
227
227
  338: "OElig",
228
228
  339: "oelig",
229
229
  352: "Scaron",
@@ -255,10 +255,11 @@ String.prototype.clean = function() {
255
255
  };
256
256
  return this.replace(/[^\x00-\x7F]|["'<>&]/igm, function(character) {
257
257
  var entity = entities[character.charCodeAt(0)];
258
- if (!entity) {
259
- entity = 'foo';
260
- alert('can\'t encode weirdness');
258
+ if (entity) {
259
+ console.log('replacing ' + character + ' with &' + entity + ';');
260
+ return '&' + entity + ';';
261
+ } else {
262
+ return character;
261
263
  }
262
- return '&' + entity + ';';
263
264
  });
264
265
  };
@@ -0,0 +1,311 @@
1
+ require('selection');
2
+ require('mustache');
3
+
4
+ jQuery.fn.wysiwyg = function(template, rootSelector) {
5
+ var editor;
6
+ this.each(function() {
7
+ editor = new Editor(this, template, rootSelector);
8
+ });
9
+ return editor;
10
+ };
11
+
12
+ var Editor = function(textarea, template, rootSelector) {
13
+ // Find the element we should make editable. Defaults to the BODY element
14
+ // once we've rendered the template.
15
+ this.rootSelector = rootSelector || 'body';
16
+ this.textarea = $(textarea);
17
+ this.container = $('<div class="wysiwyg"></div>');
18
+ var toolbarItems = [
19
+ {id: 'bold', alt: 'Make text bold'},
20
+ {id: 'italic', alt: 'Make text italic'},
21
+ {id: 'hyperlink', alt: 'Insert a link'},
22
+ {id: 'unordered_list', alt: 'Insert a bullet list'},
23
+ {id: 'ordered_list', alt: 'Insert a numbered list'},
24
+ // {id: 'gallery', alt: 'Embed a gallery'},
25
+ {id: 'image', alt: 'Embed an image'}
26
+ ];
27
+ this.toolbar = new Editor.Toolbar(this, toolbarItems);
28
+ this.container.append(this.toolbar.container);
29
+ this.iframe = $('<iframe frameBorder="0" id="' + textarea.id + '_editor"></iframe>').hide();
30
+ this.container.height(this.textarea.height() + 6.0);
31
+ this.textarea.height(this.textarea.height() + 5.0);
32
+ this.container.append(this.iframe);
33
+ this.startLoading();
34
+ this.textarea.after(this.container);
35
+ this.container.append(this.textarea);
36
+ var editor = this;
37
+ $.get('/grandstand/templates/' + template, function(response) {
38
+ editor.template = response;
39
+ editor.initialize();
40
+ });
41
+ };
42
+
43
+ Editor.prototype = {
44
+ focus: function(selector, offset) {
45
+ var selection = this.selection();
46
+ selection.select(selector || ':block', offset || 0);
47
+ },
48
+ initialize: function() {
49
+ var editor = this;
50
+ try {
51
+ this.window = this.iframe[0].contentWindow;
52
+ this.document = this.window.document;
53
+ } catch(exception) {
54
+ return setTimeout(function(){ editor.initialize(); }, 10);
55
+ }
56
+ this.write(this.textarea.val());
57
+ this.body = this.document.body;
58
+ // Make sure all data is saved, no matter what.
59
+ this.textarea.parents('form').submit(function() {
60
+ editor.save();
61
+ });
62
+ this.textarea.hide();
63
+ this.toolbar.container.show();
64
+ this.iframe.height(this.textarea.height() - this.toolbar.container.height() - 4);
65
+ this.iframe.show();
66
+ this.root = $(this.document).find(this.rootSelector);
67
+ this.root.css('height', '100%');
68
+ this.root.find('img').live('click', function(event) {
69
+ event.preventDefault();
70
+ event.stopPropagation();
71
+ var img = $(this);
72
+ var ids = this.src.match(/\d\d\d\d\d\d/ig);
73
+ var url = '/grandstand/galleries/' + ids[0].replace(/^0+/, '') + '/images/' + ids[1].replace(/^0+/, '');
74
+ url += '?align=' + this.className + '&size=' + this.src.substring(this.src.lastIndexOf(ids[1]) + 7, this.src.lastIndexOf('.'));
75
+ Dialog.show(url, {
76
+ style: 'medium',
77
+ submit: function(event) {
78
+ event.preventDefault();
79
+ // Grab the right form, thanks a lot IE...
80
+ var form = $(event.target);
81
+ if (!form.is('form')) {
82
+ form = form.parents('form');
83
+ }
84
+ img.removeClass().addClass(form.find('input[name=align]:checked').val());
85
+ img.load(function() {
86
+ img.attr('height', img.height());
87
+ img.attr('width', img.width());
88
+ });
89
+ img.attr('src', form.find('input[name=size]:checked').val());
90
+ img.removeAttr('height');
91
+ img.removeAttr('width');
92
+ Dialog.hide();
93
+ }
94
+ });
95
+ });
96
+ // $([this.document, document]).keyup(function(event) {
97
+ // editor.selection().normalize();
98
+ // });
99
+ var pasting, selection;
100
+ this.root.keyup(function(event) {
101
+ selection = editor.selection();
102
+ if (jQuery.browser.mozilla && editor.root.find('p').length === 0) {
103
+ // Ensure Firefox is using paragraphs and not line breaks when I
104
+ // insert content
105
+ if (editor.root.text().replace(/\s+/ig, '') == '') {
106
+ editor.root.html('<p></p>');
107
+ selection.select('p');
108
+ } else {
109
+ selection.selectAll();
110
+ selection.wrap('p');
111
+ selection.select('p', 1);
112
+ }
113
+ }
114
+ clearTimeout(editor.timeout);
115
+ editor.timeout = setTimeout(function() { editor.save(); }, 100);
116
+ if (selection.wrappedIn('strong')) {
117
+ editor.toolbar.on('bold');
118
+ } else {
119
+ editor.toolbar.off('bold');
120
+ }
121
+ if (selection.wrappedIn('em')) {
122
+ editor.toolbar.on('italic');
123
+ } else {
124
+ editor.toolbar.off('italic');
125
+ }
126
+ }).bind('paste', function(event) {
127
+ var clipboard;
128
+ if (event.originalEvent.clipboardData) {
129
+ clipboard = event.originalEvent.clipboardData;
130
+ } else if (typeof(Components) != 'undefined' && Components.interfaces.nsIClipboard) {
131
+ // return true;
132
+ //
133
+ // TODO: Handle Firefox's ABYSMAL onPaste support with signed JavaScript or some equally pointless bullshit.
134
+ // Hey, Firefox! If someone *pastes*, let me see what they *pasted*, you fucking bastard!
135
+ //
136
+ // var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);
137
+ // // if (!clip) return false;
138
+ //
139
+ // var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
140
+ // // if (!trans) return false;
141
+ // trans.addDataFlavor("text/unicode");
142
+ //
143
+ // clip.getData(trans, clip.kGlobalClipboard);
144
+ //
145
+ // var str = new Object();
146
+ // var strLength = new Object();
147
+ // trans.getTransferData("text/unicode", str, strLength);
148
+ } else if (window.clipboardData) {
149
+ clipboard = window.clipboardData;
150
+ }
151
+ if (clipboard) {
152
+ selection = editor.selection();
153
+ var text = clipboard.getData('text/plain').toString().split(/(\n|\r){2,}/igm);
154
+ if (text.length > 0) {
155
+ selection.replace(text.shift().clean());
156
+ $.each(text.reverse(), function() {
157
+ selection.endBlock().after('<p>' + this.clean() + '</p>');
158
+ });
159
+ return false;
160
+ }
161
+ }
162
+ });
163
+ this.root.attr('contentEditable', 'true').css('outline', '0');
164
+ // this.document.body.contentEditable = 'true';
165
+ this.focus();
166
+ this.stopLoading();
167
+ },
168
+ save: function() {
169
+ var html = this.root.html();
170
+
171
+ // Clean that HTML good
172
+ html = html.replace(/<DIV><BR class="khtml-block-placeholder"><\/DIV>/ig, '<br />');
173
+ html = html.replace(/<[^> ]*/ig, function(match) {
174
+ return match.toLowerCase();
175
+ });
176
+ html = html.replace(/<[^>]*>/ig, function(match) {
177
+ match = match.replace(/ [^=]+=/ig, function(match2) {
178
+ return match2.toLowerCase();
179
+ });
180
+ return match;
181
+ });
182
+ html = html.replace(/<[^>]*>/ig, function(match) {
183
+ match = match.replace(/( [^=]+=)([^"][^ >]*)/ig, "$1\"$2\"");
184
+ return match;
185
+ });
186
+ html = html.replace(/^\s+/, "");
187
+ html = html.replace(/\s+$/, "");
188
+ html = html.replace(/<br>/ig, "<br />");
189
+ html = html.replace(/<br \/>\s*<\/(h1|h2|h3|h4|h5|h6|li|p)/ig, "</$1");
190
+ html = html.replace(/(<img [^>]+[^\/])>/ig, "$1 />");
191
+ html = html.replace(/(<[^\/]>|<[^\/][^>]*[^\/]>)\s*<\/[^>]*>/ig, "");
192
+
193
+ this.textarea.val(html);
194
+ },
195
+ // Called when the editor is loaded up for the first time and off finding dependencies / etc.
196
+ // Just puts a white cover over the textarea and waits for everything to load before saying,
197
+ // "okay, now you can edit"
198
+ startLoading: function() {
199
+ if (!this.cover) {
200
+ this.cover = $('<div class="cover"></div>');
201
+ this.loading = $('<div class="loading"></div>');
202
+ this.cover.append(this.loading);
203
+ this.container.append(this.cover);
204
+ }
205
+ this.cover.show();
206
+ },
207
+ selection: function() {
208
+ return $(this.window).selection(this.rootSelector);
209
+ },
210
+ stopLoading: function() {
211
+ if (this.cover) {
212
+ var cover = this.cover;
213
+ this.cover = false;
214
+ setTimeout(function() {
215
+ cover.fadeOut(function() {
216
+ cover.remove();
217
+ });
218
+ }, 100);
219
+ }
220
+ },
221
+ write: function(content) {
222
+ if (content == '') {
223
+ content = '<p><br /></p>';
224
+ }
225
+ var rendered = Mustache.to_html(this.template, {body: content});
226
+ var html = '<html><head><link href="/grandstand/stylesheets/wysiwyg-content.css" rel="stylesheet" type="text/css" /></head>';
227
+ html += '<body class="wysiwyg">';
228
+ html += rendered;
229
+ html += '</body>';
230
+ html += '</html>';
231
+ this.document.open();
232
+ this.document.write(html);
233
+ this.document.close();
234
+ }
235
+ };
236
+
237
+ Editor.Toolbar = function(editor, buttons) {
238
+ this.editor = editor;
239
+ this.container = $('<div class="toolbar"></div>').hide();
240
+ var toolbar = this;
241
+ $.each(buttons, function() {
242
+ var button = $('<a class="button" rel="' + this.id + '" title="' + this.alt + '"><span class=" icon ' + this.id.replace('_', '-') + '"></span></a>');
243
+ button.click(function() {
244
+ toolbar.buttonClick(button);
245
+ });
246
+ toolbar.container.append(button);
247
+ });
248
+ }
249
+
250
+ Editor.Toolbar.prototype = {
251
+ buttonClick: function(button) {
252
+ switch(button.attr('rel')) {
253
+ case 'bold':
254
+ var selection = this.editor.selection();
255
+ if (selection.wrappedIn('strong')) {
256
+ selection.unwrap('strong');
257
+ } else {
258
+ selection.wrap('strong');
259
+ }
260
+ // this.document.execCommand('bold', false, null);
261
+ break;
262
+ case 'italic':
263
+ break;
264
+ case 'hyperlink':
265
+ this.editor.document.execCommand('CreateLink', false, prompt("Please enter an URL:"));
266
+ break;
267
+ case 'unordered_list':
268
+ this.editor.document.execCommand('InsertUnorderedList', false, null);
269
+ break;
270
+ case 'ordered_list':
271
+ this.editor.document.execCommand('InsertOrderedList', false, null);
272
+ break;
273
+ case 'gallery':
274
+ Dialog.show('/grandstand/galleries', {
275
+ load: function() {
276
+
277
+ }
278
+ });
279
+ break;
280
+ case 'image':
281
+ var editor = this.editor;
282
+ Dialog.show('/grandstand/galleries', {
283
+ style: 'large',
284
+ load: function(dialog) {
285
+ dialog.find('.image').click(function(event) {
286
+ event.preventDefault();
287
+ var image = $(this).find('img');
288
+ image = image.clone();
289
+ image.addClass('left');
290
+ editor.selection().insert(image);
291
+ Dialog.hide(function() {
292
+ image.click();
293
+ });
294
+ });
295
+ }
296
+ });
297
+ break;
298
+ }
299
+ },
300
+ off: function(buttonName) {
301
+ this.container.find('a.button[rel=' + buttonName + ']').removeClass('button-hover');
302
+ },
303
+ on: function(buttonName) {
304
+ this.container.find('a.button[rel=' + buttonName + ']').addClass('button-hover');
305
+ }
306
+ }
307
+
308
+ jQuery.fn.childOf = function(a){
309
+ a = (typeof a=='string')?$(a):a;
310
+ return (a.length == 1 && this.length === this.map(function(){if($.inArray(this,a.children())!=-1){return this;}}).length);
311
+ };
@@ -2,15 +2,20 @@
2
2
  wysiwyg-content.css is the stylesheet that is loaded INSIDE OF the WYSIWYG editors' iframe.
3
3
  This only happens if 'iFrame' mode is enabled. It imports what we assume is the stylesheet
4
4
  the user has set up for the application in an attempt to render in a similar font to what
5
- is expected in the application. IF a user
5
+ is expected in the application.
6
6
  */
7
7
  @import url(/stylesheets/screen.css);
8
8
 
9
+ html, body {
10
+ height:100%;
11
+ }
12
+
9
13
  body {
10
14
  background-color:#fff !important;
11
15
  color:#000 !important;
12
16
  margin:0;
13
- padding:3px;
17
+ /* overflow:hidden;*/
18
+ padding:0;
14
19
  text-align:left !important;
15
20
  width:auto;
16
21
  }
@@ -18,3 +23,11 @@ body {
18
23
  img {
19
24
  cursor:pointer;
20
25
  }
26
+
27
+ body .post {
28
+ padding:0 5px;
29
+ box-sizing:border-box;
30
+ -moz-box-sizing:border-box;
31
+ -ms-box-sizing:border-box;
32
+ -webkit-box-sizing:border-box;
33
+ }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grandstand
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Flip Sasser
@@ -15,104 +15,188 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-20 00:00:00 -04:00
18
+ date: 2010-11-10 00:00:00 -05:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description: "\n Grandstand is a simple blog and photo gallery application. It takes a minimal amount of configuration and can\n be built installed as a gem and used like any other thingymagig. It's totally cool.\n "
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: less
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 53
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 21
34
+ version: 1.2.21
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: more
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 25
46
+ segments:
47
+ - 0
48
+ - 1
49
+ - 1
50
+ version: 0.1.1
51
+ type: :development
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: aws-s3
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ - 6
65
+ - 2
66
+ version: 0.6.2
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: mustache
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 55
78
+ segments:
79
+ - 0
80
+ - 11
81
+ - 2
82
+ version: 0.11.2
83
+ type: :runtime
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: paperclip
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 5
94
+ segments:
95
+ - 2
96
+ - 3
97
+ - 3
98
+ version: 2.3.3
99
+ type: :runtime
100
+ version_requirements: *id005
101
+ description: "\n Grandstand is a simple blog and photo gallery application. It takes a minimal amount of configuration and can\n be built installed as a gem and used within minutes. It's totally cool. Seriously.\n "
23
102
  email: flip@x451.com
24
103
  executables: []
25
104
 
26
105
  extensions: []
27
106
 
28
107
  extra_rdoc_files:
29
- - README
108
+ - README.markdown
109
+ - README.txt
30
110
  files:
31
111
  - .gitignore
32
112
  - MIT-LICENSE
33
- - README
113
+ - README.markdown
114
+ - README.txt
34
115
  - Rakefile
35
116
  - VERSION
36
- - app/controllers/admin/galleries_controller.rb
37
- - app/controllers/admin/images_controller.rb
38
- - app/controllers/admin/main_controller.rb
39
- - app/controllers/admin/pages_controller.rb
40
- - app/controllers/admin/posts_controller.rb
41
- - app/controllers/admin/sessions_controller.rb
42
- - app/controllers/admin/templates_controller.rb
43
- - app/controllers/admin/users_controller.rb
44
117
  - app/controllers/galleries_controller.rb
118
+ - app/controllers/grandstand/galleries_controller.rb
119
+ - app/controllers/grandstand/images_controller.rb
120
+ - app/controllers/grandstand/main_controller.rb
121
+ - app/controllers/grandstand/pages_controller.rb
122
+ - app/controllers/grandstand/posts_controller.rb
123
+ - app/controllers/grandstand/sessions_controller.rb
124
+ - app/controllers/grandstand/templates_controller.rb
125
+ - app/controllers/grandstand/users_controller.rb
45
126
  - app/controllers/pages_controller.rb
46
127
  - app/controllers/posts_controller.rb
47
- - app/helpers/admin/main_helper.rb
48
- - app/helpers/admin/pages_helper.rb
49
- - app/helpers/admin/posts_helper.rb
50
- - app/helpers/admin/sessions_helper.rb
51
- - app/helpers/admin/templates_helper.rb
52
- - app/helpers/admin/users_helper.rb
128
+ - app/helpers/galleries_helper.rb
129
+ - app/helpers/grandstand/galleries_helper.rb
130
+ - app/helpers/grandstand/images_helpers.rb
131
+ - app/helpers/grandstand/main_helper.rb
132
+ - app/helpers/grandstand/pages_helper.rb
133
+ - app/helpers/grandstand/posts_helper.rb
134
+ - app/helpers/grandstand/sessions_helper.rb
135
+ - app/helpers/grandstand/templates_helper.rb
136
+ - app/helpers/grandstand/users_helper.rb
53
137
  - app/helpers/pages_helper.rb
54
138
  - app/helpers/posts_helper.rb
55
139
  - app/helpers/site_helper.rb
56
- - app/models/gallery.rb
57
- - app/models/image.rb
58
- - app/models/page.rb
59
- - app/models/page_section.rb
60
- - app/models/post.rb
61
- - app/models/template.rb
62
- - app/models/user.rb
140
+ - app/models/grandstand/gallery.rb
141
+ - app/models/grandstand/image.rb
142
+ - app/models/grandstand/page.rb
143
+ - app/models/grandstand/page_section.rb
144
+ - app/models/grandstand/post.rb
145
+ - app/models/grandstand/template.rb
146
+ - app/models/grandstand/user.rb
63
147
  - app/stylesheets/_buttons.less
64
- - app/stylesheets/_dialogs.less
65
148
  - app/stylesheets/application.less
66
149
  - app/stylesheets/global.less
67
150
  - app/stylesheets/login.less
68
151
  - app/stylesheets/wysiwyg.less
69
- - app/views/admin/galleries/_form.html.erb
70
- - app/views/admin/galleries/_gallery.html.erb
71
- - app/views/admin/galleries/_list.html.erb
72
- - app/views/admin/galleries/delete.html.erb
73
- - app/views/admin/galleries/edit.html.erb
74
- - app/views/admin/galleries/editor.html.erb
75
- - app/views/admin/galleries/editor_with_images.html.erb
76
- - app/views/admin/galleries/index.html.erb
77
- - app/views/admin/galleries/new.html.erb
78
- - app/views/admin/galleries/show.html.erb
79
- - app/views/admin/images/_form.html.erb
80
- - app/views/admin/images/delete.html.erb
81
- - app/views/admin/images/edit.html.erb
82
- - app/views/admin/images/new.html.erb
83
- - app/views/admin/images/upload.html.erb
84
- - app/views/admin/main/index.html.erb
85
- - app/views/admin/pages/_form.html.erb
86
- - app/views/admin/pages/_left.html.erb
87
- - app/views/admin/pages/_row.html.erb
88
- - app/views/admin/pages/delete.html.erb
89
- - app/views/admin/pages/edit.html.erb
90
- - app/views/admin/pages/index.html.erb
91
- - app/views/admin/pages/new.html.erb
92
- - app/views/admin/pages/show.html.erb
93
- - app/views/admin/posts/_form.html.erb
94
- - app/views/admin/posts/_left.html.erb
95
- - app/views/admin/posts/_list.html.erb
96
- - app/views/admin/posts/delete.html.erb
97
- - app/views/admin/posts/edit.html.erb
98
- - app/views/admin/posts/index.html.erb
99
- - app/views/admin/posts/new.html.erb
100
- - app/views/admin/posts/show.html.erb
101
- - app/views/admin/sessions/forgot.html.erb
102
- - app/views/admin/sessions/show.html.erb
103
- - app/views/admin/shared/_flash.html.erb
104
- - app/views/admin/users/_form.html.erb
105
- - app/views/admin/users/_left.html.erb
106
- - app/views/admin/users/delete.html.erb
107
- - app/views/admin/users/edit.html.erb
108
- - app/views/admin/users/index.html.erb
109
- - app/views/admin/users/new.html.erb
110
- - app/views/admin/users/show.html.erb
111
152
  - app/views/galleries/index.html.erb
112
153
  - app/views/galleries/show.html.erb
113
- - app/views/layouts/admin.html.erb
114
- - app/views/layouts/admin_login.html.erb
115
- - app/views/layouts/admin_xhr.html.erb
154
+ - app/views/grandstand/galleries/_form.html.erb
155
+ - app/views/grandstand/galleries/_gallery.html.erb
156
+ - app/views/grandstand/galleries/_list.html.erb
157
+ - app/views/grandstand/galleries/delete.html.erb
158
+ - app/views/grandstand/galleries/edit.html.erb
159
+ - app/views/grandstand/galleries/editor.html.erb
160
+ - app/views/grandstand/galleries/index.html.erb
161
+ - app/views/grandstand/galleries/new.html.erb
162
+ - app/views/grandstand/galleries/show.html.erb
163
+ - app/views/grandstand/images/_form.html.erb
164
+ - app/views/grandstand/images/delete.html.erb
165
+ - app/views/grandstand/images/edit.html.erb
166
+ - app/views/grandstand/images/new.html.erb
167
+ - app/views/grandstand/images/show.html.erb
168
+ - app/views/grandstand/images/upload.html.erb
169
+ - app/views/grandstand/main/index.html.erb
170
+ - app/views/grandstand/pages/_form.html.erb
171
+ - app/views/grandstand/pages/_left.html.erb
172
+ - app/views/grandstand/pages/_row.html.erb
173
+ - app/views/grandstand/pages/delete.html.erb
174
+ - app/views/grandstand/pages/edit.html.erb
175
+ - app/views/grandstand/pages/index.html.erb
176
+ - app/views/grandstand/pages/new.html.erb
177
+ - app/views/grandstand/pages/show.html.erb
178
+ - app/views/grandstand/posts/_form.html.erb
179
+ - app/views/grandstand/posts/_left.html.erb
180
+ - app/views/grandstand/posts/_list.html.erb
181
+ - app/views/grandstand/posts/delete.html.erb
182
+ - app/views/grandstand/posts/edit.html.erb
183
+ - app/views/grandstand/posts/index.html.erb
184
+ - app/views/grandstand/posts/new.html.erb
185
+ - app/views/grandstand/posts/preview.html.erb
186
+ - app/views/grandstand/posts/show.html.erb
187
+ - app/views/grandstand/sessions/forgot.html.erb
188
+ - app/views/grandstand/sessions/show.html.erb
189
+ - app/views/grandstand/shared/_flash.html.erb
190
+ - app/views/grandstand/users/_form.html.erb
191
+ - app/views/grandstand/users/_left.html.erb
192
+ - app/views/grandstand/users/delete.html.erb
193
+ - app/views/grandstand/users/edit.html.erb
194
+ - app/views/grandstand/users/index.html.erb
195
+ - app/views/grandstand/users/new.html.erb
196
+ - app/views/grandstand/users/show.html.erb
197
+ - app/views/layouts/grandstand.html.erb
198
+ - app/views/layouts/grandstand_login.html.erb
199
+ - app/views/layouts/grandstand_xhr.html.erb
116
200
  - app/views/pages/show.html.erb
117
201
  - app/views/posts/show.html.erb
118
202
  - app/views/shared/404.html.erb
@@ -120,64 +204,61 @@ files:
120
204
  - app/views/shared/image.html
121
205
  - app/views/shared/page.html
122
206
  - app/views/shared/post.html
207
+ - config/routes.rb
123
208
  - grandstand.gemspec
124
209
  - lib/grandstand.rb
125
210
  - lib/grandstand/application.rb
126
211
  - lib/grandstand/controller.rb
127
- - lib/grandstand/controller/development.rb
212
+ - lib/grandstand/form_builder.rb
128
213
  - lib/grandstand/helper.rb
129
- - lib/grandstand/routes.rb
130
214
  - lib/grandstand/session.rb
215
+ - lib/grandstand/stylesheets_controller.rb
131
216
  - pkg/grandstand-0.2.1.gem
132
217
  - public/.DS_Store
133
- - public/admin/.DS_Store
134
- - public/admin/images/.DS_Store
135
- - public/admin/images/background-input.gif
136
- - public/admin/images/background-progress-bar.png
137
- - public/admin/images/background-progress-complete.gif
138
- - public/admin/images/background-progress.gif
139
- - public/admin/images/icons/.DS_Store
140
- - public/admin/images/icons/add.png
141
- - public/admin/images/icons/collapse.png
142
- - public/admin/images/icons/delete.png
143
- - public/admin/images/icons/edit.png
144
- - public/admin/images/icons/editor/bold.png
145
- - public/admin/images/icons/editor/gallery.png
146
- - public/admin/images/icons/editor/image-center.png
147
- - public/admin/images/icons/editor/image-left.png
148
- - public/admin/images/icons/editor/image-right.png
149
- - public/admin/images/icons/editor/image.png
150
- - public/admin/images/icons/editor/italic.png
151
- - public/admin/images/icons/editor/ordered-list.png
152
- - public/admin/images/icons/editor/quote.png
153
- - public/admin/images/icons/editor/source.png
154
- - public/admin/images/icons/editor/strikethrough.png
155
- - public/admin/images/icons/editor/underline.png
156
- - public/admin/images/icons/editor/unordered-list.png
157
- - public/admin/images/icons/error.png
158
- - public/admin/images/icons/expand.png
159
- - public/admin/images/icons/galleries.png
160
- - public/admin/images/icons/gallery.png
161
- - public/admin/images/icons/image.png
162
- - public/admin/images/icons/okay.png
163
- - public/admin/images/icons/pages.png
164
- - public/admin/images/icons/posts.png
165
- - public/admin/images/icons/upload.png
166
- - public/admin/images/icons/users.png
167
- - public/admin/images/logo.png
168
- - public/admin/images/spinner-dark.gif
169
- - public/admin/images/uploader.swf
170
- - public/admin/javascripts/application.js
171
- - public/admin/javascripts/jquery.js
172
- - public/admin/javascripts/mustache.js
173
- - public/admin/javascripts/selection.js
174
- - public/admin/javascripts/string.js
175
- - public/admin/javascripts/wysiwyg.js
176
- - public/admin/stylesheets/application.css
177
- - public/admin/stylesheets/global.css
178
- - public/admin/stylesheets/login.css
179
- - public/admin/stylesheets/wysiwyg-content.css
180
- - public/admin/stylesheets/wysiwyg.css
218
+ - public/grandstand/images/background-input.gif
219
+ - public/grandstand/images/background-progress-bar.png
220
+ - public/grandstand/images/background-progress-complete.gif
221
+ - public/grandstand/images/background-progress.gif
222
+ - public/grandstand/images/galleries-empty.png
223
+ - public/grandstand/images/icons/add.png
224
+ - public/grandstand/images/icons/collapse.png
225
+ - public/grandstand/images/icons/delete.png
226
+ - public/grandstand/images/icons/edit.png
227
+ - public/grandstand/images/icons/editor/bold.png
228
+ - public/grandstand/images/icons/editor/gallery.png
229
+ - public/grandstand/images/icons/editor/image-center.png
230
+ - public/grandstand/images/icons/editor/image-left.png
231
+ - public/grandstand/images/icons/editor/image-right.png
232
+ - public/grandstand/images/icons/editor/image.png
233
+ - public/grandstand/images/icons/editor/italic.png
234
+ - public/grandstand/images/icons/editor/ordered-list.png
235
+ - public/grandstand/images/icons/editor/quote.png
236
+ - public/grandstand/images/icons/editor/source.png
237
+ - public/grandstand/images/icons/editor/strikethrough.png
238
+ - public/grandstand/images/icons/editor/underline.png
239
+ - public/grandstand/images/icons/editor/unordered-list.png
240
+ - public/grandstand/images/icons/error.png
241
+ - public/grandstand/images/icons/expand.png
242
+ - public/grandstand/images/icons/galleries.png
243
+ - public/grandstand/images/icons/gallery.png
244
+ - public/grandstand/images/icons/image.png
245
+ - public/grandstand/images/icons/okay.png
246
+ - public/grandstand/images/icons/pages.png
247
+ - public/grandstand/images/icons/posts.png
248
+ - public/grandstand/images/icons/processing.gif
249
+ - public/grandstand/images/icons/upload.png
250
+ - public/grandstand/images/icons/users.png
251
+ - public/grandstand/images/logo.png
252
+ - public/grandstand/images/spinner-dark.gif
253
+ - public/grandstand/images/uploader.swf
254
+ - public/grandstand/javascripts/application.js
255
+ - public/grandstand/javascripts/jquery.js
256
+ - public/grandstand/javascripts/mustache.js
257
+ - public/grandstand/javascripts/preview.js
258
+ - public/grandstand/javascripts/selection.js
259
+ - public/grandstand/javascripts/string.js
260
+ - public/grandstand/javascripts/wysiwyg.js
261
+ - public/grandstand/stylesheets/wysiwyg-content.css
181
262
  - vendor/cache/more-0.1.1.gem
182
263
  has_rdoc: true
183
264
  homepage: http://github.com/flipsasser/grandstand