...
 
Commits (4)
......@@ -60,6 +60,11 @@ root.controller('DashboardCtrl', ['$scope', '$http', '$stateParams', '$location'
})
}
$scope.manageDiscussions = function (activity) {
$chatEventsFactory.promptNewDiscussion()
console.log(activity);
}
$scope.getTasks = function () {
......
......@@ -2,7 +2,7 @@
/* Controllers */
root.controller('ProjectOverviewCtrl', ['$scope', '$state', '$http', '$stateParams', '$rightFactory', '$languageFactory', '$projectFactory', '$userFactory', '$portfolioManagerFactory', function ($scope, $state, $http, $stateParams, $rightFactory, $languageFactory, $projectFactory, $userFactory, $portfolioManagerFactory) {
root.controller('ProjectOverviewCtrl', ['$scope', '$state', '$http', '$stateParams', '$rightFactory', '$languageFactory', '$projectFactory', '$userFactory', '$portfolioManagerFactory', '$chatEventsFactory', function ($scope, $state, $http, $stateParams, $rightFactory, $languageFactory, $projectFactory, $userFactory, $portfolioManagerFactory, $chatEventsFactory) {
var projectCtrl = this;
projectCtrl.shortName = $stateParams.projectName;
......@@ -176,10 +176,8 @@ root.controller('ProjectOverviewCtrl', ['$scope', '$state', '$http', '$statePara
projectCtrl.startDiscussion = function () {
var projectId = $scope._getProject();
console.log(projectId);
}
$chatEventsFactory.promptNewDiscussion($scope._getProject());
}
projectCtrl.onReady();
......
......@@ -2,7 +2,7 @@
/* Controllers */
root.controller('PortfolioCtrl', ['$scope', '$http', '$stateParams', '$rightFactory', '$languageFactory', '$projectFactory', "$portfolioManagerFactory", "$alertFactory", "$userFactory", function ($scope, $http, $stateParams, $rightFactory, $languageFactory, $projectFactory, $portfolioManagerFactory, $alertFactory, $userFactory) {
root.controller('PortfolioCtrl', ['$scope', '$http', '$stateParams', '$rightFactory', '$languageFactory', '$projectFactory', "$portfolioManagerFactory", "$alertFactory", "$userFactory", '$chatEventsFactory', function ($scope, $http, $stateParams, $rightFactory, $languageFactory, $projectFactory, $portfolioManagerFactory, $alertFactory, $userFactory, $chatEventsFactory) {
var group = this;
......@@ -13,6 +13,7 @@ root.controller('PortfolioCtrl', ['$scope', '$http', '$stateParams', '$rightFact
group.displayCard = true;
group.countNumber = countNumber;
group.isTutor = $userFactory.isTutor();
group.startDiscussion = startDiscussion;
if ($languageFactory.isReady()) getGroupDetails(true)
else $languageFactory.onInitLang($scope, getGroupDetails(true));
......@@ -299,4 +300,9 @@ root.controller('PortfolioCtrl', ['$scope', '$http', '$stateParams', '$rightFact
})
function startDiscussion() {
$chatEventsFactory.promptNewDiscussion($scope._getProject());
}
}])
\ No newline at end of file
......@@ -31,7 +31,7 @@
</div>
<div style="margin-top:5px;text-align: right">
<button class="pull-right secondary" ng-click="startDiscussion()"
<button class="pull-right secondary" ng-click="portfolioCtrl.startDiscussion()"
ng-if='_userGroups[_getFullGroup()]!="STUDENT"'>{{::_labels.newDiscussion}}
</button>
<button ng-click="portfolioCtrl.newProject()">{{::_labels.addProject}}</button>
......
......@@ -10,7 +10,7 @@
<li ui-sref="project.members" class="pointerOn no-ajaxify"><a>{{::_labels.members}}</a></li>
<li ui-sref="project.settings" class="pointerOn no-ajaxify"><a>{{::_labels.settings}}</a></li>
<button class="pull-right secondary" ng-click="startDiscussion()"
<button class="pull-right secondary" ng-click="projectCtrl.startDiscussion()"
ng-if='_userGroups[_getFullGroup()]!="STUDENT"'>{{::_labels.deliverableDiscussions}}
</button>
<button class="hide pull-right" ng-if="projectCtrl.currentProject.fav" ng-click="setProjectFavourite(0)">
......
......@@ -59,12 +59,22 @@ root.controller('ChatPopupNewCtrl', ['$scope', '$chatFactory', "$chatEventsFacto
chatCtrl.newDiscussion = function () {
var projectId = $(projectSelected).val();
var discussion = {ownerId: session.user, projectId: projectId, label: chatCtrl.newElement.label};
//angular.copy(chatCtrl.newElement,discussion);
discussion.members = chatCtrl.newElement.listRecipients.map(function (e) {
var members = chatCtrl.newElement.listRecipients.map(function (e) {
return e.id
});
if(chatCtrl.newElement.visibility == "project"){
var projectId = $(projectSelected).val();
} else {
var projectId = 0;
members.push(session.user);
}
var discussion = {ownerId: session.user, projectId: projectId, label: chatCtrl.newElement.label, members : members};
//angular.copy(chatCtrl.newElement,discussion);
discussion.attachment = chatCtrl.newElement.attachment;
$chatFactory.addDiscussion(discussion);
......@@ -80,12 +90,12 @@ root.controller('ChatPopupNewCtrl', ['$scope', '$chatFactory', "$chatEventsFacto
chatCtrl.editLabelDiscussion = true;
chatCtrl.labelTitle = params.labelTitle;
chatCtrl.showType = false;
chatCtrl.showVisibility = true;
if (params.prompt == "new") {
chatCtrl.newElement = $chatModelFactory.newElement
chatCtrl.showVisibility = true;
chatCtrl.editPopupDiscussion = false;
}
......@@ -98,10 +108,20 @@ root.controller('ChatPopupNewCtrl', ['$scope', '$chatFactory', "$chatEventsFacto
if (params.projectId) {
chatCtrl.newElement.projectId = params.projectId;
$projectFactory.get_project_parents(params.projectId, function (data) {
/* $projectFactory.get_project_parents(params.projectId, function (data) {
if (data.details) {
chatCtrl.params.portfolioId = data.details[0].parentProject;
}
})*/
chatCtrl.showVisibility = false;
$projectFactory.get_project_projectMembers(params.projectId, function (data) {
if (data.status == "success") {
console.log(data);
chatCtrl.newElement.listRecipients = data.details;
//$scope._setNotification("addUser", "");
}
})
}
......
......@@ -9,7 +9,7 @@
<input type="text" ng-model="chatCtrl.newElement.label" placeholder="{{::_labels.placeholderChat}}">
</div>
<div class="form-group has-error" ng-init="chatCtrl.newElement.type='other'"
ng-show="chatCtrl.showType == true">
ng-if="chatCtrl.showType">
<label>{{::_labels.chatType}}</label><span class="required-item"> *</span>
<div class="row">
......@@ -31,7 +31,7 @@
</div>
</div>
<div class="form-group has-error">
<div class="form-group has-error" ng-if="chatCtrl.showVisibility">
<label>{{::_labels.chatVisibility}}</label><span class="required-item"> *</span>
<div class="row">
<div class="col-md-4">
......@@ -52,14 +52,19 @@
</div>
<div class="form-group has-error">
<label>{{::_labels.addMembers}}</label><span class="required-item"> *</span>
<div ng-if="chatCtrl.newElement.visibility=='custom'" >
<label>{{::_labels.addMembers}}</label><span class="required-item"> *</span>
<div>
<input type="text"
placeholder="{{::_labels.placeholderMembers}}" id="inputMembers"
ng-change="chatCtrl.changeSearchMembers()" value="" ng-model="chatCtrl.newElement.recipient">
</div>
</div>
<div>
<input ng-if="chatCtrl.editPopupDiscussion || chatCtrl.editLabelDiscussion" type="text"
ng-disabled="chatCtrl.showVisibility && chatCtrl.newElement.visibility!='custom'"
placeholder="{{::_labels.placeholderMembers}}" id="inputMembers"
ng-change="chatCtrl.changeSearchMembers()" value="" ng-model="chatCtrl.newElement.recipient">
<div class="separator"></div>
<div class="separator"></div>
<div class="borders">
<div class='jt-editor' style='height: 100px;overflow-y: auto;overflow-x: hidden;'>
<div class="row row-members">
......
......@@ -103,6 +103,10 @@ root.controller('ChatWindowsContainerCtrl', ['$scope', '$chatFactory', "$chatEve
params.projectId = params.attachment.projectId;
}
} else {
params.labelTitle = $languageFactory._labels.newDiscussion;
$chatModelFactory.newElement.listRecipients = [{
"id": $rightFactory.session.userId,
......
......@@ -153,9 +153,11 @@ function $chatEventsFactory($rootScope, $chatModelFactory, $chatFactory) {
};
returns.promptNewDiscussion = function () {
returns.promptNewDiscussion = function (projectId) {
$rootScope.$broadcast(PROMPT_NEW_DISCUSSION, {});
$rootScope.$broadcast(PROMPT_NEW_DISCUSSION, {
projectId : projectId
});
};
returns.onPromptNewDiscussion = function ($scope, handler) {
......