Skip to content

Commit 2a4e163

Browse files
authored
Merge pull request #228 from UIUCLibrary/default-interactive-lens
Make lens interactive by default
2 parents cc56ea7 + 164ef60 commit 2a4e163

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

system/application/views/melons/cantaloupe/js/scalarlenses.jquery.js

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,6 @@
372372
} else {
373373
$(snowflake).hide();
374374
}
375-
376-
// if not logged in
377-
// buttons can't be clicked
378-
let lensButtons = $(this.element).find('.lens-editor .btn');
379-
if(this.userId == 'unknown'){
380-
lensButtons.addClass('disabled');
381-
}
382375
// load frozen lens if frozen is true
383376
if(this.scalarLensObject.frozen === true){
384377
$(this.element).find('.lens-tags .btn').addClass('disabled');
@@ -3258,12 +3251,7 @@
32583251
</div>
32593252
</div>`
32603253
);
3261-
// hide if user not logged in
3262-
if(this.userId == 'unknown'){
3263-
$(button).hide();
3264-
} else {
3265-
return button;
3266-
}
3254+
return button;
32673255
}
32683256

32693257
// update options menu
@@ -3723,23 +3711,29 @@
37233711

37243712
ScalarLenses.prototype.updateDuplicateCopyPrompt = function() {
37253713
$('#duplicate-copy-prompt').find('.save').off();
3726-
if (this.myLenses.length >= this.maxLenses) {
3714+
if (this.userId == 'unknown') {
37273715
$('#duplicate-copy-prompt .row').html(`<div class="col-xs-12">
3728-
<p class="caption_font"><strong>You have made edits to this lens which have not been saved, since you are not its owner.</strong>
3729-
As you have already reached the maximum of ${this.maxLenses} lenses, saving your changes to a new copy of the lens is not possible.</p>
3716+
<p class="caption_font"><strong>You have made edits to this lens which have not been saved because you are not logged in.</strong>
37303717
</div>`);
37313718
} else {
3732-
$('#duplicate-copy-prompt .row').html(`<div class="col-xs-10">
3733-
<p class="caption_font"><strong>You have made edits to this lens which have not been saved, since you are not its owner.</strong>
3734-
Would you like to save these changes to your own copy of the lens?</p>
3735-
</div>
3736-
<div class="col-xs-2">
3737-
<button type="button" class="btn btn-default pull-right save">Save</button>
3738-
</div>`);
3739-
// save create copy of lens
3740-
$('#duplicate-copy-prompt').find('.save').on('click', () => {
3719+
if (this.myLenses.length >= this.maxLenses) {
3720+
$('#duplicate-copy-prompt .row').html(`<div class="col-xs-12">
3721+
<p class="caption_font"><strong>You have made edits to this lens which have not been saved, since you are not its owner.</strong>
3722+
As you have already reached the maximum of ${this.maxLenses} lenses, saving your changes to a new copy of the lens is not possible.</p>
3723+
</div>`);
3724+
} else {
3725+
$('#duplicate-copy-prompt .row').html(`<div class="col-xs-10">
3726+
<p class="caption_font"><strong>You have made edits to this lens which have not been saved, since you are not its owner.</strong>
3727+
Would you like to save these changes to your own copy of the lens?</p>
3728+
</div>
3729+
<div class="col-xs-2">
3730+
<button type="button" class="btn btn-default pull-right save">Save</button>
3731+
</div>`);
3732+
// save create copy of lens
3733+
$('#duplicate-copy-prompt').find('.save').on('click', () => {
37413734
this.duplicateLensByUserId();
3742-
});
3735+
});
3736+
}
37433737
}
37443738
}
37453739

@@ -3996,8 +3990,8 @@
39963990
ScalarLenses.prototype.saveLens = function(successHandler){
39973991
//console.log(JSON.stringify(this.scalarLensObject, null, 2));
39983992

3999-
// reader not added to the book, or reader added to book
4000-
if ((this.userId != 'unknown' && this.userLevel == 'unknown') || this.userLevel == 'scalar:Reader') {
3993+
// refresh the visualization if the user isn't logged in or if they are a reader
3994+
if (this.userLevel == 'unknown' || this.userLevel == 'scalar:Reader') {
40013995
if (this.canSave == true) {
40023996
this.updateLensByUserId(successHandler);
40033997
return;

0 commit comments

Comments
 (0)