Skip to content

Commit 1bd6d39

Browse files
skjnldsvdanxuliu
authored andcommitted
Migrate link shares to array
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent feb9f72 commit 1bd6d39

8 files changed

Lines changed: 390 additions & 243 deletions

apps/files_sharing/css/sharetabview.scss

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -194,31 +194,29 @@
194194
display: flex;
195195
align-items: center;
196196
white-space: nowrap;
197-
// can edit label
198-
> .shareOption > label {
199-
padding: 13px;
200-
padding-right: 0;
201-
}
202-
// more menu
203-
> .share-menu {
204-
position: relative;
197+
198+
// icons
199+
> .icon:not(.hidden),
200+
.share-menu > .icon:not(.hidden) {
201+
padding: 14px;
202+
height: 44px;
203+
width: 44px;
204+
opacity: .5;
205205
display: block;
206-
.icon-more {
207-
padding: 14px;
208-
height: 44px;
209-
width: 44px;
210-
opacity: .5;
211-
display: block;
212-
cursor: pointer;
213-
}
206+
cursor: pointer;
207+
214208
&:hover,
215209
&:focus,
216210
&:active {
217-
.icon-more {
218-
opacity: .7;;
219-
}
211+
opacity: .7;;
220212
}
221213
}
214+
215+
// more menu
216+
> .share-menu {
217+
position: relative;
218+
display: block;
219+
}
222220
}
223221
.username {
224222
padding: 0 8px;

apps/files_sharing/js/share.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@
193193
var $tr = fileList.findFileEl(fileInfoModel.get('name'));
194194

195195
// We count email shares as link share
196-
var hasLinkShare = shareModel.hasLinkShare();
196+
var hasLinkShares = shareModel.hasLinkShares();
197197
shareModel.get('shares').forEach(function (share) {
198198
if (share.share_type === OC.Share.SHARE_TYPE_EMAIL) {
199-
hasLinkShare = true;
199+
hasLinkShares = true;
200200
}
201201
});
202202

203203
OCA.Sharing.Util._updateFileListDataAttributes(fileList, $tr, shareModel);
204-
if (!OCA.Sharing.Util._updateFileActionIcon($tr, shareModel.hasUserShares(), hasLinkShare)) {
204+
if (!OCA.Sharing.Util._updateFileActionIcon($tr, shareModel.hasUserShares(), hasLinkShares)) {
205205
// remove icon, if applicable
206206
OC.Share.markFileAsShared($tr, false, false);
207207
}
@@ -249,15 +249,15 @@
249249
*
250250
* @param $tr file element of the file to update
251251
* @param {boolean} hasUserShares true if a user share exists
252-
* @param {boolean} hasLinkShare true if a link share exists
252+
* @param {boolean} hasLinkShares true if a link share exists
253253
*
254254
* @return {boolean} true if the icon was set, false otherwise
255255
*/
256-
_updateFileActionIcon: function($tr, hasUserShares, hasLinkShare) {
256+
_updateFileActionIcon: function($tr, hasUserShares, hasLinkShares) {
257257
// if the statuses are loaded already, use them for the icon
258258
// (needed when scrolling to the next page)
259-
if (hasUserShares || hasLinkShare || $tr.attr('data-share-recipient-data') || $tr.attr('data-share-owner')) {
260-
OC.Share.markFileAsShared($tr, true, hasLinkShare);
259+
if (hasUserShares || hasLinkShares || $tr.attr('data-share-recipient-data') || $tr.attr('data-share-owner')) {
260+
OC.Share.markFileAsShared($tr, true, hasLinkShares);
261261
return true;
262262
}
263263
return false;

core/js/share/sharedialoglinkshareview.handlebars

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
{{#if shareAllowed}}
22
<ul id="shareLink" class="shareWithList">
3-
<li data-share-id="{{cid}}">
4-
<div class="avatar icon-public-white"></div><span class="username" title="{{linkShareLabel}}">{{linkShareLabel}}</span>
5-
<span class="sharingOptionsGroup">
6-
<span class="shareOption">
7-
<span class="icon-loading-small hidden"></span>
8-
<input id="linkCheckbox-{{cid}}" {{#if isLinkShare}}checked="checked"{{/if}} type="checkbox" name="linkCheckbox" class="linkCheckbox permissions checkbox">
9-
<label for="linkCheckbox-{{cid}}">{{linkShareEnableLabel}}</label>
3+
{{#if nolinkShares}}
4+
<li>
5+
<div class="avatar icon-public-white"></div>
6+
<span class="username">{{newShareLabel}}</span>
7+
<span class="sharingOptionsGroup">
8+
<span class="icon icon-add new-share" title="{{newShareTitle}}"></span>
9+
<span class="icon icon-loading-small hidden"></span>
1010
</span>
11-
{{#if showMenu}}
11+
</li>
12+
{{/if}}
13+
{{#each linkShares}}
14+
<li data-share-id="{{cid}}">
15+
<div class="avatar icon-public-white"></div><span class="username" title="{{linkShareLabel}}">{{linkShareLabel}}</span>
16+
<span class="sharingOptionsGroup">
1217
<div class="share-menu" tabindex="0"><span class="icon icon-more"></span>
1318
{{#if showPending}}
1419
{{{pendingPopoverMenu}}}
1520
{{else}}
1621
{{{popoverMenu}}}
1722
{{/if}}
1823
</div>
19-
{{/if}}
20-
</span>
21-
</li>
24+
</span>
25+
</li>
26+
{{/each}}
2227
</ul>
2328
{{else}}
2429
{{#if noSharingPlaceholder}}<input id="shareWith-{{cid}}" class="shareWithField" type="text" placeholder="{{noSharingPlaceholder}}" disabled="disabled"/>{{/if}}

core/js/share/sharedialoglinkshareview_popover_menu.handlebars

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
<span>{{copyLabel}}</span>
77
</a>
88
</li>
9+
<li>
10+
<a href="#" class="new-share">
11+
<span class="icon-loading-small hidden"></span>
12+
<span class="icon icon-add"></span>
13+
<span>{{newShareTitle}}</span>
14+
</a>
15+
</li>
916
<li class="hidden linkTextMenu">
1017
<span class="menuitem icon-link-text">
1118
<input id="linkText-{{cid}}" class="linkText" type="text" readonly="readonly" value="{{shareLinkURL}}" />
@@ -70,14 +77,15 @@
7077
<li>
7178
<span class="shareOption menuitem">
7279
<input id="expireDate-{{cid}}" type="checkbox" name="expirationDate" class="expireDate checkbox"
73-
{{#if hasExpireDate}}checked="checked"{{/if}} {{#if isExpirationEnforced}}disabled="disabled"{{/if}}" />
80+
{{#if hasExpireDate}}checked="checked"{{/if}} {{#if isExpirationEnforced}}disabled="disabled"{{/if}} />
7481
<label for="expireDate-{{cid}}">{{expireDateLabel}}</label>
7582
</span>
7683
</li>
7784
<li class="{{#unless hasExpireDate}}hidden{{/unless}}">
7885
<span class="menuitem icon-expiredate expirationDateContainer-{{cid}}">
7986
<label for="expirationDatePicker-{{cid}}" class="hidden-visually" value="{{expirationDate}}">{{expirationLabel}}</label>
80-
<input id="expirationDatePicker-{{cid}}" class="datepicker" type="text" placeholder="{{expirationDatePlaceholder}}" value="{{#if hasExpireDate}}{{expireDate}}{{else}}{{defaultExpireDate}}{{/if}}" />
87+
<input id="expirationDatePicker-{{cid}}" class="datepicker" type="text" placeholder="{{expirationDatePlaceholder}}"
88+
value="{{#if hasExpireDate}}{{expireDate}}{{else}}{{defaultExpireDate}}{{/if}}" data-max-date="{{maxDate}}" />
8189
</span>
8290
</li>
8391
<li>
@@ -88,7 +96,7 @@
8896
<input type="button" class="share-note-delete icon-delete">
8997
</a>
9098
</li>
91-
<li class="share-note-form share-note-link hidden">
99+
<li class="share-note-form share-note-link {{#unless hasNote}}hidden{{/unless}}">
92100
<span class="menuitem icon-note">
93101
<textarea class="share-note">{{shareNote}}</textarea>
94102
<input type="submit" class="icon-confirm share-note-submit" value="" id="add-note-{{shareId}}" />
@@ -102,5 +110,8 @@
102110
</a>
103111
</li>
104112
{{/each}}
113+
<li>
114+
<a href="#" class="unshare"><span class="icon-loading-small hidden"></span><span class="icon icon-delete"></span><span>{{unshareLabel}}</span></a>
115+
</li>
105116
</ul>
106117
</div>

core/js/share/sharedialogshareelistview.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616
</span>
1717
</li>
18-
{{/each}}
18+
{{/each}}
1919
{{#each linkReshares}}
2020
<li data-share-id="{{shareId}}" data-share-type="{{shareType}}">
2121
<div class="avatar" data-username="{{shareInitiator}}"></div>

0 commit comments

Comments
 (0)