Closes #193 - inline components work

This commit is contained in:
James Brooks
2015-01-01 14:09:14 +00:00
parent fa6bbd52fd
commit 47a3702c98
4 changed files with 87 additions and 67 deletions

View File

@@ -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() {

View File

@@ -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();
});
});

View File

@@ -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();
});
});

View File

@@ -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"
}