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
ec1b7e3f
authored
May 23, 2016
by
Pablo Molina
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'issue/431' into 'develop'
Fixed
#431
parents
16ef6ddc
5ac991f9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
156 deletions
sails/src/api/models/Picto.js
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/student/controllers/addpicto.js
sails/src/assets/scripts/modules/student/views/addpicto.html
sails/src/api/models/Picto.js
View file @
ec1b7e3f
...
@@ -62,14 +62,14 @@ module.exports = {
...
@@ -62,14 +62,14 @@ module.exports = {
stusPicto
:
{
stusPicto
:
{
collection
:
'StuPicto'
,
collection
:
'StuPicto'
,
via
:
'picto'
via
:
'picto'
}
},
},
toJSON
:
function
()
{
toJSON
:
function
()
{
var
picto
=
this
.
toObject
();
var
picto
=
this
.
toObject
();
if
(
picto
.
owner
!==
null
)
{
if
(
picto
.
owner
!==
null
)
{
picto
.
uri
=
sails
.
config
.
pictogram
.
urls
.
getSupervisorCustomPictoUrl
(
picto
.
uri
);
picto
.
uri
=
sails
.
config
.
pictogram
.
urls
.
getSupervisorCustomPictoUrl
(
picto
.
uri
);
}
return
picto
;
}
}
return
picto
;
}
}
};
};
sails/src/assets/app/i18n/en-gb.json
View file @
ec1b7e3f
...
@@ -103,6 +103,7 @@
...
@@ -103,6 +103,7 @@
"instruction_end"
:
"End instruction"
,
"instruction_end"
:
"End instruction"
,
"instructions"
:
"Instructions"
,
"instructions"
:
"Instructions"
,
"invalid_fields"
:
"Invalid values. Please, check fields introduced."
,
"invalid_fields"
:
"Invalid values. Please, check fields introduced."
,
"invalid_file_type"
:
"Invalid file type"
,
"invisible"
:
"Invisible. Clic for enable"
,
"invisible"
:
"Invisible. Clic for enable"
,
"January"
:
"January"
,
"January"
:
"January"
,
"July"
:
"July"
,
"July"
:
"July"
,
...
@@ -171,6 +172,8 @@
...
@@ -171,6 +172,8 @@
"phrase_tape"
:
"Phrase tape"
,
"phrase_tape"
:
"Phrase tape"
,
"picto_behavior"
:
"Behavior of a pictogram when it is selected (without phrase tape)"
,
"picto_behavior"
:
"Behavior of a pictogram when it is selected (without phrase tape)"
,
"picto_labels"
:
"Pictogram labels"
,
"picto_labels"
:
"Pictogram labels"
,
"picto_upload_error"
:
"Error uploading picto"
,
"picto_upload_success"
:
"Picto uploaded successfully"
,
"pictogram"
:
"Pictogram"
,
"pictogram"
:
"Pictogram"
,
"pictogram_setup"
:
"Pictogram setup"
,
"pictogram_setup"
:
"Pictogram setup"
,
"pictograms"
:
"Pictograms"
,
"pictograms"
:
"Pictograms"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
ec1b7e3f
...
@@ -104,6 +104,7 @@
...
@@ -104,6 +104,7 @@
"instruction_end"
:
"Último intento"
,
"instruction_end"
:
"Último intento"
,
"instructions"
:
"Instrucciones"
,
"instructions"
:
"Instrucciones"
,
"invalid_fields"
:
"Valores inválidos. Compruebe los datos introducidos."
,
"invalid_fields"
:
"Valores inválidos. Compruebe los datos introducidos."
,
"invalid_file_type"
:
"Tipo de archivo no válido"
,
"invisible"
:
"Invisible. Clic para activar"
,
"invisible"
:
"Invisible. Clic para activar"
,
"January"
:
"Enero"
,
"January"
:
"Enero"
,
"July"
:
"Julio"
,
"July"
:
"Julio"
,
...
@@ -172,6 +173,8 @@
...
@@ -172,6 +173,8 @@
"phrase_tape"
:
"Cinta de frase"
,
"phrase_tape"
:
"Cinta de frase"
,
"picto_behavior"
:
"Comportamiento de un pictograma al seleccionarlo (sin cinta de frase)"
,
"picto_behavior"
:
"Comportamiento de un pictograma al seleccionarlo (sin cinta de frase)"
,
"picto_labels"
:
"Etiquetas del pictograma"
,
"picto_labels"
:
"Etiquetas del pictograma"
,
"picto_upload_error"
:
"Hubo un error al guardar el picto"
,
"picto_upload_success"
:
"Picto almacenado correctamente"
,
"pictogram"
:
"Pictograma"
,
"pictogram"
:
"Pictograma"
,
"pictogram_setup"
:
"Configuración del pictograma"
,
"pictogram_setup"
:
"Configuración del pictograma"
,
"pictograms"
:
"Pictogramas"
,
"pictograms"
:
"Pictogramas"
,
...
...
sails/src/assets/scripts/modules/student/controllers/addpicto.js
View file @
ec1b7e3f
...
@@ -156,53 +156,38 @@ dashboardControllers.controller('AddPictoCtrl', function (
...
@@ -156,53 +156,38 @@ dashboardControllers.controller('AddPictoCtrl', function (
$scope
.
alert
.
show
=
false
;
$scope
.
alert
.
show
=
false
;
};
};
//
/**
// Upload to own supervisor collection when a picto is selected from file
* When a image file is selected it tries to upload it as custom picto (making a
//
* POST request to /picto/upload).
$scope
.
onPictoSelect
=
function
(
$files
)
{
* @param {Array of Objects} $files Array of pictos to be uploaded the file
//$files: an array of files selected, each file has name, size, and type.
* itself (as binary data) will be sent.
for
(
var
i
=
0
;
i
<
$files
.
length
;
i
++
)
{
*/
var
file
=
$files
[
i
];
$scope
.
onPictoSelect
=
function
(
$files
)
{
$files
.
forEach
(
function
(
file
)
{
// Check accepted file types
if
(
file
.
type
===
'image/jpeg'
||
file
.
type
===
'image/png'
||
file
.
type
===
'image/gif'
)
{
if
(
file
.
type
==
"image/jpeg"
||
file
.
type
==
"image/png"
||
file
.
type
==
"image/gif"
){
// Get the file extension
var
extension
=
file
.
name
.
split
(
'.'
).
pop
();
var
filename
=
sup
.
id
+
file
.
name
;
console
.
log
(
"Archivo: "
+
filename
);
//file.extra="{'filename': filename, 'extension': extension, 'folder': 'custompictos', 'owner': $scope.sup.id, 'source': '2'}";
$upload
.
upload
({
$upload
.
upload
({
url
:
'/picto/upload'
,
//upload.php script, node.js route, or servlet url
url
:
'/picto/upload'
,
method
:
'POST'
,
// or 'PUT',
method
:
'POST'
,
// Fields to be sent in the body of the request
fields
:
{
owner
:
$scope
.
sup
.
id
},
fields
:
{
'filename'
:
filename
,
'extension'
:
extension
,
'folder'
:
'custompictos'
,
'owner'
:
$scope
.
sup
.
id
,
'source'
:
'2'
},
file
:
file
// or ['1.jpg', '2.jpg', ...] // to modify the name of the file(s)
}).
success
(
function
(
picto
)
{
file
:
file
,
// or list of files ($files) for html5 only
$translate
(
'picto_upload_success'
).
then
(
function
(
translation
)
{
}).
progress
(
function
(
evt
)
{
ngToast
.
success
(
translation
);
console
.
log
(
'percent: '
+
parseInt
(
100.0
*
evt
.
loaded
/
evt
.
total
));
});
}).
success
(
function
(
data
,
status
,
headers
,
config
)
{
picto
.
expressions
=
[];
// file is uploaded successfully
$scope
.
pictos
.
push
(
picto
);
console
.
log
(
"Data:"
);
$scope
.
open_exp
(
picto
);
console
.
log
(
JSON
.
stringify
(
data
));
}).
error
(
function
()
{
$translate
(
'picto_upload_error'
).
then
(
function
(
translation
)
{
// Add empty objetc for expressions
ngToast
.
danger
(
translation
);
data
.
picto
.
expressions
=
[];
});
$scope
.
pictos
.
push
(
data
.
picto
);
});
}
else
{
// Open modal window to add expression
$translate
(
'invalid_file_type'
).
then
(
function
(
translation
)
{
$scope
.
open_exp
(
data
.
picto
);
ngToast
.
danger
(
translation
);
});
}).
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error uploading: "
+
data
.
error
);
window
.
location
.
replace
(
window
.
location
.
pathname
);
});
}
else
{
alert
(
"It's only supported JPG, PNG and GIF files"
);
}
}
}
}
);
};
};
//
//
...
...
sails/src/assets/scripts/modules/student/views/addpicto.html
View file @
ec1b7e3f
<div>
<div>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
<div
class=
"btn-group"
>
<div
class=
"btn-group"
>
<button
class=
"btn btn-default"
ng-model=
"source"
uib-btn-radio=
"'symbolstx'"
ng-click=
"open_category_from_bc('0')"
>
Symbolstx
</button>
<button
class=
"btn btn-default"
ng-model=
"source"
uib-btn-radio=
"'symbolstx'"
ng-click=
"open_category_from_bc('0')"
>
Symbolstx
</button>
<button
class=
"btn btn-default"
ng-model=
"source"
uib-btn-radio=
"'ownpictos'"
ng-click=
"load_own_pictos()"
translate
>
own_pictos
</button>
<button
class=
"btn btn-default"
ng-model=
"source"
uib-btn-radio=
"'ownpictos'"
ng-click=
"load_own_pictos()"
translate
>
own_pictos
</button>
</div>
</div>
</div>
<div
class=
"modal-body"
>
</div>
<div
class=
"modal-body"
>
<!-- Panel migas de pan y categorías -->
<div
ng-show=
"source == 'symbolstx'"
class=
"panel panel-default"
id=
"bread_and_categories"
>
<div
ng-show=
"source == 'symbolstx'"
class=
"panel panel-default"
id=
"bread_and_categories"
>
<div
class=
"panel-heading"
>
<!-- Migas de pan -->
<div
class=
"pull-left"
ng-repeat=
"b in breadcrumbs"
>
<div
class=
"panel-heading"
>
<a
ng-click=
"open_category_from_bc(b.id)"
>
<div
class=
"pull-left"
ng-repeat=
"b in breadcrumbs"
>
<span
class=
"{{b.glyphicon}}"
></span>
{{ b.exp }}
<a
ng-click=
"open_category_from_bc(b.id)"
>
</a>
<span
class=
"{{b.glyphicon}}"
></span>
{{ b.exp }}
</a>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
<
!-- Categorías --
>
<
div
class=
"clearfix"
></div
>
<div
class=
"panel-body"
>
</div
>
<div
class=
"row
"
>
<div
class=
"panel-body
"
>
<div
class=
"col-md-3 col-xs-4"
ng-repeat=
"c in symbolstxCats | orderBy: 'exps[0].exp'
"
>
<div
class=
"row
"
>
<a
ng-click=
"open_category(c)"
><span
class=
"glyphicon glyphicon-folder-close"
></span>
{{ c.exps[0].exp }}
</a
>
<div
class=
"col-md-3 col-xs-4"
ng-repeat=
"c in symbolstxCats | orderBy: 'exps[0].exp'"
>
<
/div
>
<
a
ng-click=
"open_category(c)"
><span
class=
"glyphicon glyphicon-folder-close"
></span>
{{ c.exps[0].exp }}
</a
>
</div>
</div>
<!-- Fin de categorías -->
</div>
</div>
</div>
</div>
<!-- Fin del panel migas de pan y categorías -->
</div>
<div
ng-show=
"source == 'ownpictos'"
id=
"upload_pictos"
>
<!-- Botones para añadir picto nuevo -->
<button
style=
"border:none"
class=
"glyphicon glyphicon-picture"
type=
"file"
ng-file-select=
"onPictoSelect($files)"
ng-model=
"picFile"
accept=
"image/*"
popover=
"{{ 'upload_image' | translate }}"
popover-trigger=
"mouseenter"
></button>
<div
ng-show=
"source == 'ownpictos'"
id=
"upload_pictos"
>
<button
style=
"border:none"
class=
"btn btn-md glyphicon glyphicon-camera"
disabled=
"disabled"
></button>
<button
style=
"border:none"
class=
"glyphicon glyphicon-picture"
type=
"file"
ng-file-select=
"onPictoSelect($files)"
ng-model=
"picFile"
accept=
"image/*"
popover=
"{{ 'upload_image' | translate }}"
popover-trigger=
"mouseenter"
></button>
<button
class=
"btn btn-md"
disabled=
"disabled"
>
<span
class=
"glyphicon glyphicon-pencil"
></span>
<button
style=
"border:none"
class=
"btn btn-md glyphicon glyphicon-camera"
disabled=
"disabled"
></button>
</button>
</div>
<button
class=
"btn btn-md"
disabled=
"disabled"
>
<div>
<span
class=
"glyphicon glyphicon-pencil"
></span>
<alert
ng-show=
"alert.show"
ng-model=
"alert"
type=
"{{alert.type}}"
close=
"closeAlert()"
>
{{alert.msg}}
</alert>
</button>
</div>
</div>
<div
class=
"row"
>
<!-- Fin de columna vistas por categorías -->
<div
id=
"collections"
class=
"col-md-9"
>
<div
class=
"input-group"
id=
"search_pictos_box"
>
<!-- Alert panel -->
<input
type=
"text"
class=
"form-control"
placeholder=
"{{ 'filter' | translate }}"
ng-model=
"srch_term_picto"
id=
"srch_term_picto"
>
<div>
<span
class=
"input-group-addon glyphicon glyphicon-search"
id=
"basic-addon2"
aria-hidden=
"true"
></span>
<alert
ng-show=
"alert.show"
ng-model=
"alert"
type=
"{{alert.type}}"
close=
"closeAlert()"
>
{{alert.msg}}
</alert>
</div>
</div>
<!-- Galería de pictos -->
<div
class=
"picto_peq pull-left"
ng-repeat=
"p in pictos | filter:srch_term_picto"
draggable
id=
"{{p.id}}"
>
<!-- Panel de pictogramas -->
<img
ng-src=
"{{p.uri}}"
popover=
"{{p.expressions[0].text}}"
popover-trigger=
"mouseenter"
/>
<div
class=
"row"
>
<!-- Options to remove picto (Only for own pictos) -->
<!-- Pictogramas de la categoría actual -->
<div
class=
"picto_options"
ng-show=
"source == 'ownpictos'"
>
<div
id=
"collections"
class=
"col-md-9"
>
<a
ng-click=
"remove_own_picto(p.id)"
class=
"picto_remove"
title=
"{{ 'delete' | translate}}"
>
<span
class=
"color_red glyphicon glyphicon-remove-circle"
aria-hidden=
"true"
></span>
<!-- Buscador pictos -->
</a>
<div
class=
"input-group"
id=
"search_pictos_box"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"{{ 'filter' | translate }}"
ng-model=
"srch_term_picto"
id=
"srch_term_picto"
>
<span
class=
"input-group-addon glyphicon glyphicon-search"
id=
"basic-addon2"
aria-hidden=
"true"
></span>
</div>
</div>
<!-- Fin buscador pictos -->
<!-- Galería de pictos -->
<div
class=
"picto_peq pull-left"
ng-repeat=
"p in pictos | filter:srch_term_picto"
draggable
id=
"{{p.id}}"
>
<img
ng-src=
"{{p.uri}}"
popover=
"{{p.expressions[0].text}}"
popover-trigger=
"mouseenter"
/>
<!-- Options to remove picto (Only for own pictos) -->
<div
class=
"picto_options"
ng-show=
"source == 'ownpictos'"
>
<a
ng-click=
"remove_own_picto(p.id)"
class=
"picto_remove"
title=
"{{ 'delete' | translate}}"
>
<span
class=
"color_red glyphicon glyphicon-remove-circle"
aria-hidden=
"true"
></span>
</a>
</div>
</div>
<div
class=
"clearfix"
></div>
<!-- Fin galería de imágenes -->
</div>
</div>
<!-- Fin de collections -->
<div
class=
"clearfix"
></div>
</div>
<!-- Columna derecha para añadir pictos en categorías -->
<div
class=
"col-md-3"
>
<div
class=
"col-md-3"
>
<div
id=
"pictos_to_add"
>
<div
id=
"pictos_to_add"
>
<h4
class=
"text-center"
>
Para añadir
</h4>
<h4
class=
"text-center"
>
Para añadir
</h4>
<div
class=
"picto_cat"
ng-repeat=
"c in categories"
>
<div
class=
"panel panel-default"
id=
"{{c.picto.id}}_{{c.attributes.coord_x}}_{{c.attributes.coord_y}}"
droppableadd
drop=
"handleDropAddPicto"
>
<div
class=
"picto_cat"
ng-repeat=
"c in categories"
>
<div
class=
"panel-heading"
>
<div
class=
"panel panel-default"
id=
"{{c.picto.id}}_{{c.attributes.coord_x}}_{{c.attributes.coord_y}}"
droppableadd
drop=
"handleDropAddPicto"
>
<img
ng-src=
"{{c.picto.uri}}"
class=
"unselectable"
/>
<div
class=
"panel-heading"
>
<span>
{{c.expression.text}}
</span>
<img
ng-src=
"{{c.picto.uri}}"
class=
"unselectable"
/>
</div>
<span>
{{c.expression.text}}
</span>
<div
class=
"panel-body"
>
</div>
<div
class=
"picto_peq pull-left"
ng-repeat=
"pa in pictos_in_category['cat'+c.picto.id]"
id=
"{{pa.picto.id}}"
>
<!-- To append pictos to add -->
<img
ng-src=
"{{pa.picto.uri}}"
class=
"unselectable"
popover=
"{{pa.expressions[0].text}}"
popover-trigger=
"mouseenter"
/>
<div
class=
"panel-body"
>
<div
class=
"picto_options"
>
<div
class=
"picto_peq pull-left"
ng-repeat=
"pa in pictos_in_category['cat'+c.picto.id]"
id=
"{{pa.picto.id}}"
>
<a
ng-click=
"remove_picto(pa, c.picto.id)"
class=
"picto_remove"
title=
"{{ 'delete' | translate}}"
>
<img
ng-src=
"{{pa.picto.uri}}"
class=
"unselectable"
popover=
"{{pa.expressions[0].text}}"
popover-trigger=
"mouseenter"
/>
<span
class=
"color_red glyphicon glyphicon-remove-circle"
aria-hidden=
"true"
></span>
<!-- Options to remove picto -->
</a>
<div
class=
"picto_options"
>
<a
ng-click=
"remove_picto(pa, c.picto.id)"
class=
"picto_remove"
title=
"{{ 'delete' | translate}}"
>
<span
class=
"color_red glyphicon glyphicon-remove-circle"
aria-hidden=
"true"
></span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
</div>
<!-- Fin de row -->
</div>
<!-- End modal-body -->
<div
class=
"modal-footer"
>
<button
class=
"btn btn-primary"
ng-click=
"close()"
>
{{ 'close' | translate }}
</button>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div
class=
"modal-footer"
>
<button
class=
"btn btn-primary"
ng-click=
"close()"
>
{{ 'close' | translate }}
</button>
</div>
</div>
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