mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-26 08:01:49 +00:00
standardize code
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('AppController', function ($scope) {
|
||||
|
||||
})
|
||||
.controller('AppController', function ($scope) {})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('NewSnippetModalController', function ($modalInstance, aceModes, $log, Snippet, $rootScope, Tag){
|
||||
.controller('NewSnippetModalController', function ($modalInstance, aceModes, $log, Snippet, $rootScope, Tag) {
|
||||
var vm = this
|
||||
|
||||
vm.aceModes = aceModes
|
||||
|
||||
@@ -7,14 +7,14 @@ angular.module('codexen')
|
||||
return true
|
||||
}
|
||||
vm.signup = function () {
|
||||
$auth.signup({
|
||||
email: vm.email,
|
||||
password: vm.password,
|
||||
name: vm.name,
|
||||
profileName: vm.profileName
|
||||
}).then(function (data) {
|
||||
$rootScope.$broadcast('userSignIn')
|
||||
$state.go('home')
|
||||
})
|
||||
$auth.signup({
|
||||
email: vm.email,
|
||||
password: vm.password,
|
||||
name: vm.name,
|
||||
profileName: vm.profileName
|
||||
}).then(function (data) {
|
||||
$rootScope.$broadcast('userSignIn')
|
||||
$state.go('home')
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -7,7 +7,7 @@ angular.module('codexen')
|
||||
$auth.login({
|
||||
email: vm.email,
|
||||
password: vm.password
|
||||
}).then(function(data){
|
||||
}).then(function (data) {
|
||||
console.log(data)
|
||||
$rootScope.$broadcast('userSignIn')
|
||||
})
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('HomeController', function ($auth, Snippet, $scope) {
|
||||
|
||||
})
|
||||
.controller('HomeController', function ($auth, Snippet, $scope) {})
|
||||
|
||||
@@ -10,18 +10,18 @@ angular.module('codexen')
|
||||
Snippet.show(snippetId, {
|
||||
'include': ['Tag']
|
||||
})
|
||||
.success(function (data) {
|
||||
vm.snippet = data
|
||||
vm.isLoaded = true
|
||||
})
|
||||
.success(function (data) {
|
||||
vm.snippet = data
|
||||
vm.isLoaded = true
|
||||
})
|
||||
|
||||
// TODO: When deletion occurs, switch the next snippet
|
||||
// TODO: Add deletion confirmation modal
|
||||
vm.delete = function () {
|
||||
Snippet.delete(vm.snippet.id)
|
||||
.success(function () {
|
||||
$rootScope.$broadcast('snippetDeleted')
|
||||
})
|
||||
.success(function () {
|
||||
$rootScope.$broadcast('snippetDeleted')
|
||||
})
|
||||
}
|
||||
|
||||
$scope.$on('snippetUpdated', function (e, snippet) {
|
||||
|
||||
@@ -16,7 +16,7 @@ angular.module('codexen')
|
||||
vm.snippets = data
|
||||
vm.isGuest = false
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
vm.isLoaded = true
|
||||
vm.isGuest = true
|
||||
vm.snippets = void 0
|
||||
@@ -45,8 +45,8 @@ angular.module('codexen')
|
||||
if (vm.snippets[i]._id === currentSnippetId) {
|
||||
var targetSnippet = null
|
||||
|
||||
if (i === 0) targetSnippet = vm.snippets[i+1]
|
||||
else targetSnippet = vm.snippets[i-1]
|
||||
if (i === 0) targetSnippet = vm.snippets[i + 1]
|
||||
else targetSnippet = vm.snippets[i - 1]
|
||||
|
||||
console.log('target', targetSnippet)
|
||||
$state.go('snippets.detail', {id: targetSnippet._id})
|
||||
|
||||
Reference in New Issue
Block a user