mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-30 01:51:53 +00:00
add list/show routes
This commit is contained in:
@@ -14,12 +14,12 @@ angular.module('codexen')
|
||||
callSign: vm.snippet.callSign,
|
||||
mode: vm.snippet.mode == null ? null : vm.snippet.mode.toLowerCase(),
|
||||
content: vm.snippet.content,
|
||||
tags: angular.isArray(vm.snippet.tags) ? vm.snippet.tags.map(function (tag) { return {_id: tag._id, name: tag.name} }) : []
|
||||
tags: angular.isArray(vm.snippet.tags) ? vm.snippet.tags.map(function (tag) { return tag.name }) : []
|
||||
}
|
||||
|
||||
Snippet.update(vm.snippet._id, params)
|
||||
.success(function (data) {
|
||||
$modalInstance.close(data.snippet)
|
||||
$modalInstance.close(data)
|
||||
console.log('snippet created!', data)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ angular.module('codexen')
|
||||
callSign: vm.callSign,
|
||||
mode: vm.mode == null ? null : vm.mode.toLowerCase(),
|
||||
content: vm.content,
|
||||
tags: angular.isArray(vm.tags) ? vm.tags.map(function (tag) { return {_id: tag._id, name: tag.name} }) : []
|
||||
tags: angular.isArray(vm.tags) ? vm.tags.map(function (tag) { return tag.name }) : []
|
||||
}
|
||||
|
||||
Snippet.create(params)
|
||||
.success(function (data) {
|
||||
$modalInstance.close(data.snippet)
|
||||
$modalInstance.close(data)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,16 @@ angular.module('codexen')
|
||||
|
||||
var snippetId = $state.params.id
|
||||
|
||||
Snippet.show(snippetId)
|
||||
Snippet.show(snippetId, {
|
||||
'include': ['Tag']
|
||||
})
|
||||
.success(function (data) {
|
||||
vm.snippet = data.snippet
|
||||
vm.snippet = data
|
||||
vm.isLoaded = true
|
||||
})
|
||||
|
||||
vm.delete = function () {
|
||||
Snippet.delete(vm.snippet._id)
|
||||
Snippet.delete(vm.snippet.id)
|
||||
.success(function () {
|
||||
$rootScope.$broadcast('snippetDeleted')
|
||||
})
|
||||
|
||||
@@ -7,13 +7,13 @@ angular.module('codexen')
|
||||
|
||||
var loadSnippets = function () {
|
||||
if ($auth.isAuthenticated) {
|
||||
console.log($auth.getPayload())
|
||||
var userId = $auth.getPayload().sub
|
||||
Snippet.findByUser(userId)
|
||||
Snippet.findMine({
|
||||
'include': ['Tag']
|
||||
})
|
||||
.success(function (data) {
|
||||
console.log('snippets fetched', data.snippets)
|
||||
console.log('snippets fetched', data)
|
||||
vm.isLoaded = true
|
||||
vm.snippets = data.snippets
|
||||
vm.snippets = data
|
||||
vm.isGuest = false
|
||||
})
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user