From 759f38c579841f75bf1cfde0944fe899d8a87d01 Mon Sep 17 00:00:00 2001 From: Jia Yong Zeng Date: Mon, 10 Apr 2017 03:34:20 -0400 Subject: [PATCH 1/6] organize tag code and create new tag directive --- client/app/app.less | 1 + .../projects/profile/profile.controller.js | 21 ----------- client/app/projects/profile/profile.html | 11 +----- client/app/projects/profile/profile.less | 23 +----------- client/app/user/profile/profile.controller.js | 23 ------------ client/app/user/profile/profile.html | 11 +----- client/app/user/profile/profile.less | 17 --------- client/components/tag/tag.directive.js | 36 +++++++++++++++++++ client/components/tag/tag.html | 11 ++++++ client/components/tag/tag.less | 17 +++++++++ server/api/user/index.js | 6 ++-- server/api/user/user.controller.js | 4 +-- 12 files changed, 73 insertions(+), 108 deletions(-) create mode 100644 client/components/tag/tag.directive.js create mode 100644 client/components/tag/tag.html create mode 100644 client/components/tag/tag.less diff --git a/client/app/app.less b/client/app/app.less index f20f42fa..1c2d853d 100644 --- a/client/app/app.less +++ b/client/app/app.less @@ -49,6 +49,7 @@ @import '../components/footer/footer.less'; @import '../components/oauth-buttons/oauth-buttons.less'; @import '../components/sortArrow/sortArrow.less'; +@import '../components/tag/tag.less'; @import '../components/viewAttendance/viewAttendance.less'; // endinjector diff --git a/client/app/projects/profile/profile.controller.js b/client/app/projects/profile/profile.controller.js index da56370e..3419abd3 100644 --- a/client/app/projects/profile/profile.controller.js +++ b/client/app/projects/profile/profile.controller.js @@ -46,7 +46,6 @@ angular.module('observatory3App') $scope.slides = slides; }; - //end tech bubble code var updateProject = function(){ Project.getProject($stateParams.username, $stateParams.project).then(function(result) { $scope.project = result.data; @@ -94,7 +93,6 @@ angular.module('observatory3App') }); modalInstance.result.then(function (projectAdded) { - // $window.location.reload(); var redirectUsername = projectAdded.githubUsername; var redirectProjectName = projectAdded.githubProjectName; if (redirectUsername === $stateParams.username && redirectProjectName === $stateParams.project){ @@ -212,26 +210,7 @@ angular.module('observatory3App') }); } }; - //tech bubble code $scope.isMentor = Auth.isMentor; - $scope.addTechBubble = function(){ - if($scope.insertTechContent){ - $http.put('/api/projects/addTechBubble/' + $scope.project._id + '/' + $scope.insertTechContent).success(function(){ - $scope.project.tech.push($scope.insertTechContent); - $scope.insertTechContent = ''; - }).error(function(){ - notify({message: 'Could not add tech!', classes: ['alert-danger']}); - }); - } - }; - $scope.removeTech = function(tech){ - $http.put('/api/projects/' + $scope.project._id + '/' + tech + '/removeTech').success(function(){ - $scope.project.tech.splice($scope.project.tech.indexOf(tech),1); - }).error(function(){ - notify({message: 'Could not remove tech!', classes: ['alert-danger']}); - }); - }; - updateProject(); }); diff --git a/client/app/projects/profile/profile.html b/client/app/projects/profile/profile.html index 08364074..7e497647 100644 --- a/client/app/projects/profile/profile.html +++ b/client/app/projects/profile/profile.html @@ -41,16 +41,7 @@

{{project.name}}

