Skip to content

Commit

Permalink
Swapped modal options to global Mailpile.UI.ModalOptions JS
Browse files Browse the repository at this point in the history
  • Loading branch information
bnvk committed Oct 21, 2014
1 parent 7250eb8 commit f230436
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 53 deletions.
2 changes: 1 addition & 1 deletion static/default/html/jsapi/contacts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $(document).on('click', '.btn-activity-contact_add', function(e) {
var modal_data = { name: '', address: '', extras: '' };
var modal_template = _.template($("#modal-contact-add").html());
$('#modal-full').html(modal_template(modal_data));
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand Down
7 changes: 1 addition & 6 deletions static/default/html/jsapi/crypto/gpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ Mailpile.find_encryption_keys = function(query) {
});

// Show Modal
$('#modal-full').modal({
backdrop: true,
keyboard: true,
show: true,
remote: false
});
$('#modal-full').modal(Mailpile.UI.ModalOptions);
};


Expand Down
9 changes: 8 additions & 1 deletion static/default/html/jsapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,14 @@ Mailpile.API.async_{{command.url|replace("/", "_")}}_{{command.method|lower}} =
{% endfor %}


/* UI - Make fingerprints nicer */
/* Mailpile - UI */
// FIXME: move to alternate file
Mailpile.UI = {
ModalOptions: { backdrop: true, keyboard: true, show: true, remote: false }
};


/* Mailpile - UI - Make fingerprints nicer */
Mailpile.nice_fingerprint = function(fingerprint) {
// FIXME: I'd really love to make these individual pieces color coded
// Pertaining to the hex value pairings & even perhaps toggle-able icons
Expand Down
21 changes: 4 additions & 17 deletions static/default/html/jsapi/message/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ $(document).on('click', '.message-action-add-contact', function(e) {

var modal_template = _.template($("#modal-contact-add").html());
$('#modal-full').html(modal_template(modal_data));
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand All @@ -126,17 +126,9 @@ $(document).on('click', '.message-action-find-keys', function(e) {

/* Message - Import key from a message */
$(document).on('click', '.message-action-import-key', function() {

var options = {
backdrop: true,
keyboard: true,
show: true,
remote: false
};

$('#modal-full .modal-title').html('<span class="icon-key"></span> Import Key');
$('#modal-full .modal-body').html('<p>Eventually this will import a PGP key to a contact.</p>');
$('#modal-full').modal(options);
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand All @@ -157,12 +149,7 @@ $(document).on('click', '.message-crypto-action', function() {

$('#crypto-private-key-list').html(key_html);

$('#modal-full').modal({
backdrop: true,
keyboard: true,
show: true,
remote: false
});
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});
});

Expand All @@ -183,7 +170,7 @@ $(document).on('click', '.message-crypto-investigate', function() {
Mailpile.API.crypto_gpg_searchkey_get(missing_keys[0], function(data) {
var modal_template = _.template($("#modal-search-keyservers").html());
$('#modal-full').html(modal_template({ keys: '<li>Key of User #1</li>' }));
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});
}
});
Expand Down
6 changes: 2 additions & 4 deletions static/default/html/jsapi/message/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,17 @@ Mailpile.thread_html_iframe = function(element) {

/* Thread - Show People In Conversation */
$(document).on('click', '.show-thread-people', function() {
var options = { backdrop: true, keyboard: true, show: true, remote: false };
$('#modal-full .modal-title').html($('#thread-people').data('modal_title'));
$('#modal-full .modal-body').html($('#thread-people').html());
$('#modal-full').modal(options);
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


/* Thread - Show Tags In Converstation */
$(document).on('click', '.show-thread-tags', function() {
var options = { backdrop: true, keyboard: true, show: true, remote: false };
$('#modal-full .modal-title').html($('#thread-tags').data('modal_title'));
$('#modal-full .modal-body').html($('#thread-tags').html());
$('#modal-full').modal(options);
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand Down
2 changes: 1 addition & 1 deletion static/default/html/jsapi/search/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Mailpile.render_modal_tags = function() {

var modal_template = _.template($("#modal-tag-picker").html());
$('#modal-full').html(modal_template({ priority: priority_html, tags: tags_html, archive: archive_html }));
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});

} else {
Expand Down
15 changes: 2 additions & 13 deletions static/default/html/jsapi/settings/content.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* Settings - Shows profile add modal */
$(document).on('click', '#btn-settings-profile-add', function(e) {
$("#modal-full").html($("#modal-settings-profile-add").html());
$('#modal-full').modal({
backdrop: true,
keyboard: true,
show: true,
remote: false
});
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand Down Expand Up @@ -34,12 +29,7 @@ $(document).on('submit', '#form-settings-profile-add', function(e) {
/* Settings - Shows route add modal */
$(document).on('click', '#btn-settings-route-add', function(e) {
$("#modal-full").html($("#modal-settings-route-add").html());
$('#modal-full').modal({
backdrop: true,
keyboard: true,
show: true,
remote: false
});
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand All @@ -53,6 +43,5 @@ $(document).on('submit', '#form-settings-route-add', function(e) {
/* Settings - Submit route edit form */
$(document).on('submit', '.form-settings-route-edit', function() {



});
7 changes: 1 addition & 6 deletions static/default/html/jsapi/setup/profiles_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ var ProfilesSettingsView = Backbone.View.extend({
$('#modal-full').html($('#modal-gmail-auth-' + message).html());

// Instantiate
$('#modal-full').modal({
backdrop: true,
keyboard: true,
show: true,
remote: false
});
$('#modal-full').modal(Mailpile.UI.ModalOptions);

// Empty Password & Add Testing Link
setTimeout(function() {
Expand Down
4 changes: 2 additions & 2 deletions static/default/html/jsapi/setup/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var SecurityView = Backbone.View.extend({
},
showPassphrase: function(e) {
$('#modal-full').html($('#modal-security-enter-passphrase').html());
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
$('#input-setup-security-passphrase').focus();
},
actionSecurityLevel: function(e) {
Expand All @@ -107,7 +107,7 @@ var SecurityView = Backbone.View.extend({
// Show Some Snark
if (level === 'crazy') {
$('#modal-full').html($('#modal-security-level-idiot').html());
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
$(e.target).val('');
}
else if (_.indexOf(['tinfoil', 'paranoid', 'above', 'concerned', 'normal'], level) > -1) {
Expand Down
4 changes: 2 additions & 2 deletions static/default/html/jsapi/tags/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $(document).on('click', '#button-tag-change-icon', function() {

var modal_template = _.template($("#modal-tag-icon-picker").html());
$('#modal-full').html(modal_template({ icons: icons_html }));
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand Down Expand Up @@ -75,7 +75,7 @@ $(document).on('click', '#button-tag-change-label-color', function(e) {
var modal_html = $("#modal-tag-color-picker").html();
var modal_template = _.template(modal_html);
$('#modal-full').html(modal_template({ colors: colors_html }));
$('#modal-full').modal({ backdrop: true, keyboard: true, show: true, remote: false });
$('#modal-full').modal(Mailpile.UI.ModalOptions);
});


Expand Down

0 comments on commit f230436

Please sign in to comment.