Commit 6817e89f by Andy Armstrong

Fix i18n for last activity date on team cards

parent 7eb41ed8
......@@ -27,8 +27,9 @@ require.config({
"jquery.immediateDescendents": "coffee/src/jquery.immediateDescendents",
"datepair": "js/vendor/timepicker/datepair",
"date": "js/vendor/date",
"text": 'js/vendor/requirejs/text',
"moment": "js/vendor/moment.min",
"moment-with-locales": "js/vendor/moment-with-locales.min",
"text": 'js/vendor/requirejs/text',
"underscore": "js/vendor/underscore-min",
"underscore.string": "js/vendor/underscore.string.min",
"backbone": "js/vendor/backbone-min",
......
......@@ -23,6 +23,8 @@ requirejs.config({
"jquery.simulate": "xmodule_js/common_static/js/vendor/jquery.simulate",
"datepair": "xmodule_js/common_static/js/vendor/timepicker/datepair",
"date": "xmodule_js/common_static/js/vendor/date",
"moment": "xmodule_js/common_static/js/vendor/moment.min",
"moment-with-locales": "xmodule_js/common_static/js/vendor/moment-with-locales.min",
"text": "xmodule_js/common_static/js/vendor/requirejs/text",
"underscore": "xmodule_js/common_static/js/vendor/underscore-min",
"underscore.string": "xmodule_js/common_static/js/vendor/underscore.string.min",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -43,8 +43,8 @@ define(['jquery',
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('.team-activity abbr').attr('title')).toContain('August 21st 2015');
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');
......@@ -143,7 +143,7 @@ define(['jquery',
{username: 'user_5', image_url: 'user_5_image'},
{username: 'user_6', image_url: 'user_6_image'},
{username: 'user_3', image_url: 'user_3_image'},
{username: 'user_4', image_url: 'user_4_image'},
{username: 'user_4', image_url: 'user_4_image'}
]);
expect(view.$('.item-member-thumb').eq(-1)).toHaveText('and others…');
});
......
;(function (define) {
'use strict';
define([
'jquery',
'backbone',
'underscore',
'gettext',
'jquery.timeago',
'moment-with-locales',
'js/components/card/views/card',
'teams/js/views/team_utils',
'text!teams/templates/team-membership-details.underscore',
'text!teams/templates/team-country-language.underscore',
'text!teams/templates/team-activity.underscore'
], function (
$,
Backbone,
_,
gettext,
timeago,
moment,
CardView,
TeamUtils,
teamMembershipDetailsTemplate,
......@@ -75,15 +77,18 @@
},
render: function () {
var lastActivity = moment(this.date),
currentLanguage = $('html').attr('lang');
lastActivity.locale(currentLanguage);
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})},
// Translators: 'date' is a placeholder for a fuzzy, relative timestamp (see: http://momentjs.com/)
gettext("Last activity %(date)s"),
{date: this.template({date: lastActivity.format('MMMM Do YYYY, h:mm:ss a')})},
true
)
);
this.$('abbr').timeago();
this.$('abbr').text(lastActivity.fromNow());
}
});
......@@ -103,7 +108,7 @@
},
teamModel: function () {
if (this.model.has('team')) { return this.model.get('team'); };
if (this.model.has('team')) { return this.model.get('team'); }
return this.model;
},
......
......@@ -25,6 +25,8 @@
'jquery.url': 'xmodule_js/common_static/js/vendor/url.min',
'datepair': 'xmodule_js/common_static/js/vendor/timepicker/datepair',
'date': 'xmodule_js/common_static/js/vendor/date',
'moment': 'xmodule_js/common_static/js/vendor/moment.min',
'moment-with-locales': 'xmodule_js/common_static/js/vendor/moment-with-locales.min',
'text': 'xmodule_js/common_static/js/vendor/requirejs/text',
'underscore': 'xmodule_js/common_static/js/vendor/underscore-min',
'underscore.string': 'xmodule_js/common_static/js/vendor/underscore.string.min',
......
......@@ -63,6 +63,7 @@ lib_paths:
- xmodule_js/common_static/js/test/i18n.js
- xmodule_js/common_static/js/vendor/date.js
- xmodule_js/common_static/js/vendor/moment.min.js
- xmodule_js/common_static/js/vendor/moment-with-locales.min.js
- xmodule_js/common_static/js/utils/edx.utils.validate.js
# Paths to source JavaScript files
......
......@@ -35,6 +35,8 @@
"gettext": "/i18n",
"annotator_1.2.9": "js/vendor/edxnotes/annotator-full.min",
"date": "js/vendor/date",
"moment": "js/vendor/moment.min",
"moment-with-locales": "js/vendor/moment-with-locales.min",
"text": "js/vendor/requirejs/text",
"logger": "js/src/logger",
"backbone": "js/vendor/backbone-min",
......@@ -52,7 +54,6 @@
"URI": "js/vendor/URI.min",
"string_utils": "js/src/string_utils",
"utility": "js/src/utility",
"moment": "js/vendor/moment.min",
// Files needed by OVA
"annotator": "js/vendor/ova/annotator-full",
......@@ -189,6 +190,9 @@
// End of needed by OVA
"moment": {
exports: "moment"
},
"moment-with-locales": {
exports: "moment"
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment