Revert "Add Load More button to pages index"
This reverts commit 45c63d9939
.
Reason for revert: Better solution in g/355352
Change-Id: I6d9815af0ffb0b8235807c48fd124076e54849e0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/355041
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jacob DeWar <jacob.dewar@instructure.com>
This commit is contained in:
parent
a1467a378c
commit
df9122a36e
|
@ -137,37 +137,6 @@ describe "Wiki Pages" do
|
|||
course_with_teacher_logged_in
|
||||
end
|
||||
|
||||
it "does not display load more button if no pages" do
|
||||
get "/courses/#{@course.id}/pages"
|
||||
expect(f(".index-content-container")).not_to contain_css(".fetch_next")
|
||||
end
|
||||
|
||||
it "can load more pages" do
|
||||
60.times do |i|
|
||||
@course.wiki_pages.create!(title: "Page#{i}")
|
||||
end
|
||||
get "/courses/#{@course.id}/pages"
|
||||
expect(f(".fetch_next")).to be_displayed
|
||||
expect(ff(".wiki-page-link").size).not_to eq 60
|
||||
f(".fetch_next").click
|
||||
wait_for_ajaximations
|
||||
expect(f(".fetch_next")).not_to be_displayed
|
||||
expect(ff(".wiki-page-link").size).to eq 60
|
||||
end
|
||||
|
||||
it "displays load more button after sorting entire collection" do
|
||||
60.times do |i|
|
||||
@course.wiki_pages.create!(title: "Page#{i}")
|
||||
end
|
||||
get "/courses/#{@course.id}/pages"
|
||||
f(".fetch_next").click
|
||||
wait_for_ajaximations
|
||||
f("[data-sort-field='created_at']").click
|
||||
wait_for_ajaximations
|
||||
expect(ff(".wiki-page-link").size).not_to eq 60
|
||||
expect(f(".fetch_next")).to be_displayed
|
||||
end
|
||||
|
||||
it "edits page title from pages index", priority: "1" do
|
||||
@course.wiki_pages.create!(title: "B-Team")
|
||||
get "/courses/#{@course.id}/pages"
|
||||
|
|
|
@ -49,7 +49,6 @@ export default class WikiPageIndexView extends PaginatedCollectionView {
|
|||
'click .header-bar-right .menu_tool_link': 'openExternalTool',
|
||||
'click .pages-mobile-header a[data-sort-mobile-field]': 'sortBySelect',
|
||||
'click #toggle_block_editor': 'toggleBlockEditor',
|
||||
'click .fetch_next': 'fetchNext',
|
||||
},
|
||||
|
||||
els: {
|
||||
|
@ -113,7 +112,6 @@ export default class WikiPageIndexView extends PaginatedCollectionView {
|
|||
})
|
||||
this.collection.on('fetched:last', () => {
|
||||
this.fetchedLast = true
|
||||
$('.fetch_next')?.hide()
|
||||
if (this.focusAfterRenderSelector) {
|
||||
// We do a setTimeout here just to force it to the next tick.
|
||||
return setTimeout(() => {
|
||||
|
@ -192,12 +190,6 @@ export default class WikiPageIndexView extends PaginatedCollectionView {
|
|||
if (this.lastFocusField) {
|
||||
$(`[data-sort-field='${this.lastFocusField}']`).focus()
|
||||
}
|
||||
|
||||
if (this.collection.canFetch('next')) {
|
||||
$('.fetch_next')?.show()
|
||||
} else {
|
||||
$('.fetch_next')?.hide()
|
||||
}
|
||||
}
|
||||
|
||||
toggleBlockEditor(ev) {
|
||||
|
@ -388,12 +380,6 @@ export default class WikiPageIndexView extends PaginatedCollectionView {
|
|||
return !!this.collection.find(m => m.has('todo_date'))
|
||||
}
|
||||
|
||||
fetchNext() {
|
||||
this.collection.fetch({
|
||||
page: 'next',
|
||||
})
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
const json = super.toJSON(...arguments)
|
||||
json.CAN = {
|
||||
|
|
|
@ -140,15 +140,9 @@
|
|||
{{#unless fetched}}{{#t 'loading'}}Loading ...{{/t}}{{else}}{{#t 'loading_more'}}Loading more ...{{/t}}{{/unless}}
|
||||
</div>
|
||||
{{#if fetched}}
|
||||
{{#if collection.length}}
|
||||
<div style="text-align: center; padding: 10px;">
|
||||
<button class="btn fetch_next" tabindex="0" aria-label="{{#t}}Load more{{/t}}">
|
||||
{{#t}}Load more{{/t}}
|
||||
</button>
|
||||
</div>
|
||||
{{else}}
|
||||
{{#unless collection.length}}
|
||||
<div style="text-align: center">{{#t 'no_pages'}}No pages created yet.{{/t}}{{#if CAN.CREATE}} <a class="new_page" href="#">{{#t 'add_page'}}Add one!{{/t}}</a>{{/if}}</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue