FEATURE: remove star concept from Discourse

This commit is contained in:
Sam
2015-01-07 12:19:23 +11:00
parent fa8493118b
commit efc717c14a
35 changed files with 50 additions and 448 deletions
@@ -57,7 +57,6 @@
{{ render 'admin_report_counts' likes }}
{{ render 'admin_report_counts' flags }}
{{ render 'admin_report_counts' bookmarks }}
{{ render 'admin_report_counts' starred }}
{{ render 'admin_report_counts' emails }}
{{/unless}}
</table>
@@ -165,7 +165,7 @@ var controllerOpts = {
var split = this.get('filter').split('/');
if (split[0] !== 'new' && split[0] !== 'unread' && split[0] !== 'starred') { return; }
if (split[0] !== 'new' && split[0] !== 'unread') { return; }
return I18n.t("topics.none.educate." + split[0], {
userPrefsUrl: Discourse.getURL("/users/") + (Discourse.User.currentProp("username_lower")) + "/preferences"
@@ -3,7 +3,6 @@ var PATH_BINDINGS = {
'g l': '/latest',
'g n': '/new',
'g u': '/unread',
'g f': '/starred',
'g c': '/categories',
'g t': '/top'
},
@@ -74,7 +74,7 @@ Discourse.NavItem.reopenClass({
if (!Discourse.Category.list() && testName === "categories") return null;
if (!Discourse.Site.currentProp('top_menu_items').contains(testName)) return null;
var args = { name: name, hasIcon: name === "unread" || name === "starred" };
var args = { name: name, hasIcon: name === "unread" };
if (opts.category) { args.category = opts.category; }
if (opts.noSubcategories) { args.noSubcategories = true; }
return Discourse.NavItem.create(args);
@@ -172,14 +172,6 @@ Discourse.Topic = Discourse.Model.extend({
.then(function () { self.set('archetype', 'regular'); });
},
starTooltipKey: function() {
return this.get('starred') ? 'starred.help.unstar' : 'starred.help.star';
}.property('starred'),
starTooltip: function() {
return I18n.t(this.get('starTooltipKey'));
}.property('starTooltipKey'),
estimatedReadingTime: function() {
var wordCount = this.get('word_count');
if (!wordCount) return;
@@ -188,15 +180,15 @@ Discourse.Topic = Discourse.Model.extend({
return Math.floor(wordCount / 500.0);
}.property('word_count'),
toggleStar: function() {
toggleBookmark: function() {
var topic = this;
topic.toggleProperty('starred');
topic.toggleProperty('bookmarked');
return Discourse.ajax({
url: "" + (this.get('url')) + "/star",
url: "" + (this.get('url')) + "/bookmark",
type: 'PUT',
data: { starred: topic.get('starred') ? true : false }
data: { bookmarked: topic.get('bookmarked') ? true : false }
}).then(null, function (error) {
topic.toggleProperty('starred');
topic.toggleProperty('bookmarked');
if (error && error.responseText) {
bootbox.alert($.parseJSON(error.responseText).errors);
@@ -16,7 +16,6 @@ var UserActionTypes = {
replies: 6,
mentions: 7,
quotes: 9,
starred: 10,
edits: 11,
messages_sent: 12,
messages_received: 13
@@ -127,8 +126,6 @@ Discourse.UserAction = Discourse.Model.extend({
case UserActionTypes.likes_given:
case UserActionTypes.likes_received:
return "likes";
case UserActionTypes.starred:
return "stars";
case UserActionTypes.edits:
return "edits";
case UserActionTypes.bookmarks:
@@ -205,7 +202,6 @@ Discourse.UserAction.reopenClass({
TO_COLLAPSE: [
UserActionTypes.likes_given,
UserActionTypes.likes_received,
UserActionTypes.starred,
UserActionTypes.edits,
UserActionTypes.bookmarks
],
@@ -213,7 +209,6 @@ Discourse.UserAction.reopenClass({
TO_SHOW: [
UserActionTypes.likes_given,
UserActionTypes.likes_received,
UserActionTypes.starred,
UserActionTypes.edits,
UserActionTypes.bookmarks,
UserActionTypes.messages_sent,
@@ -1,9 +0,0 @@
import UserTopicListRoute from "discourse/routes/user-topic-list";
export default UserTopicListRoute.extend({
userActionType: Discourse.UserAction.TYPES.starred,
model: function() {
return Discourse.TopicList.find('starred', { user_id: this.modelFor('user').get('id') });
}
});
@@ -7,7 +7,6 @@
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.latest'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.new'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.unread'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.starred'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.categories'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.jump_to.top'}}}</li>
</ul>
@@ -54,7 +54,6 @@ export default Ember.Component.extend(StringBuffer, {
case Discourse.UserAction.TYPES.bookmarks: return "bookmark";
case Discourse.UserAction.TYPES.edits: return "pencil";
case Discourse.UserAction.TYPES.replies: return "reply";
case Discourse.UserAction.TYPES.starred: return "star";
}
}.property("content.action_type")
});
@@ -1,21 +0,0 @@
import ButtonView from 'discourse/views/button';
export default ButtonView.extend({
classNames: ['star'],
textKey: 'starred.title',
helpKeyBinding: 'controller.starTooltipKey',
attributeBindings: ['disabled'],
rerenderTriggers: ['controller.starred'],
click: function() {
this.get('controller').send('toggleStar');
},
renderIcon: function(buffer) {
buffer.push("<i class='fa fa-star " +
(this.get('controller.starred') ? ' starred' : '') +
"'></i>");
}
});
@@ -1,7 +1,6 @@
import TopicAdminMenuButton from 'discourse/views/topic-admin-menu-button';
import LoginReplyButton from 'discourse/views/login-reply-button';
import FlagTopicButton from 'discourse/views/flag-topic-button';
import StarButton from 'discourse/views/star-button';
import ShareButton from 'discourse/views/share-button';
import InviteReplyButton from 'discourse/views/invite-reply-button';
import ReplyButton from 'discourse/views/reply-button';
@@ -30,7 +29,6 @@ export default DiscourseContainerView.extend({
if (this.get('topic.details.can_invite_to')) {
this.attachViewClass(InviteReplyButton);
}
this.attachViewClass(StarButton);
this.attachViewClass(ShareButton);
if (this.get('topic.details.can_flag_topic')) {
this.attachViewClass(FlagTopicButton);