Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
fab5ef32
Commit
fab5ef32
authored
Jun 03, 2016
by
Ehtesham Kafeel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12584 from edx/ekafeel/topics-pagination-fix
fixing paging footer in topics tab
parents
d0dcfe12
2d29751d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
50 deletions
+34
-50
common/test/acceptance/tests/lms/test_teams.py
+17
-0
lms/djangoapps/teams/static/teams/js/collections/base.js
+5
-1
lms/djangoapps/teams/static/teams/js/collections/my_teams.js
+1
-3
lms/djangoapps/teams/static/teams/js/collections/team_membership.js
+0
-30
lms/djangoapps/teams/static/teams/js/collections/topic.js
+4
-4
lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
+2
-1
lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
+2
-8
lms/djangoapps/teams/static/teams/js/views/teams_tab.js
+3
-3
No files found.
common/test/acceptance/tests/lms/test_teams.py
View file @
fab5ef32
...
...
@@ -521,6 +521,23 @@ class BrowseTopicsTest(TeamsTabBase):
self
.
assertEqual
(
len
(
self
.
topics_page
.
topic_cards
),
TOPICS_PER_PAGE
)
self
.
assertTrue
(
self
.
topics_page
.
get_pagination_header_text
()
.
startswith
(
'Showing 1-12 out of 13 total'
))
def
test_topic_pagination_one_page
(
self
):
"""
Scenario: Browsing topics when there are fewer topics than the page size i.e. 12
all topics should show on one page
Given I am enrolled in a course with team configuration and topics
When I visit the Teams page
And I browse topics
And I should see corrected number of topic cards
And I should see the correct page header
And I should not see a pagination footer
"""
self
.
set_team_configuration
({
u"max_team_size"
:
10
,
u"topics"
:
self
.
create_topics
(
10
)})
self
.
topics_page
.
visit
()
self
.
assertEqual
(
len
(
self
.
topics_page
.
topic_cards
),
10
)
self
.
assertTrue
(
self
.
topics_page
.
get_pagination_header_text
()
.
startswith
(
'Showing 1-10 out of 10 total'
))
self
.
assertFalse
(
self
.
topics_page
.
pagination_controls_visible
())
def
test_topic_description_truncation
(
self
):
"""
Scenario: excessively long topic descriptions should be truncated so
...
...
lms/djangoapps/teams/static/teams/js/collections/base.js
View file @
fab5ef32
...
...
@@ -6,7 +6,9 @@
constructor
:
function
(
models
,
options
)
{
this
.
options
=
options
;
this
.
url
=
options
.
url
;
this
.
state
.
perPage
=
options
.
per_page
;
if
(
options
.
perPage
)
{
this
.
state
.
pageSize
=
options
.
perPage
;
}
this
.
course_id
=
options
.
course_id
;
this
.
teamEvents
=
options
.
teamEvents
;
...
...
@@ -33,6 +35,8 @@
this
.
isStale
=
true
;
},
// TODO: These changes has been added to backbone.paginator
// remove when backbone.paginator gets a new release
sync
:
function
(
method
,
model
,
options
)
{
// do not send total pages and total records in request
if
(
method
===
'read'
)
{
...
...
lms/djangoapps/teams/static/teams/js/collections/my_teams.js
View file @
fab5ef32
...
...
@@ -8,9 +8,7 @@
},
text_search
:
function
()
{
return
this
.
searchString
||
''
;
},
totalPages
:
null
,
totalRecords
:
null
}
},
constructor
:
function
(
teams
,
options
)
{
...
...
lms/djangoapps/teams/static/teams/js/collections/team_membership.js
deleted
100644 → 0
View file @
d0dcfe12
;(
function
(
define
)
{
'use strict'
;
define
([
'teams/js/collections/base'
,
'teams/js/models/team_membership'
],
function
(
BaseCollection
,
TeamMembershipModel
)
{
var
TeamMembershipCollection
=
BaseCollection
.
extend
({
initialize
:
function
(
team_memberships
,
options
)
{
this
.
url
=
options
.
url
;
var
self
=
this
;
BaseCollection
.
prototype
.
initialize
.
call
(
this
,
options
);
this
.
perPage
=
options
.
per_page
||
10
;
this
.
username
=
options
.
username
;
this
.
server_api
=
_
.
extend
(
{
expand
:
'team,user'
,
username
:
this
.
username
,
course_id
:
function
()
{
return
encodeURIComponent
(
self
.
course_id
);
}
},
BaseCollection
.
prototype
.
server_api
);
delete
this
.
server_api
[
'sort_order'
];
// Sort order is not specified for the TeamMembership API
delete
this
.
server_api
[
'order_by'
];
// Order by is not specified for the TeamMembership API
},
model
:
TeamMembershipModel
});
return
TeamMembershipCollection
;
});
}).
call
(
this
,
define
||
RequireJS
.
define
);
lms/djangoapps/teams/static/teams/js/collections/topic.js
View file @
fab5ef32
...
...
@@ -6,7 +6,6 @@
model
:
TopicModel
,
state
:
{
perPage
:
null
,
sortKey
:
'name'
},
...
...
@@ -16,12 +15,13 @@
},
constructor
:
function
(
topics
,
options
)
{
BaseCollection
.
prototype
.
constructor
.
call
(
this
,
topics
,
options
);
this
.
state
.
pageSize
=
topics
.
results
.
length
;
if
(
topics
.
sort_order
)
{
this
.
state
.
sortKey
=
topics
.
sort_order
;
}
options
.
perPage
=
topics
.
results
.
length
;
BaseCollection
.
prototype
.
constructor
.
call
(
this
,
topics
,
options
);
this
.
registerSortableField
(
'name'
,
gettext
(
'name'
));
// Translators: This refers to the number of teams (a count of how many teams there are)
this
.
registerSortableField
(
'team_count'
,
gettext
(
'team count'
));
...
...
lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
View file @
fab5ef32
...
...
@@ -20,8 +20,9 @@ define(['backbone', 'URI', 'underscore', 'common/js/spec_helpers/ajax_helpers',
expect
(
params
[
param
]).
toBe
(
value
);
};
it
(
'sets its p
erPag
e based on initial page size'
,
function
()
{
it
(
'sets its p
age siz
e based on initial page size'
,
function
()
{
expect
(
topicCollection
.
getPageSize
()).
toBe
(
5
);
expect
(
topicCollection
.
getTotalPages
()).
toBe
(
2
);
});
it
(
'sorts by name'
,
function
()
{
...
...
lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
View file @
fab5ef32
...
...
@@ -2,10 +2,9 @@ define([
'backbone'
,
'underscore'
,
'teams/js/collections/team'
,
'teams/js/collections/team_membership'
,
'teams/js/collections/topic'
,
'teams/js/models/topic'
],
function
(
Backbone
,
_
,
TeamCollection
,
T
eamMembershipCollection
,
T
opicCollection
,
TopicModel
)
{
],
function
(
Backbone
,
_
,
TeamCollection
,
TopicCollection
,
TopicModel
)
{
'use strict'
;
var
createMockPostResponse
,
createMockDiscussionResponse
,
createAnnotatedContentInfo
,
createMockThreadResponse
,
createMockTopicData
,
createMockTopicCollection
,
createMockTopic
,
...
...
@@ -63,9 +62,7 @@ define([
return
new
collectionType
(
createMockTeamsResponse
(
responseOptions
),
_
.
extend
({
state
:
{
pageSize
:
5
},
perPage
:
5
,
teamEvents
:
teamEvents
,
course_id
:
testCourseID
,
parse
:
true
...
...
@@ -289,9 +286,6 @@ define([
sort_order
:
'name'
},
{
state
:
{
pageSize
:
5
},
teamEvents
:
teamEvents
,
course_id
:
testCourseID
,
parse
:
true
,
...
...
lms/djangoapps/teams/static/teams/js/views/teams_tab.js
View file @
fab5ef32
...
...
@@ -103,7 +103,7 @@
teamEvents
:
this
.
teamEvents
,
course_id
:
this
.
context
.
courseID
,
username
:
this
.
context
.
userInfo
.
username
,
per
_p
age
:
2
,
per
P
age
:
2
,
parse
:
true
,
url
:
this
.
context
.
myTeamsUrl
}
...
...
@@ -337,7 +337,7 @@
course_id
:
view
.
context
.
courseID
,
topic_id
:
topicID
,
url
:
view
.
context
.
teamsUrl
,
per
_p
age
:
10
per
P
age
:
10
});
view
.
teamsCollection
=
collection
;
collection
.
getPage
(
1
).
then
(
function
()
{
...
...
@@ -346,7 +346,7 @@
collection
:
collection
,
breadcrumbs
:
view
.
createBreadcrumbs
(),
showSortControls
:
true
});
});
deferred
.
resolve
(
teamsView
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment