shorten the ISO date to locale date format

This commit is contained in:
Jacky 2017-11-11 21:15:44 -05:00
parent d1e9ab9135
commit cd94d4baad
4 changed files with 24 additions and 22 deletions

View File

@ -320,6 +320,7 @@ function init() {
"externals/date.js", "externals/date.js",
"externals/jquery.i18n.js", "externals/jquery.i18n.js",
"externals/tablesorter/jquery.tablesorter.min.js", "externals/tablesorter/jquery.tablesorter.min.js",
"externals/moment-with-locales.min.js",
"scripts/util/misc.js", "scripts/util/misc.js",
"scripts/util/url.js", "scripts/util/url.js",

File diff suppressed because one or more lines are too long

View File

@ -107,7 +107,7 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
if (data.projects.hasOwnProperty(n)) { if (data.projects.hasOwnProperty(n)) {
var project = data.projects[n]; var project = data.projects[n];
project.id = n; project.id = n;
project.date = Date.parseExact(project.modified, "yyyy-MM-ddTHH:mm:ssZ"); project.date = moment(project.modified).format('YYYY-MM-DD HH:mm A');
for (var n in data.customMetadataColumns) { for (var n in data.customMetadataColumns) {
var found = false; var found = false;
for(var i = 0; i < project.userMetadata.length; i++) { for(var i = 0; i < project.userMetadata.length; i++) {
@ -127,7 +127,6 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
} }
projects.push(project); projects.push(project);
} }
projects.sort(function(a, b) { return b.date.getTime() - a.date.getTime(); });
var container = $("#projects-container").empty(); var container = $("#projects-container").empty();
if (!projects.length) { if (!projects.length) {
@ -231,9 +230,8 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
); );
$('<div></div>') $('<div></div>')
.html(project.date.toISOString()) .html(project.date)
.addClass("last-modified") .addClass("last-modified")
.attr("title", project.date.toString())
.appendTo($(tr.insertCell(tr.cells.length)).attr('width', '1%')); .appendTo($(tr.insertCell(tr.cells.length)).attr('width', '1%'));
var nameLink = $('<a></a>') var nameLink = $('<a></a>')
@ -267,26 +265,14 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
renderProject(projects[i]); renderProject(projects[i]);
} }
$.tablesorter.addParser({
id: "isoDateParser",
is: function(s) {
return (/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}T\d{2}:\d{2}:\d{2}[\+,\-\.]\d{3}/).test(s);
},
format: function(s, table) {
return $.tablesorter.formatFloat((s !== "") ? (new Date(s).getTime() || "") : "", table);
},
type: "numeric"
});
$(table).tablesorter({ $(table).tablesorter({
headers : { headers : {
0: { sorter: false }, 0: { sorter: false },
1: { sorter: false }, 1: { sorter: false },
2: { sorter: false }, 2: { sorter: false },
3 : { 3: { sorter: "text" }
sorter : "isoDateParser"
}
}, },
sortList: [[3,1]],
widthFixed: false widthFixed: false
}); });
} }
@ -324,11 +310,17 @@ Refine.OpenProjectUI.prototype._onClickUploadFileButton = function(evt) {
Refine.OpenProjectUI.refreshProject = function(tr, metaData) { Refine.OpenProjectUI.refreshProject = function(tr, metaData) {
var refreshMetaField = function(data, index) { var refreshMetaField = function(data, index) {
if (index === 4) {
$('a', $('td', tr).eq(index))
.text(data);
} else {
$('td', tr).eq(index) $('td', tr).eq(index)
.html(data); .text(data);
}
}; };
var index = 5; var index = 4;
refreshMetaField(metaData.name, index); index++;
refreshMetaField(metaData.creator, index); index++; refreshMetaField(metaData.creator, index); index++;
refreshMetaField(metaData.subject,index); index++; refreshMetaField(metaData.subject,index); index++;
refreshMetaField(metaData.description,index); index++; refreshMetaField(metaData.description,index); index++;

View File

@ -107,17 +107,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
} }
#projects-container > table thead th:nth-child(4) { #projects-container > table thead th:nth-child(4) {
width: 9% width: 8%
} }
#projects-container > table thead th:nth-child(5) { #projects-container > table thead th:nth-child(5) {
width: 15% width: 15%
} }
#projects-container > table thead th:nth-child(6) {
width: 6%
}
#projects-container > table thead th:nth-child(8) { #projects-container > table thead th:nth-child(8) {
width: 35% width: 35%
} }
#projects-container > table thead th:nth-child(9) {
width: 5%
}
#projects-container > table > tbody > tr > td { #projects-container > table > tbody > tr > td {
word-wrap: break-word; word-wrap: break-word;
} }