caboose-cms 0.5.221 → 0.5.222
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/admin_media_index.js +401 -0
- data/app/assets/javascripts/caboose/jquery-ui.drag-multiple.min.js +4 -0
- data/app/assets/javascripts/plupload/Moxie.swf +0 -0
- data/app/assets/javascripts/plupload/Moxie.xap +0 -0
- data/app/assets/javascripts/plupload/i18n/ar.js +2 -0
- data/app/assets/javascripts/plupload/i18n/az.js +2 -0
- data/app/assets/javascripts/plupload/i18n/bg.js +2 -0
- data/app/assets/javascripts/plupload/i18n/bs.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ca.js +2 -0
- data/app/assets/javascripts/plupload/i18n/cs.js +2 -0
- data/app/assets/javascripts/plupload/i18n/cy.js +2 -0
- data/app/assets/javascripts/plupload/i18n/da.js +2 -0
- data/app/assets/javascripts/plupload/i18n/de.js +2 -0
- data/app/assets/javascripts/plupload/i18n/el.js +2 -0
- data/app/assets/javascripts/plupload/i18n/en.js +2 -0
- data/app/assets/javascripts/plupload/i18n/es.js +2 -0
- data/app/assets/javascripts/plupload/i18n/et.js +2 -0
- data/app/assets/javascripts/plupload/i18n/fa.js +2 -0
- data/app/assets/javascripts/plupload/i18n/fi.js +2 -0
- data/app/assets/javascripts/plupload/i18n/fr.js +2 -0
- data/app/assets/javascripts/plupload/i18n/he.js +2 -0
- data/app/assets/javascripts/plupload/i18n/hr.js +2 -0
- data/app/assets/javascripts/plupload/i18n/hu.js +2 -0
- data/app/assets/javascripts/plupload/i18n/hy.js +2 -0
- data/app/assets/javascripts/plupload/i18n/id.js +2 -0
- data/app/assets/javascripts/plupload/i18n/it.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ja.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ka.js +2 -0
- data/app/assets/javascripts/plupload/i18n/kk.js +2 -0
- data/app/assets/javascripts/plupload/i18n/km.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ko.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ku_IQ.js +2 -0
- data/app/assets/javascripts/plupload/i18n/lt.js +2 -0
- data/app/assets/javascripts/plupload/i18n/lv.js +2 -0
- data/app/assets/javascripts/plupload/i18n/mn.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ms.js +2 -0
- data/app/assets/javascripts/plupload/i18n/nl.js +2 -0
- data/app/assets/javascripts/plupload/i18n/pl.js +2 -0
- data/app/assets/javascripts/plupload/i18n/pt_BR.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ro.js +2 -0
- data/app/assets/javascripts/plupload/i18n/ru.js +2 -0
- data/app/assets/javascripts/plupload/i18n/sk.js +2 -0
- data/app/assets/javascripts/plupload/i18n/sq.js +2 -0
- data/app/assets/javascripts/plupload/i18n/sr.js +2 -0
- data/app/assets/javascripts/plupload/i18n/sr_RS.js +2 -0
- data/app/assets/javascripts/plupload/i18n/sv.js +2 -0
- data/app/assets/javascripts/plupload/i18n/th_TH.js +2 -0
- data/app/assets/javascripts/plupload/i18n/tr.js +2 -0
- data/app/assets/javascripts/plupload/i18n/uk_UA.js +2 -0
- data/app/assets/javascripts/plupload/i18n/vi.js +2 -0
- data/app/assets/javascripts/plupload/i18n/zh_CN.js +2 -0
- data/app/assets/javascripts/plupload/i18n/zh_TW.js +2 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css +185 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/backgrounds.gif +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/buttons-disabled.png +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/buttons.png +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/delete.gif +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/done.gif +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/error.gif +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/throbber.gif +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/img/transp50.png +0 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/jquery.plupload.queue.js +428 -0
- data/app/assets/javascripts/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js +1 -0
- data/app/assets/javascripts/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css +370 -0
- data/app/assets/javascripts/plupload/jquery.ui.plupload/img/loading.gif +0 -0
- data/app/assets/javascripts/plupload/jquery.ui.plupload/img/plupload.png +0 -0
- data/app/assets/javascripts/plupload/jquery.ui.plupload/jquery.ui.plupload.js +1323 -0
- data/app/assets/javascripts/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js +1 -0
- data/app/assets/javascripts/plupload/moxie.js +10726 -0
- data/app/assets/javascripts/plupload/moxie.min.js +15 -0
- data/app/assets/javascripts/plupload/plupload.dev.js +2315 -0
- data/app/assets/javascripts/plupload/plupload.full.min.js +28 -0
- data/app/assets/javascripts/plupload/plupload.min.js +13 -0
- data/app/assets/stylesheets/caboose/admin_media_index.css.scss +115 -0
- data/app/controllers/caboose/application_controller.rb +1 -1
- data/app/controllers/caboose/cart_controller.rb +1 -1
- data/app/controllers/caboose/media_categories_controller.rb +44 -8
- data/app/controllers/caboose/media_controller.rb +116 -0
- data/app/controllers/caboose/posts_controller.rb +1 -1
- data/app/controllers/caboose/sns_controller.rb +60 -0
- data/app/models/caboose/block.rb +4 -2
- data/app/models/caboose/media.rb +94 -0
- data/app/models/caboose/media_category.rb +55 -15
- data/app/models/caboose/schema.rb +6 -9
- data/app/models/caboose/tax_calculator.rb +1 -1
- data/app/views/caboose/{images → media}/admin_edit.html.erb +0 -0
- data/app/views/caboose/media/admin_index.html.erb +49 -0
- data/app/views/caboose/posts/admin_edit_general.html.erb +3 -1
- data/config/routes.rb +30 -17
- data/lib/caboose.rb +6 -0
- data/lib/caboose/version.rb +1 -1
- metadata +81 -11
- data/app/assets/javascripts/caboose/admin_images_index.js +0 -171
- data/app/assets/stylesheets/caboose/admin_images_index.css.scss +0 -53
- data/app/controllers/caboose/images_controller.rb +0 -149
- data/app/models/caboose/media_file.rb +0 -18
- data/app/models/caboose/media_image.rb +0 -43
- data/app/views/caboose/images/admin_index.html.erb +0 -59
- data/app/views/caboose/images/admin_new.html.erb +0 -80
- data/app/views/caboose/images/admin_s3_result.html.erb +0 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjliZDRiZWU1NmE4ODhhNDgwZDA0YWJiMjQ5MjgwMjIwNDM1YzkwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzdiN2ZkZjIxMjdlZGQzM2ViMzE1MGE5ODFhNjBjODBlMmViMTVlZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDcxZDdkMGQyNDZiYTZjZDFhZjkxOTYwNGZiYjgwODI1NWE4OGIyN2YwOTIz
|
10
|
+
YzNjMTM4YTA2MzVhN2Q2MWZlZWQ4Y2VlZjkyMjA4NDk5MGZjMjdmMTRjYTVh
|
11
|
+
ODA3NmQ0YWU2NWQ4ZGJlNjMyOGUxMTVlMzNhMDM0YWMwMmQ3YjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDRhMWIyYzEwMTAyMjY0N2I4YTE5MzEzMTE5NjE2OWJiYWQ2YmFiNmVlNGFk
|
14
|
+
OWM3MzcyODg2ZjkzMzIwNmIyN2I0NGYwNjI3ZWI3YzcwMDczMTMyMDVjZjMx
|
15
|
+
MDQyOGM1ZmEyZGFjYWM2MjE3ZGM1NTRkY2UzYjZhNDUxYTBhMTg=
|
@@ -0,0 +1,401 @@
|
|
1
|
+
|
2
|
+
var MediaController = function(params) { this.init(params); };
|
3
|
+
|
4
|
+
MediaController.prototype = {
|
5
|
+
|
6
|
+
top_cat_id: false,
|
7
|
+
cat: false,
|
8
|
+
cat_id: false,
|
9
|
+
categories: false,
|
10
|
+
s3_upload_url: false,
|
11
|
+
aws_access_key_id: false,
|
12
|
+
policy: false,
|
13
|
+
signature: false,
|
14
|
+
selected_media: false,
|
15
|
+
uploader: false,
|
16
|
+
|
17
|
+
init: function(params) {
|
18
|
+
var that = this;
|
19
|
+
for (var i in params)
|
20
|
+
this[i] = params[i];
|
21
|
+
|
22
|
+
$("#uploader")
|
23
|
+
.empty()
|
24
|
+
.append($('<p/>')
|
25
|
+
.append($('<a/>').attr('href', '#').html('Upload').click(function(e) { e.preventDefault(); that.toggle_uploader(); }))
|
26
|
+
.append(' | ')
|
27
|
+
.append($('<a/>').attr('href', '#').html('Select All').click(function(e) { e.preventDefault(); that.select_all_media(); }))
|
28
|
+
)
|
29
|
+
.append($('<div/>').attr('id', 'the_uploader'));
|
30
|
+
that.refresh();
|
31
|
+
},
|
32
|
+
|
33
|
+
refresh: function()
|
34
|
+
{
|
35
|
+
var that = this;
|
36
|
+
that.refresh_categories();
|
37
|
+
that.refresh_media();
|
38
|
+
that.print_controls();
|
39
|
+
},
|
40
|
+
|
41
|
+
toggle_uploader: function()
|
42
|
+
{
|
43
|
+
var that = this;
|
44
|
+
if (that.uploader)
|
45
|
+
{
|
46
|
+
$("#the_uploader").slideUp(400, function() {
|
47
|
+
$("#the_uploader").plupload('destroy');
|
48
|
+
that.uploader = false;
|
49
|
+
});
|
50
|
+
}
|
51
|
+
else
|
52
|
+
{
|
53
|
+
$("#the_uploader").hide();
|
54
|
+
that.uploader = $("#the_uploader").plupload({
|
55
|
+
runtimes: 'html5,flash,silverlight',
|
56
|
+
url: that.s3_upload_url,
|
57
|
+
multipart: true,
|
58
|
+
multipart_params: {
|
59
|
+
key: that.cat_id + '_${filename}', // use filename as a key
|
60
|
+
Filename: that.cat_id + '_${filename}', // adding this to keep consistency across the runtimes
|
61
|
+
acl: 'public-read',
|
62
|
+
//'Content-Type': 'image/jpeg',
|
63
|
+
AWSAccessKeyId: that.aws_access_key_id,
|
64
|
+
policy: that.policy,
|
65
|
+
signature: that.signature
|
66
|
+
},
|
67
|
+
file_data_name: 'file', // optional, but better be specified directly
|
68
|
+
filters: {
|
69
|
+
max_file_size: '10mb', // Maximum file size
|
70
|
+
mime_types: [{ title: "Upload files", extensions: "jpg,jpeg,png,gif,tif,tiff,pdf,doc,docx,odt,odp,ods,ppt,pptx,xls,xlsx,zip,tgz,csv,txt" }] // Specify what files to browse for
|
71
|
+
},
|
72
|
+
flash_swf_url: '../../js/Moxie.swf', // Flash settings
|
73
|
+
silverlight_xap_url: '../../js/Moxie.xap', // Silverlight settings
|
74
|
+
init: {
|
75
|
+
BeforeUpload: function(up, file) {
|
76
|
+
$.ajax({
|
77
|
+
url: '/admin/media/pre-upload',
|
78
|
+
type: 'post',
|
79
|
+
data: {
|
80
|
+
media_category_id: that.cat_id,
|
81
|
+
name: file.name
|
82
|
+
},
|
83
|
+
success: function(resp) {},
|
84
|
+
async: false
|
85
|
+
});
|
86
|
+
controller.refresh();
|
87
|
+
},
|
88
|
+
FileUploaded: function(ip, file)
|
89
|
+
{
|
90
|
+
that.refresh();
|
91
|
+
},
|
92
|
+
UploadComplete: function(up, files) {
|
93
|
+
that.refresh();
|
94
|
+
if (that.uploader)
|
95
|
+
{
|
96
|
+
$("#the_uploader").slideUp(400, function() {
|
97
|
+
$("#the_uploader").plupload('destroy');
|
98
|
+
that.uploader = false;
|
99
|
+
});
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
});
|
104
|
+
$("#the_uploader").slideDown();
|
105
|
+
}
|
106
|
+
},
|
107
|
+
|
108
|
+
refresh_categories: function(after)
|
109
|
+
{
|
110
|
+
var that = this;
|
111
|
+
$.ajax({
|
112
|
+
url: '/admin/media-categories/flat-tree',
|
113
|
+
type: 'get',
|
114
|
+
async: false,
|
115
|
+
success: function(resp) {
|
116
|
+
that.categories = resp;
|
117
|
+
that.print_categories();
|
118
|
+
if (after) after();
|
119
|
+
}
|
120
|
+
});
|
121
|
+
},
|
122
|
+
|
123
|
+
refresh_media: function()
|
124
|
+
{
|
125
|
+
var that = this;
|
126
|
+
$.ajax({
|
127
|
+
url: '/admin/media/json',
|
128
|
+
type: 'get',
|
129
|
+
async: false,
|
130
|
+
data: { media_category_id: that.cat_id },
|
131
|
+
success: function(resp) {
|
132
|
+
that.cat = resp;
|
133
|
+
that.cat_id = that.cat.id;
|
134
|
+
that.selected_media = [];
|
135
|
+
that.print_media();
|
136
|
+
}
|
137
|
+
});
|
138
|
+
},
|
139
|
+
|
140
|
+
print_categories: function()
|
141
|
+
{
|
142
|
+
var that = this;
|
143
|
+
var ul = $('<ul/>');
|
144
|
+
if (that.categories.length > 0)
|
145
|
+
{
|
146
|
+
$.each(that.categories, function(i, cat) {
|
147
|
+
|
148
|
+
var li = $('<li/>')
|
149
|
+
.addClass('category')
|
150
|
+
.attr('id', 'cat' + cat.id)
|
151
|
+
.data('media_category_id', cat.id)
|
152
|
+
.append($('<a/>').attr('href', '#').html(cat.name + ' (' + cat.media_count + ')').click(function(e) { e.preventDefault(); that.select_category($(this).parent().data('media_category_id')); }));
|
153
|
+
if (cat.id == that.cat_id)
|
154
|
+
li.addClass('selected');
|
155
|
+
ul.append(li);
|
156
|
+
});
|
157
|
+
}
|
158
|
+
else
|
159
|
+
ul = $('<p/>').html("There are no media categories.");
|
160
|
+
$('#categories').empty().append(ul)
|
161
|
+
.append($('<p/>').append($('<a/>').attr('href', '#').html('New Category').click(function(e) { e.preventDefault(); that.add_category(); })))
|
162
|
+
.append($('<div/>').attr('id', 'new_cat_message'));
|
163
|
+
|
164
|
+
$.each(that.categories, function(i, cat) {
|
165
|
+
$('#cat' + cat.id).droppable({
|
166
|
+
accept: function(draggable) { return (draggable.hasClass('category') || draggable.hasClass('media')) },
|
167
|
+
hoverClass: 'cat_hover',
|
168
|
+
drop: function(event, ui) {
|
169
|
+
if (ui.draggable.hasClass('category'))
|
170
|
+
{
|
171
|
+
var child_cat_id = ui.draggable.data('media_category_id');
|
172
|
+
var new_parent_id = $(this).data('media_category_id');
|
173
|
+
$.ajax({
|
174
|
+
url: '/admin/media-categories/' + child_cat_id,
|
175
|
+
type: 'put',
|
176
|
+
data: { parent_id: new_parent_id },
|
177
|
+
success: function(resp) { that.refresh_categories(); }
|
178
|
+
});
|
179
|
+
}
|
180
|
+
else // media
|
181
|
+
{
|
182
|
+
var media_category_id = $(this).data('media_category_id');
|
183
|
+
var ids = (that.selected_media.length > 0 ? that.selected_media : [ui.draggable.data('media_id')]);
|
184
|
+
$.ajax({
|
185
|
+
url: '/admin/media-categories/' + media_category_id + '/attach',
|
186
|
+
type: 'post',
|
187
|
+
data: { media_id: ids },
|
188
|
+
success: function(resp) { that.refresh_categories(); that.refresh_media(); }
|
189
|
+
});
|
190
|
+
}
|
191
|
+
}
|
192
|
+
});
|
193
|
+
$('#cat' + cat.id).draggable({ revert: 'invalid' });
|
194
|
+
});
|
195
|
+
},
|
196
|
+
|
197
|
+
print_controls: function()
|
198
|
+
{
|
199
|
+
var that = this;
|
200
|
+
$('#controls').empty()
|
201
|
+
.append($('<div/>').attr('id', 'delete').append($('<p/>').addClass('delete_dropper').html('Delete')));
|
202
|
+
|
203
|
+
$('#delete').droppable({
|
204
|
+
accept: function(draggable) { return (draggable.hasClass('category') || draggable.hasClass('media')) },
|
205
|
+
hoverClass: 'hover',
|
206
|
+
drop: function(event, ui) {
|
207
|
+
if (ui.draggable.hasClass('category'))
|
208
|
+
{
|
209
|
+
var media_category_id = ui.draggable.data('media_category_id');
|
210
|
+
that.delete_category(media_category_id);
|
211
|
+
}
|
212
|
+
else // media
|
213
|
+
{
|
214
|
+
id = ui.draggable.data('media_id');
|
215
|
+
if (that.selected_media.length > 0 && that.selected_media.indexOf(id) > -1)
|
216
|
+
{
|
217
|
+
that.select_media(id); // Go ahead and de-select because the select event is about to run
|
218
|
+
}
|
219
|
+
that.delete_media();
|
220
|
+
}
|
221
|
+
}
|
222
|
+
});
|
223
|
+
},
|
224
|
+
|
225
|
+
print_media: function()
|
226
|
+
{
|
227
|
+
var that = this;
|
228
|
+
var ul = $('<ul/>');
|
229
|
+
var processing = false;
|
230
|
+
if (that.cat.media.length > 0)
|
231
|
+
{
|
232
|
+
$.each(that.cat.media, function(i, m) {
|
233
|
+
if (m.image_urls && m.processed == false)
|
234
|
+
processing = true
|
235
|
+
var li = $('<li/>')
|
236
|
+
.attr('id', 'media' + m.id)
|
237
|
+
.addClass('media')
|
238
|
+
.data('media_id', m.id)
|
239
|
+
.click(function(e) { that.select_media($(this).data('media_id')); })
|
240
|
+
.append($('<span/>').addClass('name').html(m.name));
|
241
|
+
if (m.image_urls)
|
242
|
+
li.append($('<img/>').attr('src', m.image_urls.tiny_url));
|
243
|
+
if (that.selected_media.indexOf(m.id) > -1)
|
244
|
+
li.addClass('selected ui-selected');
|
245
|
+
ul.append(li);
|
246
|
+
});
|
247
|
+
}
|
248
|
+
else
|
249
|
+
ul = $('<p/>').html("This category is empty.");
|
250
|
+
$('#media').empty().append(ul);
|
251
|
+
//if (processing)
|
252
|
+
// setTimeout(function() { that.refresh(); }, 2000);
|
253
|
+
|
254
|
+
$.each(that.cat.media, function(i, m) {
|
255
|
+
$('li.media').draggable({
|
256
|
+
multiple: true,
|
257
|
+
revert: 'invalid',
|
258
|
+
start: function() { $(this).data("origPosition", $(this).position()); }
|
259
|
+
});
|
260
|
+
});
|
261
|
+
},
|
262
|
+
|
263
|
+
//============================================================================
|
264
|
+
|
265
|
+
select_media: function(media_id)
|
266
|
+
{
|
267
|
+
var that = this;
|
268
|
+
var i = that.selected_media.indexOf(media_id);
|
269
|
+
if (i > -1)
|
270
|
+
{
|
271
|
+
that.selected_media.splice(i, 1);
|
272
|
+
$('#media' + media_id).removeClass('selected ui-selected');
|
273
|
+
}
|
274
|
+
else
|
275
|
+
{
|
276
|
+
that.selected_media[that.selected_media.length] = media_id;
|
277
|
+
$('#media' + media_id).addClass('selected ui-selected').css('top', '0').css('left', '0');
|
278
|
+
}
|
279
|
+
},
|
280
|
+
|
281
|
+
select_all_media: function()
|
282
|
+
{
|
283
|
+
var that = this;
|
284
|
+
|
285
|
+
// See if they're all selected
|
286
|
+
var all_selected = true;
|
287
|
+
$.each(that.cat.media, function(i, m) {
|
288
|
+
if (that.selected_media.indexOf(m.id) == -1)
|
289
|
+
{
|
290
|
+
all_selected = false
|
291
|
+
return false;
|
292
|
+
}
|
293
|
+
});
|
294
|
+
|
295
|
+
// Now de-select everything
|
296
|
+
$('li.media').removeClass('selected ui-selected');
|
297
|
+
that.selected_media = [];
|
298
|
+
|
299
|
+
// And re-select everything if not everything was previously selected
|
300
|
+
if (!all_selected)
|
301
|
+
{
|
302
|
+
$.each(that.cat.media, function(i, m) {
|
303
|
+
$('#media' + m.id).addClass('selected ui-selected');
|
304
|
+
that.selected_media[i] = m.id;
|
305
|
+
});
|
306
|
+
}
|
307
|
+
},
|
308
|
+
|
309
|
+
delete_media: function(confirm)
|
310
|
+
{
|
311
|
+
var that = this;
|
312
|
+
if (!confirm)
|
313
|
+
{
|
314
|
+
$.each(that.selected_media, function(i, id) {
|
315
|
+
$('#media' + id).css('top', '0').css('left', '0');
|
316
|
+
});
|
317
|
+
var div = $('<p/>').addClass('note error')
|
318
|
+
.append('Are you sure?<br/>')
|
319
|
+
.append($('<input/>').attr('type', 'button').val('Yes').click(function() { that.delete_media(true); })).append(" ")
|
320
|
+
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { that.refresh_media(); that.print_controls(); }));
|
321
|
+
$('#delete').empty().append(div);
|
322
|
+
return;
|
323
|
+
}
|
324
|
+
$('#delete').empty().html("<p class='loading'>Deleting...</p>");
|
325
|
+
$.ajax({
|
326
|
+
url: '/admin/media/bulk',
|
327
|
+
type: 'delete',
|
328
|
+
data: { ids: that.selected_media },
|
329
|
+
success: function(resp) { that.refresh_categories(); that.refresh_media(); that.print_controls(); }
|
330
|
+
});
|
331
|
+
},
|
332
|
+
|
333
|
+
//============================================================================
|
334
|
+
|
335
|
+
select_category: function(cat_id)
|
336
|
+
{
|
337
|
+
var that = this;
|
338
|
+
that.cat_id = cat_id;
|
339
|
+
that.print_categories();
|
340
|
+
that.refresh_media();
|
341
|
+
},
|
342
|
+
|
343
|
+
add_category: function(name)
|
344
|
+
{
|
345
|
+
var that = this;
|
346
|
+
if (!name)
|
347
|
+
{
|
348
|
+
var div = $('<p/>').addClass('note warning')
|
349
|
+
.append('New Category Name: ')
|
350
|
+
.append($('<input/>').attr('type', 'text').attr('id', 'new_cat_name')).append(" ")
|
351
|
+
.append($('<input/>').attr('type', 'button').val('Add').click(function() { that.add_category($('#new_cat_name').val()); })).append(" ")
|
352
|
+
.append($('<input/>').attr('type', 'button').val('Cancel').click(function() { $('#new_cat_message').empty(); }));
|
353
|
+
$('#new_cat_message').empty().append(div);
|
354
|
+
return;
|
355
|
+
}
|
356
|
+
$('#new_cat_message').empty().html("<p class='loading'>Adding category...</p>");
|
357
|
+
$.ajax({
|
358
|
+
url: '/admin/media-categories',
|
359
|
+
type: 'post',
|
360
|
+
data: {
|
361
|
+
parent_id: that.cat.id,
|
362
|
+
name: name
|
363
|
+
},
|
364
|
+
success: function(resp) {
|
365
|
+
if (resp.error) $('#new_cat_message').empty().html("<p class='note error'>" + resp.error + "</p>");
|
366
|
+
if (resp.refresh) that.refresh_categories();
|
367
|
+
}
|
368
|
+
});
|
369
|
+
},
|
370
|
+
|
371
|
+
delete_category: function(cat_id, confirm)
|
372
|
+
{
|
373
|
+
var that = this;
|
374
|
+
if (!confirm)
|
375
|
+
{
|
376
|
+
var div = $('<p/>').addClass('note warning')
|
377
|
+
.append('Are you sure? ')
|
378
|
+
.append($('<input/>').attr('type', 'button').val('Yes').click(function() { that.delete_category(cat_id, true); })).append(" ")
|
379
|
+
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { that.refresh_categories(); that.print_controls() }));
|
380
|
+
$('#delete').empty().append(div);
|
381
|
+
return;
|
382
|
+
}
|
383
|
+
$('#delete').empty().html("<p class='loading'>Deleting...</p>");
|
384
|
+
$.ajax({
|
385
|
+
url: '/admin/media-categories/' + cat_id,
|
386
|
+
type: 'delete',
|
387
|
+
success: function(resp) {
|
388
|
+
that.refresh_categories(function() {
|
389
|
+
var exists = false;
|
390
|
+
$.each(that.categories, function(i, cat) { if (cat.id == cat_id) { exists = true; return false; }});
|
391
|
+
if (!exists)
|
392
|
+
that.select_category(that.categories[0].id);
|
393
|
+
else
|
394
|
+
that.refresh_media();
|
395
|
+
that.print_controls();
|
396
|
+
});
|
397
|
+
}
|
398
|
+
});
|
399
|
+
},
|
400
|
+
|
401
|
+
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! Drag Multiple Plugin - v0.1.1 - 2014-05-14
|
2
|
+
* https://github.com/javadoug/jquery.drag-multiple
|
3
|
+
* Copyright (c) 2014 Doug Ross; Licensed MIT */
|
4
|
+
!function(a){"use strict";function b(){return!1}function c(b){return a.extend({},h,b.options.multiple)}function d(b,c,d,e){return a.isFunction(b)?b.call(c,d,e):void 0}function e(a,b,c,e){return d(b.beforeStart,a,c,e)}function f(a,b,c,e){return d(b.beforeDrag,a,c,e)}function g(a,b,c,e){return d(b.beforeStop,a,c,e)}var h={items:function(){return a(".ui-draggable.ui-selected")},beforeStart:function(){return this.is(".ui-draggable")&&this.is(".ui-selected")?void 0:(a(".ui-draggable").removeClass("ui-selected"),!1)},beforeDrag:a.noop,beforeStop:a.noop};a.ui.plugin.add("draggable","multiple",{start:function(d,f){var g,h,i,j;return g=this,h=g.data("draggable")||g.data("ui-draggable"),h.multiple={},j=h.multiple.options=c(h),i=j.items(),!1===e(g,j,d,f)?(j.dragCanceled=!0,!1):(i.each(function(){var b=a(this).position();a(this).data("dragmultiple:originalPosition",a.extend({},b))}),h.originalRevert=j.revert=h.options.revert,void(h.options.revert=b))},drag:function(c,d){var e,g,h;return e=this,g=e.data("draggable")||e.data("ui-draggable"),h=g.multiple.options,h.dragCanceled?!1:(f(e,h,c,d),b!==g.options.revert&&(h.revert=g.options.revert,g.options.revert=b),void h.items().each(function(){var b=a(this).data("dragmultiple:originalPosition");a(this).css({top:b.top+(d.position.top-d.originalPosition.top),left:b.left+(d.position.left-d.originalPosition.left)})}))},stop:function(b,c){var d,e,f;return d=this,e=d.data("draggable")||d.data("ui-draggable"),f=e.multiple.options,f.dragCanceled?!1:(g(d,f,b,c),f.revert===!0&&f.items().each(function(){var b=a(this).data("dragmultiple:originalPosition");a(this).css(b)}),f.items().each(function(){a(this).removeData("dragmultiple:originalPosition")}),void(e.options.revert=e.originalRevert))}})}(jQuery);
|
Binary file
|
Binary file
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// Arabic (ar)
|
2
|
+
plupload.addI18n({"Stop Upload":"أيقاف التحميل","Upload URL might be wrong or doesn't exist.":"عنوان التحميل ربما يكون خاطئ أو غير متوفر","tb":"تيرابايت","Size":"الحجم","Close":"أغلاق","Init error.":"خطأ في تهيئة","Add files to the upload queue and click the start button.":"أضف ملفات إلى القائمة إنتظار التحميل ثم أضغط على زر البداية","Filename":"أسم الملف","Image format either wrong or not supported.":"صيغة الصورة أما خطاء أو غير مدعومه","Status":"الحالة","HTTP Error.":"خطأ في برتوكول نقل الملفات","Start Upload":"أبدا التحميل","mb":"ميجابايت","kb":"كيلوبايت","Duplicate file error.":"خطاء في تكرار الملف","File size error.":"خطأ في حجم الملف","N/A":"لا شي","gb":"جيجابايت","Error: Invalid file extension:":"خطاء : أمتداد الملف غير صالح :","Select files":"أختر الملفات","%s already present in the queue.":"%s الملف موجود بالفعل في قائمة الانتظار","File: %s":"ملف: %s","b":"بايت","Uploaded %d/%d files":"تحميل %d/%d ملف","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"العناصر المقبوله لتحميل هي %d ملف في هذا الوقت. الملفات الاضافية أزيلة.","%d files queued":"%d الملفات في قائمة الانتظار","File: %s, size: %d, max file size: %d":"ملف: %s, أقصى حجم للملف: %d, حجم: %d","Drag files here.":"سحب الملف هنا","Runtime ran out of available memory.":"الذاكرة المتوفره أنتهت لمدة التشغيل","File count error.":"خطاء في عد الملفات","File extension error.":"خطأ في أمتداد الملف","Error: File too large:":" خطاء : حجم الملف كبير :","Add Files":"أضف ملفات"});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// Azerbaijani (az)
|
2
|
+
plupload.addI18n({"Stop Upload":"Yükləməni saxla","Upload URL might be wrong or doesn't exist.":"Yükləmə ünvanı səhvdir və ya mövcud deyil","tb":"tb","Size":"Həcm","Close":"Bağla","Init error.":"Init error.","Add files to the upload queue and click the start button.":"Faylları əlavə edin və yüklə düyməsinə klikləyin.","Filename":"Faylın adı","Image format either wrong or not supported.":"Şəklin formatı uyğun deyil və ya dəstəklənmir.","Status":"Status","HTTP Error.":"HTTP xətası.","Start Upload":"Yüklə","mb":"mb","kb":"kb","Duplicate file error.":"Bu fayl artıq növbədə var.","File size error.":"Fayl həcmi xətası.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Xəta: Yanlış fayl uzantısı:","Select files":"Faylları seçin","%s already present in the queue.":"%s artıq növbədə var.","File: %s":"Fayl: %s","b":"b","Uploaded %d/%d files":"%d/%d fayl yüklənib","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload element accepts only %d file(s) at a time. Extra files were stripped.","%d files queued":"Növbədə %d fayl var","File: %s, size: %d, max file size: %d":"Fayl: %s, həcm: %d, max fayl həcmi: %d","Drag files here.":"Faylları bura çəkin.","Runtime ran out of available memory.":"Runtime ran out of available memory.","File count error.":"Fayl sayı çox böyükdür.","File extension error.":"Fayl uzantısı xətası.","Error: File too large:":"Xəta:Fayl həcmi çox böyükdür.","Add Files":"Fayl əlavə et"});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// Bulgarian (bg)
|
2
|
+
plupload.addI18n({"Stop Upload":"Спрете качването","Upload URL might be wrong or doesn't exist.":"URL за качване може да е грешен или да не съществува.","tb":"tb","Size":"Размер","Close":"Затвори","Init error.":"Грешка: инициализиране.","Add files to the upload queue and click the start button.":"Добавете файлове в опашката за качване, и щракнете бутона старт.","Filename":"Име на файла","Image format either wrong or not supported.":"Формата на изображението или е объркан, или не се поддържа.","Status":"Статус","HTTP Error.":"Грешка: HTTP .","Start Upload":"Започнете качването","mb":"mb","kb":"kb","Duplicate file error.":"Грешка: файла е вече качен на сървъра.","File size error.":"Грешка: размер на файла.","N/A":"не приложимо","gb":"gb","Error: Invalid file extension:":"Грешка: Невалидно разширение на файл:","Select files":"Изберете файлове","%s already present in the queue.":"%s вече го има в опашката.","File: %s":"Файл: %s","b":"b","Uploaded %d/%d files":"Качени %d/%d файла","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Елемента за качване приема само %d файл(а) наведнъж. Допълнителните файлове бяха отстранени.","%d files queued":"%d файла в опашката","File: %s, size: %d, max file size: %d":"Файл: %s, размер: %d, максимален размер: %d","Drag files here.":"Довлечете файловете тук.","Runtime ran out of available memory.":"Недостатъчна свободна памет.","File count error.":"Грешка в броя на файловете.","File extension error.":"Грешка: разширение на файла.","Error: File too large:":"Грешка: Файла е твърде голям:","Add Files":"Добавете файлове"});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// Bosnian (bs)
|
2
|
+
plupload.addI18n({"Stop Upload":"Prekini dodavanje","Upload URL might be wrong or doesn't exist.":"URL za dodavanje je neispravan ili ne postoji.","tb":"tb","Size":"Veličina","Close":"Zatvori","Init error.":"Inicijalizacijska greška.","Add files to the upload queue and click the start button.":"Dodajte datoteke u red i kliknite na dugme za pokretanje.","Filename":"Naziv datoteke","Image format either wrong or not supported.":"Format slike je neispravan ili nije podržan.","Status":"Status","HTTP Error.":"HTTP greška.","Start Upload":"Započni dodavanje","mb":"mb","kb":"kb","Duplicate file error.":"Dupla datoteka.","File size error.":"Greška u veličini datoteke.","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"Greška! Neispravan ekstenzija datoteke:","Select files":"Odaberite datoteke","%s already present in the queue.":"%s se već nalazi u redu.","File: %s":"Datoteka: %s","b":"b","Uploaded %d/%d files":"Dodano %d/%d datoteka","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Dodavanje trenutno dozvoljava samo %d datoteka istovremeno. Dodatne datoteke su uklonjene.","%d files queued":"%d datoteka čeka","File: %s, size: %d, max file size: %d":"Datoteka: %s, veličina: %d, maksimalna veličina: %d","Drag files here.":"Dovucite datoteke ovdje.","Runtime ran out of available memory.":"Nema više dostupne memorije.","File count error.":"Greška u brojanju datoeka.","File extension error.":"Greška u ekstenziji datoteke.","Error: File too large:":"Greška! Datoteka je prevelika:","Add Files":"Dodaj datoteke"});
|