Merge branch 'design_dialogs' into design_dialogs_props

pull/1/head
David Benqué 5 years ago
commit 9a67537080

@ -24,7 +24,7 @@
@alertify-input-bg: @colortheme_modal-input;
@alertify-input-fg: @colortheme_modal-input-fg;
@alertify_padding-base: @variables_padding; // XXX to align tab contents with buttons. could change @variables-padding: 12px
@alertify_padding-base: @variables_padding;
@alertify_box-shadow: @variables_shadow;
// Logs to show that something has happened
@ -226,7 +226,7 @@
width: 100%;
font-size: 100%;
padding: @alertify_padding-base;
&[readonly="readonly"]{
&[readonly] {
background-color: @alertify-light-bg;
color: @cryptpad_text_col;
border-color: @alertify-input-fg;
@ -348,8 +348,8 @@
nav {
padding: @alertify_padding-base;
text-align: right;
button{
margin:0px !important; // XXX was not overriding the button margin
button {
margin: 0px !important;
&:not(:last-child) {
margin-right: @alertify_padding-base !important;
}

@ -66,7 +66,7 @@
padding: 8px 12px;
margin: 1em;
width: 300px;
&[type="text"]{
&[type="text"] {
background-color: @colortheme_modal-input-fg;
color: @cryptpad_text_col;
border: 1px solid @colortheme_modal-input;

@ -5,24 +5,24 @@
}
& {
// Share modal
.msg.cp-inline-radio-group{
.radio-group{
.msg.cp-inline-radio-group {
.radio-group {
display: flex;
flex-direction: row;
.cp-radio{
.cp-radio {
margin-right: 30px;
}
}
}
// Properties modal
.cp-app-prop{
.cp-app-prop {
margin-bottom: 10px;
}
.cp-app-prop-content{
.cp-app-prop-content {
color: @cryptpad_text_col;
}
}
}

@ -194,7 +194,7 @@ define([
if (tab.icon) {
var icon = h('i', {class: tab.icon});
$(title).prepend(' ').prepend(icon);
};
}
$(title).click(function () {
titles.forEach(function (t) { $(t).removeClass('alertify-tabs-active'); });
contents.forEach(function (c) { $(c).removeClass('alertify-tabs-content-active'); });
@ -348,7 +348,8 @@ define([
if (!b.name || !b.onClick) { return; }
var button = h('button', { tabindex: '1', 'class': b.className || '' }, b.name);
$(button).click(function () {
b.onClick();
var noClose = b.onClick();
if (noClose) { return; }
var $modal = $(button).parents('.alertify').first();
if ($modal.length && $modal[0].closeModal) {
$modal[0].closeModal(function () {

@ -918,7 +918,6 @@ define([
name: Messages.share_withFriends,
onClick: function () {
var href = Hash.getRelativeHref(linkGetter());
console.log(href);
var $friends = $div.find('.cp-usergrid-user.cp-selected');
$friends.each(function (i, el) {
var curve = $(el).attr('data-curve');
@ -1007,7 +1006,6 @@ define([
};
};
/// Share Modal Creation XXX remove this flag
UIElements.createShareModal = function (config) {
var origin = config.origin;
var pathname = config.pathname;
@ -1031,10 +1029,11 @@ define([
Messages.share_linkEdit, false, { mark: {tabindex:1} })])
]);
var $rights = $(rights);
var saveValue = function () {
var edit = Util.isChecked($(rights).find('#cp-share-editable-true'));
var present = Util.isChecked($(rights).find('#cp-share-present'));
var edit = Util.isChecked($rights.find('#cp-share-editable-true'));
var present = Util.isChecked($rights.find('#cp-share-present'));
common.setAttribute(['general', 'share'], {
edit: edit,
present: present
@ -1043,9 +1042,9 @@ define([
var getLinkValue = function (initValue) {
var val = initValue || {};
var edit = val.edit !== undefined ? val.edit : Util.isChecked($(rights).find('#cp-share-editable-true'));
var edit = val.edit !== undefined ? val.edit : Util.isChecked($rights.find('#cp-share-editable-true'));
var embed = val.embed;
var present = val.present !== undefined ? val.present : Util.isChecked($(rights).find('#cp-share-present'));
var present = val.present !== undefined ? val.present : Util.isChecked($rights.find('#cp-share-present'));
var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash;
var href = origin + pathname + '#' + hash;
var parsed = Hash.parsePadUrl(href);
@ -1053,10 +1052,12 @@ define([
};
var makeCancelButton = function() {
return {className: 'cancel',
name: Messages.cancel,
onClick: function () {},
keys: [27]};
return {
className: 'cancel',
name: Messages.cancel,
onClick: function () {},
keys: [27]
};
};
// Share link tab
@ -1070,6 +1071,7 @@ define([
linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 }));
var link = h('div.cp-share-modal', linkContent);
var $link = $(link);
var linkButtons = [
makeCancelButton(),
@ -1079,9 +1081,10 @@ define([
onClick: function () {
saveValue();
var v = getLinkValue({
embed: Util.isChecked($(link).find('#cp-share-embed'))
embed: Util.isChecked($link.find('#cp-share-embed'))
});
window.open(v);
return true;
},
keys: [[13, 'ctrl']]
},
@ -1091,7 +1094,7 @@ define([
onClick: function () {
saveValue();
var v = getLinkValue({
embed: Util.isChecked($(link).find('#cp-share-embed'))
embed: Util.isChecked($link.find('#cp-share-embed'))
});
var success = Clipboard.copy(v);
if (success) { UI.log(Messages.shareSuccess); }
@ -1101,15 +1104,15 @@ define([
];
// update values for link preview when radio btns change
$(link).find('#cp-share-link-preview').val(getLinkValue());
$(rights).find('input[type="radio"]').on('change', function () {
$(link).find('#cp-share-link-preview').val(getLinkValue({
embed: Util.isChecked($(link).find('#cp-share-embed'))
$link.find('#cp-share-link-preview').val(getLinkValue());
$rights.find('input[type="radio"]').on('change', function () {
$link.find('#cp-share-link-preview').val(getLinkValue({
embed: Util.isChecked($link.find('#cp-share-embed'))
}));
});
$(link).find('input[type="checkbox"]').on('change', function () {
$(link).find('#cp-share-link-preview').val(getLinkValue({
embed: Util.isChecked($(link).find('#cp-share-embed'))
$link.find('input[type="checkbox"]').on('change', function () {
$link.find('#cp-share-link-preview').val(getLinkValue({
embed: Util.isChecked($link.find('#cp-share-embed'))
}));
});
@ -1123,7 +1126,7 @@ define([
var hasFriends = Object.keys(config.friends || {}).length !== 0;
var onFriendShare = Util.mkEvent();
var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare, getLinkValue) : {
content: h('p', Messages.share_noContacts),
content: h('p', Messages.team_noFriend),
button: {}
};
var friendsList = friendsObject.content;
@ -1131,7 +1134,6 @@ define([
onFriendShare.reg(saveValue);
// XXX Don't display access rights if no contacts
/// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : '';
var contactsContent = h('div.cp-share-modal');
$(contactsContent).append(friendsList);
@ -1171,7 +1173,7 @@ define([
// update values for link preview when radio btns change
$(embed).find('#cp-embed-link-preview').val(getEmbedValue());
$(rights).find('input[type="radio"]').on('change', function () {
$rights.find('input[type="radio"]').on('change', function () {
$(embed).find('#cp-embed-link-preview').val(getEmbedValue());
});
@ -1208,41 +1210,41 @@ define([
// XXX
// disable edit share options if you don't have edit rights
if (!hashes.editHash) {
$(rights).find('#cp-share-editable-false').attr('checked', true);
$(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true);
$rights.find('#cp-share-editable-false').attr('checked', true);
$rights.find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true);
} else if (!hashes.viewHash) {
$(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true);
$(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true);
$(rights).find('#cp-share-editable-true').attr('checked', true);
$rights.find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true);
$rights.find('#cp-share-present').removeAttr('checked').attr('disabled', true);
$rights.find('#cp-share-editable-true').attr('checked', true);
}
common.getAttribute(['general', 'share'], function (err, val) {
val = val || {};
if (val.present && canPresent) {
$(rights).find('#cp-share-editable-false').prop('checked', false);
$(rights).find('#cp-share-editable-true').prop('checked', false);
$(rights).find('#cp-share-present').prop('checked', true);
$rights.find('#cp-share-editable-false').prop('checked', false);
$rights.find('#cp-share-editable-true').prop('checked', false);
$rights.find('#cp-share-present').prop('checked', true);
} else if ((val.edit === false && hashes.viewHash) || !hashes.editHash) {
$(rights).find('#cp-share-editable-false').prop('checked', true);
$(rights).find('#cp-share-editable-true').prop('checked', false);
$(rights).find('#cp-share-present').prop('checked', false);
$rights.find('#cp-share-editable-false').prop('checked', true);
$rights.find('#cp-share-editable-true').prop('checked', false);
$rights.find('#cp-share-present').prop('checked', false);
} else {
$(rights).find('#cp-share-editable-true').prop('checked', true);
$(rights).find('#cp-share-editable-false').prop('checked', false);
$(rights).find('#cp-share-present').prop('checked', false);
$rights.find('#cp-share-editable-true').prop('checked', true);
$rights.find('#cp-share-editable-false').prop('checked', false);
$rights.find('#cp-share-present').prop('checked', false);
}
delete val.embed;
if (!canPresent) {
delete val.present;
}
$(link).find('#cp-share-link-preview').val(getLinkValue(val));
$link.find('#cp-share-link-preview').val(getLinkValue(val));
});
common.getMetadataMgr().onChange(function () {
// "hashes" is only available is the secure "share" app
var _hashes = common.getMetadataMgr().getPrivateData().hashes;
if (!_hashes) { return; }
hashes = _hashes;
$(link).find('#cp-share-link-preview').val(getLinkValue());
$link.find('#cp-share-link-preview').val(getLinkValue());
});
return modal;
};
@ -1281,7 +1283,8 @@ define([
onClick: function () {
var v = getLinkValue();
var success = Clipboard.copy(v);
if (success) { UI.log(Messages.shareSuccess); }
if (success) { UI.log(Messages.shareSuccess);
}
},
keys: [13]
}

@ -2559,7 +2559,6 @@ define([
var roParsed = Hash.parsePadUrl(data.roHref) || {};
if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); }
var friends = common.getFriends();
var teams = common.getMetadataMgr().getPrivateData().teams;
var ro = folders[id] && folders[id].version >= 2;
var modal = UIElements.createShareModal({
teamId: APP.team,
@ -4049,7 +4048,6 @@ define([
el = manager.find(paths[0].path);
var parsed, modal;
var friends = common.getFriends();
var teams = common.getMetadataMgr().getPrivateData().teams;
if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder
// if folder is inside SF

@ -533,7 +533,7 @@ MessengerUI, Messages) {
Common.getSframeChannel().event('EV_SHARE_OPEN', {
hidden: true
});
$shareBlock.click(function () {
$shareBlock.click(function () {
var title = (config.title && config.title.getTitle && config.title.getTitle())
|| (config.title && config.title.defaultName)
|| "";

@ -988,7 +988,6 @@
"share_linkOpen": "Preview",
"share_linkCopy": "Copy",
"share_contactCategory": "Contacts",
"share_noContacts": "You do not have any contacts yet. // XXX",
"share_embedCategory": "Embed",
"share_mediatagCopy": "Copy mediatag to clipboard",
"loading_pad_1": "Initializing pad",
@ -1002,7 +1001,7 @@
"sharedFolders_create_name": "Folder name",
"sharedFolders_create_owned": "Owned folder",
"sharedFolders_create_password": "Folder password",
"sharedFolders_share": "Share this URL with other registered users to give them access to the shared folder. Once they open this URL, the shared folder will be added to the root directory of their CryptDrive. // XXX change/delete?",
"sharedFolders_share": "Share this link with other registered users to give them access to the shared folder. Once they open this link, the shared folder will be added to their CryptDrive.",
"convertFolderToSF_SFParent": "This folder cannot be converted to a shared folder in its current location. Move it outside of the containing shared folder to continue.",
"convertFolderToSF_SFChildren": "This folder cannot be converted to a shared folder because it already contains shared folders. Move those Shared folders elsewhere to continue.",
"convertFolderToSF_confirm": "This folder must be converted to a Shared folder for others to view it. Continue?",

@ -38,8 +38,6 @@ define([
: UIElements.createShareModal;
var friends = common.getFriends();
var teams = priv.teams;
var _wide = Object.keys(friends).length || Object.keys(teams).length;
var modal = f({
origin: origin,

Loading…
Cancel
Save