1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-16 19:21:52 +00:00

add Recipes(scaffolding)

This commit is contained in:
Rokt33r
2015-06-23 19:18:00 +09:00
parent 7c2cbfb32e
commit 0e6fe35ca4
36 changed files with 801 additions and 62 deletions

View File

@@ -0,0 +1,32 @@
/* global angular */
angular.module('codexen')
.controller('RecipesDetailController', function (Recipe, $state, $rootScope, $scope, Modal) {
var vm = this
vm.isLoaded = false
var recipeId = $state.params.id
Recipe.show(recipeId)
.success(function (data) {
vm.recipe = data
vm.isLoaded = true
})
$scope.$on('taggingRequested', function (e) {
e.stopPropagation()
e.preventDefault()
Modal.editRecipe(angular.copy(vm.recipe))
.then(function (recipe) {
console.log('edited', recipe)
}, function () {
console.log('edit recipe modal dismissed')
})
})
$scope.$on('recipeUpdated', function (e, recipe) {
console.log('event received', recipe)
if (recipe.id === vm.recipe.id) vm.recipe = recipe
})
})