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
# from sorl.thumbnail import ImageField, get_thumbnail
from eav.models import BaseSchema, BaseAttribute, BaseChoice
from adim_utils.decorators import cache
# __all__ = ('AOType', 'AOSchema', 'AOChoice', 'AOAttribute', 'AnObj', 'AnObjMembership', 'EnvParam')
......@@ -121,11 +119,6 @@ class AnObj(models.Model):
_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:
app_label = "adim"
verbose_name = "Annotable Object"
......
......@@ -122,7 +122,7 @@ module.exports = function(grunt) {
files: [
{
expand: true,
cwd: "lib/jujug42-bootstrap-colorpicker/dist/img/",
cwd: "lib/bootstrap-colorpicker/dist/img/",
src: ["**"],
dest: '../img/'
},
......@@ -179,21 +179,25 @@ module.exports = function(grunt) {
cwd: "fonts/open-sans",
src: ["OpenSans-*"],
dest: '../fonts/open-sans/'
},
{
expand: true,
cwd: "lib/zeroclipboard/dist",
src: ["ZeroClipboard.swf"],
dest: '../assets/'
}
]
}
},
// ===== Lessc Files =====
sass: { // Task
adim: { // Target
options: { // Target options
style: 'compressed'
},
files: { // Dictionary of files
'../css/adim.css': 'scss/adim.scss', // 'destination': 'source'
}
}
},
less: {
adim: {
// @TODO
/*adim: {
options: {
relativeUrls: false,
compress: true
......@@ -201,7 +205,7 @@ module.exports = function(grunt) {
files: {
"../css/adim.css": "less/adim.less"
}
},
},*/
libs: {
// 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
......@@ -212,8 +216,7 @@ module.exports = function(grunt) {
files: {
"../css/libs.css": [
"lib/jquery-file-upload/css/jquery.fileupload.css",
"lib/jujug42-bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css",
"lib/bootstrap-spinedit/css/bootstrap-spinedit.css",
"lib/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css",
"lib/whhg-font/css/whhg.css"
]
}
......@@ -246,6 +249,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
......@@ -253,7 +257,7 @@ module.exports = function(grunt) {
// Optimize third party libraries.
// 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
grunt.registerTask('build app', ['uglify:adim', 'requirejs']);
......
......@@ -94,20 +94,33 @@ define([
// Init Side Col Panel layout
var sideCol = $("#side-col"),
canvasCtnr = $(".canvas-container"),
canvasCol = $("#canvas-col"),
sideColPanelGroup = $("#side-col-panel-group"),
altSideColPanelGroup = $("#alt-side-col-panel-group"),
sharedAnnotationMarkersPanel = $("#shared-annotation-markers-panel");
function displayAltCol(show) {
sideCol.toggleClass("col-sm-1", !show)
.toggleClass("col-sm-2", show);
altSideColPanelGroup.toggleClass("hidden", !show);
sideColPanelGroup.toggleClass("col-xs-12", !show)
.toggleClass("col-xs-6", show);
//sideCol.toggleClass("col-sm-1", !show)
// .toggleClass("col-sm-2", show);
sideCol.toggleClass("w-25", show);
sideCol.toggleClass("default", !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) {
displayAltCol(show && sharedAnnotationMarkersPanel.find(".panel-collapse").hasClass("in"));
sharedAnnotationMarkersPanel.toggleClass("hidden", !show);
displayAltCol(show && sharedAnnotationMarkersPanel.find(".collapse").hasClass("show"));
if (!show) {
sharedAnnotationMarkersPanel.hide();
} else {
sharedAnnotationMarkersPanel.show();
}
}
displayAltColAndLabels(params.mode === 'review');
......@@ -118,7 +131,7 @@ define([
ui.adjustCanvasToImage();
});
sharedAnnotationMarkersPanel.find(".panel-collapse")
sharedAnnotationMarkersPanel.find(".collapse")
.on('hidden.bs.collapse', function () {
canvasCtnr.css("transition", 'width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s');
sharedAnnotationMarkersPanel.prependTo(sideColPanelGroup);
......
......@@ -57,20 +57,14 @@ define([
event: "keydown",
//ctxt: "*",
fn: function(){
if (!activeTool) {
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
$("#tool-pan").click();
return false;
}
}, {
event: "keyup",
//ctxt: "*",
fn: function(){
if (activeTool) {
tools.activateTool(activeTool);
activeTool = null;
}
$("#tool-pan").click();
return false;
}
}],
......@@ -80,7 +74,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('select');
$("#tool-select").click();
return false;
}
}],
......@@ -105,7 +99,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('drawing');
$("#tool-drawing").click();
return false;
}
}],
......@@ -116,7 +110,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('arrow');
$("#tool-arrow").click();
return false;
}
}],
......@@ -127,7 +121,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('lines');
$("#tool-lines").click();
return false;
}
}],
......@@ -137,7 +131,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('ellipse');
$("#tool-ellipse").click();
return false;
}
}],
......@@ -147,7 +141,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('rectangle');
$("#tool-rectangle").click();
return false;
}
}],
......@@ -157,7 +151,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('text');
$("#tool-text").click();
return false;
}
}]
......
......@@ -57,20 +57,14 @@ define([
event: "keydown",
ctxt: "edit review",
fn: function(){
if (!activeTool) {
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
$("#tool-pan").click();
return false;
}
}, {
event: "keyup",
ctxt: "edit review",
fn: function(){
if (activeTool) {
tools.activateTool(activeTool);
activeTool = null;
}
$("#tool-pan").click();
return false;
}
}],
......@@ -90,7 +84,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('select');
$("#tool-select").click();
return false;
}
}],
......@@ -117,7 +111,7 @@ define([
fn: function () {
if ($("#tool-concordantstr").is(":disabled"))
return false;
tools.activateTool('concordantstr');
$("#tool-concordantstr").click();
return false;
}
},{
......@@ -138,7 +132,7 @@ define([
fn: function(){
if ($("#tool-discordantstr").is(":disabled"))
return false;
tools.activateTool('discordantstr');
$("#tool-discordantstr").click();
return false;
}
},{
......@@ -167,7 +161,7 @@ define([
fn: function(){
if ($("#tool-fieldedges").is(":disabled"))
return false;
tools.activateTool('fieldedges');
$("#tool-fieldedges").click();
return false;
}
}],
......@@ -186,7 +180,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('arrow');
$("#tool-arrow").click();
return false;
}
}],
......@@ -213,14 +207,14 @@ define([
// T -> [edit]:activate text tool
't': [{
/*'t': [{
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('text');
$("#tool-text").click();
return false;
}
}],
}],*/
// Z -> [edit]:activate zone tool
......@@ -230,7 +224,7 @@ define([
fn: function(){
if ($("#tool-cmsarea").is(":disabled"))
return false;
tools.activateTool('cmsarea');
$("#tool-cmsarea").click();
return false;
}
}],
......
......@@ -46,11 +46,11 @@ define([
var mode = opts.mode;
if (mode === 'edit') {
$("#annotation-display-panel").hide();
$("div.property-group").show();
$("#annotation-property-container .property-group").show();
} else if (mode === 'review') {
$("#annotation-display-panel").show();
$("div.property-group").hide();
$("div.comment-prop").show();
$("#annotation-property-container .property-group").hide();
$("#annotation-property-container .comment-prop").show();
}
});
}
......@@ -94,8 +94,8 @@ define([
sharedAnnotationMarkersPanel = $("#shared-annotation-markers-panel");
function displayAltCol(show) {
sideCol.toggleClass("col-sm-1", !show)
.toggleClass("col-sm-2", show);
//sideCol.toggleClass("col-sm-1", !show)
// .toggleClass("col-sm-2", show);
altSideColPanelGroup.toggleClass("hidden", !show);
sideColPanelGroup.toggleClass("col-xs-12", !show)
.toggleClass("col-xs-6", show);
......
......@@ -57,20 +57,7 @@ define([
event: "keydown",
//ctxt: "*",
fn: function(){
if (!activeTool) {
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
return false;
}
}, {
event: "keyup",
//ctxt: "*",
fn: function(){
if (activeTool) {
tools.activateTool(activeTool);
activeTool = null;
}
$("#tool-pan").click();
return false;
}
}],
......@@ -80,7 +67,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('select');
$("#tool-select").click();
return false;
}
}],
......@@ -105,7 +92,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('drawinggeo');
$("#tool-drawing").click();
return false;
}
}],
......@@ -116,7 +103,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('arrowgeo');
$("#tool-arrow").click();
return false;
}
}],
......@@ -127,7 +114,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('linesgeo');
$("#tool-lines").click();
return false;
}
}],
......@@ -137,7 +124,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('ellipsegeo');
$("#tool-ellipse").click();
return false;
}
}],
......@@ -147,7 +134,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('rectanglegeo');
$("#tool-rectangle").click();
return false;
}
}],
......@@ -157,7 +144,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('textgeo');
$("#tool-text").click();
return false;
}
}]
......
......@@ -57,20 +57,14 @@ define([
event: "keydown",
//ctxt: "*",
fn: function(){
if (!activeTool) {
activeTool = tools.getActiveTool();
tools.activateTool('pan');
}
$("#tool-pan").click();
return false;
}
}, {
event: "keyup",
//ctxt: "*",
fn: function(){
if (activeTool) {
tools.activateTool(activeTool);
activeTool = null;
}
$("#tool-pan").click();
return false;
}
}],
......@@ -80,7 +74,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('select');
$("#tool-select").click();
return false;
}
}],
......@@ -105,7 +99,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('drawing');
$("#tool-drawing").click();
return false;
}
}],
......@@ -116,7 +110,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('arrow');
$("#tool-arrow").click();
return false;
}
}],
......@@ -127,7 +121,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('lines');
$("#tool-lines").click();
return false;
}
}],
......@@ -137,7 +131,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('ellipse');
$("#tool-ellipse").click();
return false;
}
}],
......@@ -147,7 +141,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('rectangle');
$("#tool-rectangle").click();
return false;
}
}],
......@@ -157,7 +151,7 @@ define([
event: "keydown",
ctxt: "edit",
fn: function(){
tools.activateTool('text');
$("#tool-text").click();
return false;
}
}]
......
......@@ -5,8 +5,8 @@
$.fn.rating = function (cmd) {
var element;
var classActive = 'label label-warning rating-on'; //'glyphicon glyphicon-star';
var classInactive = 'label label-default rating-off'; //'glyphicon glyphicon-star-empty';
var classActive = 'badge badge-warning rating-on p-2'; //'glyphicon glyphicon-star';
var classInactive = 'badge badge-secondary rating-off p-2'; //'glyphicon glyphicon-star-empty';
// A private function to highlight a star corresponding to a given value
function _paintValue(ratingInput, value) {
......@@ -51,7 +51,7 @@
if (clearable) {
stars += [
' <a class="rating-clear" style="display:none;" href="javascript:void">',
'<span class="glyphicon glyphicon-remove"></span> ',
'<span class="fa fa-times"></span> ',
clearable,
'</a>'].join('');
}
......
......@@ -5,7 +5,7 @@ define([
"adim/view",
"adim/config",
"canvasToBlob"
//"canvasToBlob"
], function ($, paper, saveAs, view, config) {
var zipLoaded = false;
......@@ -171,6 +171,7 @@ define([
}
paper.view.center = ts.multiply(0.5);
paper.view.draw();
paper.view.element.toBlob(function(blob){
// // Useless overhead as not used...
......
......@@ -98,9 +98,8 @@ function($){
},
start: function() {
// params.clearAlert();
$alert.find("[class^=adim-fu-error-]").addClass("hide").end()
.addClass("hide");
$progBar.closest('.progress-wrapper').removeClass("hide");
$alert.find("[class^=adim-fu-error-]").hide();
$progBar.closest('.progress-wrapper').show();
$('#fileupload').fileupload('disable');
$(document).on('drop dragover', preventDragOver);
if (typeof params.onStart === 'function') {
......@@ -123,9 +122,9 @@ function($){
processfail: function(e, data) {
var error = data.files[data.index].error;
// params.showAlert(error);
$alert.find("[class^=adim-fu-error-]").addClass("hide");
$alert.removeClass("hide")
.find(".adim-fu-error-" + error).removeClass("hide");
$alert.find("[class^=adim-fu-error-]").hide();
$alert.show()
.find(".adim-fu-error-" + error).show();
$(document).off('drop dragover', preventDragOver);
$('#fileupload').fileupload('enable');
......
......@@ -30,9 +30,9 @@ define(['jquery'], function($){