diff --git a/src/controllers/modals/EditSnippetModalController.js b/src/controllers/modals/EditSnippetModalController.js
index 67f0d48e..883a725d 100644
--- a/src/controllers/modals/EditSnippetModalController.js
+++ b/src/controllers/modals/EditSnippetModalController.js
@@ -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)
})
}
diff --git a/src/controllers/modals/NewSnippetModalController.js b/src/controllers/modals/NewSnippetModalController.js
index 39d22e4c..dc7123ed 100644
--- a/src/controllers/modals/NewSnippetModalController.js
+++ b/src/controllers/modals/NewSnippetModalController.js
@@ -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)
})
}
diff --git a/src/controllers/states/SnippetsDetailController.js b/src/controllers/states/SnippetsDetailController.js
index ca0b9965..cb804b34 100644
--- a/src/controllers/states/SnippetsDetailController.js
+++ b/src/controllers/states/SnippetsDetailController.js
@@ -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')
})
diff --git a/src/controllers/states/SnippetsListController.js b/src/controllers/states/SnippetsListController.js
index 95754a5d..dfd2d7b4 100644
--- a/src/controllers/states/SnippetsListController.js
+++ b/src/controllers/states/SnippetsListController.js
@@ -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 {
diff --git a/src/services/snippet.js b/src/services/snippet.js
index 08094dfb..23e204f6 100644
--- a/src/services/snippet.js
+++ b/src/services/snippet.js
@@ -11,16 +11,22 @@ angular.module('codexen')
})
}
+ var findMine = function (params) {
+ var url = apiUrl + 'snippets/my'
+
+ return $http.get(url, {params: params})
+ }
+
var create = function (params) {
var url = apiUrl + 'snippets/create'
return $http.post(url, params)
}
- var show = function (id) {
+ var show = function (id, params) {
var url = apiUrl + 'snippets/id/' + id
- return $http.get(url)
+ return $http.get(url, {params: params})
}
var update = function (id, params) {
@@ -37,6 +43,7 @@ angular.module('codexen')
return {
findByUser: findByUser,
+ findMine: findMine,
create: create,
show: show,
delete: destroy,
diff --git a/src/styles/_index.styl b/src/styles/_index.styl
index 8bcfe095..b19f0eca 100644
--- a/src/styles/_index.styl
+++ b/src/styles/_index.styl
@@ -28,7 +28,7 @@ textarea
left: 0
width: 200px
background-color: $baseBackgroundColor
- border-right solid 1px $baseBorderColor
+ border-right solid 2px $backgroundColorSelected
box-sizing: border-box
padding: 10px 0 10px 10px
diff --git a/src/styles/directives/side-nav.styl b/src/styles/directives/side-nav.styl
index b9e14810..5bfe6797 100644
--- a/src/styles/directives/side-nav.styl
+++ b/src/styles/directives/side-nav.styl
@@ -2,6 +2,7 @@
.nav-control-group
margin 0 5px
ul.nav.nav-pills
+ margin-top 10px
li hr
margin: 5px 0
border-top none
diff --git a/src/tpls/directives/side-nav.tpl.html b/src/tpls/directives/side-nav.tpl.html
index 9710a7aa..d3a46558 100644
--- a/src/tpls/directives/side-nav.tpl.html
+++ b/src/tpls/directives/side-nav.tpl.html
@@ -3,8 +3,8 @@
diff --git a/src/tpls/modals/edit-snippet-modal.tpl.html b/src/tpls/modals/edit-snippet-modal.tpl.html
index 9d96ea24..8d6c1a8e 100644
--- a/src/tpls/modals/edit-snippet-modal.tpl.html
+++ b/src/tpls/modals/edit-snippet-modal.tpl.html
@@ -22,7 +22,8 @@