mirror of
https://github.com/wekan/wekan.git
synced 2026-01-05 17:18:49 +01:00
Bug fixes and buttons for previous and next page
* Use buttons for next and previous page in search results * Add custom routine for stringifying and parsing the selector to JSON so RegExp objects are preserved
This commit is contained in:
parent
4e8fc46475
commit
78a1d08a17
6 changed files with 74 additions and 15 deletions
|
|
@ -126,6 +126,40 @@ SessionData.attachSchema(
|
|||
}),
|
||||
);
|
||||
|
||||
SessionData.helpers({
|
||||
getSelector() {
|
||||
return SessionData.unpickle(this.selector);
|
||||
},
|
||||
});
|
||||
|
||||
SessionData.unpickle = pickle => {
|
||||
return JSON.parse(pickle, (key, value) => {
|
||||
if (typeof value === 'object') {
|
||||
if (value.hasOwnProperty('$$class')) {
|
||||
if (value.$$class === 'RegExp') {
|
||||
return new RegExp(value.source, value.flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
};
|
||||
|
||||
SessionData.pickle = value => {
|
||||
return JSON.stringify(value, (key, value) => {
|
||||
if (typeof value === 'object') {
|
||||
if (value.constructor.name === 'RegExp') {
|
||||
return {
|
||||
$$class: 'RegExp',
|
||||
source: value.source,
|
||||
flags: value.flags,
|
||||
};
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
};
|
||||
|
||||
if (!Meteor.isServer) {
|
||||
SessionData.getSessionId = () => {
|
||||
let sessionId = Session.get('sessionId');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue