Skip to content

Commit

Permalink
merge develop (#15)
Browse files Browse the repository at this point in the history
* change links home page

* Project (#8)

* change links home page (#5)

* Feature/folder (#7)

* #3

* Feature/folder (#9)

* #3 update home page

* reset page home

* notification feature (#12)

* #13 Display users's avatar each project (#14)

13-display-users-avatar-project
  • Loading branch information
quoctran18 authored Oct 2, 2017
1 parent ecf0829 commit e7ca62f
Show file tree
Hide file tree
Showing 45 changed files with 5,882 additions and 754 deletions.
3 changes: 2 additions & 1 deletion viDoc/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"AdminLTE": "admin-lte#^2.3.11",
"jquery": "^3.2.1",
"jquery-ui": "^1.12.1",
"ckeditor": "^4.7.1"
"ckeditor": "^4.7.1",
"angular-ui-notification": "^0.3.6"
},
"overrides": {
"bootstrap": {},
Expand Down
5 changes: 5 additions & 0 deletions viDoc/config/assets/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
// 'public/lib/AdminLTE/plugins/daterangepicker/daterangepicker.css',
// 'public/lib/AdminLTE/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css',
// endbower
// npm:css

],
js: [
// bower:js
Expand All @@ -41,6 +43,9 @@ module.exports = {
'public/lib/angular-ui-notification/dist/angular-ui-notification.js',
'public/lib/angular-ui-router/release/angular-ui-router.js',
'public/lib/owasp-password-strength-test/owasp-password-strength-test.js',
'public/lib/angular-ui-scroll/dist/ui-scroll.min.js',
'public/lib/angular-ui-scroll/dist/ui-scroll-grid.min.js',
'public/lib/ng-letter-avatar/dist/ngletteravatar.min.js'
// endbower
],
tests: ['public/lib/angular-mocks/angular-mocks.js']
Expand Down
15 changes: 10 additions & 5 deletions viDoc/config/assets/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,29 @@ module.exports = {
lib: {
css: [
// bower:css
'public/lib/angular-ui-notification/dist/angular-ui-notification.min.css',
'public/lib/bootstrap/dist/css/bootstrap.min.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.min.css',
'public/lib/angular-material/angular-material.min.css',
'public/lib/AdminLTE/dist/css/AdminLTE.min.css',
// endbower
],
js: [
// bower:js
'public/lib/angular/angular.min.js',
'public/lib/ckeditor/ckeditor.js',
'public/lib/angular-animate/angular-animate.min.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
'public/lib/angular-aria/angular-aria.min.js',
'public/lib/angular-messages/angular-messages.min.js',
'public/lib/angular-material/angular-material.min.js',
'public/lib/angular-mocks/angular-mocks.js',
'public/lib/angular-resource/angular-resource.min.js',
'public/lib/angular-ui-notification/dist/angular-ui-notification.min.js',
'public/lib/angular-ui-router/release/angular-ui-router.min.js',
'public/lib/ng-file-upload/ng-file-upload.min.js',
'public/lib/owasp-password-strength-test/owasp-password-strength-test.js',
'public/lib/AdminLTE/dist/js/app.min.js',
'public/lib/jquery-ui/jquery-ui.min.js',
'public/lib/ckeditor/ckeditor.js',
'public/lib/angular-ui-scroll/dist/ui-scroll.min.js',
'public/lib/angular-ui-scroll/dist/ui-scroll-grid.min.js',
'public/lib/ng-letter-avatar/dist/ngletteravatar.min.js'
// endbower
]
},
Expand Down
2 changes: 1 addition & 1 deletion viDoc/modules/core/client/app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var service = {
applicationEnvironment: window.env,
applicationModuleName: applicationModuleName,
applicationModuleVendorDependencies: ['ngResource', 'ngAnimate', 'ngMessages', 'ui.router', 'ngFileUpload', 'ui-notification', 'ngMaterial'],
applicationModuleVendorDependencies: ['ngResource', 'ngAnimate', 'ngMessages', 'ui.router', 'ngFileUpload', 'ui-notification', 'ngMaterial', 'ui.scroll', 'ui.scroll.grid','ngLetterAvatar'],
registerModule: registerModule
};

Expand Down
2 changes: 1 addition & 1 deletion viDoc/modules/core/client/config/core.client.menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

angular
.module('core')
.module('core', [])
.run(menuConfig);

menuConfig.$inject = ['menuService'];
Expand Down
63 changes: 61 additions & 2 deletions viDoc/modules/core/client/controllers/header.client.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,71 @@
.module('core')
.controller('HeaderController', HeaderController);

HeaderController.$inject = ['$scope', '$state', 'Authentication', 'menuService'];
HeaderController.$inject = ['$scope', '$resource', '$state','Authentication', 'menuService', '$timeout', 'NotificationsService'];

function HeaderController($scope, $state, Authentication, menuService) {
function HeaderController($scope, $resource, $state, Authentication, menuService, $timeout, NotificationsService) {
var vm = this;
vm.accountMenu = menuService.getMenu('account').items[0];
vm.authentication = Authentication;
vm.user = Authentication.user;
vm.has_message = true;

//get all new notifications
if(vm.user){
NotificationsService.getNotifications()
.then(whenGetSuccess)
.catch(whenGetError);

function whenGetSuccess(res) {
vm.notificationsReadFalse = res[1].listAllNotificationsWithReadFalse.length;
if(vm.notificationsReadFalse > 0){
vm.has_message = false;
}
}
function whenGetError(err) {
console.log(err)
}
}

// get all notifications from Notification Service and using ui-scroll to loading
vm.notificationsDataSource = {
get: (index, count, callback) => {

if(vm.user){
NotificationsService.getNotifications()
.then(getSuccess)
.catch(getError);

function getSuccess(response) {
// get all notifications of current user
vm.notifications = response[0].listAllNotifications

vm.isLoadNotification = false;

$timeout(function () {
var i, items = [], item;
for (i = index; i <= index + count - 1; i++) {
if(item = vm.notifications[i]){
items.push(item);
}
};
callback(items);
}, 50);
}
function getError(err) {
console.log(err)
}
}
}
};

// click to check all new notifications and update all of them become true
vm.check_notification = () => {
$resource('/api/notifications-read').save( () => {
vm.has_message = true;
});
}

vm.signOut = function () {
window.location.href = '/api/auth/signout';
};
Expand Down
3 changes: 3 additions & 0 deletions viDoc/modules/core/client/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,7 @@ a:hover .header-profile-image {
position: absolute;
left: 180px;
top: 30px;
}
.menu{
height: 165px;
}
28 changes: 22 additions & 6 deletions viDoc/modules/core/client/views/header.client.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<!-- <li>{{test.user}}</li> -->
<li class="" ng-bind="vm.testUser"></li>
<li class="dropdown messages-menu" uib-dropdown>
<a href="#" id="messages-menu" uib-dropdown-toggle class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
Expand Down Expand Up @@ -93,16 +95,30 @@ <h4>
</ul>
</li>
<!-- Notifications: style can be found in dropdown.less -->
<li class="dropdown notifications-menu" uib-dropdown>
<a id="notifications-menu" href="#" uib-dropdown-toggle class="dropdown-toggle" data-toggle="dropdown">
<li class="dropdown notifications-menu" uib-dropdown ng-click="vm.check_notification()">
<a id="notifications-menu" href="#" uib-dropdown-toggle class="dropdown-toggle" data-toggle="dropdown" >
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
<span ng-hide="vm.has_message" class="label label-warning">{{vm.notificationsReadFalse}}</span>
</a>
<ul class="dropdown-menu" uib-dropdown-menu aria-labelledby="notifications-menu">
<li class="header">You have 10 notifications</li>
<li class="header">Notifications</li>
<li>
<ul ng-hide="vm.isLoadNotification" ng-model="vm.isLoadNotification" class="menu" ui-scroll-viewport>
<li ui-scroll="item in vm.notificationsDataSource" buffer-size="3" padding="0.3" start-index="0">
<a href="#">
<i class="fa fa-users text-aqua"></i>
{{item.message}}
</a>
</li>
</ul>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<!-- <ul class="menu" ng-repeat="message in vm.notifications">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i>
{{message.message}}
</a>
</li>
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
Expand All @@ -129,7 +145,7 @@ <h4>
<i class="fa fa-user text-red"></i> You changed your username
</a>
</li>
</ul>
</ul> -->
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function (app) {
'use strict';

app.registerModule('notifications');
}(ApplicationConfiguration));
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function () {
'use strict';

angular
.module('core')
.factory('NotificationsService', NotificationsService);

NotificationsService.$inject = ['$resource'];

function NotificationsService($resource) {
var Notifications = $resource('/api/notifications', {}, {
listNotifications: {
method: 'GET',
url: '/api/notifications',
isArray: true
}
});

angular.extend( Notifications, {
getNotifications: function() {
return this.listNotifications().$promise;
}
});

return Notifications;
}

}());
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<section>
<div class="page-header">
<h1>{{vm.notification._id ? 'Edit Notification' : 'New Notification'}}</h1>
</div>
<div class="col-md-12">
<form name="vm.form.notificationForm" class="form-horizontal" ng-submit="vm.save(vm.form.notificationForm.$valid)" novalidate>
<fieldset>
<div class="form-group" show-errors>
<label class="control-label" for="name">Name</label>
<input name="name" type="text" ng-model="vm.notification.name" id="name" class="form-control" placeholder="Name" required>
<div ng-messages="vm.form.notificationForm.name.$error" role="alert">
<p class="help-block error-text" ng-message="required">Notification name is required.</p>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-default">{{vm.notification._id ? 'Update' : 'Create'}}</button>
</div>
<div ng-show="vm.error" class="text-danger">
<strong ng-bind="vm.error"></strong>
</div>
</fieldset>
</form>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<section>
<div class="page-header">
<h1>Notifications</h1>
</div>
<div class="list-group">
<a ng-repeat="notification in vm.notifications"
ui-sref="notifications.view({ notificationId: notification._id })"
class="list-group-item">
<small class="list-group-item-text">
Posted on
<span ng-bind="notification.created | date:'mediumDate'"></span>
by
<span ng-if="notification.user" ng-bind="notification.user.displayName"></span>
<span ng-if="!notification.user">Deleted User</span>
</small>
<h4 class="list-group-item-heading" ng-bind="notification.name"></h4>
</a>
</div>
<div class="alert alert-warning text-center" ng-if="vm.notifications.$resolved && !vm.notifications.length">
No Notifications yet, why don't you <a ui-sref="notifications.create">create one</a>?
</div>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<section>
<div class="page-header">
<h1 ng-bind="vm.notification.name"></h1>
</div>
<div class="pull-right"
ng-show="vm.notification.isCurrentUserOwner">
<a class="btn btn-primary"
ui-sref="notifications.edit({ notificationId: vm.notification._id })">
<i class="glyphicon glyphicon-edit"></i>
</a>
<a class="btn btn-primary" ng-click="vm.remove()">
<i class="glyphicon glyphicon-trash"></i>
</a>
</div>
<small>
<em class="text-muted">
Posted on
<span ng-bind="vm.notification.created | date:'mediumDate'"></span>
by
<span ng-if="vm.notification.user"
ng-bind="vm.notification.user.displayName"></span>
<span ng-if="!vm.notification.user">Deleted User</span>
</em>
</small>
<p class="lead" ng-bind="vm.notification.content"></p>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

/**
* Module dependencies
*/
var path = require('path'),
config = require(path.resolve('./config/config'));

/**
* Notifications module init function.
*/
module.exports = function (app, db) {

};
Loading

0 comments on commit e7ca62f

Please sign in to comment.