mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 02:36:36 +00:00
improve snippets.list UX & add instant edit handler for snippet with empty tag-list
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('SnippetsDetailController', function (Snippet, $state, $rootScope, $scope) {
|
||||
.controller('SnippetsDetailController', function (Snippet, $state, $rootScope, $scope, Modal) {
|
||||
var vm = this
|
||||
|
||||
vm.isLoaded = false
|
||||
@@ -24,6 +24,18 @@ angular.module('codexen')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
$scope.$on('taggingRequested', function (e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
Modal.editSnippet(angular.copy(vm.snippet))
|
||||
.result.then(function (snippet) {
|
||||
$rootScope.$broadcast('snippetUpdated', snippet)
|
||||
}, function () {
|
||||
console.log('edit snippet modal dismissed')
|
||||
})
|
||||
})
|
||||
|
||||
$scope.$on('snippetUpdated', function (e, snippet) {
|
||||
console.log('event received', snippet)
|
||||
if (snippet.id === vm.snippet.id) vm.snippet = snippet
|
||||
|
||||
Reference in New Issue
Block a user