From 0557ef64e2bd1161fd98a5dff6e45aea8e0d7567 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 30 Jul 2016 15:10:14 -0400 Subject: add site assets and remove set_default --- data/assets/js/admin/dialogs/site-add.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'data/assets/js/admin/dialogs') diff --git a/data/assets/js/admin/dialogs/site-add.js b/data/assets/js/admin/dialogs/site-add.js index 8cdc772..bf95b8e 100644 --- a/data/assets/js/admin/dialogs/site-add.js +++ b/data/assets/js/admin/dialogs/site-add.js @@ -1,8 +1,12 @@ jQuery(function($) { "use strict"; - var p = '#site-add-', - IDS = ['name', 'slug', 'body', 'lang', 'theme_id']; + var p = '#site-add-'; + + var FIELDS = { + text: ['name', 'slug', 'body', 'lang', 'theme_id'], + list: ['domains', 'styles', 'scripts'], + } var DEFAULTS = { lang: DATA.default_lang, @@ -10,12 +14,14 @@ jQuery(function($) { }; $(p + 'dialog').on('show.bs.modal', function() { - $.each(IDS, function(_, id) { + $.each(FIELDS.text, function(_, id) { $(p + id).val(DEFAULTS[id] || ''); }); - // clear list of domains - $(p + 'domains').val(''); + // clear list textareas + $.each(FIELDS.list, function(_, id) { + $(p + id).val(''); + }); }); $(p + 'dialog').on('shown.bs.modal', function() { @@ -54,13 +60,16 @@ jQuery(function($) { // toggle loading me.toggleClass('disabled').find('.loading').toggleClass('hidden'); - send('site/add', IDS.reduce(function(r, id) { + send('site/add', FIELDS.text.reduce(function(r, id) { r[id] = $(p + id).val(); return r; + }, FIELDS.list.reduce(function(r, id) { + r[id] = listify(p + id); + return r; }, { + // hard-code this for now is_full_feed: 't', - domains: listify(p + 'domains'), - })).always(function() { + }))).always(function() { // toggle loading me.toggleClass('disabled').find('.loading').toggleClass('hidden'); }).fail(function(r) { -- cgit v1.2.3