Add a new tech tag:
-
-
- - {{tech}} - - - - -
-
+
diff --git a/client/app/projects/profile/profile.less b/client/app/projects/profile/profile.less index 688b9555..0c67006f 100644 --- a/client/app/projects/profile/profile.less +++ b/client/app/projects/profile/profile.less @@ -1,8 +1,5 @@ .project-profile{ - // h3 { - // margin-top: 0px; - // } - + div[class*="col"] { padding: 10px; } @@ -152,24 +149,6 @@ display: block; } - .tech-tags { - padding: 10px; - - span { - padding: 5px 10px; - display: inline-block; - background-color: #eee; - margin-right: 5px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 10px; - } - .tech-boxes { - white-space: nowrap; - overflow-x: auto; - } - } - g { padding: 3px; } diff --git a/client/app/user/profile/profile.controller.js b/client/app/user/profile/profile.controller.js index fa1450ee..7def0f00 100644 --- a/client/app/user/profile/profile.controller.js +++ b/client/app/user/profile/profile.controller.js @@ -107,29 +107,6 @@ angular.module('observatory3App') }); }; - $scope.addTechBubble = function(){ - if($scope.insertTechContent){ - $http.put('/api/users/' + $stateParams.id + '/addTech', { - 'tech': $scope.insertTechContent - }).success(function(){ - $scope.user.tech.push($scope.insertTechContent); - $scope.insertTechContent = ''; - }).error(function(){ - notify({message: "Could not add tech!", classes: ["alert-danger"]}); - }); - } - }; - - $scope.removeTech = function(tech){ - $http.put('/api/users/' + $stateParams.id + '/removeTech', { - 'tech': tech - }).success(function(){ - $scope.user.tech.splice($scope.user.tech.indexOf(tech),1); - }).error(function(){ - notify({message: "Could not add tech!", classes: ["alert-danger"]}); - }); - }; - $scope.pastUser = function(user){ var conf = confirm("Are you sure you want to make your account inactive?"); if (conf){ diff --git a/client/app/user/profile/profile.html b/client/app/user/profile/profile.html index ba3b118f..abc4d4c2 100644 --- a/client/app/user/profile/profile.html +++ b/client/app/user/profile/profile.html @@ -49,16 +49,7 @@
Add a new tech tag:
-
-
- - {{tech}} - - - - -
-
+
User has not written a bio
diff --git a/client/app/user/profile/profile.less b/client/app/user/profile/profile.less index 487966d4..60d123c6 100644 --- a/client/app/user/profile/profile.less +++ b/client/app/user/profile/profile.less @@ -44,23 +44,6 @@ margin-top:10px; } - .tech-tags { - padding: 10px; - - span { - padding: 5px 10px; - display: inline-block; - background-color: #eee; - margin-right: 5px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 10px; - } - .tech-boxes { - white-space: nowrap; - overflow-x: auto; - } - } .project-tech-boxes{ div{ display:inline-block; diff --git a/client/components/tag/tag.directive.js b/client/components/tag/tag.directive.js new file mode 100644 index 00000000..01ab7b5c --- /dev/null +++ b/client/components/tag/tag.directive.js @@ -0,0 +1,36 @@ +'use strict'; + +angular.module('observatory3App') + .directive('tag', function () { + return{ + templateUrl: 'components/tag/tag.html', + scope: { + endpoint: '@', + canEdit: '&', + id: '=', + tags: '=' + }, + restrict: 'E', + controller: function ($scope,$http,notify) { + + $scope.addTechBubble = function(){ + if($scope.insertTechContent){ + $http.put('/api/'+$scope.endpoint+'/addTechBubble/' + $scope.id + '/' + $scope.insertTechContent).success(function(){ + $scope.tags.push($scope.insertTechContent); + $scope.insertTechContent = ''; + }).error(function(){ + notify({message: 'Could not add tech!', classes: ['alert-danger']}); + }); + } + }; + + $scope.removeTech = function(tag){ + $http.put('/api/'+$scope.endpoint + '/' + $scope.id + '/' + tag + '/removeTech').success(function(){ + $scope.tags.splice($scope.tags.indexOf(tag),1); + }).error(function(){ + notify({message: 'Could not remove tech!', classes: ['alert-danger']}); + }); + }; + } + }; +}); diff --git a/client/components/tag/tag.html b/client/components/tag/tag.html new file mode 100644 index 00000000..d9eb0947 --- /dev/null +++ b/client/components/tag/tag.html @@ -0,0 +1,11 @@ + +
+
+ + {{tag}} + + + + +
+
\ No newline at end of file diff --git a/client/components/tag/tag.less b/client/components/tag/tag.less new file mode 100644 index 00000000..05b0da6a --- /dev/null +++ b/client/components/tag/tag.less @@ -0,0 +1,17 @@ +.tech-tags { + padding: 10px; + + span { + padding: 5px 10px; + display: inline-block; + background-color: #eee; + margin-right: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 10px; + } + .tech-boxes { + white-space: nowrap; + overflow-x: auto; + } +} \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ac38ae7c..04426507 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -36,10 +36,10 @@ router.put('/:id/deactivate', auth.canEdit(), controller.deactivate); router.put('/:id/activate', auth.isAuthenticated(), controller.activate); router.put('/:id/project', auth.isAuthenticated(), controller.addProject); router.put('/:id/favorite/:project', auth.isAuthenticated(), controller.addFavorite); -router.put('/:id/addTech', auth.canEdit(), controller.addTech); -router.put('/:id/removeTech', auth.canEdit(), controller.removeTech); +router.put('/addTechBubble/:id/:tech', auth.canEdit(), controller.addTech); +router.put('/:id/:tech/removeTech', auth.canEdit(), controller.removeTech); -router.delete('/:id/project', auth.isAuthenticated(), controller.removeProject); +router.delete('/addTechBubble/:id/:tech', auth.isAuthenticated(), controller.removeProject); router.delete('/:id/favorite/:project', auth.isAuthenticated(), controller.removeFavorite); export default router; diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 06ddec45..99d689ab 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -532,7 +532,7 @@ exports.authCallback = function(req, res, next) { */ exports.addTech = function(req,res){ var userId = req.params.id; - var newTech = req.body.tech; + var newTech = req.params.tech; User.findById(userId, function(err,user){ if (err){ res.send(500, err); @@ -552,7 +552,7 @@ exports.addTech = function(req,res){ */ exports.removeTech = function(req,res){ var userId = req.params.id; - var tech = req.body.tech; + var tech = req.params.tech; User.findById(userId, function(err,user){ if (err){ res.send(500, err); From 191124043097a823edb6e6172dcce30e5d62043f Mon Sep 17 00:00:00 2001 From: Jia Yong Zeng Date: Mon, 10 Apr 2017 20:13:59 -0400 Subject: [PATCH 2/6] insert tag system for blog post --- client/app/projects/blog/blog.controller.js | 10 ++++-- client/app/projects/blog/blog.html | 3 ++ .../components/editBlog/editBlog.directive.js | 4 +++ client/components/editBlog/editBlog.html | 2 ++ client/components/tag/tag.html | 5 ++- client/components/tag/tag.less | 1 - server/api/post/index.js | 2 ++ server/api/post/post.controller.js | 34 +++++++++++++++++++ server/api/post/post.model.js | 1 + 9 files changed, 55 insertions(+), 7 deletions(-) diff --git a/client/app/projects/blog/blog.controller.js b/client/app/projects/blog/blog.controller.js index c3509ff6..09e48a79 100644 --- a/client/app/projects/blog/blog.controller.js +++ b/client/app/projects/blog/blog.controller.js @@ -13,8 +13,10 @@ angular.module('observatory3App') }; $scope.userOwnsPost = function(post) { - var userId = $scope.user._id; - return ($scope.isAdmin() || $scope.getCurrentUser().role.toLowerCase() === 'mentor' || userId === post.author._id); + if($scope.user._id){ + var userId = $scope.user._id; + return ($scope.isAdmin() || $scope.getCurrentUser().role.toLowerCase() === 'mentor' || userId === post.author._id); + } }; $scope.editPost = function(post) { @@ -143,7 +145,9 @@ angular.module('observatory3App') }); }; - + $scope.readOnly = function(){ + return false; + } $scope.load(); }); diff --git a/client/app/projects/blog/blog.html b/client/app/projects/blog/blog.html index 7b52b9e5..39b5e8c0 100644 --- a/client/app/projects/blog/blog.html +++ b/client/app/projects/blog/blog.html @@ -36,6 +36,9 @@

+
+ +
diff --git a/client/components/editBlog/editBlog.directive.js b/client/components/editBlog/editBlog.directive.js index e76f9aaf..08c356a1 100644 --- a/client/components/editBlog/editBlog.directive.js +++ b/client/components/editBlog/editBlog.directive.js @@ -62,4 +62,8 @@ angular.module('observatory3App') $uibModalInstance.dismiss('cancel'); }; + $scope.canEdit = function(){ + return true; + }; + }); diff --git a/client/components/editBlog/editBlog.html b/client/components/editBlog/editBlog.html index 593a1b9c..95e5a73d 100644 --- a/client/components/editBlog/editBlog.html +++ b/client/components/editBlog/editBlog.html @@ -13,6 +13,8 @@ What is the title of your blog post?

+ +
diff --git a/client/components/tag/tag.html b/client/components/tag/tag.html index d9eb0947..ee522365 100644 --- a/client/components/tag/tag.html +++ b/client/components/tag/tag.html @@ -5,7 +5,6 @@ {{tag}} - - +
- \ No newline at end of file + diff --git a/client/components/tag/tag.less b/client/components/tag/tag.less index 05b0da6a..b33dbacc 100644 --- a/client/components/tag/tag.less +++ b/client/components/tag/tag.less @@ -1,6 +1,5 @@ .tech-tags { padding: 10px; - span { padding: 5px 10px; display: inline-block; diff --git a/server/api/post/index.js b/server/api/post/index.js index 5dfa1e3c..8023159a 100644 --- a/server/api/post/index.js +++ b/server/api/post/index.js @@ -13,4 +13,6 @@ router.post('/', auth.isAuthenticated(), controller.create); router.put('/:id', auth.isAuthenticated(), controller.update); router.delete('/:id', auth.isAuthenticated(), controller.destroy); +router.put('/addTechBubble/:id/:tag', auth.isAuthenticated(), controller.addTechBubble); +router.put('/:id/:tech/removeTech', auth.isAuthenticated(), controller.removeTech); module.exports = router; diff --git a/server/api/post/post.controller.js b/server/api/post/post.controller.js index c2dcf00f..20a5d0fb 100644 --- a/server/api/post/post.controller.js +++ b/server/api/post/post.controller.js @@ -92,6 +92,40 @@ exports.update = function(req, res) { }); }; +exports.addTechBubble = function(req, res){ + var postId = req.params.id; + var newTag = req.params.tag; + Post.findById(postId, function(err, post){ + if (err){ + res.send(500, err); + }else{ + if (!post.tags) post.tags=[]; + post.tags.push(newTag); + post.save(function(err){ + if (err) return validationError(res, err); + res.send(200); + }); + } + }); +}; + +exports.removeTech = function(req, res){ + var postId = req.params.id; + var oldTag = req.params.tag; + Post.findById(postId, function(err, post){ + if (err){ + res.send(500, err); + }else{ + if (!post.tags) post.tags = []; + post.tags.splice(post.tags.indexOf(oldTag), 1); + post.save(function(err){ + if (err) return validationError(res, err); + res.send(200); + }); + } + }); +}; + // Deletes a post from the DB. exports.destroy = function(req, res) { Post.findById(req.params.id, function (err, post) { diff --git a/server/api/post/post.model.js b/server/api/post/post.model.js index 0c8c5c5c..3f231ace 100644 --- a/server/api/post/post.model.js +++ b/server/api/post/post.model.js @@ -16,6 +16,7 @@ var PostSchema = new Schema({ ref: 'User', index: true }, + tags:[], date: { type: Date, default: Date.now, From 41e4a343c5758bba21d0dc6583cd50355a237c61 Mon Sep 17 00:00:00 2001 From: Jia Yong Zeng Date: Tue, 11 Apr 2017 20:55:42 -0400 Subject: [PATCH 3/6] change the timming of saving blog tag --- client/app/projects/blog/blog.html | 3 +- client/app/projects/blog/blog.less | 4 +++ client/components/editBlog/editBlog.html | 2 +- client/components/tag/tag.directive.js | 34 +++++++++++++++-------- client/components/tag/tag.html | 5 ++-- client/components/tag/tag.less | 4 +-- client/index.html | 5 ++-- server/api/post/index.js | 2 -- server/api/post/post.controller.js | 35 +----------------------- 9 files changed, 38 insertions(+), 56 deletions(-) diff --git a/client/app/projects/blog/blog.html b/client/app/projects/blog/blog.html index 39b5e8c0..f57c4398 100644 --- a/client/app/projects/blog/blog.html +++ b/client/app/projects/blog/blog.html @@ -37,7 +37,8 @@

- + +
diff --git a/client/app/projects/blog/blog.less b/client/app/projects/blog/blog.less index 59369e11..0823cac9 100644 --- a/client/app/projects/blog/blog.less +++ b/client/app/projects/blog/blog.less @@ -6,3 +6,7 @@ height: 150px; width: 100%; } +.blog-tag .tech-tags { + padding : 0px; + margin-top: -10px; +} diff --git a/client/components/editBlog/editBlog.html b/client/components/editBlog/editBlog.html index 95e5a73d..f5199ba7 100644 --- a/client/components/editBlog/editBlog.html +++ b/client/components/editBlog/editBlog.html @@ -13,8 +13,8 @@ What is the title of your blog post?

