Gitlab CSE Unil

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

modif affichage bouton : utilisation boostrap et fa

parent 92158175
var COLOURPICKER_NAME = "Colourpicker", var COLOURPICKER_NAME = "Colourpicker",
COLOURPICKER; COLOURPICKER;
/** /**
* Provides an in browser PDF editor. * Provides an in browser PDF editor.
...@@ -16,7 +16,7 @@ var COLOURPICKER_NAME = "Colourpicker", ...@@ -16,7 +16,7 @@ var COLOURPICKER_NAME = "Colourpicker",
* @constructor * @constructor
* @extends M.assignfeedback_editpdfplus.dropdown * @extends M.assignfeedback_editpdfplus.dropdown
*/ */
COLOURPICKER = function(config) { COLOURPICKER = function (config) {
COLOURPICKER.superclass.constructor.apply(this, [config]); COLOURPICKER.superclass.constructor.apply(this, [config]);
}; };
...@@ -28,18 +28,36 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -28,18 +28,36 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @method initializer * @method initializer
* @return void * @return void
*/ */
initializer : function(config) { initializer: function (config) {
var colourlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdfplus_menu"/>'), var colourlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdfplus_menu"/>'),
body; body;
var iconGoutte;
// Build a list of coloured buttons. // Build a list of coloured buttons.
Y.each(this.get('colours'), function(rgb, colour) { Y.each(this.get('colours'), function (rgb, colour) {
var button, listitem, title, img, iconname; var button, listitem, title;
title = M.util.get_string(colour, 'assignfeedback_editpdfplus'); title = M.util.get_string(colour, 'assignfeedback_editpdfplus');
iconname = this.get('iconprefix') + colour; //iconname = this.get('iconprefix') + colour;
img = M.util.image_url(iconname, 'assignfeedback_editpdfplus'); //img = M.util.image_url(iconname, 'assignfeedback_editpdfplus');
button = Y.Node.create('<button><img alt="' + title + '" src="' + img + '"/></button>'); //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-colour', colour);
button.setAttribute('data-rgb', rgb); button.setAttribute('data-rgb', rgb);
button.setStyle('backgroundImage', 'none'); button.setStyle('backgroundImage', 'none');
...@@ -63,12 +81,12 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -63,12 +81,12 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
COLOURPICKER.superclass.initializer.call(this, config); COLOURPICKER.superclass.initializer.call(this, config);
}, },
callback_handler : function(e) { callback_handler: function (e) {
e.preventDefault(); e.preventDefault();
var callback = this.get('callback'), var callback = this.get('callback'),
callbackcontext = this.get('context'), callbackcontext = this.get('context'),
bind; bind;
this.hide(); this.hide();
...@@ -78,8 +96,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -78,8 +96,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
bind(); bind();
} }
}, { }, {
NAME : COLOURPICKER_NAME, NAME: COLOURPICKER_NAME,
ATTRS : { ATTRS: {
/** /**
* The list of colours this colour picker supports. * The list of colours this colour picker supports.
* *
...@@ -87,8 +105,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -87,8 +105,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) * @type {String: String} (The keys of the array are the colour names and the values are localized strings)
* @default {} * @default {}
*/ */
colours : { colours: {
value : {} value: {}
}, },
/** /**
...@@ -98,8 +116,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -98,8 +116,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type function * @type function
* @default null * @default null
*/ */
callback : { callback: {
value : null value: null
}, },
/** /**
...@@ -109,8 +127,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -109,8 +127,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type Y.Node * @type Y.Node
* @default null * @default null
*/ */
context : { context: {
value : null value: null
}, },
/** /**
...@@ -120,8 +138,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, { ...@@ -120,8 +138,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdfplus.dropdown, {
* @type String * @type String
* @default 'colour_' * @default 'colour_'
*/ */
iconprefix : { iconprefix: {
value : 'colour_' value: 'colour_'
} }
} }
}); });
......
...@@ -251,7 +251,24 @@ EDITOR.prototype = { ...@@ -251,7 +251,24 @@ EDITOR.prototype = {
var button, imgurl; var button, imgurl;
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON); button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdfplus'); 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. * 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