Commit 407d39b4 authored by Nezael's avatar Nezael
Browse files

Others workshop can now change their name too

Same functionnality as paperboard.
Some comments were added.
parent ee2336e7
......@@ -196,15 +196,30 @@ root.controller('OverviewWorkshopCtrl', ['$scope', '$stateParams', '$http', '$wo
workshopsCtrl.currentWorkshop = workshop;
}
/*
* Modify the name of the paperboard or the workshop, there id two different methods because paperboard is separated from every workshops
*/
workshopsCtrl.modifyWorkshopName = function(workshop){
let newName = prompt($languageFactory._labels.newWorkshopName);
if(newName != null)
{
$paperboardFactory.modifyPaperBoardName($scope._getProject(), workshop.id, newName, function (data){
if (data.status == "success"){
workshopsCtrl.refreshWorkshops("all");
}
});
if(workshop.type == 1)
{
$paperboardFactory.modifyPaperBoardName($scope._getProject(), workshop.id, newName, function (data){
if (data.status == "success"){
workshopsCtrl.refreshWorkshops("all");
}
});
}
else
{
$workshopFactory.modifyWorkshopName($scope._getProject(), workshop.id, newName, function (data){
if (data.status == "success"){
workshopsCtrl.refreshWorkshops("all");
}
});
}
}
}
......
......@@ -17,7 +17,13 @@ function $paperboardFactory($rootScope, $serverFactory) {
params: params
}, success, failure);
};
/**
* [modifyPaperBoardName : The aim of this method is to change the title of the paperboard in the DB]
* @param {[type]} projectId [id of the project]
* @param {[type]} id [id of the paperboard]
* @param {[type]} success [description]
* @param {[type]} failure [description]
*/
returns.modifyPaperBoardName = function (projectId, id, params, success, failure){
return $serverFactory.runCommand("put_paperboard_name", {
projectId: projectId,
......
......@@ -126,6 +126,21 @@ function $workshopFactory($rootScope, $serverFactory) {
}, success, failure);
};
/**
* [modifyWorkshopName : The aim of this method is to change the title of the workshop in the DB]
* @param {[type]} projectId [id of the project]
* @param {[type]} id [id of the workshop]
* @param {[type]} success [description]
* @param {[type]} failure [description]
*/
returns.modifyWorkshopName = function (projectId, id, params, success, failure){
return $serverFactory.runCommand("put_workshop_name", {
projectId: projectId,
id: id,
params: params
}, success, failure);
};
return returns;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment