|
372 | 372 | } else {
|
373 | 373 | $(snowflake).hide();
|
374 | 374 | }
|
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 |
| - } |
382 | 375 | // load frozen lens if frozen is true
|
383 | 376 | if(this.scalarLensObject.frozen === true){
|
384 | 377 | $(this.element).find('.lens-tags .btn').addClass('disabled');
|
|
3258 | 3251 | </div>
|
3259 | 3252 | </div>`
|
3260 | 3253 | );
|
3261 |
| - // hide if user not logged in |
3262 |
| - if(this.userId == 'unknown'){ |
3263 |
| - $(button).hide(); |
3264 |
| - } else { |
3265 |
| - return button; |
3266 |
| - } |
| 3254 | + return button; |
3267 | 3255 | }
|
3268 | 3256 |
|
3269 | 3257 | // update options menu
|
|
3723 | 3711 |
|
3724 | 3712 | ScalarLenses.prototype.updateDuplicateCopyPrompt = function() {
|
3725 | 3713 | $('#duplicate-copy-prompt').find('.save').off();
|
3726 |
| - if (this.myLenses.length >= this.maxLenses) { |
| 3714 | + if (this.userId == 'unknown') { |
3727 | 3715 | $('#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> |
3730 | 3717 | </div>`);
|
3731 | 3718 | } 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', () => { |
3741 | 3734 | this.duplicateLensByUserId();
|
3742 |
| - }); |
| 3735 | + }); |
| 3736 | + } |
3743 | 3737 | }
|
3744 | 3738 | }
|
3745 | 3739 |
|
|
3996 | 3990 | ScalarLenses.prototype.saveLens = function(successHandler){
|
3997 | 3991 | //console.log(JSON.stringify(this.scalarLensObject, null, 2));
|
3998 | 3992 |
|
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') { |
4001 | 3995 | if (this.canSave == true) {
|
4002 | 3996 | this.updateLensByUserId(successHandler);
|
4003 | 3997 | return;
|
|
0 commit comments