cleaned html of item form
This commit is contained in:
parent
71b80fc023
commit
7dbc55a10d
|
@ -164,15 +164,17 @@ function getJQ(f) {
|
|||
|
||||
function getItemForm(f) {
|
||||
var $form = $('<div />').addClass("itemForm");
|
||||
var $labelsP = $('<p />').appendTo($form);
|
||||
var $titleLabel = $('<span />').addClass("itemFormLabel").addClass("titleLabel").text("Title").appendTo($labelsP);
|
||||
var $descriptionLabel = $('<span />').addClass("itemFormLabel").addClass("descriptionLabel").text("Description").appendTo($labelsP);
|
||||
var $inputsP = $('<p />').appendTo($form);
|
||||
var $titleInput = $('<input />').addClass("itemTitle").val(f.title).appendTo($inputsP);
|
||||
var $leftCol = $('<div />').addClass("leftCol").appendTo($form);
|
||||
var $title = $('<p />').addClass("editTitle").appendTo($leftCol);
|
||||
var $titleLabel = $('<span />').addClass("itemFormLabel").addClass("titleLabel").text("Title").appendTo($title);
|
||||
var $titleInput = $('<input />').addClass("itemTitle").val(f.title).appendTo($title);
|
||||
|
||||
|
||||
|
||||
if (f.can_edit) {
|
||||
var $privateLabel = $('<span />').addClass("pvtLabel").text("Private ").appendTo($inputsP);
|
||||
var $pvtCheckbox = $('<input />').attr("type", "checkbox").attr("checked", f.is_private).appendTo($inputsP);
|
||||
var $pvt = $('<p />').addClass("editPrivate").appendTo($leftCol);
|
||||
var $privateLabel = $('<span />').addClass("pvtLabel").text("Private ").appendTo($pvt);
|
||||
var $pvtCheckbox = $('<input />').attr("type", "checkbox").attr("checked", f.is_private).appendTo($pvt);
|
||||
$pvtCheckbox.change(function() {
|
||||
var checked = $(this).is(":checked");
|
||||
if (checked) {
|
||||
|
@ -194,10 +196,12 @@ function getItemForm(f) {
|
|||
}, "json");
|
||||
});
|
||||
}
|
||||
|
||||
var $descriptionInput = $('<textarea />').addClass("itemDescription").val(f.description).appendTo($inputsP);
|
||||
var $hiddenInput = $('<input />').addClass("itemId").attr("type", "hidden").val(f.id).appendTo($inputsP);
|
||||
var $submitP = $('<p />').addClass("submitInput").appendTo($form);
|
||||
var $rightCol = $("<div />").addClass("rightCol").appendTo($form);
|
||||
var $desc = $("<p />").addClass("editDescription").appendTo($rightCol);
|
||||
var $descriptionLabel = $('<span />').addClass("itemFormLabel").addClass("descriptionLabel").text("Description").appendTo($desc);
|
||||
var $descriptionInput = $('<textarea />').addClass("itemDescription").val(f.description).appendTo($desc);
|
||||
var $hiddenInput = $('<input />').addClass("itemId").attr("type", "hidden").val(f.id).appendTo($desc);
|
||||
var $submitP = $('<p />').addClass("submitInput").appendTo($rightCol);
|
||||
var $submit = $('<input />').addClass("submitItem").attr("type", "submit").val("Submit").appendTo($submitP);
|
||||
var $submitStatus = $('<span />').addClass("submitStatus").appendTo($submitP);
|
||||
$submit.click(function(e) {
|
||||
|
@ -229,11 +233,20 @@ function getListElement(f) {
|
|||
var $item = $('<div />').addClass("fileItem").data("data", f);
|
||||
var $checkbox = $('<input />').attr("type", "checkbox").addClass("fileCheckbox").appendTo($item);
|
||||
var $icon = $('<img />').addClass("fileIcon").attr("src", "/static/images/icons2/" + f.type.toLowerCase() + ".jpg").appendTo($item);
|
||||
var $study = $('<span />').addClass("fileStudy").text(f.studies[0].name + ": ").appendTo($item);
|
||||
var study_txt = joinStudies(f.studies);
|
||||
var $study = $('<span />').addClass("fileStudy").text(study_txt + ": ").appendTo($item);
|
||||
var $title = $('<span />').addClass("fileTitle").text(f.title).appendTo($item);
|
||||
return $item;
|
||||
}
|
||||
|
||||
function joinStudies(studies) {
|
||||
var arr = [];
|
||||
for (var i=0; i<studies.length; i++) {
|
||||
arr.push(studies[i].name);
|
||||
}
|
||||
return arr.join(", ");
|
||||
}
|
||||
|
||||
function getSelectedIds() {
|
||||
var ids = [];
|
||||
$('.fileItem').each(function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user