aboutsummaryrefslogtreecommitdiff
path: root/data/assets/js/admin/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'data/assets/js/admin/dialogs')
-rw-r--r--data/assets/js/admin/dialogs/site-add.js25
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) {