Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Sang D NGO
linagora.esn.most
Commits
b46ebe20
Commit
b46ebe20
authored
Apr 17, 2018
by
Tuan Tuan LE
⛅
Browse files
Merge branch 'expert-aware' into 'master'
Expert aware See merge request
!18
parents
8ddf4ad9
553a95ac
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
16 deletions
+58
-16
backend/lib/proposal/index.js
backend/lib/proposal/index.js
+4
-0
backend/webserver/api/proposals/controller.js
backend/webserver/api/proposals/controller.js
+1
-0
frontend/app/common/most-proposal-api-client.service.js
frontend/app/common/most-proposal-api-client.service.js
+6
-1
frontend/app/proposal/detail/experts/modal.pug
frontend/app/proposal/detail/experts/modal.pug
+1
-1
frontend/app/proposal/detail/most-proposal-detail.controller.js
...nd/app/proposal/detail/most-proposal-detail.controller.js
+4
-2
frontend/app/proposal/detail/most-proposal-detail.pug
frontend/app/proposal/detail/most-proposal-detail.pug
+1
-1
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.component.js
...ail/subheader/most-proposal-detail-subheader.component.js
+1
-1
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.pug
...posal/detail/subheader/most-proposal-detail-subheader.pug
+8
-8
frontend/app/proposal/most-proposal.controller.js
frontend/app/proposal/most-proposal.controller.js
+2
-2
frontend/app/services/most-role.service.js
frontend/app/services/most-role.service.js
+30
-0
No files found.
backend/lib/proposal/index.js
View file @
b46ebe20
...
...
@@ -29,6 +29,10 @@ module.exports = function(dependencies) {
query
.
creator
=
options
.
creator
;
}
if
(
options
.
reviewer
)
{
query
.
reviewers
=
options
.
reviewer
;
}
if
(
options
.
status
)
{
query
.
status
=
options
.
status
;
}
...
...
backend/webserver/api/proposals/controller.js
View file @
b46ebe20
...
...
@@ -38,6 +38,7 @@ module.exports = function(dependencies, lib) {
function
getProposals
(
req
,
res
)
{
var
listOptions
=
{
creator
:
req
.
query
.
creator
,
reviewer
:
req
.
query
.
reviewer
,
type
:
req
.
query
.
type
,
status
:
req
.
query
.
status
,
limit
:
Number
(
req
.
query
.
limit
),
...
...
frontend/app/common/most-proposal-api-client.service.js
View file @
b46ebe20
...
...
@@ -8,6 +8,7 @@
function
mostProposalApiClient
(
session
,
mostRoleService
,
mostRestangular
)
{
return
{
...
...
@@ -22,8 +23,12 @@
}
function
getProposals
(
options
)
{
if
(
!
session
.
userIsDomainAdministrator
())
{
var
userRole
=
mostRoleService
.
getRole
();
if
(
userRole
===
'
user
'
)
{
options
.
creator
=
session
.
user
.
_id
;
}
else
if
(
userRole
===
'
expert
'
)
{
options
.
reviewer
=
session
.
user
.
_id
;
}
return
mostRestangular
.
all
(
API_PATH
).
getList
(
options
).
then
(
_stripAndReturnData
).
then
(
function
(
proposals
)
{
...
...
frontend/app/proposal/detail/experts/modal.pug
View file @
b46ebe20
...
...
@@ -5,7 +5,7 @@
.modal-header
button.close(type="button", data-dismiss="modal", aria-label="Close", ng-click="$hide()")
span(aria-hidden="true") ×
h4.modal-title #{__('
Thiết lập
chuyên gia')}
h4.modal-title #{__('
Hỏi
chuyên gia')}
.modal-body
p
| #{__('Chọn một nhóm chuyên gia:')}
...
...
frontend/app/proposal/detail/most-proposal-detail.controller.js
View file @
b46ebe20
...
...
@@ -9,7 +9,8 @@
$modal
,
$stateParams
,
session
,
mostProposalApiClient
mostProposalApiClient
,
mostRoleService
)
{
var
self
=
this
;
...
...
@@ -20,7 +21,8 @@
self
.
onReviewBtnClick
=
onReviewBtnClick
;
function
$onInit
()
{
self
.
showAction
=
session
.
userIsDomainAdministrator
();
self
.
userRole
=
mostRoleService
.
getRole
();
mostProposalApiClient
.
getProposal
(
$stateParams
.
proposalId
)
.
then
(
function
(
proposal
)
{
self
.
proposal
=
proposal
;
...
...
frontend/app/proposal/detail/most-proposal-detail.pug
View file @
b46ebe20
sub-header
most-proposal-detail-subheader(
data-title="$ctrl.proposal.formJson.title",
show-action="$ctrl.showAction
",
user-role="$ctrl.userRole
",
on-reject-btn-click="$ctrl.onRejectBtnClick()",
on-set-experts-btn-click="$ctrl.onSetExpertsBtnClick()",
on-accept-btn-click="$ctrl.onAcceptBtnClick()",
...
...
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.component.js
View file @
b46ebe20
...
...
@@ -7,7 +7,7 @@
templateUrl
:
'
/linagora.esn.most/app/proposal/detail/subheader/most-proposal-detail-subheader.html
'
,
bindings
:
{
title
:
'
<
'
,
showAction
:
'
<
'
,
userRole
:
'
<
'
,
onRejectBtnClick
:
'
&
'
,
onReviewBtnClick
:
'
&
'
,
onSetExpertsBtnClick
:
'
&
'
,
...
...
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.pug
View file @
b46ebe20
...
...
@@ -5,17 +5,17 @@ block left
span.title.ellipsis {{::$ctrl.title}}
block right
ul.actions.flex-space-around(ng-if="$ctrl.
showAction
")
ul.actions.flex-space-around(ng-if="$ctrl.
userRole !== 'user'
")
li.contact-dropdown.dropdown
a(href='', data-toggle='dropdown')
i.mdi.mdi-dots-vertical
ul.dropdown-menu.dropdown-menu-right
li
a(href='', ng-click='$ctrl.onRejectBtnClick()') Từ chối
li
a(href='', ng-click='$ctrl.onSetExpertsBtnClick()') Thiết lập chuyên gia
li
li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click='$ctrl.onAcceptBtnClick()') Duyệt
li
a(href='', ng-click="$ctrl.onReviewBtnClick()") Nhận xét và đánh giá
li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click='$ctrl.onRejectBtnClick()') Từ chối
li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click='$ctrl.onSetExpertsBtnClick()') Hỏi chuyên gia
li(ng-if="$ctrl.userRole === 'expert'")
a(href='', ng-click="$ctrl.onReviewBtnClick()") Nhận xét
frontend/app/proposal/most-proposal.controller.js
View file @
b46ebe20
...
...
@@ -6,7 +6,7 @@
function
MostProposalController
(
$stateParams
,
session
,
mostRoleService
,
mostProposalApiClient
)
{
var
self
=
this
;
...
...
@@ -15,7 +15,7 @@
function
$onInit
()
{
self
.
status
=
'
loading
'
;
self
.
showCreateBtn
=
!
session
.
userIsDomainAdministrator
()
;
self
.
showCreateBtn
=
mostRoleService
.
getRole
()
===
'
user
'
;
mostProposalApiClient
.
getProposals
({
status
:
$stateParams
.
status
}).
then
(
function
(
proposals
)
{
self
.
status
=
'
loaded
'
;
...
...
frontend/app/services/most-role.service.js
0 → 100644
View file @
b46ebe20
(
function
(
angular
)
{
'
use strict
'
;
angular
.
module
(
'
linagora.esn.most
'
)
.
factory
(
'
mostRoleService
'
,
mostRoleService
);
function
mostRoleService
(
session
)
{
return
{
getRole
:
getRole
};
function
getRole
()
{
if
(
userIsExpert
())
{
return
'
expert
'
;
}
if
(
session
.
userIsDomainAdministrator
())
{
return
'
moderator
'
;
}
return
'
user
'
;
}
function
userIsExpert
()
{
return
session
.
user
.
preferredEmail
.
indexOf
(
'
chuyengia
'
)
===
0
;
}
}
})(
angular
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment