FIX: pin a topic globally wasn't working
This commit is contained in:
parent
b8cf797e31
commit
0a2f615aab
|
@ -1,5 +1,6 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
||||||
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Controller.extend(ModalFunctionality, {
|
export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
needs: ["topic"],
|
needs: ["topic"],
|
||||||
|
@ -9,7 +10,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
pinnedGloballyCount: 0,
|
pinnedGloballyCount: 0,
|
||||||
bannerCount: 0,
|
bannerCount: 0,
|
||||||
|
|
||||||
reset: function() {
|
reset() {
|
||||||
this.set("model.pinnedInCategoryUntil", null);
|
this.set("model.pinnedInCategoryUntil", null);
|
||||||
this.set("model.pinnedGloballyUntil", null);
|
this.set("model.pinnedGloballyUntil", null);
|
||||||
},
|
},
|
||||||
|
@ -27,21 +28,24 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
return I18n.t(name, { categoryLink: this.get("categoryLink"), until: until });
|
return I18n.t(name, { categoryLink: this.get("categoryLink"), until: until });
|
||||||
}.property("categoryLink", "model.{pinned_globally,pinned_until}"),
|
}.property("categoryLink", "model.{pinned_globally,pinned_until}"),
|
||||||
|
|
||||||
pinMessage: function() {
|
@computed("categoryLink")
|
||||||
return I18n.t("topic.feature_topic.pin", { categoryLink: this.get("categoryLink") });
|
pinMessage(categoryLink) {
|
||||||
}.property("categoryLink"),
|
return I18n.t("topic.feature_topic.pin", { categoryLink });
|
||||||
|
},
|
||||||
|
|
||||||
alreadyPinnedMessage: function() {
|
alreadyPinnedMessage: function() {
|
||||||
return I18n.t("topic.feature_topic.already_pinned", { categoryLink: this.get("categoryLink"), count: this.get("pinnedInCategoryCount") });
|
return I18n.t("topic.feature_topic.already_pinned", { categoryLink: this.get("categoryLink"), count: this.get("pinnedInCategoryCount") });
|
||||||
}.property("categoryLink", "pinnedInCategoryCount"),
|
}.property("categoryLink", "pinnedInCategoryCount"),
|
||||||
|
|
||||||
pinDisabled: function() {
|
@computed("parsedPinnedInCategoryUntil")
|
||||||
return !this._isDateValid(this.get("parsedPinnedInCategoryUntil"));
|
pinDisabled(parsedPinnedInCategoryUntil) {
|
||||||
}.property("parsedPinnedInCategoryUntil"),
|
return !this._isDateValid(parsedPinnedInCategoryUntil);
|
||||||
|
},
|
||||||
|
|
||||||
pinGloballyDisabled: function() {
|
@computed("parsedPinnedGloballyUntil")
|
||||||
return !this._isDateValid(this.get("parsedPinnedGloballyUntil"));
|
pinGloballyDisabled(parsedPinnedGloballyUntil) {
|
||||||
}.property("pinnedGloballyUntil"),
|
return !this._isDateValid(parsedPinnedGloballyUntil);
|
||||||
|
},
|
||||||
|
|
||||||
parsedPinnedInCategoryUntil: function() {
|
parsedPinnedInCategoryUntil: function() {
|
||||||
return this._parseDate(this.get("model.pinnedInCategoryUntil"));
|
return this._parseDate(this.get("model.pinnedInCategoryUntil"));
|
||||||
|
|
Loading…
Reference in New Issue