<commit_before>import m from 'mithril';
import _ from 'underscore';
import h from '../h';

const adminItem = {
    controller(args) {
        return {
            displayDetailBox: h.toggleProp(false, true)
        };
    },
    view(ctrl, args) {
        const item = args.item;

        return m('.w-clearfix.card.u-radius.u-marginbottom-20.results-admin-items', [
            m.component(args.listItem, {
                item,
                key: args.key
            }),
            m('button.w-inline-block.arrow-admin.fa.fa-chevron-down.fontcolor-secondary', {
                onclick: ctrl.displayDetailBox.toggle
            }),
            ctrl.displayDetailBox() ? m.component(args.listDetail, {
                item,
                key: args.key
            }) : ''
        ]);
    }
};

export default adminItem;<commit_msg>adminItem should look for selected item and refresh class<commit_after>import m from 'mithril';
import _ from 'underscore';
import h from '../h';

const adminItem = {
    controller(args) {
        const displayDetailBox =  h.toggleProp(false, true),
              alertClassToggle =  h.toggleProp(false, true);

        if(args.listWrapper && _.isFunction(args.listWrapper.isSelected) && args.listWrapper.isSelected(args.item.id)) {
            alertClassToggle(true);
        }

        return {
            displayDetailBox,
            alertClassToggle
        };
    },
    view(ctrl, args) {
        const item = args.item;

        return m('.w-clearfix.card.u-radius.u-marginbottom-20.results-admin-items', {
            class: (ctrl.alertClassToggle() ? 'card-alert' : '' )
        },[
            m.component(args.listItem, {
                item,
                listWrapper: args.listWrapper,
                alertClassToggle: ctrl.alertClassToggle,
                key: args.key
            }),
            m('button.w-inline-block.arrow-admin.fa.fa-chevron-down.fontcolor-secondary', {
                onclick: ctrl.displayDetailBox.toggle
            }),
            ctrl.displayDetailBox() ? m.component(args.listDetail, {
                item,
                key: args.key
            }) : ''
        ]);
    }
};

export default adminItem;
{'fraction_non_alphanumeric': 0.12431693989071038, 'fraction_numerical': 0.0018214936247723133, 'mean_word_length': 1.7190594059405941, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2315345', 'n_tokens_mistral': 633, 'n_tokens_neox': 609, 'n_words': 104}