caboose-cms 0.9.229 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/javascripts/caboose/admin.js +1 -1
- data/app/assets/javascripts/caboose/admin/application.js +20 -0
- data/app/assets/javascripts/caboose/admin_main.js +13 -3
- data/app/assets/javascripts/caboose/admin_media_index.js +158 -161
- data/app/assets/javascripts/caboose/application.js +7 -8
- data/app/assets/javascripts/caboose/block_content_controller_dragdrop.js +4 -60
- data/app/assets/javascripts/caboose/block_modal_controllers/block_dd_modal_controller.js +2 -3
- data/app/assets/javascripts/caboose/block_modal_controllers/media_modal_controller.js +6 -17
- data/app/assets/javascripts/caboose/model/all.js +1 -5
- data/app/assets/stylesheets/caboose/admin/_config.scss +102 -0
- data/app/assets/stylesheets/caboose/admin/application.css +11 -0
- data/app/assets/stylesheets/caboose/admin/component.css +183 -0
- data/app/assets/stylesheets/caboose/admin/froala.min.css +91 -0
- data/app/assets/stylesheets/caboose/admin/ie.scss +67 -0
- data/app/assets/stylesheets/caboose/admin/integrations/main.scss +6 -0
- data/app/assets/stylesheets/caboose/admin/integrations/shopify.scss +128 -0
- data/app/assets/stylesheets/caboose/admin/jquery-ui-subnav-theme.min.css +5 -0
- data/app/assets/stylesheets/caboose/admin/layout.scss +150 -0
- data/app/assets/stylesheets/caboose/admin/main.scss +34 -0
- data/app/assets/stylesheets/caboose/admin/modules/body.scss +176 -0
- data/app/assets/stylesheets/caboose/admin/modules/buttons.scss +120 -0
- data/app/assets/stylesheets/caboose/admin/modules/countdown.css +21 -0
- data/app/assets/stylesheets/caboose/admin/modules/crumbtrail.scss +80 -0
- data/app/assets/stylesheets/caboose/admin/modules/data_table.scss +92 -0
- data/app/assets/stylesheets/caboose/admin/modules/footer.scss +62 -0
- data/app/assets/stylesheets/caboose/admin/modules/forms.scss +72 -0
- data/app/assets/stylesheets/caboose/admin/modules/functions.scss +31 -0
- data/app/assets/stylesheets/caboose/admin/modules/grid.scss +108 -0
- data/app/assets/stylesheets/caboose/admin/modules/header.scss +77 -0
- data/app/assets/stylesheets/caboose/admin/modules/headings.scss +38 -0
- data/app/assets/stylesheets/caboose/admin/modules/main_nav.scss +73 -0
- data/app/assets/stylesheets/caboose/admin/modules/message_boxes.scss +55 -0
- data/app/assets/stylesheets/caboose/admin/modules/model_binder.scss +189 -0
- data/app/assets/stylesheets/caboose/admin/modules/navigation.scss +261 -0
- data/app/assets/stylesheets/caboose/admin/modules/order_bumps.scss +57 -0
- data/app/assets/stylesheets/caboose/admin/modules/pager.scss +34 -0
- data/app/assets/stylesheets/caboose/admin/modules/product_images.scss +21 -0
- data/app/assets/stylesheets/caboose/admin/modules/products.css +86 -0
- data/app/assets/stylesheets/caboose/admin/modules/search.scss +49 -0
- data/app/assets/stylesheets/caboose/admin/modules/selects.scss +12 -0
- data/app/assets/stylesheets/caboose/admin/modules/subnav_tabs.scss +34 -0
- data/app/assets/stylesheets/caboose/admin/modules/tabs.scss +140 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/block_anchors.scss +48 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/block_overlays.scss +182 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/device_selector.scss +65 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/froala.scss +81 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/group_overlay.scss +115 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/layout.scss +128 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/main.scss +18 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/modal.scss +11 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/preview.scss +25 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/publish.scss +25 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/revisions.scss +58 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/subnav.scss +273 -0
- data/app/assets/stylesheets/caboose/admin/page_edit/top_nav.scss +109 -0
- data/app/assets/stylesheets/caboose/admin/pages/assets_index.css +48 -0
- data/app/assets/stylesheets/caboose/admin/pages/block_edit_image.css.scss +386 -0
- data/app/assets/stylesheets/caboose/admin/pages/media_index.css.scss +300 -0
- data/app/assets/stylesheets/caboose/admin/pages/new_block.css +9 -0
- data/app/assets/stylesheets/caboose/admin/pages/page_edit.scss +960 -0
- data/app/assets/stylesheets/caboose/admin/pages/page_edit_content.scss +103 -0
- data/app/assets/stylesheets/caboose/admin/pages/pages_index.scss +79 -0
- data/app/assets/stylesheets/caboose/admin/pages/post_edit_content.css +46 -0
- data/app/assets/stylesheets/caboose/admin/print.css +3 -0
- data/app/assets/stylesheets/caboose/admin/slack.scss +51 -0
- data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +1 -2
- data/app/assets/stylesheets/caboose/admin_edit_page_content_dragdrop.scss +15 -71
- data/app/assets/stylesheets/caboose/admin_main.css.scss +29 -25
- data/app/assets/stylesheets/caboose/admin_media_index.css.scss +5 -26
- data/app/assets/stylesheets/caboose/application.css +5 -11
- data/app/assets/stylesheets/caboose/login.scss +0 -1
- data/app/assets/stylesheets/caboose/modal_main.css +19 -21
- data/app/assets/stylesheets/caboose/model_binder.css +4 -13
- data/app/assets/stylesheets/caboose/page_bar_generator.css +1 -2
- data/app/controllers/caboose/admin_controller.rb +4 -3
- data/app/controllers/caboose/application_controller.rb +19 -16
- data/app/controllers/caboose/assets_controller.rb +65 -0
- data/app/controllers/caboose/block_types_controller.rb +6 -8
- data/app/controllers/caboose/cart_controller.rb +2 -2
- data/app/controllers/caboose/fonts_controller.rb +2 -139
- data/app/controllers/caboose/invoices_controller.rb +4 -5
- data/app/controllers/caboose/login_logs_controller.rb +7 -5
- data/app/controllers/caboose/media_categories_controller.rb +2 -16
- data/app/controllers/caboose/media_controller.rb +11 -14
- data/app/controllers/caboose/pages_controller.rb +42 -104
- data/app/controllers/caboose/posts_controller.rb +7 -53
- data/app/controllers/caboose/products_controller.rb +1 -1
- data/app/controllers/caboose/sites_controller.rb +6 -25
- data/app/controllers/caboose/sns_controller.rb +3 -3
- data/app/controllers/caboose/themes_controller.rb +0 -30
- data/app/controllers/caboose/users_controller.rb +10 -17
- data/app/controllers/caboose/variants_controller.rb +9 -9
- data/app/models/caboose/ab_variant.rb +1 -1
- data/app/models/caboose/asset.rb +23 -0
- data/app/models/caboose/asset_manager.rb +92 -0
- data/app/models/caboose/asset_manifest.rb +91 -0
- data/app/models/caboose/block.rb +24 -100
- data/app/models/caboose/block_cache.rb +105 -0
- data/app/models/caboose/block_cache_file.rb +22 -0
- data/app/models/caboose/block_cache_image.rb +53 -0
- data/app/models/caboose/block_type.rb +3 -4
- data/app/models/caboose/block_type_category.rb +2 -2
- data/app/models/caboose/block_type_parser.rb +1 -1
- data/app/models/caboose/block_type_source.rb +2 -2
- data/app/models/caboose/calendar_event_group.rb +2 -2
- data/app/models/caboose/category.rb +2 -2
- data/app/models/caboose/comment_routes.rb +8 -7
- data/app/models/caboose/core_plugin.rb +3 -4
- data/app/models/caboose/export.rb +1 -1
- data/app/models/caboose/font.rb +2 -7
- data/app/models/caboose/font_variant.rb +0 -12
- data/app/models/caboose/invoice.rb +14 -14
- data/app/models/caboose/line_item.rb +4 -4
- data/app/models/caboose/media.rb +4 -15
- data/app/models/caboose/media_category.rb +7 -5
- data/app/models/caboose/modification.rb +2 -2
- data/app/models/caboose/page.rb +54 -325
- data/app/models/caboose/page_bar_generator.rb +10 -20
- data/app/models/caboose/page_cache.rb +12 -0
- data/app/models/caboose/page_cacher.rb +137 -0
- data/app/models/caboose/post.rb +8 -108
- data/app/models/caboose/product.rb +5 -5
- data/app/models/caboose/product_image.rb +1 -1
- data/app/models/caboose/role.rb +2 -2
- data/app/models/caboose/schema.rb +72 -73
- data/app/models/caboose/site.rb +1 -203
- data/app/models/caboose/theme.rb +5 -70
- data/app/views/caboose/admin/_content.html.erb +44 -0
- data/app/views/caboose/admin/_fonts.html.erb +47 -0
- data/app/views/caboose/admin/_footer.html.erb +1 -0
- data/app/views/caboose/admin/_header.html.erb +12 -0
- data/app/views/caboose/admin/_icons.html.erb +6 -0
- data/app/views/caboose/admin/_mobile_navigation.html.erb +22 -0
- data/app/views/caboose/admin/_post.html.erb +74 -0
- data/app/views/caboose/admin/index.html.erb +33 -36
- data/app/views/caboose/block_types/admin_edit.html.erb +8 -6
- data/app/views/caboose/blocks/_file.html.erb +2 -2
- data/app/views/caboose/blocks/_ga.html.erb +2 -1
- data/app/views/caboose/blocks/_image.html.erb +0 -4
- data/app/views/caboose/blocks/_render_function.html.erb +4 -9
- data/app/views/caboose/fonts/admin_index.html.erb +10 -55
- data/app/views/caboose/invoices_mailer/customer_status_updated.html.erb +14 -5
- data/app/views/caboose/login_logs/admin_index_for_user.html.erb +1 -1
- data/app/views/caboose/media/admin_index.html.erb +24 -14
- data/app/views/caboose/my_account/index.html.erb +0 -1
- data/app/views/caboose/pages/_admin_header.html.erb +0 -5
- data/app/views/caboose/pages/admin_edit_content.html.erb +2 -6
- data/app/views/caboose/pages/admin_edit_general.html.erb +4 -32
- data/app/views/caboose/pages/admin_new_old.html.erb +46 -0
- data/app/views/caboose/pages/test.html.erb +64 -0
- data/app/views/caboose/posts/_admin_header.html.erb +0 -5
- data/app/views/caboose/posts/admin_delete_form.html.erb +1 -1
- data/app/views/caboose/posts/admin_edit_content.html.erb +2 -6
- data/app/views/caboose/products/admin_group_variants.html.erb +1 -1
- data/app/views/caboose/products/admin_sort.html copy.erb +1 -1
- data/app/views/caboose/sites/admin_edit.html.erb +0 -21
- data/app/views/caboose/themes/admin_edit.html.erb +3 -7
- data/app/views/caboose/users/_admin_header.html.erb +0 -4
- data/app/views/caboose/users/admin_edit_roles.html.erb +0 -1
- data/app/views/caboose/variants/admin_group.html.erb +1 -1
- data/app/views/layouts/caboose/admin.html.erb +2 -9
- data/app/views/layouts/caboose/application.html.erb +92 -62
- data/config/routes.rb +1 -4
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +14 -3
- metadata +238 -57
- data/app/controllers/caboose/change_logs_controller.rb +0 -13
- data/app/models/caboose/change_log.rb +0 -97
- data/app/views/caboose/blocks/_cached_block.html.erb +0 -28
- data/app/views/caboose/change_logs/admin_index.html.erb +0 -65
- data/app/views/caboose/fonts/admin_family_edit.html.erb +0 -63
- data/app/views/caboose/fonts/admin_family_index.html.erb +0 -42
- data/app/views/caboose/fonts/admin_variant_edit.html.erb +0 -84
- data/app/views/caboose/pages/admin_change_logs.html.erb +0 -56
- data/app/views/caboose/pages/compiled_asset.css.erb +0 -0
- data/app/views/caboose/pages/compiled_asset.js.erb +0 -0
- data/app/views/caboose/posts/admin_change_logs.html.erb +0 -56
- data/app/views/caboose/sites/compiled_asset.css.erb +0 -0
- data/app/views/caboose/sites/compiled_asset.js.erb +0 -0
- data/app/views/caboose/themes/admin_error_log.html.erb +0 -9
- data/app/views/caboose/themes/admin_js.html.erb +0 -131
- data/app/views/caboose/users/admin_change_logs.html.erb +0 -63
- data/app/views/layouts/caboose/css.css.erb +0 -44
- data/app/views/layouts/caboose/footer_css.css.erb +0 -41
- data/app/views/layouts/caboose/footer_js.js.erb +0 -31
- data/app/views/layouts/caboose/js.js.erb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: baac14246cad522d361a83bef4fc56834e4aa6ec
|
4
|
+
data.tar.gz: d59419b1a8984e4728df7f301a5e51c3284e5bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58d92891b8f85db3a35682cf03140055bd6929e16e6e577263643a88e86f44e6c2d4298feaa677a5c853f9c62e5f71c8bb17530730b90bc5bee4504bc90d6050
|
7
|
+
data.tar.gz: a3d136234e9b51bb59a8d95e7a1159700a66f929c198a6507717cf21e5c02bcc98f2387f84e3ae3e18ce1d58e9956611476d8362e2f8394a91bbd6f85153254f
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require jquery-ui
|
16
|
+
//= require colorbox-rails
|
17
|
+
//= require caboose/jquery.datetimepicker
|
18
|
+
//= require caboose/jquery.placeholder
|
19
|
+
//= require caboose/modal_integration
|
20
|
+
//= require caboose/admin_main
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
function curr(x)
|
2
3
|
{
|
3
4
|
if (!x) return '0.00'
|
@@ -14,7 +15,16 @@ function curr(x)
|
|
14
15
|
function add_to_crumbtrail(href, text)
|
15
16
|
{
|
16
17
|
var c = $('#crumbtrail');
|
17
|
-
if (!c.is(':empty'))
|
18
|
-
c.append(' > ');
|
19
18
|
c.append($('<a/>').attr('href', href).html(text));
|
20
|
-
}
|
19
|
+
}
|
20
|
+
|
21
|
+
$(window).load(function() {
|
22
|
+
$("#top_nav ul.quick > li").mouseenter(function() {
|
23
|
+
$(this).find("ul").show();
|
24
|
+
$(this).children('a, span').addClass('hovered');
|
25
|
+
});
|
26
|
+
$("#top_nav ul.quick > li").mouseleave(function() {
|
27
|
+
$(this).find("ul").hide();
|
28
|
+
$(this).children('a, span').removeClass('hovered');
|
29
|
+
});
|
30
|
+
});
|
@@ -29,23 +29,20 @@ MediaController.prototype = {
|
|
29
29
|
.empty()
|
30
30
|
.append($('<p/>')
|
31
31
|
.append($('<a/>').addClass('caboose-btn').attr('href', '#').html('Upload').click(function(e) { e.preventDefault(); that.toggle_uploader(); }))
|
32
|
-
.append($('<a/>').addClass('caboose-btn
|
33
|
-
.append($('<a/>').addClass('caboose-btn
|
34
|
-
.append($('<a/>').addClass('caboose-btn red').attr('href', '#').attr('id', 'delete-btn').html('Delete Selected Files').click(function(e) { e.preventDefault(); that.delete_media(false); }))
|
35
|
-
.append($('<a/>').addClass('caboose-btn red').attr('href', '#').attr('id', 'delete-btn').html('Delete Selected Category').click(function(e) { e.preventDefault(); that.delete_category(that.cat_id, false); }))
|
36
|
-
.append($('<a/>').addClass('caboose-btn green').attr('href', '#').attr('id', 'new-btn').html('New Category').click(function(e) { e.preventDefault(); that.add_category(); }))
|
32
|
+
.append($('<a/>').addClass('caboose-btn').attr('href', '#').html('Select All').click(function(e) { e.preventDefault(); that.select_all_media(); }))
|
33
|
+
.append($('<a/>').addClass('caboose-btn').attr('href', '#').attr('id', 'sort-btn').html('Sort').click(function(e) { e.preventDefault(); that.sort_media(); }))
|
37
34
|
)
|
38
|
-
.append("<div id='delete'></div>")
|
39
|
-
.append("<div id='new_cat_message'></div>")
|
40
35
|
.append($('<div/>').attr('id', 'the_uploader'));
|
41
36
|
that.refresh();
|
42
37
|
},
|
43
38
|
|
44
39
|
refresh: function()
|
45
40
|
{
|
41
|
+
//console.log("REFRESHING EVERYTHING");
|
46
42
|
var that = this;
|
47
43
|
that.refresh_categories();
|
48
44
|
that.refresh_media();
|
45
|
+
that.print_controls();
|
49
46
|
},
|
50
47
|
|
51
48
|
refresh_categories: function(after)
|
@@ -67,6 +64,7 @@ MediaController.prototype = {
|
|
67
64
|
|
68
65
|
refresh_media: function()
|
69
66
|
{
|
67
|
+
//console.log("REFRESHING MEDIA");
|
70
68
|
var that = this;
|
71
69
|
$.ajax({
|
72
70
|
url: '/admin/media/json',
|
@@ -90,7 +88,7 @@ MediaController.prototype = {
|
|
90
88
|
sort: list
|
91
89
|
},
|
92
90
|
success: function(resp) {
|
93
|
-
|
91
|
+
console.log("success");
|
94
92
|
}
|
95
93
|
});
|
96
94
|
},
|
@@ -238,9 +236,10 @@ MediaController.prototype = {
|
|
238
236
|
.addClass('category')
|
239
237
|
.attr('id', 'cat' + cat.id)
|
240
238
|
.data('media_category_id', cat.id)
|
241
|
-
.append($('<a/>').attr('href', '#').html(cat.name).click(function(e) { e.preventDefault(); that.select_category($(this).parent().data('media_category_id')); }));
|
239
|
+
.append($('<a/>').attr('href', '#').html(cat.name + ' (' + cat.media_count + ')').click(function(e) { e.preventDefault(); that.select_category($(this).parent().data('media_category_id')); }));
|
242
240
|
if (cat.id == that.cat_id)
|
243
241
|
li.addClass('selected');
|
242
|
+
// console.dir(cat);
|
244
243
|
if (cat.name && cat.name.indexOf('Products') > -1 && product_cat_id == 0) {
|
245
244
|
li.addClass('products-li');
|
246
245
|
li.html('').append($('<a/>').attr('href', '#').html(cat.name).click(function(e) { e.preventDefault(); $(this).closest('#left_content').toggleClass('hide-products'); }));
|
@@ -248,7 +247,7 @@ MediaController.prototype = {
|
|
248
247
|
}
|
249
248
|
else if ( cat.parent_id == product_cat_id ) {
|
250
249
|
li.addClass('product-sub-li');
|
251
|
-
li.html('').append($('<a/>').attr('href', '#').html(cat.name).click(function(e) { e.preventDefault(); that.select_category($(this).parent().data('media_category_id')); }));
|
250
|
+
li.html('').append($('<a/>').attr('href', '#').html(cat.name + ' (' + cat.media_count + ')').click(function(e) { e.preventDefault(); that.select_category($(this).parent().data('media_category_id')); }));
|
252
251
|
}
|
253
252
|
ul.append(li);
|
254
253
|
});
|
@@ -256,8 +255,8 @@ MediaController.prototype = {
|
|
256
255
|
else
|
257
256
|
ul = $('<p/>').html("There are no media categories.");
|
258
257
|
$('#categories').empty().append(ul)
|
259
|
-
|
260
|
-
|
258
|
+
.append($('<p/>').append($('<a/>').attr('href', '#').html('New Category').click(function(e) { e.preventDefault(); that.add_category(); })))
|
259
|
+
.append($('<div/>').attr('id', 'new_cat_message'));
|
261
260
|
|
262
261
|
$.each(that.categories, function(i, cat) {
|
263
262
|
$('#cat' + cat.id).droppable({
|
@@ -291,49 +290,34 @@ MediaController.prototype = {
|
|
291
290
|
$('#cat' + cat.id).draggable({ revert: 'invalid' });
|
292
291
|
});
|
293
292
|
},
|
294
|
-
|
295
|
-
// delete_media: function() {
|
296
|
-
// if (ui.draggable.hasClass('category')) {
|
297
|
-
// var media_category_id = ui.draggable.data('media_category_id');
|
298
|
-
// that.delete_category(media_category_id);
|
299
|
-
// }
|
300
|
-
// else {
|
301
|
-
// id = ui.draggable.data('media_id');
|
302
|
-
// if (that.selected_media.length > 0 && that.selected_media.indexOf(id) > -1)
|
303
|
-
// {
|
304
|
-
// that.select_media(id); // Go ahead and de-select because the select event is about to run
|
305
|
-
// }
|
306
|
-
// that.delete_media();
|
307
|
-
// }
|
308
|
-
// },
|
309
293
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
294
|
+
print_controls: function()
|
295
|
+
{
|
296
|
+
var that = this;
|
297
|
+
$('#controls').empty()
|
298
|
+
.append($('<div/>').attr('id', 'delete').append($('<p/>').addClass('delete_dropper').html('Delete')));
|
315
299
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
300
|
+
$('#delete').droppable({
|
301
|
+
accept: function(draggable) { return (draggable.hasClass('category') || draggable.hasClass('media')) },
|
302
|
+
hoverClass: 'hover',
|
303
|
+
drop: function(event, ui) {
|
304
|
+
if (ui.draggable.hasClass('category'))
|
305
|
+
{
|
306
|
+
var media_category_id = ui.draggable.data('media_category_id');
|
307
|
+
that.delete_category(media_category_id);
|
308
|
+
}
|
309
|
+
else // media
|
310
|
+
{
|
311
|
+
id = ui.draggable.data('media_id');
|
312
|
+
if (that.selected_media.length > 0 && that.selected_media.indexOf(id) > -1)
|
313
|
+
{
|
314
|
+
that.select_media(id); // Go ahead and de-select because the select event is about to run
|
315
|
+
}
|
316
|
+
that.delete_media();
|
317
|
+
}
|
318
|
+
}
|
319
|
+
});
|
320
|
+
},
|
337
321
|
|
338
322
|
print_media: function()
|
339
323
|
{
|
@@ -358,13 +342,8 @@ MediaController.prototype = {
|
|
358
342
|
if (m.original_name && m.original_name.indexOf('png') > 0) {
|
359
343
|
li.addClass("png");
|
360
344
|
}
|
361
|
-
//console.log("original_name: " + m.original_name);
|
362
345
|
if (m.image_urls)
|
363
346
|
li.append($("<div/>").addClass("table").append($("<div/>").addClass("table-cell").append($('<img/>').attr('src', m.image_urls.tiny_url).attr("id","image-" + m.id))));
|
364
|
-
// else if (m.original_name && (m.original_name.indexOf('.pdf') > 0 || m.original_name.indexOf('.PDF') > 0)) {
|
365
|
-
// li.append($('<canvas/>').attr('id','pdf-' + m.id).attr("width","80").attr("height","80"));
|
366
|
-
// that.load_pdf_preview(m);
|
367
|
-
// }
|
368
347
|
else if (m.original_name) {
|
369
348
|
var ext = m.original_name.match(/\.[0-9a-z]+$/i);
|
370
349
|
li.addClass('empty');
|
@@ -375,19 +354,22 @@ MediaController.prototype = {
|
|
375
354
|
li.addClass('selected ui-selected');
|
376
355
|
var btndiv = $("<div/>").addClass("buttons");
|
377
356
|
li.append(btndiv);
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
else
|
382
|
-
btndiv.append($("<a/>").attr('target','_blank').attr('href', m.file_url).html("Direct URL"));
|
383
|
-
btndiv.append($("<a/>").addClass("dl i").html("Download").click(function() { that.download_image($(this).parent().parent().data('media_id')); }));
|
357
|
+
if (that.allow_edit && m.image_urls) btndiv.append($("<a/>").html("Edit Image").click(function() { that.edit_image($(this).parent().parent().data('media_id')); }));
|
358
|
+
else btndiv.append($("<a/>").attr('href', m.file_url).html("Direct URL"));
|
359
|
+
if ( m.image_urls ) btndiv.append($("<a/>").addClass("dl i").html("Download").click(function() { that.download_image($(this).parent().parent().data('media_id')); }));
|
360
|
+
else btndiv.append($("<a/>").addClass("dl i").html("Download").click(function() { that.download_image($(this).parent().parent().data('media_id')); }));
|
384
361
|
ul.append(li);
|
385
362
|
});
|
386
363
|
}
|
387
364
|
else
|
388
365
|
ul = $('<p/>').html("This category is empty.");
|
389
366
|
$('#media').empty().append(ul);
|
390
|
-
if (that.refresh_unprocessed_images == true && processing)
|
367
|
+
if (that.refresh_unprocessed_images == true && processing)
|
368
|
+
{
|
369
|
+
//setTimeout(function() { that.refresh_media(); }, 2000);
|
370
|
+
setTimeout(function() { that.check_processing_status(); }, 3000);
|
371
|
+
}
|
372
|
+
|
391
373
|
$.each(that.media, function(i, m) {
|
392
374
|
$('li.media').draggable({
|
393
375
|
multiple: true,
|
@@ -395,6 +377,7 @@ MediaController.prototype = {
|
|
395
377
|
start: function() { $(this).data("origPosition", $(this).position()); }
|
396
378
|
});
|
397
379
|
});
|
380
|
+
// $("#media ul").sortable();
|
398
381
|
},
|
399
382
|
|
400
383
|
//============================================================================
|
@@ -448,37 +431,58 @@ MediaController.prototype = {
|
|
448
431
|
delete_media: function(confirm)
|
449
432
|
{
|
450
433
|
var that = this;
|
451
|
-
if (
|
452
|
-
$('#delete').empty().html("<p class='note error'>You don't have any files selected.</p>");
|
453
|
-
setTimeout(function(){ $('#delete').empty() }, 3000);
|
454
|
-
}
|
455
|
-
else if (!confirm)
|
434
|
+
if (!confirm)
|
456
435
|
{
|
457
|
-
|
458
|
-
|
459
|
-
|
436
|
+
$.each(that.selected_media, function(i, id) {
|
437
|
+
$('#media' + id).css('top', '0').css('left', '0');
|
438
|
+
});
|
460
439
|
var div = $('<p/>').addClass('note error')
|
461
|
-
.append('Are you sure
|
440
|
+
.append('Are you sure?<br/>')
|
462
441
|
.append($('<input/>').attr('type', 'button').val('Yes').click(function() { that.delete_media(true); })).append(" ")
|
463
|
-
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { that.refresh_media();
|
442
|
+
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { that.refresh_media(); that.print_controls(); }));
|
464
443
|
$('#delete').empty().append(div);
|
465
444
|
return;
|
466
445
|
}
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
});
|
475
|
-
}
|
446
|
+
$('#delete').empty().html("<p class='loading'>Deleting...</p>");
|
447
|
+
$.ajax({
|
448
|
+
url: '/admin/media/bulk',
|
449
|
+
type: 'delete',
|
450
|
+
data: { ids: that.selected_media },
|
451
|
+
success: function(resp) { that.refresh_categories(); that.refresh_media(); that.print_controls(); }
|
452
|
+
});
|
476
453
|
},
|
477
454
|
|
478
455
|
edit_media_description: function(media_id)
|
479
456
|
{
|
480
457
|
var that = this;
|
481
458
|
caboose_modal_url('/admin/media/' + media_id + '/description');
|
459
|
+
|
460
|
+
//var div = $('<div/>').attr('id', 'media_' + media_id + '_description');
|
461
|
+
//$('#media').append(div);
|
462
|
+
//new ModelBinder({
|
463
|
+
// name: 'Media',
|
464
|
+
// id: media_id,
|
465
|
+
// update_url: '/admin/media/' + media_id,
|
466
|
+
// authenticity_token: that.authenticity_token,
|
467
|
+
// attributes: [
|
468
|
+
// {
|
469
|
+
// name: 'description', nice_name: 'Description', type: 'textarea', value: '', width: 400, height: 100, fixed_placeholder: true,
|
470
|
+
// after_update: function() { $('#media_' + media_id + '_description_container').remove(); },
|
471
|
+
// after_cancel: function() { $('#media_' + media_id + '_description_container').remove(); }
|
472
|
+
// }
|
473
|
+
// ]
|
474
|
+
//});
|
475
|
+
//var options = {
|
476
|
+
// iframe: true,
|
477
|
+
// innerWidth: 200,
|
478
|
+
// innerHeight: 50,
|
479
|
+
// scrolling: false,
|
480
|
+
// transition: 'fade',
|
481
|
+
// closeButton: false,
|
482
|
+
// onComplete: caboose_fix_colorbox,
|
483
|
+
// opacity: 0.50
|
484
|
+
//};
|
485
|
+
//setTimeout(function() { $('#media_' + media_id + '_description_container').colorbox(options); }, 2000);
|
482
486
|
},
|
483
487
|
|
484
488
|
//============================================================================
|
@@ -498,14 +502,14 @@ MediaController.prototype = {
|
|
498
502
|
if (!name)
|
499
503
|
{
|
500
504
|
var div = $('<p/>').addClass('note warning')
|
501
|
-
.append('New
|
505
|
+
.append('New Category Name: ')
|
502
506
|
.append($('<input/>').attr('type', 'text').attr('id', 'new_cat_name')).append(" ")
|
503
507
|
.append($('<input/>').attr('type', 'button').val('Add').click(function() { that.add_category($('#new_cat_name').val()); })).append(" ")
|
504
508
|
.append($('<input/>').attr('type', 'button').val('Cancel').click(function() { $('#new_cat_message').empty(); }));
|
505
509
|
$('#new_cat_message').empty().append(div);
|
506
510
|
return;
|
507
511
|
}
|
508
|
-
$('#new_cat_message').empty().html("<p class='
|
512
|
+
$('#new_cat_message').empty().html("<p class='loading'>Adding category...</p>");
|
509
513
|
$.ajax({
|
510
514
|
url: '/admin/media-categories',
|
511
515
|
type: 'post',
|
@@ -516,7 +520,6 @@ MediaController.prototype = {
|
|
516
520
|
success: function(resp) {
|
517
521
|
if (resp.error) $('#new_cat_message').empty().html("<p class='note error'>" + resp.error + "</p>");
|
518
522
|
if (resp.refresh) that.refresh_categories();
|
519
|
-
$('#new_cat_message').empty();
|
520
523
|
}
|
521
524
|
});
|
522
525
|
},
|
@@ -524,38 +527,31 @@ MediaController.prototype = {
|
|
524
527
|
delete_category: function(cat_id, confirm)
|
525
528
|
{
|
526
529
|
var that = this;
|
527
|
-
if (
|
528
|
-
$('#delete').empty().html("<p class='note error'>You cannot delete the top level category.</p>");
|
529
|
-
setTimeout(function(){ $('#delete').empty() }, 3000);
|
530
|
-
}
|
531
|
-
else if (!confirm)
|
530
|
+
if (!confirm)
|
532
531
|
{
|
533
532
|
var div = $('<p/>').addClass('note warning')
|
534
|
-
.append('Are you sure
|
533
|
+
.append('Are you sure? ')
|
535
534
|
.append($('<input/>').attr('type', 'button').val('Yes').click(function() { that.delete_category(cat_id, true); })).append(" ")
|
536
|
-
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { that.refresh_categories();
|
535
|
+
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { that.refresh_categories(); that.print_controls() }));
|
537
536
|
$('#delete').empty().append(div);
|
538
537
|
return;
|
539
538
|
}
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
});
|
557
|
-
}
|
558
|
-
|
539
|
+
$('#delete').empty().html("<p class='loading'>Deleting...</p>");
|
540
|
+
$.ajax({
|
541
|
+
url: '/admin/media-categories/' + cat_id,
|
542
|
+
type: 'delete',
|
543
|
+
success: function(resp) {
|
544
|
+
that.refresh_categories(function() {
|
545
|
+
var exists = false;
|
546
|
+
$.each(that.categories, function(i, cat) { if (cat.id == cat_id) { exists = true; return false; }});
|
547
|
+
if (!exists)
|
548
|
+
that.select_category(that.categories[0].id);
|
549
|
+
else
|
550
|
+
that.refresh_media();
|
551
|
+
that.print_controls();
|
552
|
+
});
|
553
|
+
}
|
554
|
+
});
|
559
555
|
},
|
560
556
|
|
561
557
|
media_with_id: function(media_id)
|
@@ -596,58 +592,59 @@ MediaController.prototype = {
|
|
596
592
|
// Aviary
|
597
593
|
//============================================================================
|
598
594
|
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
595
|
+
edit_image: function(media_id)
|
596
|
+
{
|
597
|
+
var that = this;
|
598
|
+
var m = that.media_with_id(media_id);
|
603
599
|
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
600
|
+
if (that.feather_editor != false)
|
601
|
+
{
|
602
|
+
that.edit_image_helper(m);
|
603
|
+
return;
|
604
|
+
}
|
605
|
+
that.feather_editor = new Aviary.Feather({
|
606
|
+
apiKey: '933414ee42934e8b81d8cd2226a5a13b',
|
607
|
+
theme: 'light',
|
608
|
+
enableCORS: false,
|
609
|
+
maxSize: 1600,
|
610
|
+
onSave: function(media_id, new_url) { return that.update_image(media_id, new_url); },
|
611
|
+
onLoad: function() { that.edit_image_helper(m); }
|
612
|
+
});
|
613
|
+
},
|
618
614
|
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
615
|
+
edit_image_helper: function(m)
|
616
|
+
{
|
617
|
+
console.log(m.image_urls.original_url);
|
618
|
+
var that = this;
|
619
|
+
that.feather_editor.launch({
|
620
|
+
image: 'image-' + m.id,
|
621
|
+
url: m.image_urls.original_url
|
622
|
+
});
|
623
|
+
},
|
627
624
|
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
625
|
+
update_image: function(image_id, new_url)
|
626
|
+
{
|
627
|
+
var that = this;
|
628
|
+
var media_id = parseInt(image_id.replace('image-', ''));
|
632
629
|
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
630
|
+
that.feather_editor.showWaitIndicator();
|
631
|
+
$.ajax({
|
632
|
+
url: '/admin/media/' + media_id,
|
633
|
+
type: 'put',
|
634
|
+
data: { image_url: new_url },
|
635
|
+
success: function(resp) {
|
636
|
+
if(resp.error) { alert("Error saving image:\n\n" + resp.error); }
|
637
|
+
if(resp.success) {
|
638
|
+
that.feather_editor.hideWaitIndicator();
|
639
|
+
var src = $('#image-' + media_id).attr('src').split('?')[0];
|
640
|
+
$('#image-' + media_id).attr('src', src + '?' + Date.now());
|
641
|
+
that.feather_editor.close();
|
642
|
+
that.refresh_media();
|
643
|
+
}
|
644
|
+
}
|
645
|
+
});
|
646
|
+
return false;
|
647
|
+
}
|
651
648
|
|
652
649
|
};
|
653
650
|
|