Skip to content

Commit

Permalink
fix: more specific selectors, eslint
Browse files Browse the repository at this point in the history
TODO: convert this to data-component (breaking change)
  • Loading branch information
psychobunny committed Aug 21, 2020
1 parent 0dd8193 commit e5d6eb9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions static/lib/composer/categoryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

/*globals define, socket, app*/

define('composer/categoryList', ['categorySelector', 'taskbar'], function(categorySelector, taskbar) {
define('composer/categoryList', ['categorySelector', 'taskbar'], function (categorySelector, taskbar) {
var categoryList = {};

var selector;

categoryList.init = function(postContainer, postData) {
categoryList.init = function (postContainer, postData) {
var listContainer = postContainer.find('.category-list-container');
if (!listContainer.length) {
return;
Expand All @@ -18,7 +18,7 @@ define('composer/categoryList', ['categorySelector', 'taskbar'], function(catego
toggleDropDirection(postContainer);
});

socket.emit('plugins.composer.getCategoriesForSelect', {}, function(err, categories) {
socket.emit('plugins.composer.getCategoriesForSelect', {}, function (err, categories) {
if (err) {
return app.alertError(err.message);
}
Expand Down Expand Up @@ -53,15 +53,15 @@ define('composer/categoryList', ['categorySelector', 'taskbar'], function(catego

var selectedCategory = selector.getSelectedCategory();

$('.category-name').translateText(selectedCategory ? selectedCategory.name : '[[modules:composer.select_category]]');
$('.category-selector').find('li[data-cid="' + postData.cid + '"]').addClass('active');
postContainer.find('.category-name').translateText(selectedCategory ? selectedCategory.name : '[[modules:composer.select_category]]');
postContainer.find('.category-selector').find('li[data-cid="' + postData.cid + '"]').addClass('active');

toggleDropDirection(postContainer);
});
});


$('.category-selector').on('click', 'li', function() {
$('.category-selector').on('click', 'li', function () {
$('.category-name').text($(this).text());
$('.category-selector').removeClass('open');
$('.category-selector li').removeClass('active');
Expand Down

0 comments on commit e5d6eb9

Please sign in to comment.