From 47a3702c98832a477d7582c955fc7637220ecb11 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 1 Jan 2015 14:09:14 +0000 Subject: [PATCH] Closes #193 - inline components work --- app/assets/js/start.js | 46 ++++++++-------- .../js/{all-337c2216.js => all-215df44c.js} | 53 +++++++++++-------- public/build/js/all.js | 53 +++++++++++-------- public/build/rev-manifest.json | 2 +- 4 files changed, 87 insertions(+), 67 deletions(-) rename public/build/js/{all-337c2216.js => all-215df44c.js} (99%) diff --git a/app/assets/js/start.js b/app/assets/js/start.js index c2b87d44..6708a0f4 100644 --- a/app/assets/js/start.js +++ b/app/assets/js/start.js @@ -71,29 +71,31 @@ $(function() { // Sortable components. var componentList = document.getElementById("component-list"); - new Sortable(componentList, { - group: "omega", - handle: ".drag-handle", - onUpdate: function() { - // Loop each component, setting the order input to the new order. - var $components = $('#component-list .striped-list-item'); - $.each($components, function(id) { - // Order should start from 1 now. - $(this).find('input[rel=order]').val(id + 1); - }); + if (componentList) { + new Sortable(componentList, { + group: "omega", + handle: ".drag-handle", + onUpdate: function() { + // Loop each component, setting the order input to the new order. + var $components = $('#component-list .striped-list-item'); + $.each($components, function(id) { + // Order should start from 1 now. + $(this).find('input[rel=order]').val(id + 1); + }); - // Now POST the form to the internal API. - $.ajax({ - async: true, - url: '/dashboard/api/components/order', - type: 'POST', - data: $('form[name=componentList]').serializeObject(), - success: function() { - (new CachetHQ.Notifier).notify('Components updated.', 'success'); - } - }); - } - }); + // Now POST the form to the internal API. + $.ajax({ + async: true, + url: '/dashboard/api/components/order', + type: 'POST', + data: $('form[name=componentList]').serializeObject(), + success: function() { + (new CachetHQ.Notifier).notify('Components updated.', 'success'); + } + }); + } + }); + } // Toggle inline component statuses. $('form.component-inline').on('click', 'input[type=radio]', function() { diff --git a/public/build/js/all-337c2216.js b/public/build/js/all-215df44c.js similarity index 99% rename from public/build/js/all-337c2216.js rename to public/build/js/all-215df44c.js index ad0a5c11..1a99b685 100644 --- a/public/build/js/all-337c2216.js +++ b/public/build/js/all-215df44c.js @@ -12433,29 +12433,31 @@ $(function() { // Sortable components. var componentList = document.getElementById("component-list"); - new Sortable(componentList, { - group: "omega", - handle: ".drag-handle", - onUpdate: function() { - // Loop each component, setting the order input to the new order. - var $components = $('#component-list .striped-list-item'); - $.each($components, function(id) { - // Order should start from 1 now. - $(this).find('input[rel=order]').val(id + 1); - }); + if (componentList) { + new Sortable(componentList, { + group: "omega", + handle: ".drag-handle", + onUpdate: function() { + // Loop each component, setting the order input to the new order. + var $components = $('#component-list .striped-list-item'); + $.each($components, function(id) { + // Order should start from 1 now. + $(this).find('input[rel=order]').val(id + 1); + }); - // Now POST the form to the internal API. - $.ajax({ - async: true, - url: '/dashboard/api/components/order', - type: 'POST', - data: $('form[name=componentList]').serializeObject(), - success: function() { - (new CachetHQ.Notifier).notify('Components updated.', 'success'); - } - }); - } - }); + // Now POST the form to the internal API. + $.ajax({ + async: true, + url: '/dashboard/api/components/order', + type: 'POST', + data: $('form[name=componentList]').serializeObject(), + success: function() { + (new CachetHQ.Notifier).notify('Components updated.', 'success'); + } + }); + } + }); + } // Toggle inline component statuses. $('form.component-inline').on('click', 'input[type=radio]', function() { @@ -12475,4 +12477,11 @@ $(function() { } }); }); + + // Banner removal JS + $('#remove-banner').click(function(){ + $('#banner-view').remove(); + $('input[name=remove_banner]').val('1'); + $('#settings-form').submit(); + }); }); diff --git a/public/build/js/all.js b/public/build/js/all.js index ad0a5c11..1a99b685 100644 --- a/public/build/js/all.js +++ b/public/build/js/all.js @@ -12433,29 +12433,31 @@ $(function() { // Sortable components. var componentList = document.getElementById("component-list"); - new Sortable(componentList, { - group: "omega", - handle: ".drag-handle", - onUpdate: function() { - // Loop each component, setting the order input to the new order. - var $components = $('#component-list .striped-list-item'); - $.each($components, function(id) { - // Order should start from 1 now. - $(this).find('input[rel=order]').val(id + 1); - }); + if (componentList) { + new Sortable(componentList, { + group: "omega", + handle: ".drag-handle", + onUpdate: function() { + // Loop each component, setting the order input to the new order. + var $components = $('#component-list .striped-list-item'); + $.each($components, function(id) { + // Order should start from 1 now. + $(this).find('input[rel=order]').val(id + 1); + }); - // Now POST the form to the internal API. - $.ajax({ - async: true, - url: '/dashboard/api/components/order', - type: 'POST', - data: $('form[name=componentList]').serializeObject(), - success: function() { - (new CachetHQ.Notifier).notify('Components updated.', 'success'); - } - }); - } - }); + // Now POST the form to the internal API. + $.ajax({ + async: true, + url: '/dashboard/api/components/order', + type: 'POST', + data: $('form[name=componentList]').serializeObject(), + success: function() { + (new CachetHQ.Notifier).notify('Components updated.', 'success'); + } + }); + } + }); + } // Toggle inline component statuses. $('form.component-inline').on('click', 'input[type=radio]', function() { @@ -12475,4 +12477,11 @@ $(function() { } }); }); + + // Banner removal JS + $('#remove-banner').click(function(){ + $('#banner-view').remove(); + $('input[name=remove_banner]').val('1'); + $('#settings-form').submit(); + }); }); diff --git a/public/build/rev-manifest.json b/public/build/rev-manifest.json index df846183..309e49ae 100644 --- a/public/build/rev-manifest.json +++ b/public/build/rev-manifest.json @@ -1,4 +1,4 @@ { "css/all.css": "css/all-c5b65085.css", - "js/all.js": "js/all-337c2216.js" + "js/all.js": "js/all-215df44c.js" } \ No newline at end of file