Sha256: 275f56778d1801c985a4a6e133a7f06b4bbb2aaf499f337f86e817b8b04fbc5d

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

/**
 * This Javascript/JQuery method is used for the population of the contributor field
 * when a proxy user is making a deposit on behalf of someone else.  The method gets the selected
 * person on behalf of whom the proxy person is making the deposit and places that person's name in
 * a Contributor field and clicks the contributor Add button.
 */
function updateContributors(){

    // Get the selected owner name from the owner control.
    // If it is 'Myself', then pluck the name from the display name on the dropdown menu in the title bar of the page.
    // If 'nothing' was selected, do nothing and return.

    var ownerName = $("[id*='_owner'] option:selected").text();
    if (ownerName == 'Myself') {
        ownerName = $(".user-display-name").text().trim();
    }
    else if (ownerName === "") { return; }

    // Put that name into the "Add" Contributor control and force a click of the Add button.
    // Note that the last Contributor control is always the one into which a new user is entered.
    $('input[id$=_contributor]').last().val(ownerName);
    $("div[class*=_contributor] .add").click();
}

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
curation_concerns-0.1.0 app/assets/javascripts/curation_concerns/proxy_submission.js
worthwhile-0.1.2 app/assets/javascripts/worthwhile/proxy_submission.js
worthwhile-0.1.1 app/assets/javascripts/worthwhile/proxy_submission.js
worthwhile-0.1.0 app/assets/javascripts/worthwhile/proxy_submission.js
worthwhile-0.0.3 app/assets/javascripts/worthwhile/proxy_submission.js
worthwhile-0.0.2 app/assets/javascripts/worthwhile/proxy_submission.js
worthwhile-0.0.1 app/assets/javascripts/worthwhile/proxy_submission.js