Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
ADIM
Commits
3bbe9628
Commit
3bbe9628
authored
Jun 15, 2018
by
M. Chardon
Browse files
migration de la police whhg-font (erreur dans la police) sur fa et material-icon
parent
85236afb
Changes
12
Hide whitespace changes
Inline
Side-by-side
adim_project/adim_app/static/_src/Gruntfile.js
View file @
3bbe9628
module
.
exports
=
function
(
grunt
)
{
module
.
exports
=
function
(
grunt
)
{
var
jsOptimizedSuffix
=
'
.min
'
;
grunt
.
initConfig
({
...
...
@@ -9,9 +8,9 @@ module.exports = function(grunt) {
adim
:
{
options
:
{
banner
:
'
/*! <%= pkg.name %> - v<%= pkg.version %> -
'
+
'
<%= grunt.template.today("yyyy-mm-dd") %> -
'
+
'
Copyright (C) <%= grunt.template.today("yyyy") %> Université de Lausanne -
'
+
'
see licence */
'
+
grunt
.
util
.
linefeed
,
'
<%= grunt.template.today("yyyy-mm-dd") %> -
'
+
'
Copyright (C) <%= grunt.template.today("yyyy") %> Université de Lausanne -
'
+
'
see licence */
'
+
grunt
.
util
.
linefeed
,
compress
:
{
drop_console
:
false
}
...
...
@@ -30,7 +29,7 @@ module.exports = function(grunt) {
files
:
[{
src
:
"
lib/requirejs/require.js
"
,
dest
:
"
../js/libs/require.min.js
"
},{
},
{
src
:
"
lib/jquery.hotkeys/jquery.hotkeys.js
"
,
dest
:
"
lib/jquery.hotkeys/jquery.hotkeys.min.js
"
}]
...
...
@@ -51,8 +50,8 @@ module.exports = function(grunt) {
paths
:
{
zip
:
"
empty:
"
,
adim
:
"
_build/adim
"
,
tools
:
"
_build/adim/tools
"
,
adim
:
"
_build/adim
"
,
tools
:
"
_build/adim/tools
"
,
helper
:
'
_build/adim/helper
'
}
},
...
...
@@ -146,7 +145,7 @@ module.exports = function(grunt) {
},
{
expand
:
true
,
cwd
:
"
lib/
whhg-font/
font
"
,
cwd
:
"
lib/
material-design-icons/icon
font
"
,
src
:
[
"
**
"
],
dest
:
'
../fonts/
'
},
...
...
@@ -180,6 +179,12 @@ module.exports = function(grunt) {
src
:
[
"
OpenSans-*
"
],
dest
:
'
../fonts/open-sans/
'
}
/*{
expand: true,
cwd: "lib/whhg-font/font",
src: ["**"],
dest: '../fonts/'
},*/
]
}
},
...
...
@@ -187,12 +192,12 @@ module.exports = function(grunt) {
// ===== Lessc Files =====
sass
:
{
// Task
adim
:
{
// Target
options
:
{
// Target options
style
:
'
compressed
'
},
files
:
{
// Dictionary of files
'
../css/adim.css
'
:
'
scss/adim.scss
'
,
// 'destination': 'source'
}
options
:
{
// Target options
style
:
'
compressed
'
},
files
:
{
// Dictionary of files
'
../css/adim.css
'
:
'
scss/adim.scss
'
,
// 'destination': 'source'
}
}
},
...
...
@@ -217,7 +222,8 @@ module.exports = function(grunt) {
"
../css/libs.css
"
:
[
"
lib/jquery-file-upload/css/jquery.fileupload.css
"
,
"
lib/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css
"
,
"
lib/whhg-font/css/whhg.css
"
"
lib/material-design-icons/iconfont/material-icons.css
"
//"lib/whhg-font/css/whhg.css"
]
}
}
...
...
adim_project/adim_app/static/_src/adim/env/anodate/env.js
View file @
3bbe9628
...
...
@@ -156,12 +156,18 @@ define([
ui
.
updateReservedSpace
();
ui
.
adjustCanvasToImage
();
canvasCtnr
.
css
(
"
transition
"
,
""
);
var
icon
=
$
(
"
a[href='#
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
'] .fa-chevron-circle-right
"
);
icon
.
removeClass
(
"
fa-chevron-circle-right
"
);
icon
.
addClass
(
"
fa-chevron-circle-left
"
);
})
.
on
(
'
show.bs.collapse
'
,
function
()
{
displayAltCol
(
true
);
sharedAnnotationMarkersPanel
.
appendTo
(
altSideColPanelGroup
);
ui
.
updateReservedSpace
();
ui
.
adjustCanvasToImage
();
var
icon
=
$
(
"
a[href='#
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
'] .fa-chevron-circle-left
"
);
icon
.
removeClass
(
"
fa-chevron-circle-left
"
);
icon
.
addClass
(
"
fa-chevron-circle-right
"
);
})
;
}
...
...
adim_project/adim_app/static/_src/adim/ui.js
View file @
3bbe9628
...
...
@@ -20,979 +20,1019 @@
*/
define
([
"
jquery
"
,
"
underscore
"
,
"
signals
"
,
"
paper
"
,
// ----- app
"
adim/config
"
,
"
adim/view
"
,
"
adim/io
"
,
"
adim/tools
"
,
"
adim/attributes
"
,
"
adim/users
"
,
"
helper/exporter
"
,
"
anobj-mgr/views/AnObjMgr
"
,
// ----- no module exported
"
jquery.bootstrap
"
,
"
jquery.mousewheel
"
,
"
bootstrap.colorpicker
"
,
"
bootstrap.slider
"
,
"
jquery.autoGrowInput
"
,
"
bootstrap.rating
"
,
//"FileSaver",
"
fontawesome
"
],
function
(
$
,
_
,
Signal
,
paper
,
config
,
view
,
io
,
tools
,
attributes
,
Users
,
exporter
,
AnObjMgr
)
{
// ----- Locale variables -----------------------------
var
_$w
=
$
(
window
);
var
_canvas
=
null
;
var
_canvasCtnr
=
null
;
var
_canvasToolBar
=
null
;
var
_canvasCol
=
null
;
var
_sideCol
=
null
;
var
_toolsCol
=
null
;
var
_minWind
=
false
;
var
_annotationListCtnr
=
null
;
var
_markerLabelListCtnr
=
null
;
var
_sharedMarkerLabelListCtnr
=
null
;
var
_canvasCtnrTop
;
// Attribute Widgets
var
_colorSelector
=
$
(
"
#tool-colorselect
"
);
var
_opacitySlider
;
var
_widthSlider
;
// The width needed to draw the elements, initialized in document.ready
// (tools col, layers col if applicable, margins and min canvas width)
var
_reservedWidth
=
0
;
// The height needed to draw the elements, initialized during document.ready
// (zoom-attr heights, margins)
var
_reservedHeight
=
0
;
var
_events
=
{
modeChanged
:
new
Signal
(),
saveButClick
:
new
Signal
(),
autoSaveChanged
:
new
Signal
(),
userLayerActivated
:
new
Signal
()
};
// ----- Initialisations ------------------------------
/**
* Main UI initialization, called by main.js during initialization.
* When this function is called, we can assume following:
* - document is ready
* - view.js is initialized
*
* @param params A dictionary of the signals dispatched by main.js
* used to listen to the needed signals
*
*/
function
init
(
params
)
{
var
me
=
this
;
var
_mainNavBar
=
$
(
"
#main-navbar
"
);
var
pageLoader
=
$
(
"
#page-loader
"
);
// ----- Store jQuery objects for some layout elements
_$w
=
$
(
window
);
_canvas
=
$
(
"
#my-canvas
"
);
_canvasCtnr
=
$
(
"
.canvas-container
"
);
_canvasToolBar
=
$
(
"
#canvas-bbar
"
);
_canvasCol
=
$
(
"
#canvas-col
"
);
_sideCol
=
$
(
"
#side-col
"
);
_toolsCol
=
$
(
"
#tools-col
"
);
_annotationListCtnr
=
$
(
"
#annotation-list-container
"
);
_markerLabelListCtnr
=
$
(
"
#annotation-markers-container
"
).
find
(
"
.list-group
"
);
_sharedMarkerLabelListCtnr
=
$
(
"
#shared-annotation-markers-container
"
).
find
(
"
.list-group
"
);
_canvasCtnrTop
=
_canvasCtnr
.
offset
().
top
+
_canvasToolBar
.
outerHeight
();
//$("#annotation-property-panel").remove();
//$("body").addClass("mode-"+config.mode);
//$("#mode-selector button[data-href]").click(function(event){
// event.preventDefault();
// document.location.href = $(this).data('href');
//});
//if (config.mode === config.MODE_EDIT) {
// $("#annotation-list-panel").remove();
//}
//else if (config.mode === config.MODE_REVIEW) {
//}
// ----- General Event listeners -----
// Listen to events
view
.
events
.
imageLoaded
.
add
(
function
(
evt
)
{
adjustCanvasToImage
(
evt
.
raster
);
pageLoader
.
remove
();
console
.
timeEnd
(
"
complete app
"
);
});
view
.
events
.
annotationsLoaded
.
add
(
function
()
{
zoomFitContent
();
updateUserLayers
();
_autoSave
=
true
;
io
.
setAutoSave
(
_autoSave
);
//updateSaveButState();
});
"
jquery
"
,
"
underscore
"
,
"
signals
"
,
"
paper
"
,
// ----- app
"
adim/config
"
,
"
adim/view
"
,
"
adim/io
"
,
"
adim/tools
"
,
"
adim/attributes
"
,
"
adim/users
"
,
"
helper/exporter
"
,
"
anobj-mgr/views/AnObjMgr
"
,
// ----- no module exported
"
jquery.bootstrap
"
,
"
jquery.mousewheel
"
,
"
bootstrap.colorpicker
"
,
"
bootstrap.slider
"
,
"
jquery.autoGrowInput
"
,
"
bootstrap.rating
"
,
//"FileSaver",
"
fontawesome
"
],
function
(
$
,
_
,
Signal
,
paper
,
config
,
view
,
io
,
tools
,
attributes
,
Users
,
exporter
,
AnObjMgr
)
{
// ----- Locale variables -----------------------------
var
_$w
=
$
(
window
);
var
_canvas
=
null
;
var
_canvasCtnr
=
null
;
var
_canvasToolBar
=
null
;
var
_canvasCol
=
null
;
var
_sideCol
=
null
;
var
_toolsCol
=
null
;
var
_minWind
=
false
;
var
_annotationListCtnr
=
null
;
var
_markerLabelListCtnr
=
null
;
var
_sharedMarkerLabelListCtnr
=
null
;
var
_canvasCtnrTop
;
// Attribute Widgets
var
_colorSelector
=
$
(
"
#tool-colorselect
"
);
var
_opacitySlider
;
var
_widthSlider
;
// The width needed to draw the elements, initialized in document.ready
// (tools col, layers col if applicable, margins and min canvas width)
var
_reservedWidth
=
0
;
// The height needed to draw the elements, initialized during document.ready
// (zoom-attr heights, margins)
var
_reservedHeight
=
0
;
var
_events
=
{
modeChanged
:
new
Signal
(),
saveButClick
:
new
Signal
(),
autoSaveChanged
:
new
Signal
(),
userLayerActivated
:
new
Signal
()
};
view
.
events
.
userLayerVisibilityChanged
.
add
(
onUserLayerVisChange
);
tools
.
events
.
annotationSelected
.
add
(
function
(
items
){
_
.
each
(
$
.
isArray
(
items
)
?
items
:
[
items
],
function
(
item
)
{
// ----- Update Properties Panel -----
// disable properties panel if there is no item or more than one
var
doDisplay
=
!!
item
&&
view
.
getSelectedAnnotations
().
length
===
1
;
// ----- Initialisations ------------------------------
/**
* Main UI initialization, called by main.js during initialization.
* When this function is called, we can assume following:
* - document is ready
* - view.js is initialized
*
* @param params A dictionary of the signals dispatched by main.js
* used to listen to the needed signals
*
*/
function
init
(
params
)
{
var
me
=
this
;
var
_mainNavBar
=
$
(
"
#main-navbar
"
);
var
pageLoader
=
$
(
"
#page-loader
"
);
// ----- Store jQuery objects for some layout elements
_$w
=
$
(
window
);
_canvas
=
$
(
"
#my-canvas
"
);
_canvasCtnr
=
$
(
"
.canvas-container
"
);
_canvasToolBar
=
$
(
"
#canvas-bbar
"
);
_canvasCol
=
$
(
"
#canvas-col
"
);
_sideCol
=
$
(
"
#side-col
"
);
_toolsCol
=
$
(
"
#tools-col
"
);
_annotationListCtnr
=
$
(
"
#annotation-list-container
"
);
_markerLabelListCtnr
=
$
(
"
#annotation-markers-container
"
).
find
(
"
.list-group
"
);
_sharedMarkerLabelListCtnr
=
$
(
"
#shared-annotation-markers-container
"
).
find
(
"
.list-group
"
);
_canvasCtnrTop
=
_canvasCtnr
.
offset
().
top
+
_canvasToolBar
.
outerHeight
();
//$("#annotation-property-panel").remove();
//$("body").addClass("mode-"+config.mode);
//$("#mode-selector button[data-href]").click(function(event){
// event.preventDefault();
// document.location.href = $(this).data('href');
//});
//if (config.mode === config.MODE_EDIT) {
// $("#annotation-list-panel").remove();
//}
//else if (config.mode === config.MODE_REVIEW) {
//}
// ----- General Event listeners -----
// Listen to events
view
.
events
.
imageLoaded
.
add
(
function
(
evt
)
{
adjustCanvasToImage
(
evt
.
raster
);
pageLoader
.
remove
();
console
.
timeEnd
(
"
complete app
"
);
});
// If there are multiple selected items, determine if they are all children
// of the selected annotation. If so, it can be considered as a unique selection
/*if (paper.project.getSelectedItems().length > 1) {
doDisplay = paper.project.getSelectedItems().every(function(c){
return c === item || c.parent === item
;
}
);
}*/
view
.
events
.
annotationsLoaded
.
add
(
function
()
{
zoomFitContent
();
updateUserLayers
();
_autoSave
=
true
;
io
.
setAutoSave
(
_autoSave
)
;
//updateSaveButState(
);
});
if
(
!
doDisplay
)
{
// Disable properties panel
disableProperties
(
true
);
$
(
"
*:focus
"
).
blur
();
view
.
events
.
userLayerVisibilityChanged
.
add
(
onUserLayerVisChange
);
}
else
{
// Update properties panel
displayProperties
(
item
);
// Update state of the attributes controllers in the left TB
// -- strokeWidth
var
itemStokeWidth
=
(
typeof
item
.
data
.
getStrokeWidth
===
'
function
'
)
?
item
.
data
.
getStrokeWidth
.
call
(
item
)
:
(
typeof
item
.
data
.
strokeWidth
!==
'
undefined
'
)
?
item
.
data
.
strokeWidth
:
(
typeof
item
.
strokeWidth
!==
'
undefined
'
)
?
item
.
strokeWidth
:
0
;
if
(
itemStokeWidth
)
{
_widthSlider
.
slider
(
'
setValue
'
,
itemStokeWidth
);
attributes
.
setStrokeWidth
(
itemStokeWidth
,
false
,
true
);
}
tools
.
events
.
annotationSelected
.
add
(
function
(
items
)
{
_
.
each
(
$
.
isArray
(
items
)
?
items
:
[
items
],
function
(
item
)
{
// ----- Update Properties Panel -----
// disable properties panel if there is no item or more than one
var
doDisplay
=
!!
item
&&
view
.
getSelectedAnnotations
().
length
===
1
;
// -- opacity
if
(
typeof
item
.
opacity
!==
"
undefined
"
)
{
_opacitySlider
.
slider
(
'
setValue
'
,
item
.
opacity
*
100
);
attributes
.
setOpacity
(
item
.
opacity
,
false
,
true
);
}
// If there are multiple selected items, determine if they are all children
// of the selected annotation. If so, it can be considered as a unique selection
/*if (paper.project.getSelectedItems().length > 1) {
doDisplay = paper.project.getSelectedItems().every(function(c){
return c === item || c.parent === item;
});
}*/
// -- color
var
itemColor
=
(
typeof
item
.
data
.
getColor
===
'
function
'
)
?
item
.
data
.
getColor
.
call
(
item
)
:
(
item
.
data
.
color
)
?
item
.
data
.
color
:
(
item
.
strokeColor
)
?
item
.
strokeColor
:
item
.
fillColor
;
if
(
itemColor
)
{
updateColorSelector
(
itemColor
);
attributes
.
setColor
(
itemColor
,
false
,
true
);
}
// -- isFill
var
isFill
=
(
typeof
item
.
data
.
getFill
===
'
function
'
)
?
item
.
data
.
getFill
.
call
(
item
)
:
!!
item
.
fillColor
;
$
(
"
#tool-fill-color
"
).
toggleClass
(
"
active
"
,
isFill
);
attributes
.
setFill
(
isFill
,
false
,
true
);
// -- fontSize
var
fontSize
=
(
typeof
item
.
data
.
getFontSize
===
'
function
'
)
?
item
.
data
.
getFontSize
.
call
(
item
)
:
attributes
.
getFontSize
();
$
(
"
#attr-font-size
"
).
val
(
fontSize
);
attributes
.
setFontSize
(
fontSize
,
false
,
true
);
}
if
(
!
doDisplay
)
{
// Disable properties panel
disableProperties
(
true
);
$
(
"
*:focus
"
).
blur
();
}
else
{
// Update properties panel
displayProperties
(
item
);
// Update state of the attributes controllers in the left TB
// -- strokeWidth
var
itemStokeWidth
=
(
typeof
item
.
data
.
getStrokeWidth
===
'
function
'
)
?
item
.
data
.
getStrokeWidth
.
call
(
item
)
:
(
typeof
item
.
data
.
strokeWidth
!==
'
undefined
'
)
?
item
.
data
.
strokeWidth
:
(
typeof
item
.
strokeWidth
!==
'
undefined
'
)
?
item
.
strokeWidth
:
0
;
if
(
itemStokeWidth
)
{
_widthSlider
.
slider
(
'
setValue
'
,
itemStokeWidth
);
attributes
.
setStrokeWidth
(
itemStokeWidth
,
false
,
true
);
}
// Update User Layer panel
if
(
item
&&
item
.
layer
)
{
var
id
=
item
.
layer
.
id
;
var
annotationLayerListItem
=
$
(
"
#annotation-list-container .list-group-item
"
).
filter
(
function
(
i
,
n
)
{
return
(
$
(
n
).
data
(
'
layerId
'
)
==
id
);
}
);
selectLayerListItem
(
annotationLayerListItem
,
false
);
}
});
});
// -- opacity
if
(
typeof
item
.
opacity
!==
"
undefined
"
)
{
_opacitySlider
.
slider
(
'
setValue
'
,
item
.
opacity
*
100
);
attributes
.
setOpacity
(
item
.
opacity
,
false
,
true
);
}
io
.
events
.
loadingError
.
add
(
function
(
err
)
{
if
(
pageLoader
.
length
)
{
pageLoader
.
html
(
'
<div class="text-danger lead">Erreur de chargement</div>
'
+
'
<div class="text-danger">
'
+
err
.
msg
+
'
</div>
'
);
}
else
{
var
alert
=
$
(
'
<div class="alert alert-danger in">
'
+
'
<button data-dismiss="alert" class="close" type="button">×</button>
'
+
'
<h4>Erreur de chargement</h4>
'
+
'
<p>
'
+
err
.
msg
+
'
</p>
'
+
'
</div>
'
);
// -- color
var
itemColor
=
(
typeof
item
.
data
.
getColor
===
'
function
'
)
?
item
.
data
.
getColor
.
call
(
item
)
:
(
item
.
data
.
color
)
?
item
.
data
.
color
:
(
item
.
strokeColor
)
?
item
.
strokeColor
:
item
.
fillColor
;
if
(
itemColor
)
{
updateColorSelector
(
itemColor
);
attributes
.
setColor
(
itemColor
,
false
,
true
);
}
$
(
"
#main
"
).
prepend
(
alert
.
alert
());
}
});
// -- isFill
var
isFill
=
(
typeof
item
.
data
.
getFill
===
'
function
'
)
?
item
.
data
.
getFill
.
call
(
item
)
:
!!
item
.
fillColor
;
$
(
"
#tool-fill-color
"
).
toggleClass
(
"
active
"
,
isFill
);
attributes
.
setFill
(
isFill
,
false
,
true
);
// -- fontSize
var
fontSize
=
(
typeof
item
.
data
.
getFontSize
===
'
function
'
)
?
item
.
data
.
getFontSize
.
call
(
item
)
:
attributes
.
getFontSize
();
$
(
"
#attr-font-size
"
).
val
(
fontSize
);
attributes
.
setFontSize
(
fontSize
,
false
,
true
);
}
// Minify mainNavBar if needed
_minWind
=
params
.
minWind
;
if
(
_minWind
)
{
_mainNavBar
.
hide
();
}
// Update User Layer panel
if
(
item
&&
item
.
layer
)
{
var
id
=
item
.
layer
.
id
;
var
annotationLayerListItem
=
$
(
"
#annotation-list-container .list-group-item
"
).
filter
(
function
(
i
,
n
)
{
return
(
$
(
n
).
data
(
'
layerId
'
)
==
id
);
}
);
selectLayerListItem
(
annotationLayerListItem
,
false
);
}
});
});
io
.
events
.
loadingError
.
add
(
function
(
err
)
{
if
(
pageLoader
.
length
)
{
pageLoader
.
html
(
'
<div class="text-danger lead">Erreur de chargement</div>
'
+
'
<div class="text-danger">
'
+
err
.
msg
+
'
</div>
'
);
}
else
{
var
alert
=
$
(
'
<div class="alert alert-danger in">
'
+
'
<button data-dismiss="alert" class="close" type="button">×</button>
'
+
'
<h4>Erreur de chargement</h4>
'
+
'
<p>
'
+
err
.
msg
+
'
</p>
'
+
'
</div>
'
);
// AAI SLO
if
(
config
.
aai
&&
config
.
aai
.
slo
&&
config
.
user
&&
config
.
user
.
shibboleth
)
{
$
(
"
#adim-logout-but
"
).
click
(
function
(
event
)
{
event
.
preventDefault
();
var
logout_url
=
$
(
this
).
attr
(
"
href
"
);
$
(
"
<iframe>
"
,
{
src
:
config
.
aai
.
urls
.
sp_logout
}).
appendTo
(
"
body
"
).
hide
();
$
(
"
<iframe>
"
,
{
src
:
config
.
aai
.
urls
.
idp_logout
}).
appendTo
(
"
body
"
).
hide
();
setTimeout
(
function
()
{
window
.
document
.
location
.
href
=
logout_url
;
},
500
);
$
(
"
#main
"
).
prepend
(
alert
.
alert
());
}
});
}
var
_autoSave
=
io
.
getAutoSave
();
//var saveBut = $("#save-but");
//var autoSaveBut = $("#autosave-but");
//saveBut.click(function(){
// io.saveUserAnnotations();
// _events.saveButClick.dispatch();
//});
// Minify mainNavBar if needed
_minWind
=
params
.
minWind
;
if
(
_minWind
)
{
_mainNavBar
.
hide
();
}
//autoSaveBut.click(function(){
// toggleAutoSaveMode();
// updateSaveButState();
//});
//
//function toggleAutoSaveMode(autoSave) {
// if (typeof autoSave !== 'boolean')
// autoSave = !_autoSave;
//
// io.setAutoSave(autoSave);
// _events.autoSaveChanged.dispatch(autoSave);
// _autoSave = autoSave;
//}
//function updateSaveButState() {
// if (_autoSave) {
// saveBut.attr("disabled", "disabled");
// autoSaveBut
// .addClass("active btn-success")
// .removeClass("btn-primary");