summaryrefslogtreecommitdiffstats
path: root/welco/static
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2015-11-16 09:19:44 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2015-11-16 09:19:44 (GMT)
commit4d7d626cf9909f9f02c2c2c52c7b4104502dd40d (patch)
tree0a8914c4e10d22c2056453e7e310dbac8d5d1f23 /welco/static
parent0f3abdf5db5d174122109a24ab6ae7c567898919 (diff)
downloadwelco-4d7d626cf9909f9f02c2c2c52c7b4104502dd40d.zip
welco-4d7d626cf9909f9f02c2c2c52c7b4104502dd40d.tar.gz
welco-4d7d626cf9909f9f02c2c2c52c7b4104502dd40d.tar.bz2
contacts: basic UI to add contacts
Diffstat (limited to 'welco/static')
-rw-r--r--welco/static/css/style.css10
-rw-r--r--welco/static/js/welco.js20
2 files changed, 28 insertions, 2 deletions
diff --git a/welco/static/css/style.css b/welco/static/css/style.css
index 094749b..9b9ca69 100644
--- a/welco/static/css/style.css
+++ b/welco/static/css/style.css
@@ -523,3 +523,13 @@ a.icon-phone:before {
content: "\f095 "; /* phone */
padding-right: 1ex;
}
+
+form.contact-add p label {
+ display: inline-block;
+ width: 6em;
+}
+
+div.ui-dialog form.contact-add p input {
+ display: inline-block;
+ width: 20em;
+}
diff --git a/welco/static/js/welco.js b/welco/static/js/welco.js
index 774a264..676a79c 100644
--- a/welco/static/js/welco.js
+++ b/welco/static/js/welco.js
@@ -13,6 +13,7 @@ $(function() {
$(zone).find('select').select2();
$(zone).removeClass('has-page-displayed');
$(zone).removeClass('has-contact-displayed');
+ $('#create-new-contact').off('click').on('click', window.displayPopup);
if (typeof(callback) === 'function') callback();
},
error: function(error) { console.log(':(', error); }
@@ -260,12 +261,14 @@ $(function() {
$('.mails ul li[data-pdf-href]:first-child').trigger('click');
});
- $(document).on('gadjo:dialog-done welco:load-mail-note', function() {
+ $(document).on('gadjo:dialog-done welco:load-mail-note', function(ev) {
+ if (ev.target && ev.target.id == 'create-new-contact') return;
var source_pk = $('div.source .active[data-source-pk]').data('source-pk');
$('#postit').load('/ajax/mail/note/' + source_pk);
});
- $(document).on('gadjo:dialog-done welco:load-copies', function() {
+ $(document).on('gadjo:dialog-done welco:load-copies', function(ev) {
+ if (ev.target && ev.target.id == 'create-new-contact') return;
var source_pk = $('div.source .active[data-source-pk]').data('source-pk');
$.getJSON(
'/ajax/copies/' + source_pk + '/',
@@ -277,6 +280,19 @@ $(function() {
);
});
+ $(document).on('gadjo:dialog-done', function(ev) {
+ if (ev.target && ev.target.id != 'create-new-contact') return;
+ $.ajax({url: $('#create-new-contact').data('url'),
+ data: $('form.contact-add').serialize(),
+ method: 'POST',
+ dataType: 'json',
+ success: function(data) {
+ console.log('got data', data);
+ },
+ error: function(error) { console.log(':/', error); }
+ });
+ });
+
$('#postit').on('click', window.displayPopup);
$('#id_post_date').datepicker($.datepicker.regional["fr"]);