FIX: Loading more broken on groups page.

Regressed in 1f17d52f552d01cb5ea628294d1b25666631fa87.
This commit is contained in:
Guo Xiang Tan 2019-04-30 10:33:25 +08:00
parent 75a6c440f7
commit dca7f8ecf2
2 changed files with 11 additions and 9 deletions
app
assets/javascripts/discourse/templates/groups
controllers

@ -23,11 +23,11 @@
{{#if model}} {{#if model}}
{{#conditional-loading-spinner condition=model.loading}} {{#conditional-loading-spinner condition=model.loading}}
{{#load-more selector=".groups-table .groups-table-row" action=(action "loadMore")}} {{#load-more selector=".groups-boxes .group-box" action=(action "loadMore")}}
<div class='container'> <div class='container'>
<div class="groups-boxes"> <div class="groups-boxes">
{{#each model as |group|}} {{#each model as |group|}}
{{#link-to "group.members" group.name class="group-box"}} {{#link-to "group.members" group.name class="group-box"}}
<div class="group-box-inner"> <div class="group-box-inner">
<div class="group-info-wrapper"> <div class="group-info-wrapper">
{{#if group.flair_url}} {{#if group.flair_url}}
@ -39,13 +39,13 @@
groupName=group.name}} groupName=group.name}}
</span> </span>
{{/if}} {{/if}}
<span class="group-info"> <span class="group-info">
{{groups-info group=group}} {{groups-info group=group}}
<div class="group-user-count">{{d-icon "user"}}{{group.user_count}}</div>
</span>
</div>
<div class="group-user-count">{{d-icon "user"}}{{group.user_count}}</div>
</span>
</div>
<div class="group-description">{{{group.bio_excerpt}}}</div> <div class="group-description">{{{group.bio_excerpt}}}</div>
@ -77,7 +77,7 @@
{{/group-membership-button}} {{/group-membership-button}}
</div> </div>
</div> </div>
{{/link-to}} {{/link-to}}
{{/each}} {{/each}}
</div> </div>
</div> </div>

@ -1,4 +1,6 @@
class GroupsController < ApplicationController class GroupsController < ApplicationController
include ApplicationHelper
requires_login only: [ requires_login only: [
:set_notifications, :set_notifications,
:mentionable, :mentionable,
@ -42,7 +44,7 @@ class GroupsController < ApplicationController
raise Discourse::InvalidAccess.new(:enable_group_directory) raise Discourse::InvalidAccess.new(:enable_group_directory)
end end
page_size = 30 page_size = mobile_device? ? 15 : 36
page = params[:page]&.to_i || 0 page = params[:page]&.to_i || 0
order = %w{name user_count}.delete(params[:order]) order = %w{name user_count}.delete(params[:order])
dir = params[:asc] ? 'ASC' : 'DESC' dir = params[:asc] ? 'ASC' : 'DESC'