CSS cleanups

This commit is contained in:
Mo Bitar
2018-01-17 12:04:29 -06:00
parent 0b430d4d08
commit 0cf13ad28b
20 changed files with 136 additions and 369 deletions

View File

@@ -25,7 +25,9 @@ angular.module('app.frontend')
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager,
syncManager, storageManager, passcodeManager, componentManager, singletonManager, packageManager) {
this.user = authManager.user;
this.getUser = function() {
return authManager.user;
}
this.updateOfflineStatus = function() {
this.offline = authManager.offline();
@@ -110,14 +112,14 @@ angular.module('app.frontend')
this.rooms = _.uniq(this.rooms.concat(incomingRooms)).filter((candidate) => {return !candidate.deleted});
});
componentManager.registerHandler({identifier: "roomBar", areas: ["rooms"], activationHandler: (component) => {
componentManager.registerHandler({identifier: "roomBar", areas: ["rooms", "modal"], activationHandler: (component) => {
if(component.active) {
// Show room, if it was not activated manually (in the event of event from componentManager)
if(!component.showRoom) {
if(component.area == "rooms" && !component.showRoom) {
this.selectRoom(component);
}
$timeout(() => {
var lastSize = component.getRoomLastSize();
var lastSize = component.getLastSize();
if(lastSize) {
componentManager.handleSetSizeEvent(component, lastSize);
}
@@ -125,7 +127,7 @@ angular.module('app.frontend')
}
}, actionHandler: (component, action, data) => {
if(action == "set-size") {
component.setRoomLastSize(data);
component.setLastSize(data);
}
}});

View File

@@ -83,12 +83,12 @@ class Component extends Item {
return this.getAppDataItem("defaultEditor") == true;
}
setRoomLastSize(size) {
this.setAppDataItem("lastRoomSize", size);
setLastSize(size) {
this.setAppDataItem("lastSize", size);
}
getRoomLastSize() {
return this.getAppDataItem("lastRoomSize");
getLastSize() {
return this.getAppDataItem("lastSize");
}

View File

@@ -738,7 +738,11 @@ class ComponentManager {
setSize(iframe, data);
} else {
var container = document.getElementById("component-" + component.uuid);
setSize(container, data);
if(container) {
// in the case of Modals, sometimes they may be "active" because they were so in another session,
// but no longer actually visible. So check to make sure the container exists
setSize(container, data);
}
}
}

View File

@@ -1,6 +1,6 @@
angular
.module('app.frontend')
.directive('mbAutofocus', ['$timeout', function($timeout) {
.directive('snAutofocus', ['$timeout', function($timeout) {
return {
restrict: 'A',
scope: {

View File

@@ -33,7 +33,13 @@ class AccountMenu {
$scope.submitPasswordChange = function() {
if($scope.newPasswordData.newPassword != $scope.newPasswordData.newPasswordConfirmation) {
let newPass = $scope.newPasswordData.newPassword;
if(!newPass || newPass.length == 0) {
return;
}
if(newPass != $scope.newPasswordData.newPasswordConfirmation) {
alert("Your new password does not match its confirmation.");
$scope.newPasswordData.status = null;
return;
@@ -51,7 +57,7 @@ class AccountMenu {
// perform a sync beforehand to pull in any last minutes changes before we change the encryption key (and thus cant decrypt new changes)
syncManager.sync(function(response){
authManager.changePassword(email, $scope.newPasswordData.newPassword, function(response){
authManager.changePassword(email, newPass, function(response){
if(response.error) {
alert("There was an error changing your password. Please try again.");
$scope.newPasswordData.status = null;
@@ -84,6 +90,10 @@ class AccountMenu {
}
$scope.submitAuthForm = function() {
console.log("Submitting auth form");
if(!$scope.formData.email || !$scope.formData.user_password) {
return;
}
if($scope.formData.showLogin) {
$scope.login();
} else {
@@ -92,6 +102,7 @@ class AccountMenu {
}
$scope.login = function(extraParams) {
console.log("Logging in");
$scope.formData.status = "Generating Login Keys...";
$timeout(function(){
authManager.login($scope.formData.url, $scope.formData.email, $scope.formData.user_password, $scope.formData.ephemeral, extraParams,
@@ -99,7 +110,7 @@ class AccountMenu {
if(!response || response.error) {
$scope.formData.status = null;
var error = response ? response.error : {message: "An unknown error occured."}
if(error.tag == "mfa-required") {
if(error.tag == "mfa-required" || error.tag == "mfa-invalid") {
$timeout(() => {
$scope.formData.showLogin = false;
$scope.formData.mfa = error;
@@ -539,13 +550,6 @@ class AccountMenu {
$scope.formData.showPasscodeForm = false;
var offline = authManager.offline();
// Allow UI to update before showing alert
setTimeout(function () {
var message = "You've succesfully set an app passcode.";
if(offline) { message += " Your items will now be encrypted using this passcode."; }
alert(message);
}, 10);
if(offline) {
// Allows desktop to make backup file
$rootScope.$broadcast("major-data-change");

View File

@@ -431,7 +431,7 @@ class ModelManager {
"SN|Editor" : "editor",
"SN|Theme" : "theme",
"SF|Extension" : "server extension",
"SF|MFA" : "server multi-factor authentication setting"
"SF|MFA" : "two-factor authentication setting"
}[contentType];
}

View File

@@ -80,8 +80,6 @@ class SyncManager {
// use a copy, as alternating uuid will affect array
var originalItems = this.modelManager.allItems.slice();
console.log("markAllItemsDirtyAndSaveOffline", originalItems);
var block = () => {
var allItems = this.modelManager.allItems;
for(var item of allItems) {