Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
89628470
authored
Apr 21, 2017
by
Jose Antonio
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added New Scene
parent
7dbcfa6e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
9 deletions
sails/src/api/controllers/SceneController.js
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/config/routes.js
sails/src/api/controllers/SceneController.js
View file @
89628470
...
...
@@ -19,8 +19,8 @@ module.exports = {
name
:
params
.
name
,
active
:
false
,
categories
:
params
.
categories
,
supervisor
:
supervisor
.
id
,
student
:
student
.
id
supervisor
:
params
.
id_sup
,
student
:
params
.
id_stu
}).
then
(
scene
=>
{
return
res
.
ok
(
scene
);
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
89628470
...
...
@@ -49,6 +49,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope
.
loadingPictos
=
true
;
$scope
.
viewingScene
=
null
;
$scope
.
scenesList
=
null
;
$scope
.
newSceneCat
=
null
;
$scope
.
newSceneName
=
"no name"
;
$scope
.
isCategory
=
function
(
studentPicto
)
{
return
studentPicto
.
attributes
.
id_cat
===
null
&&
...
...
@@ -230,7 +233,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$translate
(
'confirmation'
).
then
(
t
=>
{
if
(
$window
.
confirm
(
t
))
{
if
(
!
active
){
$http
.
delete
(
config
.
backend
+
'/scene/'
+
idScene
)
$http
.
delete
(
config
.
backend
+
'/scene/'
+
idScene
+
'/stu/'
+
$scope
.
studentData
.
id
)
.
success
(
function
()
{
io
.
socket
.
post
(
'/scene'
,
{
action
:
'delete'
,
...
...
@@ -259,9 +262,36 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
};
// Update student scene
$scope
.
new_scene
=
function
()
{
$http
.
post
(
config
.
backend
+
'/scene/'
+
scene
.
id
+
'/stu/'
+
$scope
.
studentData
.
id
,
{
name
:
$scope
.
newSceneName
,
id_sup
:
$scope
.
user
.
id
,
categories
:
$scope
.
newSceneCat
})
.
success
(
function
()
{
var
data
=
{
name
:
scene
.
name
,
active
:
scene
.
active
,
categories
:
scene
.
categories
,
student
:
scene
.
student
,
supervisor
:
scene
.
supervisor
};
io
.
socket
.
post
(
'/scene'
,
{
action
:
'add'
,
scene
:
data
},
function
()
{});
$translate
(
'scene_updated'
).
then
(
function
(
translation
)
{
ngToast
.
success
({
content
:
translation
});
});
}).
error
(
function
()
{});
};
// Update student scene
$scope
.
update_scene
=
function
(
scene
)
{
$http
.
put
(
config
.
backend
+
'/scene/'
+
scene
.
id
,
{
$http
.
put
(
config
.
backend
+
'/scene/'
+
scene
.
id
+
'/stu/'
+
$scope
.
studentData
.
id
,
{
name
:
scene
.
name
,
active
:
scene
.
active
,
id_stu
:
scene
.
student
})
...
...
@@ -288,7 +318,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Duplicate viewing scene
$scope
.
copy_scene
=
function
()
{
$http
.
get
(
config
.
backend
+
'/scene/'
+
$scope
.
viewingScene
.
id
+
'/copy'
)
$http
.
get
(
config
.
backend
+
'/scene/'
+
$scope
.
viewingScene
.
id
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/copy'
)
.
success
(
function
(
newScene
)
{
io
.
socket
.
post
(
'/scene'
,
{
...
...
sails/src/config/routes.js
View file @
89628470
...
...
@@ -77,10 +77,10 @@ module.exports.routes = {
'POST /scene'
:
'SceneController.scene'
,
'GET /scene/:id'
:
'SceneController.getScene'
,
'GET /scene/:id/copy'
:
'SceneController.duplicate'
,
'POST /scene/:id'
:
'SceneController.create'
,
'PUT /scene/:id'
:
'SceneController.update'
,
'DELETE /scene/:id'
:
'SceneController.destroy'
,
'GET /scene/:id/
stu/:id_stu/
copy'
:
'SceneController.duplicate'
,
'POST /scene/:id
/stu/:id_stu
'
:
'SceneController.create'
,
'PUT /scene/:id
/stu/:id_stu
'
:
'SceneController.update'
,
'DELETE /scene/:id
/stu/:id_stu
'
:
'SceneController.destroy'
,
'GET /server/ping'
:
'ServerController.ping'
,
'GET /server/ping_session'
:
'ServerController.ping_session'
,
...
...
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