1
0
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:
Rokt33r
2015-06-11 04:10:01 +09:00
parent 9762da28a4
commit c81bddad2a
6 changed files with 61 additions and 6 deletions

View File

@@ -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