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
fad40cf3
Commit
fad40cf3
authored
Aug 21, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show a team's last activity in the UI.
Fix timeago and requireJS.
parent
38fb6eae
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
7 deletions
+97
-7
lms/djangoapps/teams/static/teams/js/models/team.js
+2
-1
lms/djangoapps/teams/static/teams/js/spec/views/edit_team_spec.js
+2
-1
lms/djangoapps/teams/static/teams/js/spec/views/team_card_spec.js
+55
-0
lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
+2
-1
lms/djangoapps/teams/static/teams/js/views/team_card.js
+29
-4
lms/djangoapps/teams/static/teams/templates/team-activity.underscore
+1
-0
lms/static/js/spec/main.js
+1
-0
lms/static/lms/js/require-config.js
+5
-0
No files found.
lms/djangoapps/teams/static/teams/js/models/team.js
View file @
fad40cf3
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
description
:
''
,
description
:
''
,
country
:
''
,
country
:
''
,
language
:
''
,
language
:
''
,
membership
:
[]
membership
:
[],
last_activity_at
:
''
},
},
initialize
:
function
(
options
)
{
initialize
:
function
(
options
)
{
...
...
lms/djangoapps/teams/static/teams/js/spec/views/edit_team_spec.js
View file @
fad40cf3
...
@@ -20,7 +20,8 @@ define([
...
@@ -20,7 +20,8 @@ define([
description
:
"TeamDescription"
,
description
:
"TeamDescription"
,
country
:
"c"
,
country
:
"c"
,
language
:
"a"
,
language
:
"a"
,
membership
:
[]
membership
:
[],
last_activity_at
:
''
},
},
verifyValidation
=
function
(
requests
,
teamEditView
,
fieldsData
)
{
verifyValidation
=
function
(
requests
,
teamEditView
,
fieldsData
)
{
_
.
each
(
fieldsData
,
function
(
fieldData
)
{
_
.
each
(
fieldsData
,
function
(
fieldData
)
{
...
...
lms/djangoapps/teams/static/teams/js/spec/views/team_card_spec.js
0 → 100644
View file @
fad40cf3
define
([
'jquery'
,
'underscore'
,
'teams/js/views/team_card'
,
'teams/js/models/team'
],
function
(
$
,
_
,
TeamCardView
,
Team
)
{
describe
(
'TeamCardView'
,
function
()
{
var
createTeamCardView
,
view
;
createTeamCardView
=
function
()
{
var
model
=
new
Team
({
id
:
'test-team'
,
name
:
'Test Team'
,
is_active
:
true
,
course_id
:
'test/course/id'
,
topic_id
:
'test-topic'
,
description
:
'A team for testing'
,
last_activity_at
:
"2015-08-21T18:53:01.145Z"
,
country
:
'us'
,
language
:
'en'
}),
teamCardClass
=
TeamCardView
.
extend
({
maxTeamSize
:
'100'
,
srInfo
:
{
id
:
'test-sr-id'
,
text
:
'Screenreader text'
},
countries
:
{
us
:
'United States of America'
},
languages
:
{
en
:
'English'
}
});
return
new
teamCardClass
({
model
:
model
});
};
beforeEach
(
function
()
{
view
=
createTeamCardView
();
view
.
render
();
});
it
(
'can render itself'
,
function
()
{
expect
(
view
.
$el
).
toHaveClass
(
'list-card'
);
expect
(
view
.
$el
.
find
(
'.card-title'
).
text
()).
toContain
(
'Test Team'
);
expect
(
view
.
$el
.
find
(
'.card-description'
).
text
()).
toContain
(
'A team for testing'
);
expect
(
view
.
$el
.
find
(
'.team-activity abbr'
).
attr
(
'title'
)).
toEqual
(
"2015-08-21T18:53:01.145Z"
);
expect
(
view
.
$el
.
find
(
'.team-activity'
).
text
()).
toContain
(
'Last Activity'
);
expect
(
view
.
$el
.
find
(
'.card-meta'
).
text
()).
toContain
(
'0 / 100 Members'
);
expect
(
view
.
$el
.
find
(
'.team-location'
).
text
()).
toContain
(
'United States of America'
);
expect
(
view
.
$el
.
find
(
'.team-language'
).
text
()).
toContain
(
'English'
);
});
it
(
'navigates to the associated team page when its action button is clicked'
,
function
()
{
expect
(
view
.
$
(
'.action'
).
attr
(
'href'
)).
toEqual
(
'#teams/test-topic/test-team'
);
});
});
}
);
lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
View file @
fad40cf3
...
@@ -33,7 +33,8 @@ define([
...
@@ -33,7 +33,8 @@ define([
language
:
testLanguages
[
i
%
4
][
0
],
language
:
testLanguages
[
i
%
4
][
0
],
country
:
testCountries
[
i
%
4
][
0
],
country
:
testCountries
[
i
%
4
][
0
],
is_active
:
true
,
is_active
:
true
,
membership
:
[]
membership
:
[],
last_activity_at
:
''
};
};
});
});
};
};
...
...
lms/djangoapps/teams/static/teams/js/views/team_card.js
View file @
fad40cf3
...
@@ -4,11 +4,13 @@
...
@@ -4,11 +4,13 @@
'backbone'
,
'backbone'
,
'underscore'
,
'underscore'
,
'gettext'
,
'gettext'
,
'jquery.timeago'
,
'js/components/card/views/card'
,
'js/components/card/views/card'
,
'teams/js/views/team_utils'
,
'teams/js/views/team_utils'
,
'text!teams/templates/team-country-language.underscore'
'text!teams/templates/team-country-language.underscore'
,
],
function
(
Backbone
,
_
,
gettext
,
CardView
,
TeamUtils
,
teamCountryLanguageTemplate
)
{
'text!teams/templates/team-activity.underscore'
var
TeamMembershipView
,
TeamCountryLanguageView
,
TeamCardView
;
],
function
(
Backbone
,
_
,
gettext
,
timeago
,
CardView
,
TeamUtils
,
teamCountryLanguageTemplate
,
teamActivityTemplate
)
{
var
TeamMembershipView
,
TeamCountryLanguageView
,
TeamActivityView
,
TeamCardView
;
TeamMembershipView
=
Backbone
.
View
.
extend
({
TeamMembershipView
=
Backbone
.
View
.
extend
({
tagName
:
'div'
,
tagName
:
'div'
,
...
@@ -54,6 +56,28 @@
...
@@ -54,6 +56,28 @@
}
}
});
});
TeamActivityView
=
Backbone
.
View
.
extend
({
tagName
:
'div'
,
className
:
'team-activity'
,
template
:
_
.
template
(
teamActivityTemplate
),
initialize
:
function
(
options
)
{
this
.
date
=
options
.
date
;
},
render
:
function
()
{
this
.
$el
.
html
(
interpolate
(
// Translators: 'date' is a placeholder for a fuzzy, relative timestamp (see: https://github.com/rmm5t/jquery-timeago)
gettext
(
"Last Activity %(date)s"
),
{
date
:
this
.
template
({
date
:
this
.
date
})},
true
)
);
this
.
$
(
'abbr'
).
timeago
();
}
});
TeamCardView
=
CardView
.
extend
({
TeamCardView
=
CardView
.
extend
({
initialize
:
function
()
{
initialize
:
function
()
{
CardView
.
prototype
.
initialize
.
apply
(
this
,
arguments
);
CardView
.
prototype
.
initialize
.
apply
(
this
,
arguments
);
...
@@ -64,7 +88,8 @@
...
@@ -64,7 +88,8 @@
model
:
this
.
teamModel
(),
model
:
this
.
teamModel
(),
countries
:
this
.
countries
,
countries
:
this
.
countries
,
languages
:
this
.
languages
languages
:
this
.
languages
})
}),
new
TeamActivityView
({
date
:
this
.
teamModel
().
get
(
'last_activity_at'
)})
];
];
},
},
...
...
lms/djangoapps/teams/static/teams/templates/team-activity.underscore
0 → 100644
View file @
fad40cf3
<abbr title="<%= date %>"></abbr>
lms/static/js/spec/main.js
View file @
fad40cf3
...
@@ -794,6 +794,7 @@
...
@@ -794,6 +794,7 @@
'lms/include/teams/js/spec/teams_tab_factory_spec.js'
,
'lms/include/teams/js/spec/teams_tab_factory_spec.js'
,
'lms/include/teams/js/spec/views/edit_team_spec.js'
,
'lms/include/teams/js/spec/views/edit_team_spec.js'
,
'lms/include/teams/js/spec/views/my_teams_spec.js'
,
'lms/include/teams/js/spec/views/my_teams_spec.js'
,
'lms/include/teams/js/spec/views/team_card_spec.js'
,
'lms/include/teams/js/spec/views/team_discussion_spec.js'
,
'lms/include/teams/js/spec/views/team_discussion_spec.js'
,
'lms/include/teams/js/spec/views/team_profile_spec.js'
,
'lms/include/teams/js/spec/views/team_profile_spec.js'
,
'lms/include/teams/js/spec/views/teams_spec.js'
,
'lms/include/teams/js/spec/views/teams_spec.js'
,
...
...
lms/static/lms/js/require-config.js
View file @
fad40cf3
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
"underscore.string"
:
"js/vendor/underscore.string.min"
,
"underscore.string"
:
"js/vendor/underscore.string.min"
,
"jquery"
:
"js/vendor/jquery.min"
,
"jquery"
:
"js/vendor/jquery.min"
,
"jquery.cookie"
:
"js/vendor/jquery.cookie"
,
"jquery.cookie"
:
"js/vendor/jquery.cookie"
,
'jquery.timeago'
:
'js/vendor/jquery.timeago'
,
"jquery.url"
:
"js/vendor/url.min"
,
"jquery.url"
:
"js/vendor/url.min"
,
"jquery.ui"
:
"js/vendor/jquery-ui.min"
,
"jquery.ui"
:
"js/vendor/jquery-ui.min"
,
"jquery.iframe-transport"
:
"js/vendor/jQuery-File-Upload/js/jquery.iframe-transport"
,
"jquery.iframe-transport"
:
"js/vendor/jQuery-File-Upload/js/jquery.iframe-transport"
,
...
@@ -94,6 +95,10 @@
...
@@ -94,6 +95,10 @@
deps
:
[
"jquery"
],
deps
:
[
"jquery"
],
exports
:
"jQuery.fn.cookie"
exports
:
"jQuery.fn.cookie"
},
},
"jquery.timeago"
:
{
deps
:
[
"jquery"
],
exports
:
"jQuery.timeago"
},
"jquery.url"
:
{
"jquery.url"
:
{
deps
:
[
"jquery"
],
deps
:
[
"jquery"
],
exports
:
"jQuery.url"
exports
:
"jQuery.url"
...
...
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