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
8e42e6cd
authored
Feb 20, 2017
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' of
http://scm.ujaen.es/softuno/pictogram
into develop
parents
72e99377
6ff72c1f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
26 deletions
sails/src/assets/scripts/directives/directives.js
sails/src/assets/scripts/modules/student/controllers/addpicto.js
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/assets/scripts/modules/student/views/addpicto.html
sails/src/assets/scripts/directives/directives.js
View file @
8e42e6cd
...
@@ -4,7 +4,7 @@ var dashboardDirectives = angular.module('dashboardDirectives', ['dashboardConfi
...
@@ -4,7 +4,7 @@ var dashboardDirectives = angular.module('dashboardDirectives', ['dashboardConfi
/*-------------------------------------------------------------------------------
/*-------------------------------------------------------------------------------
Pictogram follows a Hierarchical MVC pattern (the old PAC pattern)
Pictogram follows a Hierarchical MVC pattern (the old PAC pattern)
We have a main controller (see main.js) and then others that are associated to
We have a main controller (see main.js) and then others that are associated to
different headers (by means of AngularJS directives)
different headers (by means of AngularJS directives)
Here we are just defining those directives
Here we are just defining those directives
*/
*/
...
@@ -70,9 +70,9 @@ dashboardDirectives.directive('draggable', function() {
...
@@ -70,9 +70,9 @@ dashboardDirectives.directive('draggable', function() {
return
function
(
scope
,
element
)
{
return
function
(
scope
,
element
)
{
// this gives us the native JS object
// this gives us the native JS object
var
el
=
element
[
0
];
var
el
=
element
[
0
];
el
.
draggable
=
true
;
el
.
draggable
=
true
;
el
.
addEventListener
(
el
.
addEventListener
(
'dragstart'
,
'dragstart'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -83,7 +83,7 @@ dashboardDirectives.directive('draggable', function() {
...
@@ -83,7 +83,7 @@ dashboardDirectives.directive('draggable', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'dragend'
,
'dragend'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -104,7 +104,7 @@ dashboardDirectives.directive('droppable', function() {
...
@@ -104,7 +104,7 @@ dashboardDirectives.directive('droppable', function() {
link
:
function
(
scope
,
element
)
{
link
:
function
(
scope
,
element
)
{
// again we need the native object
// again we need the native object
var
el
=
element
[
0
];
var
el
=
element
[
0
];
el
.
addEventListener
(
el
.
addEventListener
(
'dragover'
,
'dragover'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -116,7 +116,7 @@ dashboardDirectives.directive('droppable', function() {
...
@@ -116,7 +116,7 @@ dashboardDirectives.directive('droppable', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'dragenter'
,
'dragenter'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -125,7 +125,7 @@ dashboardDirectives.directive('droppable', function() {
...
@@ -125,7 +125,7 @@ dashboardDirectives.directive('droppable', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'dragleave'
,
'dragleave'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -134,20 +134,20 @@ dashboardDirectives.directive('droppable', function() {
...
@@ -134,20 +134,20 @@ dashboardDirectives.directive('droppable', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'drop'
,
'drop'
,
function
(
e
)
{
function
(
e
)
{
e
.
preventDefault
();
// Added to avoid openning the picto image
e
.
preventDefault
();
// Added to avoid openning the picto image
// Stops some browsers from redirecting.
// Stops some browsers from redirecting.
if
(
e
.
stopPropagation
)
e
.
stopPropagation
();
if
(
e
.
stopPropagation
)
e
.
stopPropagation
();
this
.
classList
.
remove
(
'over'
);
this
.
classList
.
remove
(
'over'
);
var
destination
=
this
.
id
;
var
destination
=
this
.
id
;
var
origin
=
e
.
dataTransfer
.
getData
(
'Text'
);
var
origin
=
e
.
dataTransfer
.
getData
(
'Text'
);
// ERASE this 2 lines and move in other directive
// ERASE this 2 lines and move in other directive
// One for drop in general view and other to drop in add pictos view
// One for drop in general view and other to drop in add pictos view
//var item = document.getElementById(origin);
//var item = document.getElementById(origin);
//this.appendChild(item);
//this.appendChild(item);
...
@@ -155,11 +155,11 @@ dashboardDirectives.directive('droppable', function() {
...
@@ -155,11 +155,11 @@ dashboardDirectives.directive('droppable', function() {
// call the passed drop function
// call the passed drop function
scope
.
$apply
(
function
(
scope
)
{
scope
.
$apply
(
function
(
scope
)
{
var
fn
=
scope
.
drop
();
var
fn
=
scope
.
drop
();
if
(
'undefined'
!==
typeof
fn
)
{
if
(
'undefined'
!==
typeof
fn
)
{
fn
(
origin
,
destination
);
fn
(
origin
,
destination
);
}
}
});
});
return
false
;
return
false
;
},
},
false
false
...
@@ -178,7 +178,7 @@ dashboardDirectives.directive('droppableadd', function() {
...
@@ -178,7 +178,7 @@ dashboardDirectives.directive('droppableadd', function() {
link
:
function
(
scope
,
element
)
{
link
:
function
(
scope
,
element
)
{
// again we need the native object
// again we need the native object
var
el
=
element
[
0
];
var
el
=
element
[
0
];
el
.
addEventListener
(
el
.
addEventListener
(
'dragover'
,
'dragover'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -190,7 +190,7 @@ dashboardDirectives.directive('droppableadd', function() {
...
@@ -190,7 +190,7 @@ dashboardDirectives.directive('droppableadd', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'dragenter'
,
'dragenter'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -199,7 +199,7 @@ dashboardDirectives.directive('droppableadd', function() {
...
@@ -199,7 +199,7 @@ dashboardDirectives.directive('droppableadd', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'dragleave'
,
'dragleave'
,
function
(
e
)
{
function
(
e
)
{
...
@@ -208,31 +208,46 @@ dashboardDirectives.directive('droppableadd', function() {
...
@@ -208,31 +208,46 @@ dashboardDirectives.directive('droppableadd', function() {
},
},
false
false
);
);
el
.
addEventListener
(
el
.
addEventListener
(
'drop'
,
'drop'
,
function
(
e
)
{
function
(
e
)
{
e
.
preventDefault
();
// Added to avoid openning the picto image
e
.
preventDefault
();
// Added to avoid openning the picto image
// Stops some browsers from redirecting.
// Stops some browsers from redirecting.
if
(
e
.
stopPropagation
)
e
.
stopPropagation
();
if
(
e
.
stopPropagation
)
e
.
stopPropagation
();
this
.
classList
.
remove
(
'over'
);
this
.
classList
.
remove
(
'over'
);
var
destination
=
this
.
id
;
var
destination
=
this
.
id
;
var
origin
=
e
.
dataTransfer
.
getData
(
'Text'
);
var
origin
=
e
.
dataTransfer
.
getData
(
'Text'
);
// call the passed drop function
// call the passed drop function
scope
.
$apply
(
function
(
scope
)
{
scope
.
$apply
(
function
(
scope
)
{
var
fn
=
scope
.
drop
();
var
fn
=
scope
.
drop
();
if
(
'undefined'
!==
typeof
fn
)
{
if
(
'undefined'
!==
typeof
fn
)
{
fn
(
origin
,
destination
);
fn
(
origin
,
destination
);
}
}
});
});
return
false
;
return
false
;
},
},
false
false
);
);
}
}
}
}
});
});
\ No newline at end of file
dashboardDirectives
.
directive
(
'popoveraddpicto'
,
function
()
{
var
y
=
99999
;
return
{
restrict
:
'A'
,
link
:
function
(
scope
,
element
,
attrs
)
{
if
(
element
[
0
].
y
<=
y
){
y
=
element
[
0
].
y
;
attrs
.
popoverPlacement
=
"bottom"
;
}
console
.
log
(
element
[
0
].
y
);
console
.
log
(
angular
.
element
(
document
.
querySelector
(
'#collections'
)
));
}
}
});
sails/src/assets/scripts/modules/student/controllers/addpicto.js
View file @
8e42e6cd
...
@@ -316,9 +316,16 @@ dashboardControllers.controller('AddPictoCtrl', function (
...
@@ -316,9 +316,16 @@ dashboardControllers.controller('AddPictoCtrl', function (
$scope
.
search
=
function
()
{
$scope
.
search
=
function
()
{
$scope
.
page
=
1
;
// Reset pagination
$scope
.
page
=
1
;
// Reset pagination
var
length
=
$scope
.
srch_term_picto
==
undefined
?
0
:
$scope
.
srch_term_picto
.
length
;
var
length
=
$scope
.
srch_term_picto
==
undefined
?
0
:
$scope
.
srch_term_picto
.
length
;
if
(
length
<
2
){
//Check the word length
if
(
length
==
1
){
//Check the word length
$scope
.
alert
=
{
type
:
'warning'
,
msg
:
'warning_two_characters'
,
show
:
true
};
$scope
.
alert
=
{
type
:
'warning'
,
msg
:
'warning_two_characters'
,
show
:
true
};
}
else
if
(
length
==
0
){
// If there is no word, reset pictos
if
(
$scope
.
onlyOwn
||
$scope
.
source
==
"ownpictos"
){
$scope
.
load_own_pictos
();
}
else
{
$scope
.
open_category_from_bc
(
0
);
}
}
else
{
}
else
{
var
request
=
""
;
var
request
=
""
;
var
source
=
1
;
var
source
=
1
;
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
8e42e6cd
...
@@ -313,6 +313,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
...
@@ -313,6 +313,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
},
},
supervisor
:
function
()
{
supervisor
:
function
()
{
return
$scope
.
user
;
return
$scope
.
user
;
},
onlyOwn
:
function
()
{
return
false
;
}
}
}
}
});
});
...
...
sails/src/assets/scripts/modules/student/views/addpicto.html
View file @
8e42e6cd
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
<div
id=
"clearfix-infiniteScroll-parent"
infinite-scroll=
"scroll()"
infinite-scroll-container=
"'#collections'"
>
<div
id=
"clearfix-infiniteScroll-parent"
infinite-scroll=
"scroll()"
infinite-scroll-container=
"'#collections'"
>
<div
class=
"picto_peq pull-left"
ng-repeat=
"p in pictos"
>
<div
class=
"picto_peq pull-left"
ng-repeat=
"p in pictos"
>
<img
ng-src=
"{{p.uri}}"
popover=
"{{p.expressions[0].text}}"
popover-trigger=
"mouseenter"
style=
"z-index:9000"
/>
<img
ng-src=
"{{p.uri}}"
popover=
"{{p.expressions[0].text}}"
popover-trigger=
"mouseenter"
popover-placement=
"top"
style=
"z-index:9000"
popoveraddpicto
/>
<!-- Options to remove picto (Only for own pictos) -->
<!-- Options to remove picto (Only for own pictos) -->
<div
class=
"picto_options"
>
<div
class=
"picto_options"
>
<a
ng-click=
"remove_own_picto(p.id)"
class=
"picto_remove"
title=
"{{ 'delete' | translate }}"
ng-show=
"source == 'ownpictos'"
>
<a
ng-click=
"remove_own_picto(p.id)"
class=
"picto_remove"
title=
"{{ 'delete' | translate }}"
ng-show=
"source == 'ownpictos'"
>
...
...
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