mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Backwards compatibility with deprecation for Discourse.PostMenuView
This commit is contained in:
parent
724781f426
commit
4706b77940
3 changed files with 13 additions and 5 deletions
|
@ -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;
|
||||
|
|
5
app/assets/javascripts/discourse/views/post-menu.js.es6
Normal file
5
app/assets/javascripts/discourse/views/post-menu.js.es6
Normal file
|
@ -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,10 +108,13 @@ module Tilt
|
|||
result = "Controller" if result == "ControllerController"
|
||||
result = "Route" if result == "DiscourseRoute"
|
||||
result = "View" if result == "ViewView"
|
||||
|
||||
result.gsub!(/Mixin$/, '')
|
||||
result.gsub!(/Model$/, '')
|
||||
|
||||
@output << "\n\nDiscourse.#{result} = require('#{require_name}').default;\n"
|
||||
if result != "PostMenuView"
|
||||
@output << "\n\nDiscourse.#{result} = require('#{require_name}').default;\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue