Gitlab CSE Unil

Commit a2d3307a authored by M. Chardon's avatar M. Chardon
Browse files

Merge branch 'javascript' into 'master'

Javascript

See merge request !1
parents cf1fc902 03bb6268
...@@ -16,8 +16,6 @@ from jsonfield import JSONField ...@@ -16,8 +16,6 @@ from jsonfield import JSONField
# from sorl.thumbnail import ImageField, get_thumbnail # from sorl.thumbnail import ImageField, get_thumbnail
from eav.models import BaseSchema, BaseAttribute, BaseChoice
from adim_utils.decorators import cache from adim_utils.decorators import cache
# __all__ = ('AOType', 'AOSchema', 'AOChoice', 'AOAttribute', 'AnObj', 'AnObjMembership', 'EnvParam') # __all__ = ('AOType', 'AOSchema', 'AOChoice', 'AOAttribute', 'AnObj', 'AnObjMembership', 'EnvParam')
...@@ -121,11 +119,6 @@ class AnObj(models.Model): ...@@ -121,11 +119,6 @@ class AnObj(models.Model):
_thumb_url = models.CharField(max_length=512, blank=True, null=True) _thumb_url = models.CharField(max_length=512, blank=True, null=True)
# ----- eav attributes
# ao_type = models.ForeignKey(AOType, verbose_name="type", blank=True, null=True)
# attrs = generic.GenericRelation(AOAttribute, object_id_field='entity_id',
# content_type_field='entity_type')
class Meta: class Meta:
app_label = "adim" app_label = "adim"
verbose_name = "Annotable Object" verbose_name = "Annotable Object"
......
...@@ -122,7 +122,7 @@ module.exports = function(grunt) { ...@@ -122,7 +122,7 @@ module.exports = function(grunt) {
files: [ files: [
{ {
expand: true, expand: true,
cwd: "lib/jujug42-bootstrap-colorpicker/dist/img/", cwd: "lib/bootstrap-colorpicker/dist/img/",
src: ["**"], src: ["**"],
dest: '../img/' dest: '../img/'
}, },
...@@ -179,21 +179,25 @@ module.exports = function(grunt) { ...@@ -179,21 +179,25 @@ module.exports = function(grunt) {
cwd: "fonts/open-sans", cwd: "fonts/open-sans",
src: ["OpenSans-*"], src: ["OpenSans-*"],
dest: '../fonts/open-sans/' dest: '../fonts/open-sans/'
},
{
expand: true,
cwd: "lib/zeroclipboard/dist",
src: ["ZeroClipboard.swf"],
dest: '../assets/'
} }
] ]
} }
}, },
// ===== Lessc Files ===== // ===== Lessc Files =====
sass: { // Task
adim: { // Target
options: { // Target options
style: 'compressed'
},
files: { // Dictionary of files
'../css/adim.css': 'scss/adim.scss', // 'destination': 'source'
}
}
},
less: { less: {
adim: { /*adim: {
// @TODO
options: { options: {
relativeUrls: false, relativeUrls: false,
compress: true compress: true
...@@ -201,7 +205,7 @@ module.exports = function(grunt) { ...@@ -201,7 +205,7 @@ module.exports = function(grunt) {
files: { files: {
"../css/adim.css": "less/adim.less" "../css/adim.css": "less/adim.less"
} }
}, },*/
libs: { libs: {
// Compress and rewrite 'src' attributes of third party css (found in lib) // Compress and rewrite 'src' attributes of third party css (found in lib)
// The concat:libs task should be called after this to include the bootstrap's css // The concat:libs task should be called after this to include the bootstrap's css
...@@ -212,8 +216,7 @@ module.exports = function(grunt) { ...@@ -212,8 +216,7 @@ module.exports = function(grunt) {
files: { files: {
"../css/libs.css": [ "../css/libs.css": [
"lib/jquery-file-upload/css/jquery.fileupload.css", "lib/jquery-file-upload/css/jquery.fileupload.css",
"lib/jujug42-bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css", "lib/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css",
"lib/bootstrap-spinedit/css/bootstrap-spinedit.css",
"lib/whhg-font/css/whhg.css" "lib/whhg-font/css/whhg.css"
] ]
} }
...@@ -246,6 +249,7 @@ module.exports = function(grunt) { ...@@ -246,6 +249,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
...@@ -253,7 +257,7 @@ module.exports = function(grunt) { ...@@ -253,7 +257,7 @@ module.exports = function(grunt) {
// Optimize third party libraries. // Optimize third party libraries.
// This has to be called when there is a modification at the libraries level // This has to be called when there is a modification at the libraries level
grunt.registerTask('libs', ['copy:libs', 'less:libs', 'concat:libs', 'less:adim']); grunt.registerTask('libs', ['copy:libs', 'less:libs', 'concat:libs', 'sass:adim', 'concat:adim']);
// Build main app // Build main app
grunt.registerTask('build app', ['uglify:adim', 'requirejs']); grunt.registerTask('build app', ['uglify:adim', 'requirejs']);
......
...@@ -94,20 +94,33 @@ define([ ...@@ -94,20 +94,33 @@ define([
// Init Side Col Panel layout // Init Side Col Panel layout
var sideCol = $("#side-col"), var sideCol = $("#side-col"),
canvasCtnr = $(".canvas-container"), canvasCtnr = $(".canvas-container"),
canvasCol = $("#canvas-col"),
sideColPanelGroup = $("#side-col-panel-group"), sideColPanelGroup = $("#side-col-panel-group"),
altSideColPanelGroup = $("#alt-side-col-panel-group"), altSideColPanelGroup = $("#alt-side-col-panel-group"),
sharedAnnotationMarkersPanel = $("#shared-annotation-markers-panel"); sharedAnnotationMarkersPanel = $("#shared-annotation-markers-panel");
function displayAltCol(show) { function displayAltCol(show) {
sideCol.toggleClass("col-sm-1", !show) //sideCol.toggleClass("col-sm-1", !show)
.toggleClass("col-sm-2", show); // .toggleClass("col-sm-2", show);
altSideColPanelGroup.toggleClass("hidden", !show); sideCol.toggleClass("w-25", show);
sideColPanelGroup.toggleClass("col-xs-12", !show) sideCol.toggleClass("default", !show);
.toggleClass("col-xs-6", show); canvasCol.toggleClass("w-100", !show);
if (!show) {
altSideColPanelGroup.hide();
} else {
altSideColPanelGroup.show();
}
//altSideColPanelGroup.toggleClass("hidden", !show);
sideColPanelGroup.toggleClass("w-50", show);
sideColPanelGroup.toggleClass("w-100", !show);
} }
function displayAltColAndLabels(show) { function displayAltColAndLabels(show) {
displayAltCol(show && sharedAnnotationMarkersPanel.find(".panel-collapse").hasClass("in")); displayAltCol(show && sharedAnnotationMarkersPanel.find(".collapse").hasClass("show"));
sharedAnnotationMarkersPanel.toggleClass("hidden", !show); if (!show) {
sharedAnnotationMarkersPanel.hide();
} else {
sharedAnnotationMarkersPanel.show();
}
} }
displayAltColAndLabels(params.mode === 'review'); displayAltColAndLabels(params.mode === 'review');
...@@ -118,7 +131,7 @@ define([ ...@@ -118,7 +131,7 @@ define([
ui.adjustCanvasToImage(); ui.adjustCanvasToImage();
}); });
sharedAnnotationMarkersPanel.find(".panel-collapse") sharedAnnotationMarkersPanel.find(".collapse")
.on('hidden.bs.collapse', function () { .on('hidden.bs.collapse', function () {
canvasCtnr.css("transition", 'width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s'); canvasCtnr.css("transition", 'width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s');
sharedAnnotationMarkersPanel.prependTo(sideColPanelGroup); sharedAnnotationMarkersPanel.prependTo(sideColPanelGroup);
......
...@@ -57,20 +57,14 @@ define([ ...@@ -57,20 +57,14 @@ define([
event: "keydown", event: "keydown",
//ctxt: "*", //ctxt: "*",
fn: function(){ fn: function(){
if (!activeTool) { $("#tool-pan").click();
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
return false; return false;
} }
}, { }, {
event: "keyup", event: "keyup",
//ctxt: "*", //ctxt: "*",
fn: function(){ fn: function(){
if (activeTool) { $("#tool-pan").click();
tools.activateTool(activeTool);
activeTool = null;
}
return false; return false;
} }
}], }],
...@@ -80,7 +74,7 @@ define([ ...@@ -80,7 +74,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('select'); $("#tool-select").click();
return false; return false;
} }
}], }],
...@@ -105,7 +99,7 @@ define([ ...@@ -105,7 +99,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('drawing'); $("#tool-drawing").click();
return false; return false;
} }
}], }],
...@@ -116,7 +110,7 @@ define([ ...@@ -116,7 +110,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('arrow'); $("#tool-arrow").click();
return false; return false;
} }
}], }],
...@@ -127,7 +121,7 @@ define([ ...@@ -127,7 +121,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('lines'); $("#tool-lines").click();
return false; return false;
} }
}], }],
...@@ -137,7 +131,7 @@ define([ ...@@ -137,7 +131,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('ellipse'); $("#tool-ellipse").click();
return false; return false;
} }
}], }],
...@@ -147,7 +141,7 @@ define([ ...@@ -147,7 +141,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('rectangle'); $("#tool-rectangle").click();
return false; return false;
} }
}], }],
...@@ -157,7 +151,7 @@ define([ ...@@ -157,7 +151,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('text'); $("#tool-text").click();
return false; return false;
} }
}] }]
......
...@@ -57,20 +57,14 @@ define([ ...@@ -57,20 +57,14 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit review", ctxt: "edit review",
fn: function(){ fn: function(){
if (!activeTool) { $("#tool-pan").click();
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
return false; return false;
} }
}, { }, {
event: "keyup", event: "keyup",
ctxt: "edit review", ctxt: "edit review",
fn: function(){ fn: function(){
if (activeTool) { $("#tool-pan").click();
tools.activateTool(activeTool);
activeTool = null;
}
return false; return false;
} }
}], }],
...@@ -90,7 +84,7 @@ define([ ...@@ -90,7 +84,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('select'); $("#tool-select").click();
return false; return false;
} }
}], }],
...@@ -117,7 +111,7 @@ define([ ...@@ -117,7 +111,7 @@ define([
fn: function () { fn: function () {
if ($("#tool-concordantstr").is(":disabled")) if ($("#tool-concordantstr").is(":disabled"))
return false; return false;
tools.activateTool('concordantstr'); $("#tool-concordantstr").click();
return false; return false;
} }
},{ },{
...@@ -138,7 +132,7 @@ define([ ...@@ -138,7 +132,7 @@ define([
fn: function(){ fn: function(){
if ($("#tool-discordantstr").is(":disabled")) if ($("#tool-discordantstr").is(":disabled"))
return false; return false;
tools.activateTool('discordantstr'); $("#tool-discordantstr").click();
return false; return false;
} }
},{ },{
...@@ -167,7 +161,7 @@ define([ ...@@ -167,7 +161,7 @@ define([
fn: function(){ fn: function(){
if ($("#tool-fieldedges").is(":disabled")) if ($("#tool-fieldedges").is(":disabled"))
return false; return false;
tools.activateTool('fieldedges'); $("#tool-fieldedges").click();
return false; return false;
} }
}], }],
...@@ -186,7 +180,7 @@ define([ ...@@ -186,7 +180,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('arrow'); $("#tool-arrow").click();
return false; return false;
} }
}], }],
...@@ -213,14 +207,14 @@ define([ ...@@ -213,14 +207,14 @@ define([
// T -> [edit]:activate text tool // T -> [edit]:activate text tool
't': [{ /*'t': [{
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('text'); $("#tool-text").click();
return false; return false;
} }
}], }],*/
// Z -> [edit]:activate zone tool // Z -> [edit]:activate zone tool
...@@ -230,7 +224,7 @@ define([ ...@@ -230,7 +224,7 @@ define([
fn: function(){ fn: function(){
if ($("#tool-cmsarea").is(":disabled")) if ($("#tool-cmsarea").is(":disabled"))
return false; return false;
tools.activateTool('cmsarea'); $("#tool-cmsarea").click();
return false; return false;
} }
}], }],
......
...@@ -46,11 +46,11 @@ define([ ...@@ -46,11 +46,11 @@ define([
var mode = opts.mode; var mode = opts.mode;
if (mode === 'edit') { if (mode === 'edit') {
$("#annotation-display-panel").hide(); $("#annotation-display-panel").hide();
$("div.property-group").show(); $("#annotation-property-container .property-group").show();
} else if (mode === 'review') { } else if (mode === 'review') {
$("#annotation-display-panel").show(); $("#annotation-display-panel").show();
$("div.property-group").hide(); $("#annotation-property-container .property-group").hide();
$("div.comment-prop").show(); $("#annotation-property-container .comment-prop").show();
} }
}); });
} }
...@@ -94,8 +94,8 @@ define([ ...@@ -94,8 +94,8 @@ define([
sharedAnnotationMarkersPanel = $("#shared-annotation-markers-panel"); sharedAnnotationMarkersPanel = $("#shared-annotation-markers-panel");
function displayAltCol(show) { function displayAltCol(show) {
sideCol.toggleClass("col-sm-1", !show) //sideCol.toggleClass("col-sm-1", !show)
.toggleClass("col-sm-2", show); // .toggleClass("col-sm-2", show);
altSideColPanelGroup.toggleClass("hidden", !show); altSideColPanelGroup.toggleClass("hidden", !show);
sideColPanelGroup.toggleClass("col-xs-12", !show) sideColPanelGroup.toggleClass("col-xs-12", !show)
.toggleClass("col-xs-6", show); .toggleClass("col-xs-6", show);
......
...@@ -57,20 +57,7 @@ define([ ...@@ -57,20 +57,7 @@ define([
event: "keydown", event: "keydown",
//ctxt: "*", //ctxt: "*",
fn: function(){ fn: function(){
if (!activeTool) { $("#tool-pan").click();
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
return false;
}
}, {
event: "keyup",
//ctxt: "*",
fn: function(){
if (activeTool) {
tools.activateTool(activeTool);
activeTool = null;
}
return false; return false;
} }
}], }],
...@@ -80,7 +67,7 @@ define([ ...@@ -80,7 +67,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('select'); $("#tool-select").click();
return false; return false;
} }
}], }],
...@@ -105,7 +92,7 @@ define([ ...@@ -105,7 +92,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('drawinggeo'); $("#tool-drawing").click();
return false; return false;
} }
}], }],
...@@ -116,7 +103,7 @@ define([ ...@@ -116,7 +103,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('arrowgeo'); $("#tool-arrow").click();
return false; return false;
} }
}], }],
...@@ -127,7 +114,7 @@ define([ ...@@ -127,7 +114,7 @@ define([
event: "keydown", event: "keydown",
ctxt: "edit", ctxt: "edit",
fn: function(){ fn: function(){
tools.activateTool('linesgeo'); $("#tool-lines").click();
return false;