Merge branch 'master' of github.com:standardnotes/web into ivs

This commit is contained in:
Mo Bitar
2017-03-18 15:48:42 -05:00
20 changed files with 179 additions and 130 deletions

View File

@@ -46,7 +46,12 @@ angular.module('app.frontend')
}
}.bind(this), false);
$rootScope.$on("tag-changed", function(){
this.loadTagsString();
}.bind(this));
this.setNote = function(note, oldNote) {
this.noteReady = false;
var currentEditor = this.customEditor;
this.customEditor = null;
this.showExtensions = false;
@@ -56,6 +61,7 @@ angular.module('app.frontend')
var setEditor = function(editor) {
this.customEditor = editor;
this.postNoteToExternalEditor();
this.noteReady = true;
}.bind(this)
var editor = this.editorForNote(note);
@@ -71,6 +77,7 @@ angular.module('app.frontend')
}
} else {
this.customEditor = null;
this.noteReady = true;
}
if(note.safeText().length == 0 && note.dummy) {

View File

@@ -91,18 +91,19 @@ angular.module('app.frontend')
$scope.tagsSave = function(tag, callback) {
if(!tag.title || tag.title.length == 0) {
$scope.notesRemoveTag(tag);
$scope.removeTag(tag);
return;
}
tag.setDirty(true);
syncManager.sync(callback);
$rootScope.$broadcast("tag-changed");
}
/*
Notes Ctrl Callbacks
*/
$scope.notesRemoveTag = function(tag) {
$scope.removeTag = function(tag) {
var validNotes = Note.filterDummyNotes(tag.notes);
if(validNotes == 0) {
modelManager.setItemToBeDeleted(tag);

View File

@@ -4,8 +4,7 @@ angular.module('app.frontend')
scope: {
addNew: "&",
selectionMade: "&",
tag: "=",
removeTag: "&"
tag: "="
},
templateUrl: 'frontend/notes.html',
@@ -69,11 +68,6 @@ angular.module('app.frontend')
this.selectFirstNote(createNew);
}
this.selectedTagDelete = function() {
this.showMenu = false;
this.removeTag()(this.tag);
}
this.selectFirstNote = function(createNew) {
var visibleNotes = this.sortedNotes.filter(function(note){
return note.visible;

View File

@@ -9,7 +9,8 @@ angular.module('app.frontend')
save: "&",
tags: "=",
allTag: "=",
updateNoteTag: "&"
updateNoteTag: "&",
removeTag: "&"
},
templateUrl: 'frontend/tags.html',
replace: true,
@@ -32,7 +33,7 @@ angular.module('app.frontend')
}
}
})
.controller('TagsCtrl', function (modelManager) {
.controller('TagsCtrl', function (modelManager, $timeout) {
var initialLoad = true;
@@ -68,11 +69,6 @@ angular.module('app.frontend')
this.addNew()(this.newTag);
}
var originalTagName = "";
this.onTagTitleFocus = function(tag) {
originalTagName = tag.title;
}
this.tagTitleDidChange = function(tag) {
this.editingTag = tag;
}
@@ -98,6 +94,23 @@ angular.module('app.frontend')
}.bind(this));
}
function inputElementForTag(tag) {
return document.getElementById("tag-" + tag.uuid);
}
var originalTagName = "";
this.selectedRenameTag = function($event, tag) {
originalTagName = tag.title;
this.editingTag = tag;
$timeout(function(){
inputElementForTag(tag).focus();
})
}
this.selectedDeleteTag = function(tag) {
this.removeTag()(tag);
}
this.noteCount = function(tag) {
var validNotes = Note.filterDummyNotes(tag.notes);
return validNotes.length;

View File

@@ -98,11 +98,17 @@ class AccountMenu {
}
$scope.submitRegistrationForm = function() {
var confirmation = prompt("Please confirm your password. Note that because your notes are encrypted using your password, Standard Notes does not have a password reset option. You cannot forget your password.")
$scope.formData.confirmPassword = true;
}
$scope.submitPasswordConfirmation = function() {
let confirmation = $scope.formData.pw_confirmation;
if(confirmation !== $scope.formData.user_password) {
alert("The two passwords you entered do not match. Please try again.");
return;
}
$scope.formData.confirmPassword = false;
$scope.formData.status = "Generating Account Keys...";
$timeout(function(){

View File

@@ -92,6 +92,10 @@ class ExtensionManager {
*/
retrieveExtensionFromServer(url, callback) {
this.httpManager.getAbsolute(url, {}, function(response){
if(typeof response !== 'object') {
callback(null);
return;
}
var ext = this.handleExtensionLoadExternalResponseItem(url, response);
if(callback) {
callback(ext);

View File

@@ -28,7 +28,9 @@ class HttpManager {
if (xmlhttp.readyState == 4) {
var response = xmlhttp.responseText;
if(response) {
response = JSON.parse(response);
try {
response = JSON.parse(response);
} catch(e) {}
}
if(xmlhttp.status >= 200 && xmlhttp.status <= 299){

View File

@@ -10,7 +10,7 @@ class SyncManager {
}
get serverURL() {
return localStorage.getItem("server") || "https://n3.standardnotes.org";
return localStorage.getItem("server") || window._default_sf_server;
}
get masterKey() {

View File

@@ -5,6 +5,7 @@ $heading-height: 75px;
display: flex;
flex-direction: column;
overflow-y: hidden;
background-color: white;
&.fullscreen {
width: 100%;
@@ -15,24 +16,19 @@ $heading-height: 75px;
padding: 0;
}
.section-title-bar {
border-bottom: none !important;
height: $heading-height !important;
}
.section-menu {
flex: 1 0 28px;
max-height: 28px;
}
}
.editor-heading {
#editor-title-bar {
width: 100%;
padding: 15px;
padding-top: 0px;
padding: 20px;
background-color: white;
border-bottom: none;
height: $heading-height;
min-height: $heading-height;
padding-right: 10px;
@@ -63,8 +59,8 @@ $heading-height: 75px;
}
.save-status {
width: 20% !important;
#save-status {
width: 20%;
float: right;
position: absolute;
@@ -73,12 +69,11 @@ $heading-height: 75px;
text-transform: none;
font-weight: normal;
margin-top: 4px;
width: 120px;
text-align: right;
color: rgba(black, 0.23);
}
.tags {
.editor-tags {
clear: left;
width: 100%;
height: 25px;
@@ -125,6 +120,8 @@ $heading-height: 75px;
padding: 85px 10%;
max-width: 1200px;
display: inline-block;
margin-left: auto;
margin-right: auto;
}
}
}

View File

@@ -13,7 +13,7 @@ h2 {
margin-top: 0px;
}
.footer-bar {
#footer-bar {
position: relative;
width: 100%;
padding: 5px;
@@ -23,7 +23,6 @@ h2 {
z-index: 100;
font-size: 10px;
color: $dark-gray;
border-bottom: 1px solid rgba(#979799, 0.4);
.medium-text {
font-size: 14px;
@@ -35,11 +34,11 @@ h2 {
color: $blue-color;
&.gray {
color: $dark-gray !important;
color: $dark-gray;
}
&.block {
display: block !important;
display: block;
}
}
@@ -59,14 +58,14 @@ h2 {
h3 {
font-size: 14px !important;
margin-top: 4px !important;
margin-bottom: 3px !important;
font-size: 14px ;
margin-top: 4px ;
margin-bottom: 3px;
}
h4 {
margin-bottom: 4px !important;
font-size: 13px !important;
margin-bottom: 4px;
font-size: 13px;
}
section {
@@ -88,7 +87,7 @@ h2 {
}
}
.footer-bar-link {
#footer-bar .footer-bar-link {
font-size: 11px;
font-weight: bold;
margin-left: 8px;
@@ -161,11 +160,6 @@ button.light {
border: 1px solid rgba(gray, 0.2);
}
.item.last-refreshed {
font-weight: normal !important;
cursor: default !important;
}
a.disabled {
pointer-events: none;
}

View File

@@ -180,7 +180,7 @@ button:focus {outline:0;}
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
box-shadow: 0;
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}

View File

@@ -8,12 +8,12 @@
$notes-title-bar-height: 130px;
.notes-title-bar {
#notes-title-bar {
color: rgba(black, 0.40);
padding-top: 16px !important;
height: $notes-title-bar-height !important;
font-weight: normal !important;
font-size: 18px !important;
padding-top: 16px;
height: $notes-title-bar-height;
font-weight: normal;
font-size: 18px;
}
.tag-menu-bar {

View File

@@ -1,31 +1,30 @@
.tags {
// width: 15%;
flex: 1 10%;
max-width: 180px;
min-width: 100px;
$tags-title-bar-height: 55px;
.tags-title-bar {
color: black;
height: $tags-title-bar-height !important;
padding-left: 12px !important;
padding-right: 12px !important;
font-size: 12px !important;
color: rgba(black, 0.8);
#tags-title-bar {
color: black;
height: $tags-title-bar-height;
padding-left: 12px;
padding-right: 12px;
font-size: 12px;
color: rgba(black, 0.8);
}
.content {
background-color: #f6f6f6 !important;
#tags-content {
background-color: #f6f6f6;
}
.tag-add-button {
#tag-add-button {
margin-top: -6px;
background-color: #d7d7d7 !important;
background-color: #d7d7d7;
float: right;
&:hover {
background-color: rgba(#d7d7d7, 0.8) !important;
background-color: rgba(#d7d7d7, 0.8);
}
}
@@ -34,36 +33,54 @@
}
.tag {
height: 30px;
min-height: 30px;
padding: 5px 12px;
cursor: pointer;
transition: height .1s ease-in-out;
position: relative;
font-size: 14px;
> .icon {
float: left;
padding-top: 6px;
margin-right: 5px;
> .info {
height: 20px;
> .title {
width: 80%;
background-color: transparent;
font-weight: 600;
float: left;
color: $main-text-color;
border: none;
cursor: pointer;
text-overflow: ellipsis;
width: 75%;
pointer-events: none;
}
> .count {
position: absolute;
right: 17px;
padding-top: 1px;
font-weight: bold;
}
}
> .title {
width: 80%;
background-color: transparent;
font-weight: 600;
float: left;
color: $main-text-color;
border: none;
cursor: pointer;
text-overflow: ellipsis;
width: 75%;
}
> .menu {
font-size: 11px;
> .count {
position: absolute;
right: 17px;
padding-top: 1px;
> .item {
margin-right: 2px;
}
opacity: 0.5;
font-weight: bold;
clear: both;
margin-top: 2px;
margin-bottom: 2px;
&:hover {
opacity: 1.0;
}
}
$tags-selected-color: #dbdbdb;

View File

@@ -1,26 +1,35 @@
.panel.panel-default.panel-right.account-data-menu
.panel-body.large-padding
%div{"ng-if" => "!user"}
%p Enter your <a href="https://standardnotes.org" target="_blank">Standard File</a> account information. You can also register for free using the default server address.
.small-v-space
%div{"ng-if" => "!formData.confirmPassword"}
%p Enter your <a href="https://standardnotes.org" target="_blank">Standard File</a> account information. You can also register for free using the default server address.
.small-v-space
%form.account-form.mt-5{'name' => "loginForm"}
%input.form-control{:name => 'server', :placeholder => 'Server URL', :required => true, :type => 'text', 'ng-model' => 'formData.url'}
%input.form-control{:autofocus => 'autofocus', :name => 'email', :placeholder => 'Email', :required => true, :type => 'email', 'ng-model' => 'formData.email'}
%input.form-control{:placeholder => 'Password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.user_password'}
.checkbox{"ng-if" => "localNotesCount() > 0"}
%label
%input{"type" => "checkbox", "ng-model" => "formData.mergeLocal", "ng-bind" => "true", "ng-change" => "mergeLocalChanged()"}
Merge local notes ({{localNotesCount()}} notes)
%form.mt-5
%input.form-control{:name => 'server', :placeholder => 'Server URL', :required => true, :type => 'text', 'ng-model' => 'formData.url'}
%input.form-control{:autofocus => 'autofocus', :name => 'email', :placeholder => 'Email', :required => true, :type => 'email', 'ng-model' => 'formData.email'}
%input.form-control{:placeholder => 'Password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.user_password'}
.checkbox{"ng-if" => "localNotesCount() > 0"}
%label
%input{"type" => "checkbox", "ng-model" => "formData.mergeLocal", "ng-bind" => "true", "ng-change" => "mergeLocalChanged()"}
Merge local notes ({{localNotesCount()}} notes)
%div{"ng-if" => "!formData.status"}
%button.btn.dark-button.half-button{"ng-click" => "loginSubmitPressed()", "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
%span Sign In
%button.btn.dark-button.half-button{"ng-click" => "submitRegistrationForm()", "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
%span Register
%br
.block{"style" => "margin-top: 10px; font-size: 14px; font-weight: bold; text-align: center;"}
%a.btn{"ng-click" => "showResetForm = !showResetForm"} Passwords cannot be forgotten.
%div{"ng-if" => "!formData.status"}
%button.btn.dark-button.half-button{"ng-click" => "loginSubmitPressed()"}
%span Sign In
%button.btn.dark-button.half-button{"ng-click" => "submitRegistrationForm()"}
%span Register
%br
.block{"style" => "margin-top: 10px; font-size: 14px; font-weight: bold; text-align: center;"}
%a.btn{"ng-click" => "showResetForm = !showResetForm"} Passwords cannot be forgotten.
%div{"ng-if" => "formData.confirmPassword"}
%h3 Confirm your password.
%p.mt-5 Note that because your notes are encrypted using your password, Standard Notes does not have a password reset option. You cannot forget your password.
%form.mt-10
%input.form-control{:placeholder => 'Confirm Password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.pw_confirmation'}
%button.btn.dark-button.btn-block{"ng-click" => "submitPasswordConfirmation()"}
%span Confirm
%em.block.center-align.mt-10{"ng-if" => "formData.status", "style" => "font-size: 14px;"} {{formData.status}}

View File

@@ -1,11 +1,11 @@
.section.editor{"ng-class" => "{'fullscreen' : ctrl.fullscreen}"}
.section-title-bar.editor-heading{"ng-if" => "ctrl.note", "ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
#editor-title-bar.section-title-bar{"ng-if" => "ctrl.note", "ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
.title
%input.input#note-title-editor{"ng-model" => "ctrl.note.title", "ng-keyup" => "$event.keyCode == 13 && ctrl.saveTitle($event)",
"ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()",
"select-on-click" => "true"}
.save-status{"ng-class" => "{'red bold': ctrl.saveError}", "ng-bind-html" => "ctrl.noteStatus"}
.tags
#save-status{"ng-class" => "{'red bold': ctrl.saveError}", "ng-bind-html" => "ctrl.noteStatus"}
.editor-tags
%input.tags-input{"type" => "text", "ng-keyup" => "$event.keyCode == 13 && $event.target.blur();",
"ng-model" => "ctrl.tagsString", "placeholder" => "#tags", "ng-blur" => "ctrl.updateTagsFromTagsString($event, ctrl.tagsString)"}
.section-menu{"ng-if" => "ctrl.note"}
@@ -38,7 +38,7 @@
%span.sr-only
%contextual-extensions-menu{"ng-if" => "ctrl.showExtensions", "item" => "ctrl.note"}
.editor-content{"ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
.editor-content{"ng-if" => "ctrl.noteReady", "ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
%iframe#editor-iframe{"ng-if" => "ctrl.customEditor", "ng-src" => "{{ctrl.customEditor.url | trusted}}", "frameBorder" => "0", "style" => "width: 100%;"}
%textarea.editable#note-text-editor{"ng-if" => "!ctrl.customEditor", "ng-class" => "{'fullscreen' : ctrl.fullscreen }", "ng-model" => "ctrl.note.text",
"ng-change" => "ctrl.contentChanged()", "ng-click" => "ctrl.clickedTextArea()", "ng-focus" => "ctrl.onContentFocus()"}

View File

@@ -1,4 +1,4 @@
.footer-bar
#footer-bar
.pull-left
.footer-bar-link{"click-outside" => "ctrl.showAccountMenu = false;", "is-open" => "ctrl.showAccountMenu"}
%a{"ng-click" => "ctrl.accountMenuPressed()", "ng-class" => "{red: ctrl.error}"} Account

View File

@@ -1,10 +1,9 @@
.main-ui-view
.app
%tags-section{"save" => "tagsSave", "add-new" => "tagsAddNew", "will-select" => "tagsWillMakeSelection", "selection-made" => "tagsSelectionMade", "all-tag" => "allTag",
"tags" => "tags"}
"tags" => "tags", "remove-tag" => "removeTag"}
%notes-section{"remove-tag" => "notesRemoveTag", "add-new" => "notesAddNew", "selection-made" => "notesSelectionMade",
"tag" => "selectedTag"}
%notes-section{"add-new" => "notesAddNew", "selection-made" => "notesSelectionMade", "tag" => "selectedTag"}
%editor-section{"note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}

View File

@@ -1,6 +1,6 @@
.section.notes
.content
.section-title-bar.notes-title-bar
.section-title-bar#notes-title-bar
.title {{ctrl.tag.title}} notes
.add-button{"ng-click" => "ctrl.createNewNote()"} +
%br
@@ -10,7 +10,7 @@
%ul.nav.nav-pills
%li.dropdown
%a.dropdown-toggle{"ng-click" => "ctrl.showMenu = !ctrl.showMenu"}
Menu
Sort
%span.caret
%span.sr-only
@@ -18,13 +18,11 @@
%li
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedSortByCreated()"}
%span.top.mt-5.mr-5{"ng-if" => "ctrl.sortBy == 'created_at'"} ✓
Sort by date created
By date added
%li
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedSortByUpdated()"}
%span.top.mt-5.mr-5{"ng-if" => "ctrl.sortBy == 'updated_at'"} ✓
Sort by date updated
%li
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedTagDelete()"} Delete Tag
By date modified
.scrollable
.infinite-scroll{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}

View File

@@ -1,18 +1,22 @@
.section.tags
.content
.section-title-bar.tags-title-bar
#tags-content.content
#tags-title-bar.section-title-bar
.title Tags
.add-button.tag-add-button{"ng-click" => "ctrl.clickedAddNewTag()"} +
.add-button#tag-add-button{"ng-click" => "ctrl.clickedAddNewTag()"} +
{{ctrl.test}}
.scrollable
.tag{"ng-if" => "ctrl.allTag", "ng-click" => "ctrl.selectTag(ctrl.allTag)", "ng-class" => "{'selected' : ctrl.selectedTag == ctrl.allTag}"}
%input.title{"ng-disabled" => "true", "ng-model" => "ctrl.allTag.title"}
.count {{ctrl.noteCount(ctrl.allTag)}}
.tag{"ng-repeat" => "tag in ctrl.tags", "ng-click" => "ctrl.selectTag(tag)", "ng-class" => "{'selected' : ctrl.selectedTag == tag}",
"droppable" => true, "drop" => "ctrl.handleDrop", "tag" => "tag"}
%input.title{"ng-disabled" => "tag != ctrl.selectedTag", "ng-model" => "tag.title",
"ng-keyup" => "$event.keyCode == 13 && ctrl.saveTag($event, tag)", "mb-autofocus" => "true", "should-focus" => "ctrl.newTag",
"ng-change" => "ctrl.tagTitleDidChange(tag)", "ng-focus" => "ctrl.onTagTitleFocus(tag)", "ng-blur" => "ctrl.saveTag($event, tag)"}
.count {{ctrl.noteCount(tag)}}
.info
%input.title{"ng-disabled" => "true", "ng-model" => "ctrl.allTag.title"}
.count {{ctrl.noteCount(ctrl.allTag)}}
.tag{"ng-repeat" => "tag in ctrl.tags", "ng-click" => "ctrl.selectTag(tag)", "ng-class" => "{'selected' : ctrl.selectedTag == tag}"}
.info
%input.title{"ng-attr-id" => "tag-{{tag.uuid}}", "ng-click" => "ctrl.selectTag(tag)", "ng-model" => "tag.title",
"ng-keyup" => "$event.keyCode == 13 && ctrl.saveTag($event, tag)", "mb-autofocus" => "true", "should-focus" => "ctrl.newTag || ctrl.editingTag == tag",
"ng-change" => "ctrl.tagTitleDidChange(tag)", "ng-blur" => "ctrl.saveTag($event, tag)", "spellcheck" => "false"}
.count {{ctrl.noteCount(tag)}}
.menu{"ng-if" => "ctrl.selectedTag == tag"}
%a.item{"ng-click" => "ctrl.selectedRenameTag($event, tag)", "ng-if" => "!ctrl.editingTag"} Rename
%a.item{"ng-click" => "ctrl.saveTag($event, tag)", "ng-if" => "ctrl.editingTag"} Save
%a.item{"ng-click" => "ctrl.selectedDeleteTag(tag)"} Delete

View File

@@ -28,6 +28,10 @@
<meta name="og:title" content="Standard Notes, a private and secure notes app."/>
<meta name="og:description" content="Standard Notes is a basic notes app that delivers only the essentials in note taking. Because of its simplicity and resistance to growth, users can count on durability and convenience."/>
<script>
window._default_sf_server = "<%= ENV['SF_DEFAULT_SERVER'] %>";
</script>
<% if Rails.env.development? %>
<%= javascript_include_tag "compiled.js", debug: true %>
<% else %>