|
178 | 178 | }, |
179 | 179 |
|
180 | 180 | onHideDownloadChange: function() { |
181 | | - var $checkbox = this.$('.hideDownloadCheckbox'); |
| 181 | + var $element = $(event.target); |
| 182 | + var $li = $element.closest('li[data-share-id]'); |
| 183 | + var shareId = $li.data('share-id'); |
| 184 | + var $checkbox = $li.find('.hideDownloadCheckbox'); |
182 | 185 | $checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock'); |
183 | 186 |
|
184 | 187 | var hideDownload = false; |
|
187 | 190 | } |
188 | 191 |
|
189 | 192 | this.model.saveLinkShare({ |
190 | | - hideDownload: hideDownload |
| 193 | + hideDownload: hideDownload, |
| 194 | + cid: shareId |
| 195 | + }, { |
| 196 | + success: function() { |
| 197 | + $checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock'); |
| 198 | + }, |
| 199 | + error: function(obj, msg) { |
| 200 | + OC.Notification.showTemporary(t('core', 'Unable to toggle this option')); |
| 201 | + $checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock'); |
| 202 | + } |
191 | 203 | }); |
192 | 204 | }, |
193 | 205 |
|
|
279 | 291 | this.model.saveLinkShare({ |
280 | 292 | permissions: permissions, |
281 | 293 | cid: shareId |
| 294 | + }, { |
| 295 | + success: function() { |
| 296 | + $checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock'); |
| 297 | + }, |
| 298 | + error: function(obj, msg) { |
| 299 | + OC.Notification.showTemporary(t('core', 'Unable to toggle this option')); |
| 300 | + $checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock'); |
| 301 | + } |
282 | 302 | }); |
283 | 303 | }, |
284 | 304 |
|
|
409 | 429 | var passwordPlaceholderInitial = this.configModel.get('enforcePasswordForPublicLink') |
410 | 430 | ? PASSWORD_PLACEHOLDER_MESSAGE : PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL; |
411 | 431 |
|
412 | | - var showHideDownloadCheckbox = !this.model.isFolder(); |
413 | | - var hideDownload = this.model.get('linkShare').hideDownload; |
414 | | - |
415 | 432 | var publicEditable = |
416 | 433 | !this.model.isFolder() |
417 | 434 | && this.model.updatePermissionPossible(); |
|
446 | 463 | copyLabel: t('core', 'Copy link'), |
447 | 464 | social: social, |
448 | 465 | urlLabel: t('core', 'Link'), |
449 | | - showHideDownloadCheckbox: showHideDownloadCheckbox, |
450 | | - hideDownload: hideDownload, |
451 | 466 | hideDownloadLabel: t('core', 'Hide download'), |
452 | 467 | enablePasswordLabel: t('core', 'Password protect'), |
453 | 468 | passwordLabel: t('core', 'Password'), |
|
514 | 529 | var $element = $(event.target); |
515 | 530 | var $li = $element.closest('li[data-share-id]'); |
516 | 531 | var $menu = $li.find('.sharingOptionsGroup .popovermenu'); |
| 532 | + var shareId = $li.data('share-id'); |
| 533 | + |
| 534 | + var linkShares = this.model.get('linkShares'); |
| 535 | + var shareIndex = _.findIndex(linkShares, function(share) {return share.id === shareId}) |
| 536 | + |
| 537 | + console.log(this, linkShares[shareIndex]) |
517 | 538 |
|
518 | 539 | OC.showMenu(null, $menu); |
519 | | - this._menuOpen = $li.data('share-id'); |
| 540 | + this._menuOpen = shareId; |
520 | 541 | }, |
521 | 542 |
|
522 | 543 | /** |
|
620 | 641 | * @returns {Array} |
621 | 642 | */ |
622 | 643 | getShareeList: function() { |
623 | | - var universal = this.getShareProperties(); |
624 | | - |
625 | 644 | var shares = this.model.get('linkShares'); |
626 | 645 |
|
| 646 | + console.log(this, shares); |
| 647 | + |
627 | 648 | if(!this.model.hasLinkShares()) { |
628 | 649 | return []; |
629 | 650 | } |
630 | 651 |
|
631 | 652 | var list = []; |
632 | 653 | for(var index = 0; index < shares.length; index++) { |
633 | 654 | var share = this.getShareeObject(index); |
634 | | - |
635 | 655 | // first empty {} is necessary, otherwise we get in trouble |
636 | 656 | // with references |
637 | | - list.push(_.extend({}, universal, share)); |
| 657 | + list.push(_.extend({}, share)); |
638 | 658 | } |
639 | 659 |
|
640 | 660 | return list; |
|
689 | 709 | expireDate = moment(share.expiration, 'YYYY-MM-DD').format('DD-MM-YYYY'); |
690 | 710 | } |
691 | 711 |
|
| 712 | + var showHideDownloadCheckbox = !this.model.isFolder(); |
| 713 | + var hideDownload = share.hideDownload; |
| 714 | + |
692 | 715 | var maxDate = null; |
693 | 716 |
|
694 | 717 | if(hasExpireDate) { |
|
709 | 732 |
|
710 | 733 | return { |
711 | 734 | cid: share.id, |
712 | | - shareLinkURL: share.link, |
| 735 | + shareLinkURL: share.url, |
713 | 736 | passwordPlaceholder: isPasswordSet ? PASSWORD_PLACEHOLDER : PASSWORD_PLACEHOLDER_MESSAGE, |
714 | 737 | isPasswordSet: isPasswordSet || isPasswordEnabledByDefault || isPasswordEnforced, |
715 | 738 | showPasswordCheckBox: showPasswordCheckBox, |
|
720 | 743 | expireDate: expireDate, |
721 | 744 | shareNote: share.note, |
722 | 745 | hasNote: share.note !== '', |
723 | | - maxDate: maxDate |
| 746 | + maxDate: maxDate, |
| 747 | + showHideDownloadCheckbox: showHideDownloadCheckbox, |
| 748 | + hideDownload: hideDownload, |
724 | 749 | } |
725 | 750 | }, |
726 | 751 |
|
|
740 | 765 |
|
741 | 766 | }, |
742 | 767 |
|
743 | | - getShareProperties: function() { |
744 | | - return { |
745 | | - linkShareLabel: t('core', 'Share link'), |
746 | | - linkShareEnableLabel: t('core', 'Enable'), |
747 | | - }; |
748 | | - }, |
749 | | - |
750 | 768 | onUnshare: function(event) { |
751 | 769 | event.preventDefault(); |
752 | 770 | event.stopPropagation(); |
|
0 commit comments