[PAGATO] Il mio pulsante Argomenti nel menu in alto

Cosa vorresti che fosse fatto?
Ho bisogno di un pulsante nel menu superiore simile a posted che mostri tutti i post che hai creato, ma che non includa gli argomenti di altri utenti a cui hai risposto, come fa posted.

Sarebbe utile se potessi rinominarlo in ‘Le mie foto’ in determinate categorie.

Questo deve funzionare con il plugin Topic Previews in modo che i risultati includano le miniature, cosa che il codice sottostante supporta già.

Quando hai bisogno che sia fatto?
Nessuna fretta, ma sarebbe bello averlo pronto entro un mese.

Qual è il tuo budget, in $ USD, che puoi offrire per questo compito?
Spero che il codice sottostante possa essere utilizzato come punto di partenza (questo è per un pulsante che mostra i post senza risposte) e che si tratti di un compito abbastanza semplice, quindi offro 100 $.

Il problema principale che incontro nel modificarlo da solo è che non riesco a trovare un modo per utilizzare una variabile username nella query di ricerca in modo che mostri solo gli argomenti dell’utente corrente.

<!-- NEEDS REPLY -->
<script type="text/discourse-plugin" version="0.8.18">
    if (I18n.translations.en) {
        I18n.translations.en.js.filters.needsreply = {title: "No Replies", help: "Topics with no replies"};
    }

    // CUSTOMIZE THESE VALUES
    // Set the search query
    let search_query = '?max_posts=1';
    // Exclude certain categories from showing the needs reply menu item
    let excludeList = ['classifieds', 'workshops', 'staff', 'wiki','site-discussions', 'site-feedback', 'announcements', 'site-tips', 'site-support'];


    // Add active class to Needs Reply button
    api.modifyClass('component:navigation-item', {
        active: Ember.computed("contentFilterMode", "filterMode", function () {
            let contentFilterMode = this.get('content').get('filterMode');
            if (window.location.search && window.location.search.split('&')[0] === search_query.split('&')[0]) {
                return contentFilterMode === "needsreply";
            } else {
                return this._super(contentFilterMode, this.get('filterMode'));
            }
        }),
    });

    // Remove max_posts filter and tags filter
    api.modifyClass('controller:discovery/topics', {
        resetParams: function () {
            this.setProperties({max_posts: null});
            this.setProperties({tags: null});
            this._super();
        }
    });

    Discourse.ExternalNavItem = Discourse.NavItem.extend({
        href: function () {
            return this.get('href');
        }.property("href")
    });

    Discourse.NavItem.reopenClass({
        buildList: function (category, args) {
            let list = this._super(category, args),
                tag = args.tagId,
                needsreplyHref;

            if (!category) { // does not have a category
                needsreplyHref = tag ? '/latest/' + search_query + '&tags=' + tag : '/latest/' + search_query; // if there's a tag build the href with the tag, else fall back to the latest view and the search query
            }
            else if (excludeList.indexOf(category.slug) != -1) { // the category is in the exclude list, do nothing
                return list; // return the list without creating the custom nav item
            }
            else if (!category.parentCategory) { // is not a sub-category
                needsreplyHref = tag ? '/c/' + category.slug + search_query + '&tags=' + tag : '/c/' + category.slug + search_query; // if there's a tag build the href with tags and the category, else fallback to the search query et al
            } else { // is a sub-category
                needsreplyHref = tag ? '/c/' + category.parentCategory.slug + '/' + category.slug + search_query + '&tags=' + tag :
                    '/c/' + category.parentCategory.slug + '/' + category.slug + search_query; // if there's a tag build the href with tags, sub-cateogry, and category, else fallback to search query et al
            }
            list.push(Discourse.ExternalNavItem.create({href: needsreplyHref, name: 'needsreply'}));
            return list;
        }
    });
</script>
6 Mi Piace

@merefield pensi che questo possa in qualche modo collegarsi a quello che stiamo facendo?

3 Mi Piace

Sì, molto probabilmente. David, ti aggiungerò a una conversazione.

4 Mi Piace

Sto ancora cercando aiuto per questo…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.