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
2398824b
Commit
2398824b
authored
Aug 05, 2015
by
Bill DeRusha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Full Country & Language Names to Teams [TNL-2891]
parent
117bc4a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
10 deletions
+51
-10
lms/djangoapps/teams/static/teams/js/spec/views/teams_spec.js
+22
-6
lms/djangoapps/teams/static/teams/js/views/team_card.js
+12
-3
lms/djangoapps/teams/static/teams/js/views/teams.js
+17
-1
No files found.
lms/djangoapps/teams/static/teams/js/spec/views/teams_spec.js
View file @
2398824b
...
...
@@ -9,13 +9,25 @@ define([
return
{
name
:
"team "
+
i
,
id
:
"id "
+
i
,
language
:
"English"
,
country
:
"Sealand"
,
language
:
languages
[
i
%
4
][
0
]
,
country
:
countries
[
i
%
4
][
0
]
,
is_active
:
true
,
membership
:
[]
};
});
};
},
countries
=
[
[
''
,
''
],
[
'US'
,
'United States'
],
[
'CA'
,
'Canada'
],
[
'MX'
,
'Mexico'
]
],
languages
=
[
[
''
,
''
],
[
'en'
,
'English'
],
[
'es'
,
'Spanish'
],
[
'fr'
,
'French'
]
];
beforeEach
(
function
()
{
setFixtures
(
'<div class="teams-container"></div>'
);
...
...
@@ -33,7 +45,10 @@ define([
teamsView
=
new
TeamsView
({
el
:
'.teams-container'
,
collection
:
teamCollection
,
teamParams
:
{}
teamParams
:
{
countries
:
countries
,
languages
:
languages
}
}).
render
();
});
...
...
@@ -43,9 +58,10 @@ define([
expect
(
teamsView
.
$
(
'.teams-paging-header'
).
text
()).
toMatch
(
'Showing 1-5 out of 6 total'
);
_
.
each
(
initialTeams
,
function
(
team
,
index
)
{
var
currentCard
=
teamCards
.
eq
(
index
);
expect
(
currentCard
.
text
()).
toMatch
(
team
.
name
);
expect
(
currentCard
.
text
()).
toMatch
(
team
.
language
);
expect
(
currentCard
.
text
()).
toMatch
(
team
.
country
);
expect
(
currentCard
.
text
()).
toMatch
(
_
.
object
(
languages
)[
team
.
language
]
);
expect
(
currentCard
.
text
()).
toMatch
(
_
.
object
(
countries
)[
team
.
country
]
);
});
expect
(
footerEl
.
text
()).
toMatch
(
'1
\\
s+out of
\\
s+
\
/
\\
s+2'
);
expect
(
footerEl
).
not
.
toHaveClass
(
'hidden'
);
...
...
lms/djangoapps/teams/static/teams/js/views/team_card.js
View file @
2398824b
...
...
@@ -47,11 +47,16 @@
TeamCountryLanguageView
=
Backbone
.
View
.
extend
({
template
:
_
.
template
(
teamCountryLanguageTemplate
),
initialize
:
function
(
options
)
{
this
.
countries
=
options
.
countries
;
this
.
languages
=
options
.
languages
;
},
render
:
function
()
{
// this.$el should be the card meta div
this
.
$el
.
append
(
this
.
template
({
country
:
this
.
model
.
get
(
'country'
)
,
language
:
this
.
model
.
get
(
'language'
)
country
:
this
.
countries
[
this
.
model
.
get
(
'country'
)]
,
language
:
this
.
languages
[
this
.
model
.
get
(
'language'
)]
}));
}
});
...
...
@@ -62,7 +67,11 @@
// TODO: show last activity detail view
this
.
detailViews
=
[
new
TeamMembershipView
({
model
:
this
.
model
,
maxTeamSize
:
this
.
maxTeamSize
}),
new
TeamCountryLanguageView
({
model
:
this
.
model
})
new
TeamCountryLanguageView
({
model
:
this
.
model
,
countries
:
this
.
countries
,
languages
:
this
.
languages
})
];
},
...
...
lms/djangoapps/teams/static/teams/js/views/teams.js
View file @
2398824b
...
...
@@ -14,7 +14,9 @@
this
.
itemViewClass
=
TeamCardView
.
extend
({
router
:
options
.
router
,
topic
:
options
.
topic
,
maxTeamSize
:
options
.
maxTeamSize
maxTeamSize
:
options
.
maxTeamSize
,
countries
:
this
.
selectorOptionsArrayToHashWithBlank
(
options
.
teamParams
.
countries
),
languages
:
this
.
selectorOptionsArrayToHashWithBlank
(
options
.
teamParams
.
languages
),
});
PaginatedView
.
prototype
.
initialize
.
call
(
this
);
this
.
teamParams
=
options
.
teamParams
;
...
...
@@ -29,6 +31,20 @@
this
.
$el
.
append
(
teamActionsView
.
$el
);
teamActionsView
.
render
();
return
this
;
},
/**
* Convert a 2d array to an object equivalent with an additional blank element
*
* @param {Array.<Array.<string>>} Two dimensional options array
* @returns {Object} Hash version of the input array
* @example selectorOptionsArrayToHashWithBlank([["a", "alpha"],["b","beta"]])
* // returns {"a":"alpha", "b":"beta", "":""}
*/
selectorOptionsArrayToHashWithBlank
:
function
(
options
)
{
var
map
=
_
.
object
(
options
);
map
[
""
]
=
""
;
return
map
;
}
});
return
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