feeds-tree: move external onClick dojo/method to PrefFeedTree class

This commit is contained in:
Andrew Dolgov 2022-06-06 09:31:37 +03:00
parent 6436dd16f9
commit 8ef816d8f8
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 12 additions and 11 deletions

View File

@ -973,16 +973,6 @@ class Pref_Feeds extends Handler_Protected {
persist="true" persist="true"
model="feedModel" model="feedModel"
openOnClick="false"> openOnClick="false">
<script type="dojo/method" event="onClick" args="item">
var id = String(item.id);
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FEED:')) {
CommonDialogs.editFeed(bare_id);
} else if (id.match('CAT:')) {
dijit.byId('feedTree').editCategory(bare_id, item);
}
</script>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
/* eslint-disable prefer-rest-params */ /* eslint-disable prefer-rest-params */
/* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost, xhr, fox, App */ /* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhr, fox, App */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_base/array", "dojo/cookie"], define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_base/array", "dojo/cookie"],
function (declare, domConstruct, checkBoxTree, array, cookie) { function (declare, domConstruct, checkBoxTree, array, cookie) {
@ -14,6 +14,17 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b
this.checkInactiveFeeds(); this.checkInactiveFeeds();
this.checkErrorFeeds(); this.checkErrorFeeds();
}); });
dojo.connect(this, 'onClick', (item) => {
const id = String(item.id);
const bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FEED:')) {
CommonDialogs.editFeed(bare_id);
} else if (id.match('CAT:')) {
dijit.byId('feedTree').editCategory(bare_id, item);
}
});
}, },
// save state in localStorage instead of cookies // save state in localStorage instead of cookies
// reference: https://stackoverflow.com/a/27968996 // reference: https://stackoverflow.com/a/27968996