mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 18:56:22 +00:00
update recipe states
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('ExpandRecipeModalController', function (recipe, $modalInstance, $scope, Modal) {
|
||||
var vm = this
|
||||
console.log(recipe)
|
||||
|
||||
vm.recipe = recipe
|
||||
|
||||
vm.cancel = function () {
|
||||
$modalInstance.dismiss('cancel')
|
||||
}
|
||||
|
||||
vm.insert = function (type) {
|
||||
$scope.$broadcast('insertRequested', type)
|
||||
}
|
||||
|
||||
vm.insertSnippet = function () {
|
||||
Modal.selectSnippet()
|
||||
.then(function (snippet) {
|
||||
$scope.$broadcast('insertSnippetRequested', snippet)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -3,13 +3,13 @@ angular.module('codexen')
|
||||
.controller('NewRecipeModalController', function (Recipe, Tag, $modalInstance) {
|
||||
var vm = this
|
||||
|
||||
vm.content = ''
|
||||
vm.recipe = {}
|
||||
|
||||
vm.submit = function () {
|
||||
var params = {
|
||||
title: vm.title,
|
||||
content: vm.content,
|
||||
Tags: angular.isArray(vm.Tags) ? vm.Tags.map(function (tag) { return tag.name }) : []
|
||||
title: vm.recipe.title,
|
||||
content: vm.recipe.content,
|
||||
Tags: angular.isArray(vm.recipe.Tags) ? vm.recipe.Tags.map(function (tag) { return tag.name }) : []
|
||||
}
|
||||
|
||||
Recipe.create(params)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('SelectSnippetModalController', function (Snippet, $modalInstance) {
|
||||
var vm = this
|
||||
|
||||
vm.select = function (snippet) {
|
||||
$modalInstance.close(snippet)
|
||||
}
|
||||
|
||||
vm.cancel = function () {
|
||||
$modalInstance.dismiss('cancel')
|
||||
}
|
||||
|
||||
Snippet.findMine()
|
||||
.success(function (snippets) {
|
||||
vm.snippets = snippets
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user