Skip to content

Commit

Permalink
Merge pull request #46 from documize/share-login-tify-up
Browse files Browse the repository at this point in the history
Share login tidy up
  • Loading branch information
HarveyKandola authored Oct 17, 2016
2 parents b058353 + 10ecf0f commit 3019c6f
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 103 deletions.
4 changes: 4 additions & 0 deletions app/app/components/dropdown-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export default Ember.Component.extend({
// TODO: refactor to eliminate self
let self = this;

if (is.null(self.get('target'))) {
return;
}

let drop = this.get('tether').createDrop({
target: document.getElementById(self.get('target')),
content: self.$(".dropdown-dialog")[0],
Expand Down
115 changes: 68 additions & 47 deletions app/app/components/folder/folder-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.set('movedFolderOptions', targets);
},

didRender() {
didRender() {
if (this.get('hasSelectedDocuments')) {
this.addTooltip(document.getElementById("move-documents-button"));
this.addTooltip(document.getElementById("delete-documents-button"));
Expand All @@ -57,52 +57,14 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.addTooltip(document.getElementById("import-document-button"));
}
}

if (this.get('folderService').get('canEditCurrentFolder')) {
let self = this;
let folderId = this.get('folder.id');
let url = this.get('appMeta.endpoint');
let importUrl = `${url}/import/folder/${folderId}`;

let dzone = new Dropzone("#import-document-button > i", {
headers: {
'Authorization': 'Bearer ' + self.get('session.session.content.authenticated.token')
},
url: importUrl,
method: "post",
paramName: 'attachment',
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
clickable: true,
maxFilesize: 10,
parallelUploads: 3,
uploadMultiple: false,
addRemoveLinks: false,
autoProcessQueue: true,

init: function () {
this.on("success", function (document) {
self.send('onDocumentImported', document.name, document);
});

this.on("error", function (x) {
console.log("Conversion failed for ", x.name, " obj ", x); // TODO proper error handling
});

this.on("queuecomplete", function () {});

this.on("addedfile", function (file) {
self.send('onDocumentImporting', file.name);
self.audit.record('converted-document');
});
}
});

dzone.on("complete", function (file) {
dzone.removeFile(file);
});

this.set('drop', dzone);
}
},

didUpdate() {
this.setupImport();
},

didInsertElement() {
// this.setupImport();
},

willDestroyElement() {
Expand All @@ -114,6 +76,65 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.destroyTooltips();
},

setupImport() {
// guard against unecessary file upload component init
if (this.get('hasSelectedDocuments') || !this.get('folderService').get('canEditCurrentFolder')) {
return;
}

// already done init?
if (is.not.null(this.get('drop'))) {
if (is.not.null(this.get('drop'))) {
this.get('drop').destroy();
this.set('drop', null);
}
}

let self = this;
let folderId = this.get('folder.id');
let url = this.get('appMeta.endpoint');
let importUrl = `${url}/import/folder/${folderId}`;

let dzone = new Dropzone("#import-document-button > i", {
headers: {
'Authorization': 'Bearer ' + self.get('session.session.content.authenticated.token')
},
url: importUrl,
method: "post",
paramName: 'attachment',
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
clickable: true,
maxFilesize: 10,
parallelUploads: 3,
uploadMultiple: false,
addRemoveLinks: false,
autoProcessQueue: true,

init: function () {
this.on("success", function (document) {
self.send('onDocumentImported', document.name, document);
});

this.on("error", function (x) {
console.log("Conversion failed for ", x.name, " obj ", x); // TODO proper error handling
});

this.on("queuecomplete", function () {});

this.on("addedfile", function (file) {
self.send('onDocumentImporting', file.name);
self.audit.record('converted-document');
});
}
});

dzone.on("complete", function (file) {
dzone.removeFile(file);
});

this.set('drop', dzone);
},

actions: {
onDocumentImporting(filename) {
this.send("showNotification", `Importing ${filename}`);
Expand Down
20 changes: 10 additions & 10 deletions app/app/components/onboard/share-folder.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
// by contacting <sales@documize.com>.
//
// https://documize.com

Expand All @@ -29,9 +29,9 @@ export default Ember.Component.extend({
// Stage 1 - person name keypress handler
$("#stage-1-firstname, #stage-1-lastname").keyup(function() {
if (!$("#stage-1-firstname").val() || !$("#stage-1-lastname").val()) {
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
$(".name-status").attr("src", "/assets/img/onboard/person-red.png");
} else {
$(".name-status").attr("src", "assets/img/onboard/person-green.png");
$(".name-status").attr("src", "/assets/img/onboard/person-green.png");
}
});

Expand All @@ -40,14 +40,14 @@ export default Ember.Component.extend({
if (!$("#stage-1-firstname").val()) {
$("#stage-1-firstname").focus();
$("#stage-1-firstname").addClass("error");
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
$(".name-status").attr("src", "/assets/img/onboard/person-red.png");
return;
}

if (!$("#stage-1-lastname").val()) {
$("#stage-1-lastname").focus();
$("#stage-1-lastname").addClass("error");
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
$(".name-status").attr("src", "/assets/img/onboard/person-red.png");
return;
}

Expand All @@ -67,9 +67,9 @@ export default Ember.Component.extend({
$("#stage-2-password-confirm").keyup(function() {
if ($("#stage-2-password").val().length < 6 || $("#stage-2-password").val().length > 50 ||
($("#stage-2-password").val() !== $("#stage-2-password-confirm").val())) {
$(".password-status").attr("src", "assets/img/onboard/lock-red.png");
$(".password-status").attr("src", "/assets/img/onboard/lock-red.png");
} else {
$(".password-status").attr("src", "assets/img/onboard/lock-green.png");
$(".password-status").attr("src", "/assets/img/onboard/lock-green.png");
}
});
});
Expand All @@ -91,7 +91,7 @@ export default Ember.Component.extend({

if ($("#stage-2-password-confirm").val() !== $("#stage-2-password").val()) {
$(".mismatch").show();
$(".password-status").attr("src", "assets/img/onboard/lock-red.png");
$(".password-status").attr("src", "/assets/img/onboard/lock-red.png");
return;
}

Expand Down Expand Up @@ -121,4 +121,4 @@ export default Ember.Component.extend({
});
});
},
});
});
2 changes: 1 addition & 1 deletion app/app/styles/view/document/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

.no-sections {
text-align: center;
opacity: 0.4;
opacity: 0.5;

> .box {
padding: 35px;
Expand Down
25 changes: 16 additions & 9 deletions app/app/styles/view/document/wysiwyg.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

table
{
margin: 10px 20px 0 20px !important;
// width: auto !important;

@include border(1px);
Expand Down Expand Up @@ -43,37 +42,45 @@
font-family: "open_sanssemibold";
}

h1.doc-name {
font-size: 2em;
font-family: open_sansregular;
}

h1
{
font-size: 1.6em;
font-family: open_sansregular;
font-family: open_sanslight;
color:$color-off-black;
margin: 30px 0 20px 0;
}

h2
{
font-size: 2rem;
font-size: 1.5em;
margin: 30px 0 20px 0;
font-family: open_sansregular;
font-family: open_sanslight;
}

h3
{
font-size: 1.6rem;
font-size: 1.4rem;
margin: 30px 0 20px 0;
font-family: open_sanslight;
}

h4
{
font-size: 1.6rem;
font-size: 1.3rem;
margin: 30px 0 20px 0;
font-family: open_sanslight;
}

h5, h6, h7, h8, h9
{
font-size: 1.4rem;
font-size: 1.2rem;
margin: 30px 0 20px 0;
font-family: open_sanslight;
}

h2, h3, h4, h5, h6, h7, h8, h9
Expand Down Expand Up @@ -118,7 +125,7 @@
}
td,
th {
border: 1px solid #dddddd;
border: 1px solid #f3f5f8;
padding: 5px 7px !important;
}
td:empty,
Expand All @@ -134,7 +141,7 @@
border-width: 2px;
}
th {
background: #efefef;
background: #f7f6f6;
}
}
}
2 changes: 1 addition & 1 deletion app/app/styles/view/page-auth.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
margin: 0 auto;

> img {
height: 40px;
height: 60px;
margin: 40px 0;
}
}
Expand Down
16 changes: 10 additions & 6 deletions app/app/styles/view/page-documents.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,24 @@
}