+ -
diff --git a/client/components/tag/tag.directive.js b/client/components/tag/tag.directive.js index 01ab7b5c..c7568bd2 100644 --- a/client/components/tag/tag.directive.js +++ b/client/components/tag/tag.directive.js @@ -14,22 +14,32 @@ angular.module('observatory3App') controller: function ($scope,$http,notify) { $scope.addTechBubble = function(){ - if($scope.insertTechContent){ - $http.put('/api/'+$scope.endpoint+'/addTechBubble/' + $scope.id + '/' + $scope.insertTechContent).success(function(){ - $scope.tags.push($scope.insertTechContent); - $scope.insertTechContent = ''; - }).error(function(){ - notify({message: 'Could not add tech!', classes: ['alert-danger']}); - }); + if($scope.insertTechContent){ + if($scope.endpoint==='posts'){ + $scope.tags.push($scope.insertTechContent); + $scope.insertTechContent = ''; + } + else{ + $http.put('/api/'+$scope.endpoint+'/addTechBubble/' + $scope.id + '/' + $scope.insertTechContent).success(function(){ + $scope.tags.push($scope.insertTechContent); + $scope.insertTechContent = ''; + }).error(function(){ + notify({message: 'Could not add tech!', classes: ['alert-danger']}); + }); + } } }; $scope.removeTech = function(tag){ - $http.put('/api/'+$scope.endpoint + '/' + $scope.id + '/' + tag + '/removeTech').success(function(){ - $scope.tags.splice($scope.tags.indexOf(tag),1); - }).error(function(){ - notify({message: 'Could not remove tech!', classes: ['alert-danger']}); - }); + if($scope.endpoint==='posts'){ + $scope.tags.splice($scope.tags.indexOf(tag),1); + }else{ + $http.put('/api/'+$scope.endpoint + '/' + $scope.id + '/' + tag + '/removeTech').success(function(){ + $scope.tags.splice($scope.tags.indexOf(tag),1); + }).error(function(){ + notify({message: 'Could not remove tech!', classes: ['alert-danger']}); + }); + } }; } }; diff --git a/client/components/tag/tag.html b/client/components/tag/tag.html index ee522365..f93b0a5e 100644 --- a/client/components/tag/tag.html +++ b/client/components/tag/tag.html @@ -2,9 +2,10 @@
- {{tag}} + {{tag}} - + +
diff --git a/client/components/tag/tag.less b/client/components/tag/tag.less index b33dbacc..a9074b9d 100644 --- a/client/components/tag/tag.less +++ b/client/components/tag/tag.less @@ -3,7 +3,7 @@ span { padding: 5px 10px; display: inline-block; - background-color: #eee; + background-color: #ddeeff; margin-right: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; @@ -13,4 +13,4 @@ white-space: nowrap; overflow-x: auto; } -} \ No newline at end of file +} diff --git a/client/index.html b/client/index.html index 8ede6876..557834b5 100644 --- a/client/index.html +++ b/client/index.html @@ -81,7 +81,7 @@ - + @@ -107,8 +107,8 @@ + - @@ -133,6 +133,7 @@ + diff --git a/server/api/post/index.js b/server/api/post/index.js index 8023159a..5dfa1e3c 100644 --- a/server/api/post/index.js +++ b/server/api/post/index.js @@ -13,6 +13,4 @@ router.post('/', auth.isAuthenticated(), controller.create); router.put('/:id', auth.isAuthenticated(), controller.update); router.delete('/:id', auth.isAuthenticated(), controller.destroy); -router.put('/addTechBubble/:id/:tag', auth.isAuthenticated(), controller.addTechBubble); -router.put('/:id/:tech/removeTech', auth.isAuthenticated(), controller.removeTech); module.exports = router; diff --git a/server/api/post/post.controller.js b/server/api/post/post.controller.js index 20a5d0fb..c798624f 100644 --- a/server/api/post/post.controller.js +++ b/server/api/post/post.controller.js @@ -80,6 +80,7 @@ exports.update = function(req, res) { if (err) { return handleError(res, err); } if (userId.equals(post.author) || user.role === 'mentor' || user.role === 'admin'){ + post.tags = req.body.tags; var updated = _.merge(post, req.body); updated.save(function (err) { if (err) { return handleError(res, err); } @@ -92,40 +93,6 @@ exports.update = function(req, res) { }); }; -exports.addTechBubble = function(req, res){ - var postId = req.params.id; - var newTag = req.params.tag; - Post.findById(postId, function(err, post){ - if (err){ - res.send(500, err); - }else{ - if (!post.tags) post.tags=[]; - post.tags.push(newTag); - post.save(function(err){ - if (err) return validationError(res, err); - res.send(200); - }); - } - }); -}; - -exports.removeTech = function(req, res){ - var postId = req.params.id; - var oldTag = req.params.tag; - Post.findById(postId, function(err, post){ - if (err){ - res.send(500, err); - }else{ - if (!post.tags) post.tags = []; - post.tags.splice(post.tags.indexOf(oldTag), 1); - post.save(function(err){ - if (err) return validationError(res, err); - res.send(200); - }); - } - }); -}; - // Deletes a post from the DB. exports.destroy = function(req, res) { Post.findById(req.params.id, function (err, post) { From bd3aafa4dd65e2770b736712964fab1d794ad1e9 Mon Sep 17 00:00:00 2001 From: Jia Yong Zeng Date: Tue, 18 Apr 2017 17:08:55 -0400 Subject: [PATCH 4/6] change button type to button --- client/components/editBlog/editBlog.directive.js | 2 ++ client/components/tag/tag.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/components/editBlog/editBlog.directive.js b/client/components/editBlog/editBlog.directive.js index 08c356a1..3dc4c0aa 100644 --- a/client/components/editBlog/editBlog.directive.js +++ b/client/components/editBlog/editBlog.directive.js @@ -9,6 +9,8 @@ angular.module('observatory3App') if (editBlog) { $scope.blog = editBlog; $scope.editing = true; + }else{ + $scope.blog.tags = []; } $scope.submit = function(form) { $scope.submitted = true; diff --git a/client/components/tag/tag.html b/client/components/tag/tag.html index f93b0a5e..da049c70 100644 --- a/client/components/tag/tag.html +++ b/client/components/tag/tag.html @@ -6,6 +6,6 @@ - +
From 68742eecee709b8a24d79570015028e28fabf1ec Mon Sep 17 00:00:00 2001 From: Jia Yong Zeng Date: Tue, 18 Apr 2017 17:59:41 -0400 Subject: [PATCH 5/6] change tags' color fix spacing problems on blog --- client/app/projects/blog/blog.html | 36 ++++++++++++++---------------- client/app/projects/blog/blog.less | 25 ++++++++++++--------- client/components/tag/tag.less | 4 ++-- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/client/app/projects/blog/blog.html b/client/app/projects/blog/blog.html index f57c4398..b60c2b3a 100644 --- a/client/app/projects/blog/blog.html +++ b/client/app/projects/blog/blog.html @@ -1,6 +1,6 @@
-
+

{{ project.name }}

@@ -23,32 +23,30 @@

-

{{sem}}

-
-
-

-
-
+

{{sem}}

+
+
+

{{post.title}}

+
-
-
diff --git a/client/app/projects/blog/blog.less b/client/app/projects/blog/blog.less index 0823cac9..5ebdd35f 100644 --- a/client/app/projects/blog/blog.less +++ b/client/app/projects/blog/blog.less @@ -1,12 +1,15 @@ -#titleEdit { - height: 30px; -} +.project-blogs{ + h2.title { + padding-left: 15px; + } -#contentEdit { - height: 150px; - width: 100%; -} -.blog-tag .tech-tags { - padding : 0px; - margin-top: -10px; -} + .tech-tags { + padding : 0px; + span{ + background-color: #c0d6ec; + a { + color: #545454; + } + } + } +} \ No newline at end of file diff --git a/client/components/tag/tag.less b/client/components/tag/tag.less index a9074b9d..122ddb9f 100644 --- a/client/components/tag/tag.less +++ b/client/components/tag/tag.less @@ -1,9 +1,9 @@ .tech-tags { - padding: 10px; + padding: 10px 10px 10px 0; span { padding: 5px 10px; display: inline-block; - background-color: #ddeeff; + background-color: #eee; margin-right: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; From e9b60bc76b9e4060187cb83f19fb8b0bb0f12050 Mon Sep 17 00:00:00 2001 From: Jia Yong Zeng Date: Thu, 20 Apr 2017 03:24:42 -0400 Subject: [PATCH 6/6] changed naming style according to sugguestions --- client/app/projects/blog/blog.controller.js | 4 +++- client/app/projects/blog/blog.html | 2 +- client/components/editBlog/editBlog.directive.js | 3 ++- server/api/project/index.js | 4 ++-- server/api/user/index.js | 7 ++++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/client/app/projects/blog/blog.controller.js b/client/app/projects/blog/blog.controller.js index 09e48a79..efc86527 100644 --- a/client/app/projects/blog/blog.controller.js +++ b/client/app/projects/blog/blog.controller.js @@ -145,9 +145,11 @@ angular.module('observatory3App') }); }; - $scope.readOnly = function(){ + + $scope.canEdit = function(){ return false; } + $scope.load(); }); diff --git a/client/app/projects/blog/blog.html b/client/app/projects/blog/blog.html index b60c2b3a..46f36f74 100644 --- a/client/app/projects/blog/blog.html +++ b/client/app/projects/blog/blog.html @@ -35,7 +35,7 @@

{{post.title}}

- +
diff --git a/client/components/editBlog/editBlog.directive.js b/client/components/editBlog/editBlog.directive.js index 3dc4c0aa..dab87a4e 100644 --- a/client/components/editBlog/editBlog.directive.js +++ b/client/components/editBlog/editBlog.directive.js @@ -39,7 +39,8 @@ angular.module('observatory3App') else{ $http.put('/api/posts/' + $scope.blog._id, { 'title': $scope.blog.title, - 'content': $scope.blog.content + 'content': $scope.blog.content, + 'tags' : $scope.blog.tags }).then(function(){ notify('Post updated!'); $uibModalInstance.close($scope.project); diff --git a/server/api/project/index.js b/server/api/project/index.js index 673b8f01..142b05de 100644 --- a/server/api/project/index.js +++ b/server/api/project/index.js @@ -25,6 +25,6 @@ router.put('/:id/markPast', auth.isAuthenticated(), controller.markPast); router.put('/:id/markActive', auth.isAuthenticated(), controller.markActive); router.delete('/:id', auth.hasRole('mentor'), controller.destroy); -router.put('/addTechBubble/:id/:tech', auth.isAuthenticated(), controller.addTechBubble); -router.put('/:id/:tech/removeTech', auth.isAuthenticated(), controller.removeTech); +router.put('/:id/addTechBubble/:tech', auth.isAuthenticated(), controller.addTechBubble); +router.put('/:id/removeTech/:tech', auth.isAuthenticated(), controller.removeTech); module.exports = router; diff --git a/server/api/user/index.js b/server/api/user/index.js index 04426507..b4337cf7 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -36,10 +36,11 @@ router.put('/:id/deactivate', auth.canEdit(), controller.deactivate); router.put('/:id/activate', auth.isAuthenticated(), controller.activate); router.put('/:id/project', auth.isAuthenticated(), controller.addProject); router.put('/:id/favorite/:project', auth.isAuthenticated(), controller.addFavorite); -router.put('/addTechBubble/:id/:tech', auth.canEdit(), controller.addTech); -router.put('/:id/:tech/removeTech', auth.canEdit(), controller.removeTech); +router.put('/:id/addTechBubble/:tech', auth.canEdit(), controller.addTech); +router.put('/:id/removeTech/:tech', auth.canEdit(), controller.removeTech); -router.delete('/addTechBubble/:id/:tech', auth.isAuthenticated(), controller.removeProject); + +router.delete('/:id/project', auth.isAuthenticated(), controller.removeProject); router.delete('/:id/favorite/:project', auth.isAuthenticated(), controller.removeFavorite); export default router;