grandstand 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/MIT-LICENSE +20 -0
- data/README +7 -0
- data/Rakefile +44 -0
- data/VERSION +1 -0
- data/app/controllers/admin/galleries_controller.rb +52 -0
- data/app/controllers/admin/images_controller.rb +68 -0
- data/app/controllers/admin/main_controller.rb +36 -0
- data/app/controllers/admin/pages_controller.rb +51 -0
- data/app/controllers/admin/posts_controller.rb +48 -0
- data/app/controllers/admin/sessions_controller.rb +41 -0
- data/app/controllers/admin/templates_controller.rb +6 -0
- data/app/controllers/admin/users_controller.rb +48 -0
- data/app/controllers/galleries_controller.rb +5 -0
- data/app/controllers/pages_controller.rb +5 -0
- data/app/controllers/posts_controller.rb +5 -0
- data/app/helpers/admin/main_helper.rb +31 -0
- data/app/helpers/admin/pages_helper.rb +2 -0
- data/app/helpers/admin/posts_helper.rb +2 -0
- data/app/helpers/admin/sessions_helper.rb +2 -0
- data/app/helpers/admin/templates_helper.rb +2 -0
- data/app/helpers/admin/users_helper.rb +2 -0
- data/app/helpers/pages_helper.rb +2 -0
- data/app/helpers/posts_helper.rb +2 -0
- data/app/helpers/site_helper.rb +2 -0
- data/app/models/gallery.rb +22 -0
- data/app/models/image.rb +61 -0
- data/app/models/page.rb +45 -0
- data/app/models/page_section.rb +6 -0
- data/app/models/post.rb +27 -0
- data/app/models/template.rb +33 -0
- data/app/models/user.rb +68 -0
- data/app/stylesheets/_buttons.less +76 -0
- data/app/stylesheets/_dialogs.less +85 -0
- data/app/stylesheets/application.less +238 -0
- data/app/stylesheets/global.less +435 -0
- data/app/stylesheets/login.less +30 -0
- data/app/stylesheets/wysiwyg.less +96 -0
- data/app/views/admin/galleries/_form.html.erb +11 -0
- data/app/views/admin/galleries/_gallery.html.erb +16 -0
- data/app/views/admin/galleries/_list.html.erb +17 -0
- data/app/views/admin/galleries/delete.html.erb +8 -0
- data/app/views/admin/galleries/edit.html.erb +8 -0
- data/app/views/admin/galleries/editor.html.erb +13 -0
- data/app/views/admin/galleries/editor_with_images.html.erb +19 -0
- data/app/views/admin/galleries/index.html.erb +13 -0
- data/app/views/admin/galleries/new.html.erb +8 -0
- data/app/views/admin/galleries/show.html.erb +15 -0
- data/app/views/admin/images/_form.html.erb +11 -0
- data/app/views/admin/images/delete.html.erb +8 -0
- data/app/views/admin/images/edit.html.erb +8 -0
- data/app/views/admin/images/new.html.erb +8 -0
- data/app/views/admin/images/upload.html.erb +11 -0
- data/app/views/admin/main/index.html.erb +10 -0
- data/app/views/admin/pages/_form.html.erb +33 -0
- data/app/views/admin/pages/_left.html.erb +3 -0
- data/app/views/admin/pages/_row.html.erb +9 -0
- data/app/views/admin/pages/delete.html.erb +8 -0
- data/app/views/admin/pages/edit.html.erb +8 -0
- data/app/views/admin/pages/index.html.erb +20 -0
- data/app/views/admin/pages/new.html.erb +8 -0
- data/app/views/admin/pages/show.html.erb +3 -0
- data/app/views/admin/posts/_form.html.erb +29 -0
- data/app/views/admin/posts/_left.html.erb +3 -0
- data/app/views/admin/posts/_list.html.erb +22 -0
- data/app/views/admin/posts/delete.html.erb +9 -0
- data/app/views/admin/posts/edit.html.erb +10 -0
- data/app/views/admin/posts/index.html.erb +10 -0
- data/app/views/admin/posts/new.html.erb +10 -0
- data/app/views/admin/posts/show.html.erb +4 -0
- data/app/views/admin/sessions/forgot.html.erb +8 -0
- data/app/views/admin/sessions/show.html.erb +12 -0
- data/app/views/admin/shared/_flash.html.erb +3 -0
- data/app/views/admin/users/_form.html.erb +16 -0
- data/app/views/admin/users/_left.html.erb +3 -0
- data/app/views/admin/users/delete.html.erb +10 -0
- data/app/views/admin/users/edit.html.erb +8 -0
- data/app/views/admin/users/index.html.erb +22 -0
- data/app/views/admin/users/new.html.erb +8 -0
- data/app/views/admin/users/show.html.erb +12 -0
- data/app/views/galleries/index.html.erb +0 -0
- data/app/views/galleries/show.html.erb +12 -0
- data/app/views/layouts/admin.html.erb +80 -0
- data/app/views/layouts/admin_login.html.erb +17 -0
- data/app/views/layouts/admin_xhr.html.erb +3 -0
- data/app/views/pages/show.html.erb +8 -0
- data/app/views/posts/show.html.erb +3 -0
- data/app/views/shared/404.html.erb +5 -0
- data/app/views/shared/gallery.html +14 -0
- data/app/views/shared/image.html +1 -0
- data/app/views/shared/page.html +0 -0
- data/app/views/shared/post.html +3 -0
- data/grandstand.gemspec +189 -0
- data/lib/grandstand/application.rb +50 -0
- data/lib/grandstand/controller/development.rb +15 -0
- data/lib/grandstand/controller.rb +104 -0
- data/lib/grandstand/helper.rb +117 -0
- data/lib/grandstand/routes.rb +59 -0
- data/lib/grandstand/session.rb +25 -0
- data/lib/grandstand.rb +27 -0
- data/public/.DS_Store +0 -0
- data/public/admin/.DS_Store +0 -0
- data/public/admin/images/.DS_Store +0 -0
- data/public/admin/images/background-input.gif +0 -0
- data/public/admin/images/background-progress-bar.png +0 -0
- data/public/admin/images/background-progress-complete.gif +0 -0
- data/public/admin/images/background-progress.gif +0 -0
- data/public/admin/images/icons/.DS_Store +0 -0
- data/public/admin/images/icons/add.png +0 -0
- data/public/admin/images/icons/collapse.png +0 -0
- data/public/admin/images/icons/delete.png +0 -0
- data/public/admin/images/icons/edit.png +0 -0
- data/public/admin/images/icons/editor/bold.png +0 -0
- data/public/admin/images/icons/editor/gallery.png +0 -0
- data/public/admin/images/icons/editor/image-center.png +0 -0
- data/public/admin/images/icons/editor/image-left.png +0 -0
- data/public/admin/images/icons/editor/image-right.png +0 -0
- data/public/admin/images/icons/editor/image.png +0 -0
- data/public/admin/images/icons/editor/italic.png +0 -0
- data/public/admin/images/icons/editor/ordered-list.png +0 -0
- data/public/admin/images/icons/editor/quote.png +0 -0
- data/public/admin/images/icons/editor/source.png +0 -0
- data/public/admin/images/icons/editor/strikethrough.png +0 -0
- data/public/admin/images/icons/editor/underline.png +0 -0
- data/public/admin/images/icons/editor/unordered-list.png +0 -0
- data/public/admin/images/icons/error.png +0 -0
- data/public/admin/images/icons/expand.png +0 -0
- data/public/admin/images/icons/galleries.png +0 -0
- data/public/admin/images/icons/gallery.png +0 -0
- data/public/admin/images/icons/image.png +0 -0
- data/public/admin/images/icons/okay.png +0 -0
- data/public/admin/images/icons/pages.png +0 -0
- data/public/admin/images/icons/posts.png +0 -0
- data/public/admin/images/icons/upload.png +0 -0
- data/public/admin/images/icons/users.png +0 -0
- data/public/admin/images/logo.png +0 -0
- data/public/admin/images/spinner-dark.gif +0 -0
- data/public/admin/images/uploader.swf +0 -0
- data/public/admin/javascripts/application.js +231 -0
- data/public/admin/javascripts/jquery.js +404 -0
- data/public/admin/javascripts/mustache.js +324 -0
- data/public/admin/javascripts/selection.js +280 -0
- data/public/admin/javascripts/string.js +264 -0
- data/public/admin/javascripts/wysiwyg.js +335 -0
- data/public/admin/stylesheets/application.css +1 -0
- data/public/admin/stylesheets/global.css +1 -0
- data/public/admin/stylesheets/login.css +1 -0
- data/public/admin/stylesheets/wysiwyg-content.css +20 -0
- data/public/admin/stylesheets/wysiwyg.css +1 -0
- data/vendor/cache/more-0.1.1.gem +0 -0
- metadata +216 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,231 @@
|
|
1
|
+
$LOAD_PATH = ['/admin/javascripts'];
|
2
|
+
|
3
|
+
$(document).ready(function() {
|
4
|
+
$('a[data-method]').live('click', function(event) {
|
5
|
+
event.preventDefault();
|
6
|
+
var link = $(this);
|
7
|
+
var form = $('<form></form>').attr('action', this.href).attr('method', 'post');
|
8
|
+
form.append('<input type="hidden" name="_method" value="' + link.attr('data-method') + '" />');
|
9
|
+
var authenticityToken = $('meta[name=csrf-token]').attr('content');
|
10
|
+
form.append('<input type="hidden" name="authenticity_token" value="' + authenticityToken + '"/>');
|
11
|
+
$(document.body).append(form);
|
12
|
+
form.submit();
|
13
|
+
});
|
14
|
+
|
15
|
+
$('a.expand').live('click', function(event) {
|
16
|
+
event.preventDefault();
|
17
|
+
var link = $(this);
|
18
|
+
var li = link.parents('li');
|
19
|
+
var ul = li.find('ul');
|
20
|
+
var add;
|
21
|
+
if (li.hasClass('expanded')) {
|
22
|
+
ul.css('display', 'block');
|
23
|
+
li.removeClass('expanded');
|
24
|
+
ul.slideUp(100);
|
25
|
+
add = false;
|
26
|
+
} else {
|
27
|
+
ul.hide();
|
28
|
+
li.addClass('expanded');
|
29
|
+
ul.slideDown(100);
|
30
|
+
add = true;
|
31
|
+
}
|
32
|
+
$.get('/admin/expand?add=' + (add ? 'yup' : 'nope') + '§ion=' + link.attr('rel'));
|
33
|
+
});
|
34
|
+
|
35
|
+
$('#cover').click(function() {
|
36
|
+
$(this).fadeOut(200);
|
37
|
+
var pulldown = $('#pulldown');
|
38
|
+
if (pulldown.css('display') != 'none') {
|
39
|
+
pulldown.animate({top: -(pulldown.height())}, 300, function() {
|
40
|
+
pulldown.hide();
|
41
|
+
});
|
42
|
+
}
|
43
|
+
});
|
44
|
+
|
45
|
+
$('#pulldown a.cancel').live('click', function(event) {
|
46
|
+
event.preventDefault();
|
47
|
+
$('#cover').click();
|
48
|
+
});
|
49
|
+
|
50
|
+
$('.remote').live('click', function(event) {
|
51
|
+
$('#cover').fadeIn(100);
|
52
|
+
event.preventDefault();
|
53
|
+
$.get(this.href, function(response) {
|
54
|
+
var pulldown = $('#pulldown');
|
55
|
+
pulldown.html(response);
|
56
|
+
if (pulldown.css('display') == 'none') {
|
57
|
+
pulldown.css('top', -(pulldown.height())).show().animate({top: 0}, 300);
|
58
|
+
}
|
59
|
+
});
|
60
|
+
});
|
61
|
+
|
62
|
+
$('.galleries.sortable').sortable({
|
63
|
+
handle: '.float-left',
|
64
|
+
items: '.container',
|
65
|
+
stop: function(event, ui) {
|
66
|
+
$.post('/admin/galleries/reorder', $(this).sortable('serialize'), function() {
|
67
|
+
Flash.show('notice', "Your changes have been saved!");
|
68
|
+
});
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
$('.images.sortable').sortable({
|
73
|
+
handle: '.float-left',
|
74
|
+
items: '.container',
|
75
|
+
stop: function(event, ui) {
|
76
|
+
$.post(window.location.toString() + '/images/reorder', $(this).sortable('serialize'), function() {
|
77
|
+
Flash.show('notice', "Your changes have been saved!");
|
78
|
+
});
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
$('.container.gallery a').mousemove(function(event) {
|
83
|
+
var link = $(this);
|
84
|
+
var width = link.width();
|
85
|
+
var images = link.parent().children('img');
|
86
|
+
var segment = width / images.length;
|
87
|
+
var index = Math.max(Math.ceil(event.offsetX / segment), 1);
|
88
|
+
var image = $(images[index - 1]);
|
89
|
+
var active = link.find('img');
|
90
|
+
if (active.attr('src') != image.attr('src')) {
|
91
|
+
active.attr('src', image.attr('src'));
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
$('#uploads').livequery(function() {
|
96
|
+
var uploads = $(this);
|
97
|
+
if (uploads.length > 0) {
|
98
|
+
var form = uploads.parents('form');
|
99
|
+
var data = {}
|
100
|
+
$.each(form.serializeArray(), function() {
|
101
|
+
data[this.name] = this.value;
|
102
|
+
});
|
103
|
+
form.find('.toolbar').empty().flash(
|
104
|
+
{
|
105
|
+
align: 'center',
|
106
|
+
flashvars: {action: form.attr('action'), method: form.attr('method').toUpperCase(), data: $.param(data)},
|
107
|
+
height: 24,
|
108
|
+
id: 'uploads-flash',
|
109
|
+
src: '/admin/images/uploader.swf',
|
110
|
+
width: 118,
|
111
|
+
wmode: 'transparent'
|
112
|
+
}
|
113
|
+
);
|
114
|
+
Upload.element = document.getElementById('uploads-flash');
|
115
|
+
Upload.list = uploads;
|
116
|
+
}
|
117
|
+
});
|
118
|
+
|
119
|
+
$('.tabset').tabs();
|
120
|
+
|
121
|
+
$('.wysiwyg').dependency('wysiwyg', function() {
|
122
|
+
this.wysiwyg('post', this.attr('id') == 'post_body' ? '.post' : null);
|
123
|
+
});
|
124
|
+
|
125
|
+
$('.source a').live('click', function(event) {
|
126
|
+
event.preventDefault();
|
127
|
+
var link = $(this);
|
128
|
+
if (link.hasClass('active')) {
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
var source = link.parents('.source');
|
132
|
+
var destination = source.nextAll('.destination');
|
133
|
+
var active = source.find('a.active');
|
134
|
+
active.removeClass('active');
|
135
|
+
link.addClass('active');
|
136
|
+
$('#' + active.attr('rel')).hide();
|
137
|
+
$('#' + link.attr('rel')).show();
|
138
|
+
});
|
139
|
+
|
140
|
+
Flash.hideAll();
|
141
|
+
});
|
142
|
+
|
143
|
+
var Upload = {
|
144
|
+
// Every file is done; move on with our lives
|
145
|
+
allComplete: function() {
|
146
|
+
window.location = window.location;
|
147
|
+
},
|
148
|
+
// Called when someone clicks a "cancel this event" button
|
149
|
+
cancel: function(event) {
|
150
|
+
|
151
|
+
},
|
152
|
+
// Called AFTER we've successfully cancelled, but we initiate the cancelling.
|
153
|
+
cancelled: function() {
|
154
|
+
|
155
|
+
},
|
156
|
+
// Called for each file that's queued for upload
|
157
|
+
fileAdded: function(file) {
|
158
|
+
var item = $('<tr class="item" id="' + Upload.idFor(file.name) + '"></tr>');
|
159
|
+
item.append('<td class="image icon">' + file.name + '</td>');
|
160
|
+
item.append('<td class="progress-bar"><div class="progress"></div></td>');
|
161
|
+
item.append('<td style="width:20px;"><a class="delete icon"></a></td>');
|
162
|
+
item.find('a.delete').click(function(event) {
|
163
|
+
event.preventDefault();
|
164
|
+
var link = $(this);
|
165
|
+
if (link.hasClass('cancel')) {
|
166
|
+
$(this).parents('tr.item').remove();
|
167
|
+
Upload.stripe();
|
168
|
+
Upload.element.cancelFile(file);
|
169
|
+
}
|
170
|
+
});
|
171
|
+
Upload.list.find('tbody').append(item);
|
172
|
+
},
|
173
|
+
// Called the moment all of the queued files are done being added. We'll start the
|
174
|
+
// upload when this event occurs.
|
175
|
+
filesAdded: function() {
|
176
|
+
Upload.stripe();
|
177
|
+
Upload.list.slideDown(200, function() {
|
178
|
+
Upload.element.upload();
|
179
|
+
});
|
180
|
+
},
|
181
|
+
// Called when an individual upload finishes. We'll have to move our pointer forward
|
182
|
+
// here.
|
183
|
+
fileCompleted: function(event) {
|
184
|
+
var row = Upload.rowFor(event.target.name);
|
185
|
+
row.find('.progress-bar').addClass('complete');
|
186
|
+
row.find('.delete').removeClass('delete').addClass('okay');
|
187
|
+
},
|
188
|
+
fileError: function(event) {
|
189
|
+
var row = Upload.rowFor(event.target.name)
|
190
|
+
row.find('.progress-bar').addClass('complete');
|
191
|
+
row.find('.icon').removeClass('delete').addClass('error');
|
192
|
+
},
|
193
|
+
fileProgress: function(event) {
|
194
|
+
var progress = Upload.rowFor(event.target.name).find('.progress');
|
195
|
+
progress.animate({width: (event.bytesLoaded / event.bytesTotal * 100).toString() + '%'}, 50);
|
196
|
+
},
|
197
|
+
fileStarted: function(event) {
|
198
|
+
|
199
|
+
},
|
200
|
+
idFor: function(name) {
|
201
|
+
return 'file-' + name.toLowerCase().replace(/[^0-9a-z]/ig, '');
|
202
|
+
},
|
203
|
+
rowFor: function(name) {
|
204
|
+
return $('#' + Upload.idFor(name));
|
205
|
+
},
|
206
|
+
stripe: function() {
|
207
|
+
Upload.list.find('tbody').find('tr').removeClass('odd');
|
208
|
+
Upload.list.find('tbody').find('tr:odd').addClass('odd');
|
209
|
+
}
|
210
|
+
};
|
211
|
+
|
212
|
+
var Flash = {
|
213
|
+
hideAll: function() {
|
214
|
+
$('.flash').each(function() {
|
215
|
+
var flash = $(this);
|
216
|
+
setTimeout(function() {
|
217
|
+
flash.fadeOut(200);
|
218
|
+
}, 2000);
|
219
|
+
});
|
220
|
+
},
|
221
|
+
show: function(type, message) {
|
222
|
+
var flash = $('.flash.' + type);
|
223
|
+
if (flash.length === 0) {
|
224
|
+
flash = $('<div class="flash ' + type + '"><div class="inner"></div></div>').hide();
|
225
|
+
$(document.body).prepend(flash);
|
226
|
+
}
|
227
|
+
flash.find('.inner').html(message);
|
228
|
+
Flash.hideAll();
|
229
|
+
return flash.fadeIn(200);
|
230
|
+
}
|
231
|
+
};
|