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/jquery.i18n.js",
"externals/tablesorter/jquery.tablesorter.min.js",
"externals/moment-with-locales.min.js",
"scripts/util/misc.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)) {
var project = data.projects[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) {
var found = false;
for(var i = 0; i < project.userMetadata.length; i++) {
@ -127,7 +127,6 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
}
projects.push(project);
}
projects.sort(function(a, b) { return b.date.getTime() - a.date.getTime(); });
var container = $("#projects-container").empty();
if (!projects.length) {
@ -231,9 +230,8 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
);
$('<div></div>')
.html(project.date.toISOString())
.html(project.date)
.addClass("last-modified")
.attr("title", project.date.toString())
.appendTo($(tr.insertCell(tr.cells.length)).attr('width', '1%'));
var nameLink = $('<a></a>')
@ -267,26 +265,14 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
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({
headers : {
0: { sorter: false },
1: { sorter: false },
2: { sorter: false },
3 : {
sorter : "isoDateParser"
}
3: { sorter: "text" }
},
sortList: [[3,1]],
widthFixed: false
});
}
@ -324,11 +310,17 @@ Refine.OpenProjectUI.prototype._onClickUploadFileButton = function(evt) {
Refine.OpenProjectUI.refreshProject = function(tr, metaData) {
var refreshMetaField = function(data, index) {
$('td', tr).eq(index)
.html(data);
if (index === 4) {
$('a', $('td', tr).eq(index))
.text(data);
} else {
$('td', tr).eq(index)
.text(data);
}
};
var index = 5;
var index = 4;
refreshMetaField(metaData.name, index); index++;
refreshMetaField(metaData.creator, index); index++;
refreshMetaField(metaData.subject,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) {
width: 9%
width: 8%
}
#projects-container > table thead th:nth-child(5) {
width: 15%
}
#projects-container > table thead th:nth-child(6) {
width: 6%
}
#projects-container > table thead th:nth-child(8) {
width: 35%
}
#projects-container > table thead th:nth-child(9) {
width: 5%
}
#projects-container > table > tbody > tr > td {
word-wrap: break-word;
}