diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-07-30 15:10:14 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-07-30 15:10:14 -0400 |
commit | 0557ef64e2bd1161fd98a5dff6e45aea8e0d7567 (patch) | |
tree | 2960808d40679eb3059a8bbf22d389e81b5cb83d /data/assets/js/admin/dialogs/site-add.js | |
parent | e6ebc011f255596f09fec40f69049514d52bebef (diff) | |
download | guff-0557ef64e2bd1161fd98a5dff6e45aea8e0d7567.tar.bz2 guff-0557ef64e2bd1161fd98a5dff6e45aea8e0d7567.zip |
add site assets and remove set_default
Diffstat (limited to 'data/assets/js/admin/dialogs/site-add.js')
-rw-r--r-- | data/assets/js/admin/dialogs/site-add.js | 25 |
1 files changed, 17 insertions, 8 deletions
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) { |