components system

v1.18.x
psychobunny 10 years ago
parent f5b701553c
commit 54cbbe2844

@ -96,7 +96,7 @@ define('forum/topic/events', [
} }
function onPostEdited(data) { function onPostEdited(data) {
var editedPostEl = $('#content_' + data.pid), var editedPostEl = components.get('post/content', data.pid),
editedPostTitle = $('#topic_title_' + data.pid); editedPostTitle = $('#topic_title_' + data.pid);
if (editedPostTitle.length) { if (editedPostTitle.length) {

@ -0,0 +1,17 @@
"use strict";
var components = components || {};
(function() {
components.core = {
'post/content': function(pid) {
var el = $('[data-pid="' + pid + '"]').find('[component="post/content"]');
return el.length ? el : $('[data-pid="' + pid + '"]').find('.post-content'); // deprecated after 0.7x
}
};
components.get = function() {
var args = Array.prototype.slice.call(arguments, 1);
return components.core[arguments[0]].apply(this, args);
};
}());

@ -44,10 +44,11 @@ module.exports = function(Meta) {
'public/src/utils.js', 'public/src/utils.js',
'public/src/app.js', 'public/src/app.js',
'public/src/ajaxify.js', 'public/src/ajaxify.js',
'public/src/variables.js', 'public/src/components.js',
'public/src/widgets.js', 'public/src/overrides.js',
'public/src/translator.js', 'public/src/translator.js',
'public/src/overrides.js' 'public/src/variables.js',
'public/src/widgets.js'
], ],
rjs: [] rjs: []
} }

Loading…
Cancel
Save