[有料] 最上部メニューの「マイトピック」ボタン

何をしてほしいですか?
「投稿済み(posted)」に似たボタンをトップメニューに追加してほしいです。これは自分が作成した投稿のみを表示し、「投稿済み」のように他のユーザーのトピックへの返信は含めないようにする必要があります。

また、特定のカテゴリではそのボタン名を「私の写真(My Photos)」に変更できるようにすると嬉しいです。

この機能は「トピックプレビュー」プラグインと連携して動作する必要があり、結果にサムネイルが表示されるようにしてください。以下のコードは既にその点で動作しています。

いつまでに必要ですか?
急ぎではありませんが、できれば1ヶ月以内の完了を希望します。

このタスクに対して提示できる予算(米ドル)はいくらですか?
以下のコードをスタートポイントとして活用できると考えています(これは返信のない投稿を表示するボタン用です)。比較的簡単な作業だと思うので、100ドルを提示します。

自分で修正しようとする際に最も困っているのは、検索クエリでユーザー名の変数を使用する方法が見つからず、現在のユーザーのトピックのみを表示できないことです。

<!-- 返信が必要 -->
<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"};
    }

    // これらの値をカスタマイズ
    // 検索クエリを設定
    let search_query = '?max_posts=1';
    // 特定のカテゴリから「返信が必要」メニュー項目を除外
    let excludeList = ['classifieds', 'workshops', 'staff', 'wiki','site-discussions', 'site-feedback', 'announcements', 'site-tips', 'site-support'];


    // 「返信が必要」ボタンにアクティブクラスを追加
    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'));
            }
        }),
    });

    // max_posts フィルタとタグ フィルタを削除
    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) { // カテゴリがない場合
                needsreplyHref = tag ? '/latest/' + search_query + '&tags=' + tag : '/latest/' + search_query; // タグがある場合はタグを含んだ href を作成、なければ最新のビューと検索クエリにフォールバック
            }
            else if (excludeList.indexOf(category.slug) != -1) { // カテゴリが除外リストに含まれている場合は何もしない
                return list; // カスタムナビ項目を作成せずにリストを返す
            }
            else if (!category.parentCategory) { // サブカテゴリでない場合
                needsreplyHref = tag ? '/c/' + category.slug + search_query + '&tags=' + tag : '/c/' + category.slug + search_query; // タグがある場合はタグとカテゴリを含んだ href を作成、なければ検索クエリなどにフォールバック
            } else { // サブカテゴリの場合
                needsreplyHref = tag ? '/c/' + category.parentCategory.slug + '/' + category.slug + search_query + '&tags=' + tag :
                    '/c/' + category.parentCategory.slug + '/' + category.slug + search_query; // タグがある場合はタグ、サブカテゴリ、カテゴリを含んだ href を作成、なければ検索クエリなどにフォールバック
            }
            list.push(Discourse.ExternalNavItem.create({href: needsreplyHref, name: 'needsreply'}));
            return list;
        }
    });
</script>
「いいね!」 6

@merefield これって、私たちがやっていることと少し関連があると思いますか?

「いいね!」 3

はい、非常に可能性が高いです。デヴィッドさん、会話に参加していただきます。

「いいね!」 4

まだこの件について助けを探しています…

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