git://git.onelab.eu
/
myslice.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0f95c8f
)
plugins: RESET state now distirnguished ADD and REMOVE events, hazelnut and googlemap...
author
Jordan Augé
<jordan.auge@lip6.fr>
Wed, 21 Aug 2013 08:17:50 +0000
(10:17 +0200)
committer
Jordan Augé
<jordan.auge@lip6.fr>
Wed, 21 Aug 2013 08:17:50 +0000
(10:17 +0200)
manifold/js/manifold.js
patch
|
blob
|
history
plugins/googlemaps/static/js/googlemaps.js
patch
|
blob
|
history
plugins/hazelnut/static/js/hazelnut.js
patch
|
blob
|
history
plugins/resources_selected/static/js/resources_selected.js
patch
|
blob
|
history
diff --git
a/manifold/js/manifold.js
b/manifold/js/manifold.js
index
b2df24b
..
826ea32
100644
(file)
--- a/
manifold/js/manifold.js
+++ b/
manifold/js/manifold.js
@@
-51,7
+51,8
@@
var SET_REMOVED = 202;
var FIELD_REQUEST_CHANGE = 301;
var FIELD_REQUEST_ADD = 302;
var FIELD_REQUEST_REMOVE = 303;
var FIELD_REQUEST_CHANGE = 301;
var FIELD_REQUEST_ADD = 302;
var FIELD_REQUEST_REMOVE = 303;
-var FIELD_REQUEST_RESET = 304;
+var FIELD_REQUEST_ADD_RESET = 304;
+var FIELD_REQUEST_REMOVE_RESET = 305;
// status
var FIELD_REQUEST_PENDING = 401;
var FIELD_REQUEST_SUCCESS = 402;
// status
var FIELD_REQUEST_PENDING = 401;
var FIELD_REQUEST_SUCCESS = 402;
@@
-795,19
+796,20
@@
var manifold = {
break;
case FIELD_REQUEST_ADD:
if ($.inArray(value.value, update_query_orig.params[value.key]) != -1)
break;
case FIELD_REQUEST_ADD:
if ($.inArray(value.value, update_query_orig.params[value.key]) != -1)
- value.request = FIELD_REQUEST_RESET;
+ value.request = FIELD_REQUEST_
ADD_
RESET;
update_query.params[value.key].push(value.value);
break;
case FIELD_REQUEST_REMOVE:
if ($.inArray(value.value, update_query_orig.params[value.key]) == -1)
update_query.params[value.key].push(value.value);
break;
case FIELD_REQUEST_REMOVE:
if ($.inArray(value.value, update_query_orig.params[value.key]) == -1)
- value.request = FIELD_REQUEST_RESET;
+ value.request = FIELD_REQUEST_RE
MOVE_RE
SET;
var arr = update_query.params[value.key];
arr = $.grep(arr, function(x) { return x != value.value; });
update_query.params[value.key] = arr;
break;
var arr = update_query.params[value.key];
arr = $.grep(arr, function(x) { return x != value.value; });
update_query.params[value.key] = arr;
break;
- case FIELD_REQUEST_RESET:
+ case FIELD_REQUEST_ADD_RESET:
+ case FIELD_REQUEST_REMOVE_RESET:
// XXX We would need to keep track of the original query
throw "Not implemented";
break;
// XXX We would need to keep track of the original query
throw "Not implemented";
break;
diff --git
a/plugins/googlemaps/static/js/googlemaps.js
b/plugins/googlemaps/static/js/googlemaps.js
index
aefd2cb
..
d985017
100644
(file)
--- a/
plugins/googlemaps/static/js/googlemaps.js
+++ b/
plugins/googlemaps/static/js/googlemaps.js
@@
-4,6
+4,10
@@
* License: GPLv3
*/
* License: GPLv3
*/
+/* BUGS:
+ * - infowindow is not properly reopened when the maps has not the focus
+ */
+
(function($){
var GoogleMaps = Plugin.extend({
(function($){
var GoogleMaps = Plugin.extend({
@@
-73,6
+77,10
@@
set_checkbox: function(record, checked)
{
set_checkbox: function(record, checked)
{
+ /* Default: checked = true */
+ if (typeof checked === 'undefined')
+ checked = true;
+
var key_value;
/* The function accepts both records and their key */
switch (manifold.get_type(record)) {
var key_value;
/* The function accepts both records and their key */
switch (manifold.get_type(record)) {
@@
-95,20
+103,16
@@
var dict_info = this.map_markers[unfold.escape_id(key_value).replace(/\\/g, '')];
var dict_info = this.map_markers[unfold.escape_id(key_value).replace(/\\/g, '')];
- /* Default: swap check status */
- if (typeof checked === 'undefined')
- dict_info.in_set = !dict_info.in_set;
- else
- dict_info.in_set = checked;
// Update the marker content
// Update the marker content
+ dict_info.in_set = checked;
dict_info.marker.content = this.get_marker_content(dict_info.record, checked);
// Update opened infowindow
// XXX Factor this code
this.infowindow.close();
dict_info.marker.content = this.get_marker_content(dict_info.record, checked);
// Update opened infowindow
// XXX Factor this code
this.infowindow.close();
- this.infowindow.setContent(dict_info.marker.content);
this.infowindow.open(this.map, dict_info.marker);
this.infowindow.open(this.map, dict_info.marker);
+ this.infowindow.setContent(dict_info.marker.content);
this.els('map-button').unbind('click').click(this, this._button_click);
//var button = this.checkbox(record, checked);
this.els('map-button').unbind('click').click(this, this._button_click);
//var button = this.checkbox(record, checked);
@@
-245,14
+249,13
@@
{
switch(data.request) {
case FIELD_REQUEST_ADD:
{
switch(data.request) {
case FIELD_REQUEST_ADD:
+ case FIELD_REQUEST_ADD_RESET:
this.set_checkbox(data.value, true);
break;
case FIELD_REQUEST_REMOVE:
this.set_checkbox(data.value, true);
break;
case FIELD_REQUEST_REMOVE:
+ case FIELD_REQUEST_REMOVE_RESET:
this.set_checkbox(data.value, false);
break;
this.set_checkbox(data.value, false);
break;
- case FIELD_REQUEST_RESET:
- this.set_checkbox(data.value); // swap
- break;
default:
break;
}
default:
break;
}
diff --git
a/plugins/hazelnut/static/js/hazelnut.js
b/plugins/hazelnut/static/js/hazelnut.js
index
91fe152
..
af2dcfa
100644
(file)
--- a/
plugins/hazelnut/static/js/hazelnut.js
+++ b/
plugins/hazelnut/static/js/hazelnut.js
@@
-320,6
+320,10
@@
set_checkbox: function(record, checked)
{
set_checkbox: function(record, checked)
{
+ /* Default: checked = true */
+ if (typeof checked === 'undefined')
+ checked = true;
+
var key_value;
/* The function accepts both records and their key */
switch (manifold.get_type(record)) {
var key_value;
/* The function accepts both records and their key */
switch (manifold.get_type(record)) {
@@
-341,10
+345,6
@@
var element = $(checkbox_id, this.table.fnGetNodes());
var element = $(checkbox_id, this.table.fnGetNodes());
- /* Default: swap check status */
- if (typeof checked === 'undefined')
- checked = !(element.is(':checked'));
-
element.attr('checked', checked);
},
element.attr('checked', checked);
},
@@
-417,14
+417,13
@@
{
switch(data.request) {
case FIELD_REQUEST_ADD:
{
switch(data.request) {
case FIELD_REQUEST_ADD:
+ case FIELD_REQUEST_ADD_RESET:
this.set_checkbox(data.value, true);
break;
case FIELD_REQUEST_REMOVE:
this.set_checkbox(data.value, true);
break;
case FIELD_REQUEST_REMOVE:
+ case FIELD_REQUEST_REMOVE_RESET:
this.set_checkbox(data.value, false);
break;
this.set_checkbox(data.value, false);
break;
- case FIELD_REQUEST_RESET:
- this.set_checkbox(data.value); // swap
- break;
default:
break;
}
default:
break;
}
@@
-561,6
+560,7
@@
_check_click: function(e)
{
_check_click: function(e)
{
+ e.stopPropagation();
var self = e.data;
var self = e.data;
diff --git
a/plugins/resources_selected/static/js/resources_selected.js
b/plugins/resources_selected/static/js/resources_selected.js
index
524bf62
..
56a49af
100644
(file)
--- a/
plugins/resources_selected/static/js/resources_selected.js
+++ b/
plugins/resources_selected/static/js/resources_selected.js
@@
-120,17
+120,14
@@
var row;
var row;
- if (data.request == FIELD_REQUEST_RESET) {
- // find line
- // delete it
- row = this.find_row(data.value);
- if (row) {
- this.table.fnDeleteRow(row.nTr);
- }
- return;
- }
-
switch(data.request) {
switch(data.request) {
+ case FIELD_REQUEST_ADD_RESET:
+ case FIELD_REQUEST_REMOVE_RESET:
+ // find line and delete it
+ row = this.find_row(data.value);
+ if (row)
+ this.table.fnDeleteRow(row.nTr);
+ return;
case FIELD_REQUEST_CHANGE:
action = 'UPDATE';
break;
case FIELD_REQUEST_CHANGE:
action = 'UPDATE';
break;