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
59b2dcc0
authored
Nov 01, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
integrity id child and grid color
parent
77cf2f21
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
109 additions
and
7 deletions
sails/src/CHANGES.md
sails/src/api/controllers/GridController.js
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/assets/scripts/modules/student/controllers/gridconfig.js
sails/src/assets/scripts/modules/student/views/collections.html
sails/src/assets/scripts/modules/student/views/gridconfig.html
sails/src/tasks/config/concat.js
sails/src/CHANGES.md
View file @
59b2dcc0
...
...
@@ -12,4 +12,7 @@ ALTER TABLE `stu_picto` ADD `id_child_grid` int(11) NULL;
ALTER TABLE
`grid`
DROP COLUMN
`categories`
;
-- Add color to grid column
ALTER TABLE
`grid`
ADD
`color`
varchar(7) NULL;
ALTER TABLE
`grid`
ADD
`color`
varchar(7) NULL;
-- Foreign key stu_picto(id_child_grid) <- grid(id)
ALTER TABLE stu_picto ADD FOREIGN KEY(id_child_grid) REFERENCES grid(id) ON DELETE SET NULL;
sails/src/api/controllers/GridController.js
View file @
59b2dcc0
...
...
@@ -59,6 +59,7 @@ module.exports = {
delete
grid
.
supervisor
;
delete
grid
.
student
;
grid
.
name
=
params
.
name
||
grid
.
name
;
grid
.
color
=
params
.
color
||
grid
.
color
;
grid
.
save
(
function
(
error
)
{
if
(
error
)
{
return
res
.
serverError
(
"Could not save grid "
+
error
);
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
59b2dcc0
...
...
@@ -535,6 +535,44 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
};
/**
* Modal window to open grid color config
*/
$scope
.
open_grid_color
=
function
(
grid
)
{
console
.
log
(
grid
);
var
modalInstance
=
$modal
.
open
({
animation
:
true
,
templateUrl
:
'modules/student/views/gridconfig.html'
,
controller
:
'GridConfigCtrl'
,
size
:
'md'
,
resolve
:
{
// Passing data to the controller of the window
gridColor
:
function
()
{
return
$scope
.
viewingGrid
.
color
;
},
}
});
modalInstance
.
result
.
then
(
function
(
color
)
{
$scope
.
viewingGrid
.
color
=
color
;
$http
.
put
(
config
.
backend
+
'/grid/'
+
$scope
.
viewingGrid
.
id
+
'/stu/'
+
$scope
.
studentData
.
id
,
{
color
:
$scope
.
viewingGrid
.
color
})
.
success
(
function
(
stu
)
{
io
.
socket
.
post
(
'/stu/config'
,
{
action
:
'update'
,
attributes
:
stu
},
function
()
{});
ngToast
.
success
(
$translate
.
instant
(
'grid_updated'
));
}).
error
(
function
()
{});
});
};
/**
* Modal window to create grids
*/
$scope
.
open_new_grid
=
function
()
{
...
...
@@ -578,7 +616,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
}).
error
(
function
()
{});
});
};
// Add new listener to the event
...
...
sails/src/assets/scripts/modules/student/controllers/gridconfig.js
0 → 100644
View file @
59b2dcc0
'use strict'
;
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
dashboardControllers
.
controller
(
'GridConfigCtrl'
,
function
(
$window
,
$scope
,
$translate
,
$modalInstance
,
$http
,
config
,
ngToast
,
gridColor
)
{
$scope
.
gridColor
=
gridColor
;
$scope
.
close
=
function
(
color
)
{
$modalInstance
.
close
(
color
);
};
$scope
.
cancel
=
function
()
{
$modalInstance
.
dismiss
(
'cancel'
);
};
});
sails/src/assets/scripts/modules/student/views/collections.html
View file @
59b2dcc0
...
...
@@ -124,12 +124,22 @@
<label>
Opciones
</label>
<div
class=
"text-center"
>
<button
type=
"button"
ng-if=
"!viewingGrid.active"
class=
"btn btn-primary"
ng-click=
"viewingGrid.active=true;activate_grid(viewingGrid)"
style=
"margin-bottom:1em;"
>
Activar tablero
</button>
<button
type=
"button"
ng-if=
"viewingGrid.active"
class=
"btn btn-success"
disabled
style=
"margin-bottom:1em;"
>
Tablero activado
</button>
<button
type=
"button"
class=
"btn btn-success"
ng-click=
"open_new_grid()"
aria-expanded=
"false"
><i
class=
"fa fa-plus"
aria-hidden=
"true"
></i></button>
<button
type=
"button"
class=
"btn btn-primary"
ng-click=
"copy_grid()"
title=
"{{ 'duplicate' | translate}}"
><i
class=
"fa fa-files-o"
aria-hidden=
"true"
></i></button>
<button
type=
"button"
class=
"btn btn-danger"
ng-click=
"delete_grid(viewingGrid)"
title=
"{{ 'delete' | translate}}"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i></button>
<div
class=
"form-group row"
>
<button
type=
"button"
ng-if=
"!viewingGrid.active"
class=
"btn btn-primary"
ng-click=
"viewingGrid.active=true;activate_grid(viewingGrid)"
>
Activar tablero
</button>
<button
type=
"button"
ng-if=
"viewingGrid.active"
class=
"btn btn-success"
disabled
>
Tablero activado
</button>
</div>
<div
class=
"form-group row"
>
<button
type=
"button"
class=
"btn btn-primary"
ng-click=
"open_grid_color(viewingGrid)"
>
Cambiar color
</button>
</div>
<div
class=
"form-group row"
>
<button
type=
"button"
class=
"btn btn-success"
ng-click=
"open_new_grid()"
aria-expanded=
"false"
><i
class=
"fa fa-plus"
aria-hidden=
"true"
></i></button>
<button
type=
"button"
class=
"btn btn-primary"
ng-click=
"copy_grid()"
title=
"{{ 'duplicate' | translate}}"
><i
class=
"fa fa-files-o"
aria-hidden=
"true"
></i></button>
<button
type=
"button"
class=
"btn btn-danger"
ng-click=
"delete_grid(viewingGrid)"
title=
"{{ 'delete' | translate}}"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i></button>
</div>
</div>
<hr>
...
...
sails/src/assets/scripts/modules/student/views/gridconfig.html
0 → 100644
View file @
59b2dcc0
<div
id=
"grid-config"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
ng-click=
"close()"
>
<span
aria-hidden=
"true"
>
×
</span><span
class=
"sr-only"
translate
>
close
</span>
</button>
<h4
class=
"modal-title"
id=
"myModalLabel"
translate
>
Cambiar color del tablero
</h4>
</div>
<div
class=
"modal-body"
>
<div
class=
"form-group row"
>
<label
for=
"favcolor"
class=
"col-xs-2"
>
Color
</label>
<div
class=
"col-xs-10"
>
<input
type=
"color"
class=
"form-control"
value=
"{{gridColor}}"
id=
"favcolor"
ng-model=
"gridColor"
>
</div>
</div>
</div>
<div
class=
"modal-footer text-right"
>
<button
class=
"btn btn-primary"
ng-click=
"close(gridColor)"
>
Guardar
</button>
</div>
</div>
sails/src/tasks/config/concat.js
View file @
59b2dcc0
...
...
@@ -64,6 +64,7 @@ module.exports = function (grunt) {
'assets/scripts/modules/student/controllers/addpicto.js'
,
'assets/scripts/modules/student/controllers/tags.js'
,
'assets/scripts/modules/student/controllers/pictoconfig.js'
,
'assets/scripts/modules/student/controllers/gridconfig.js'
,
'assets/scripts/modules/student/controllers/pictoexp.js'
,
'assets/scripts/modules/student/controllers/newgrid.js'
,
'assets/scripts/modules/student/controllers/instructiondetail.js'
,
...
...
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