position and style alert

pull/1/head
David Benqué 5 years ago
parent 5b18e3a633
commit 1ba03dee45

@ -514,6 +514,11 @@
font-size:12px; font-size:12px;
padding:5px; padding:5px;
border-radius:0px; border-radius:0px;
&.alert-primary {
background-color: @alertify-base;
color: @alertify-fg;
border-color: @alertify-fg;
}
} }
} }

@ -1027,6 +1027,12 @@ define([
if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; }
// check if the pad is password protected
var hash = hashes.editHash || hashes.viewHash;
var href = origin + pathname + '#' + hash;
var parsedHref = Hash.parsePadUrl(href);
var hasPassword = parsedHref.hashData.password;
var parsed = Hash.parsePadUrl(pathname); var parsed = Hash.parsePadUrl(pathname);
var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1;
@ -1081,18 +1087,15 @@ define([
UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }),
h('br'), h('br'),
]; ];
// check if the pad is password protection
var hash = hashes.editHash || hashes.viewHash; linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 }));
var href = origin + pathname + '#' + hash;
var parsedHref = Hash.parsePadUrl(href); // Show alert if the pad is password protected
var hasPassword = parsedHref.hashData.password;
if (hasPassword) { if (hasPassword) {
linkContent.push(h('div.alert.alert-danger', [h('i.fa.fa-lock'), linkContent.push(h('div.alert.alert-primary', [h('i.fa.fa-lock'),
' ', Messages.share_linkPasswordAlert])) ' ', Messages.share_linkPasswordAlert]))
}; };
linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 }));
var link = h('div.cp-share-modal', linkContent); var link = h('div.cp-share-modal', linkContent);
var $link = $(link); var $link = $(link);
@ -1158,7 +1161,16 @@ define([
// XXX Don't display access rights if no contacts // XXX Don't display access rights if no contacts
var contactsContent = h('div.cp-share-modal'); var contactsContent = h('div.cp-share-modal');
$(contactsContent).append(friendsList); var $contactsContent = $(contactsContent);
$contactsContent.append(friendsList);
// Show alert if the pad is password protected
if (hasPassword) {
$contactsContent.append(h('div.alert.alert-primary', [h('i.fa.fa-unlock'),
' ', Messages.share_contactPasswordAlert]))
};
var contactButtons = [makeCancelButton(), var contactButtons = [makeCancelButton(),
friendsObject.button]; friendsObject.button];

Loading…
Cancel
Save