mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 07:34:18 +08:00
UX: Remove drag and drop reordering of categories. It was not working
perfectly and you can re-order using the modal number.
This commit is contained in:
parent
11e43bd434
commit
f1572a43e1
|
@ -5,10 +5,6 @@ export default Discourse.DiscoveryController.extend({
|
|||
showPostsColumn: Em.computed.empty('withLogo'),
|
||||
|
||||
actions: {
|
||||
toggleOrdering: function(){
|
||||
this.set("ordering",!this.get("ordering"));
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var self = this;
|
||||
|
||||
|
@ -27,13 +23,6 @@ export default Discourse.DiscoveryController.extend({
|
|||
return Discourse.User.currentProp('staff');
|
||||
}.property(),
|
||||
|
||||
fixedCategoryPositions: Discourse.computed.setting('fixed_category_positions'),
|
||||
canOrder: Em.computed.and('fixedCategoryPositions', 'canEdit'),
|
||||
|
||||
moveCategory: function(categoryId, position){
|
||||
this.get('model.categories').moveCategory(categoryId, position);
|
||||
},
|
||||
|
||||
latestTopicOnly: function() {
|
||||
return this.get('categories').find(function(c) { return c.get('featuredTopics.length') > 1; }) === undefined;
|
||||
}.property('categories.@each.featuredTopics.length')
|
||||
|
|
|
@ -10,13 +10,6 @@ Discourse.CategoryList = Ember.ArrayProxy.extend({
|
|||
init: function() {
|
||||
this.content = [];
|
||||
this._super();
|
||||
},
|
||||
|
||||
moveCategory: function(categoryId, position){
|
||||
Discourse.ajax("/category/" + categoryId + "/move", {
|
||||
type: 'POST',
|
||||
data: { position: position }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
<th class='latest'>{{i18n categories.latest}}</th>
|
||||
<th class='stats topics'>{{i18n categories.topics}}</th>
|
||||
{{#if showPostsColumn}}
|
||||
<th class='stats posts'>{{i18n categories.posts}}
|
||||
{{#if canOrder}}<button title='{{i18n categories.toggle_ordering}}' class='btn toggle-admin no-text' {{action toggleOrdering}}><i class='fa fa-wrench'></i></button>{{/if}}
|
||||
</th>
|
||||
<th class='stats posts'>{{i18n categories.posts}}</th>
|
||||
{{/if}}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -19,7 +17,6 @@
|
|||
<td class='category' style="border-color: #{{unbound color}}">
|
||||
<div>
|
||||
<div class="pull-left">
|
||||
{{#if controller.ordering}}<i class="fa fa-bars"></i>{{/if}}
|
||||
{{category-title-link category=this}}
|
||||
{{#if unreadTopics}}
|
||||
<a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{i18n filters.unread.lower_title_with_count count="unreadTopics"}}</a>
|
||||
|
|
|
@ -1,43 +1,3 @@
|
|||
import UrlRefresh from 'discourse/mixins/url-refresh';
|
||||
|
||||
export default Discourse.View.extend(UrlRefresh, {
|
||||
|
||||
orderingChanged: function(){
|
||||
if (this.get("controller.ordering")) {
|
||||
this.enableOrdering();
|
||||
} else {
|
||||
this.disableOrdering();
|
||||
}
|
||||
}.observes("controller.ordering"),
|
||||
|
||||
rows: function() {
|
||||
return $('.topic-list tbody');
|
||||
},
|
||||
|
||||
enableOrdering: function(){
|
||||
var self = this;
|
||||
Em.run.next(function(){
|
||||
self.rows().sortable({handle: '.fa-bars'}).on('sortupdate',function(evt, data){
|
||||
var tr = $(data.item);
|
||||
var categoryId = tr.data('category_id');
|
||||
var position = self.rows().find('tr').index(tr[0]);
|
||||
self.get('controller').moveCategory(categoryId, position);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_scrollTop: function() {
|
||||
Em.run.schedule('afterRender', function() {
|
||||
$(document).scrollTop(0);
|
||||
});
|
||||
}.on('didInsertElement'),
|
||||
|
||||
disableOrdering: function(){
|
||||
this.rows().sortable("destroy").off('sortupdate');
|
||||
},
|
||||
|
||||
willDestroyElement: function(){
|
||||
this.disableOrdering();
|
||||
}
|
||||
|
||||
});
|
||||
export default Discourse.View.extend(UrlRefresh, Discourse.ScrollTop);
|
||||
|
|
Loading…
Reference in New Issue
Block a user