Sha256: f037ed7b3531f4b16a9085d898564fa205d48b00a929b0ad5ecdf2333c5d5f12
Contents?: true
Size: 1.14 KB
Versions: 82
Compression:
Stored size: 1.14 KB
Contents
export class DepositAgreement { // Monitors the form and runs the callback if any files are added constructor(form, callback) { this.agreementCheckbox = form.find('input#agreement') // If true, require the accept checkbox to be checked. // Tracks whether the user needs to accept again to the depositor // agreement. Once the user has manually agreed once she does not // need to agree again regardless on how many files are being added. this.isActiveAgreement = this.agreementCheckbox.length > 0 if (this.isActiveAgreement) { this.setupActiveAgreement(callback) this.mustAgreeAgain = this.isAccepted } else { this.mustAgreeAgain = false } } setupActiveAgreement(callback) { this.agreementCheckbox.on('change', callback) } setNotAccepted() { this.agreementCheckbox.prop("checked", false) this.mustAgreeAgain = false } setAccepted() { this.agreementCheckbox.prop("checked", true) } /** * return true if it's a passive agreement or if the checkbox has been checked */ get isAccepted() { return !this.isActiveAgreement || this.agreementCheckbox[0].checked } }
Version data entries
82 entries across 82 versions & 1 rubygems