Backwards compatibility with deprecation for `Discourse.PostMenuView`
This commit is contained in:
parent
724781f426
commit
4706b77940
|
@ -45,7 +45,7 @@ Button.prototype.render = function(buffer) {
|
|||
|
||||
let hiddenButtons;
|
||||
|
||||
const PostMenuView = Ember.Component.extend(StringBuffer, {
|
||||
const PostMenuComponent = Ember.Component.extend(StringBuffer, {
|
||||
tagName: 'section',
|
||||
classNames: ['post-menu-area', 'clearfix'],
|
||||
|
||||
|
@ -164,7 +164,7 @@ const PostMenuView = Ember.Component.extend(StringBuffer, {
|
|||
visibleButtons.splice(visibleButtons.length - 1, 0, this.buttonForShowMoreActions(post));
|
||||
}
|
||||
|
||||
const callbacks = PostMenuView._registerButtonCallbacks;
|
||||
const callbacks = PostMenuComponent._registerButtonCallbacks;
|
||||
if (callbacks) {
|
||||
_.each(callbacks, function(callback) {
|
||||
callback.apply(self, [visibleButtons]);
|
||||
|
@ -412,11 +412,11 @@ const PostMenuView = Ember.Component.extend(StringBuffer, {
|
|||
|
||||
});
|
||||
|
||||
PostMenuView.reopenClass({
|
||||
PostMenuComponent.reopenClass({
|
||||
registerButton(callback){
|
||||
this._registerButtonCallbacks = this._registerButtonCallbacks || [];
|
||||
this._registerButtonCallbacks.push(callback);
|
||||
}
|
||||
});
|
||||
|
||||
export default PostMenuView;
|
||||
export default PostMenuComponent;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import PostMenuComponent from 'discourse/components/post-menu';
|
||||
|
||||
Ember.warn("PostMenuView has been deprecated, use PostMenuComponent instead");
|
||||
|
||||
export default PostMenuComponent.extend();
|
|
@ -108,12 +108,15 @@ module Tilt
|
|||
result = "Controller" if result == "ControllerController"
|
||||
result = "Route" if result == "DiscourseRoute"
|
||||
result = "View" if result == "ViewView"
|
||||
|
||||
result.gsub!(/Mixin$/, '')
|
||||
result.gsub!(/Model$/, '')
|
||||
|
||||
if result != "PostMenuView"
|
||||
@output << "\n\nDiscourse.#{result} = require('#{require_name}').default;\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Include JS code for JSHint
|
||||
unless Rails.env.production?
|
||||
|
|
Loading…
Reference in New Issue