presentations

This commit is contained in:
Mo Bitar
2016-12-16 00:44:49 -06:00
parent 36c74ed14d
commit 15a227daa2
11 changed files with 132 additions and 249 deletions

View File

@@ -228,20 +228,20 @@ angular.module('app.frontend')
this.editUrlPressed = function() {
this.showMenu = false;
var url = this.publicUrlForNote(this.note);
url = url.replace(this.note.presentation.root_path, "");
this.url = {base: url, token : this.note.presentation.root_path};
url = url.replace(this.note.presentation_name, "");
this.url = {base: url, token : this.note.presentation_name};
this.editingUrl = true;
}
this.saveUrl = function($event) {
$event.target.blur();
var original = this.note.presentation.relative_path;
this.note.presentation.relative_path = this.url.token;
var original = this.note.presentation_name;
this.note.presentation_name = this.url.token;
apiController.updatePresentation(this.note, this.note.presentation, function(response){
apiController.saveItems([this.note], function(response){
if(!response) {
this.note.presentation.relative_path = original;
this.note.presentation_name = original;
this.url.token = original;
alert("This URL is not available.");
} else {
@@ -259,14 +259,14 @@ angular.module('app.frontend')
a.click();
}
apiController.shareItem(this.user, this.note, function(note){
apiController.shareItem(this.note, function(note){
openInNewTab(this.publicUrlForNote(note));
}.bind(this))
this.showMenu = false;
}
this.unshareNote = function() {
apiController.unshareItem(this.user, this.note, function(note){
apiController.unshareItem(this.note, function(note){
})
this.showMenu = false;

View File

@@ -25,7 +25,7 @@ angular.module('app.frontend')
}
}
})
.controller('NotesCtrl', function (apiController, $timeout, ngDialog, $rootScope) {
.controller('NotesCtrl', function (apiController, $timeout, $rootScope) {
$rootScope.$on("editorFocused", function(){
this.showMenu = false;
@@ -81,38 +81,16 @@ angular.module('app.frontend')
return;
}
var callback = function(username) {
apiController.shareItem(this.user, this.tag, function(response){
})
}.bind(this);
if(!this.user.username) {
ngDialog.open({
template: 'frontend/modals/username.html',
controller: 'UsernameModalCtrl',
resolve: {
user: function() {return this.user}.bind(this),
callback: function() {return callback}
},
className: 'ngdialog-theme-default',
disableAnimation: true
});
} else {
callback(this.user.username);
}
apiController.shareItem(this.tag, function(response){})
}
this.selectedTagUnshare = function() {
this.showMenu = false;
apiController.unshareItem(this.user, this.tag, function(response){
apiController.unshareItem(this.tag, function(response){
})
}
this.publicUrlForTag = function() {
return this.tag.presentation.url;
}
this.selectFirstNote = function(createNew) {
var visibleNotes = this.tag.notes.filter(function(note){
return note.visible;