.no-documents {
margin-top: 50px;
margin-top: 150px;
text-align: center;
opacity: 0.4;
opacity: 0.5;
background-image: url("/assets/img/no-documents.png");
background-repeat: no-repeat;
background-position: center;

> .box {
padding: 35px;
width: 300px;
display: inline-block;
margin: 0 20px;
max-width: 400px;
margin: 0 auto;
border: 1px dashed #b3adad;
padding: 20px;

> .message {
font-size: 14px;
color: $color-off-black;
margin-top: 20px;
line-height: 50px;
}

> .regular-button {
Expand Down
15 changes: 10 additions & 5 deletions app/app/styles/view/page-onboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
width: 100%;
text-align: left;
color: $color-primary;
color: $color-off-black;
letter-spacing: 1px;

.stage-1
Expand Down Expand Up @@ -145,17 +145,18 @@

.sidebar
{
padding: 50px 50px 0 50px;
margin-left: -15px;
padding: 100px 50px 50px 50px;
overflow: auto;

.logo
{
height: 100px;
height: 62px;
margin-bottom: 15px;
margin-top: 20px;
}

h1
h2
{
font-size: 2rem;;
color: $color-primary;
Expand All @@ -165,6 +166,7 @@
p
{
font-size: 1.3rem;
color: $color-primary;
}

p.note
Expand All @@ -179,8 +181,11 @@
height: 400px;
width: 500px;
margin-top: 200px;
background-color: #eaeaea;
background-color: #f6f9fc;
position: relative;
border-radius: 10px;
background-color: #fff;
box-shadow: 0 6px 20px 0 rgba(30,71,101,.1);
}

input[type='email'], input[type='text'], input[type='password'] {
Expand Down
Loading

0 comments on commit 3019c6f

Please sign in to comment.