¿Qué te gustaría que se hiciera?
Necesito un botón en el menú superior, similar a posted, que muestre todos los temas que has creado tú mismo, pero que no incluya las respuestas que has dado en temas de otros usuarios (como lo hace posted).
Sería ideal si pudiera renombrarlo a ‘Mis Fotos’ en ciertas categorías.
Esto debe funcionar con el plugin Topic Previews para que los resultados tengan miniaturas, lo cual el código de abajo ya logra.
¿Cuándo lo necesitas?
No hay prisa, pero sería agradable tenerlo listo dentro de un mes.
¿Cuál es tu presupuesto, en $ USD, que puedes ofrecer por esta tarea?
Espero que el código de abajo pueda usarse como punto de partida (esto es para un botón que muestra temas sin respuesta) y que sea una tarea bastante sencilla, así que ofreceré $100.
El mayor problema que tengo al intentar modificarlo yo mismo es que no encuentro una forma de usar una variable de nombre de usuario en la consulta de búsqueda para que solo muestre los temas del usuario actual.
<!-- 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>