Gitlab CSE Unil

Commit 6ae9e75a authored by M. Chardon's avatar M. Chardon
Browse files

modif affichage bouton : utilisation boostrap et fa

parent bbc556d3
......@@ -4619,7 +4619,7 @@ Y.Base.modifyAttrs(DROPDOWN, {
M.assignfeedback_editpdfplus = M.assignfeedback_editpdfplus || {};
M.assignfeedback_editpdfplus.dropdown = DROPDOWN;
var COLOURPICKER_NAME = "Colourpicker",
COLOURPICKER;
COLOURPICKER;
/**
* Provides an in browser PDF editor.
......@@ -4636,7 +4636,7 @@ var COLOURPICKER_NAME = "Colourpicker",
* @constructor
* @extends M.assignfeedback_editpdfplus.dropdown
*/
COLOURPICKER = function(config) {
COLOURPICKER = function (config) {
COLOURPICKER.superclass.constructor.apply(this, [config]);
};
......@@ -4648,18 +4648,36 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @method initializer
* @return void
*/
initializer : function(config) {
initializer: function (config) {
var colourlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdfplus_menu"/>'),
body;
body;
var iconGoutte;
// Build a list of coloured buttons.
Y.each(this.get('colours'), function(rgb, colour) {
var button, listitem, title, img, iconname;
Y.each(this.get('colours'), function (rgb, colour) {
var button, listitem, title;
title = M.util.get_string(colour, 'assignfeedback_editpdfplus');
iconname = this.get('iconprefix') + colour;
img = M.util.image_url(iconname, 'assignfeedback_editpdfplus');
button = Y.Node.create('<button><img alt="' + title + '" src="' + img + '"/></button>');
//iconname = this.get('iconprefix') + colour;
//img = M.util.image_url(iconname, 'assignfeedback_editpdfplus');
//button = Y.Node.create('<button><img alt="' + title + '" src="' + img + '"/></button>');
if (colour === "white" || colour === "yellowlemon") {
iconGoutte = Y.Node.create('<span class="fa-stack fa-lg">'
+ '<i class="fa fa-square fa-stack-2x" style="color:#E3E3E3;"></i>'
+ '<i class="fa fa-tint fa-stack-1x fa-inverse" aria-hidden="true" '
+ 'style="color:' + rgb + ';">'
+ '</i>'
+ '</span>');
} else {
iconGoutte = Y.Node.create('<span class="fa-stack fa-lg">'
+ '<i class="fa fa-square-o fa-stack-2x" style="color:#E3E3E3;"></i>'
+ '<i class="fa fa-tint fa-stack-1x" aria-hidden="true" '
+ 'style="color:' + rgb + ';">'
+ '</i>'
+ '</span>');
}
button = Y.Node.create('<button class="btn btn-default btn-sm" type="button"></button>');
button.append(iconGoutte);
button.setAttribute('data-colour', colour);
button.setAttribute('data-rgb', rgb);
button.setStyle('backgroundImage', 'none');
......@@ -4683,12 +4701,12 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
COLOURPICKER.superclass.initializer.call(this, config);
},
callback_handler : function(e) {
callback_handler: function (e) {
e.preventDefault();
var callback = this.get('callback'),
callbackcontext = this.get('context'),
bind;
callbackcontext = this.get('context'),
bind;
this.hide();
......@@ -4698,8 +4716,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
bind();
}
}, {
NAME : COLOURPICKER_NAME,
ATTRS : {
NAME: COLOURPICKER_NAME,
ATTRS: {
/**
* The list of colours this colour picker supports.
*
......@@ -4707,8 +4725,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type {String: String} (The keys of the array are the colour names and the values are localized strings)
* @default {}
*/
colours : {
value : {}
colours: {
value: {}
},
/**
......@@ -4718,8 +4736,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type function
* @default null
*/
callback : {
value : null
callback: {
value: null
},
/**
......@@ -4729,8 +4747,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type Y.Node
* @default null
*/
context : {
value : null
context: {
value: null
},
/**
......@@ -4740,8 +4758,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type String
* @default 'colour_'
*/
iconprefix : {
value : 'colour_'
iconprefix: {
value: 'colour_'
}
}
});
......@@ -5001,7 +5019,24 @@ EDITOR.prototype = {
var button, imgurl;
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdfplus');
button.one('img').setAttribute('src', imgurl);
//button.one('img').setAttribute('src', imgurl);
if (this.currentedit.annotationcolour === "white") {
button.one('i').setStyle('color', this.currentedit.annotationcolour);
button.setStyle('background-color', '#EEEEEE');
} else {
switch (this.currentedit.annotationcolour) {
case "yellowlemon":
button.one('i').setStyle('color', "#fff44f");
break;
case "yellow":
button.one('i').setStyle('color', "rgb(255,207,53)");
break;
default:
button.one('i').setStyle('color', this.currentedit.annotationcolour);
break;
}
button.setStyle('background-color', 'transparent');
}
},
/**
* Called to get the bounds of the drawing region.
......
......@@ -4619,7 +4619,7 @@ Y.Base.modifyAttrs(DROPDOWN, {
M.assignfeedback_editpdfplus = M.assignfeedback_editpdfplus || {};
M.assignfeedback_editpdfplus.dropdown = DROPDOWN;
var COLOURPICKER_NAME = "Colourpicker",
COLOURPICKER;
COLOURPICKER;
/**
* Provides an in browser PDF editor.
......@@ -4636,7 +4636,7 @@ var COLOURPICKER_NAME = "Colourpicker",
* @constructor
* @extends M.assignfeedback_editpdfplus.dropdown
*/
COLOURPICKER = function(config) {
COLOURPICKER = function (config) {
COLOURPICKER.superclass.constructor.apply(this, [config]);
};
......@@ -4648,18 +4648,36 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @method initializer
* @return void
*/
initializer : function(config) {
initializer: function (config) {
var colourlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdfplus_menu"/>'),
body;
body;
var iconGoutte;
// Build a list of coloured buttons.
Y.each(this.get('colours'), function(rgb, colour) {
var button, listitem, title, img, iconname;
Y.each(this.get('colours'), function (rgb, colour) {
var button, listitem, title;
title = M.util.get_string(colour, 'assignfeedback_editpdfplus');
iconname = this.get('iconprefix') + colour;
img = M.util.image_url(iconname, 'assignfeedback_editpdfplus');
button = Y.Node.create('<button><img alt="' + title + '" src="' + img + '"/></button>');
//iconname = this.get('iconprefix') + colour;
//img = M.util.image_url(iconname, 'assignfeedback_editpdfplus');
//button = Y.Node.create('<button><img alt="' + title + '" src="' + img + '"/></button>');
if (colour === "white" || colour === "yellowlemon") {
iconGoutte = Y.Node.create('<span class="fa-stack fa-lg">'
+ '<i class="fa fa-square fa-stack-2x" style="color:#E3E3E3;"></i>'
+ '<i class="fa fa-tint fa-stack-1x fa-inverse" aria-hidden="true" '
+ 'style="color:' + rgb + ';">'
+ '</i>'
+ '</span>');
} else {
iconGoutte = Y.Node.create('<span class="fa-stack fa-lg">'
+ '<i class="fa fa-square-o fa-stack-2x" style="color:#E3E3E3;"></i>'
+ '<i class="fa fa-tint fa-stack-1x" aria-hidden="true" '
+ 'style="color:' + rgb + ';">'
+ '</i>'
+ '</span>');
}
button = Y.Node.create('<button class="btn btn-default btn-sm" type="button"></button>');
button.append(iconGoutte);
button.setAttribute('data-colour', colour);
button.setAttribute('data-rgb', rgb);
button.setStyle('backgroundImage', 'none');
......@@ -4683,12 +4701,12 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
COLOURPICKER.superclass.initializer.call(this, config);
},
callback_handler : function(e) {
callback_handler: function (e) {
e.preventDefault();
var callback = this.get('callback'),
callbackcontext = this.get('context'),
bind;
callbackcontext = this.get('context'),
bind;
this.hide();
......@@ -4698,8 +4716,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
bind();
}
}, {
NAME : COLOURPICKER_NAME,
ATTRS : {
NAME: COLOURPICKER_NAME,
ATTRS: {
/**
* The list of colours this colour picker supports.
*
......@@ -4707,8 +4725,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type {String: String} (The keys of the array are the colour names and the values are localized strings)
* @default {}
*/
colours : {
value : {}
colours: {
value: {}
},
/**
......@@ -4718,8 +4736,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type function
* @default null
*/
callback : {
value : null
callback: {
value: null
},
/**
......@@ -4729,8 +4747,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type Y.Node
* @default null
*/
context : {
value : null
context: {
value: null
},
/**
......@@ -4740,8 +4758,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type String
* @default 'colour_'
*/
iconprefix : {
value : 'colour_'
iconprefix: {
value: 'colour_'
}
}
});
......@@ -5001,7 +5019,24 @@ EDITOR.prototype = {
var button, imgurl;
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdfplus');
button.one('img').setAttribute('src', imgurl);
//button.one('img').setAttribute('src', imgurl);
if (this.currentedit.annotationcolour === "white") {
button.one('i').setStyle('color', this.currentedit.annotationcolour);
button.setStyle('background-color', '#EEEEEE');
} else {
switch (this.currentedit.annotationcolour) {
case "yellowlemon":
button.one('i').setStyle('color', "#fff44f");
break;
case "yellow":
button.one('i').setStyle('color', "rgb(255,207,53)");
break;
default:
button.one('i').setStyle('color', this.currentedit.annotationcolour);
break;
}
button.setStyle('background-color', 'transparent');
}
},
/**
* Called to get the bounds of the drawing region.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment