mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
[share] share repo to group with 'admin' perm: fix
This commit is contained in:
@@ -196,12 +196,10 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><a href="#group/<%= group_id %>/lib/<%= id %>" class="normal"><%- name %></a></td>
|
<td><a href="#group/<%= group_id %>/lib/<%= id %>" class="normal"><%- name %></a></td>
|
||||||
<td class="alc">
|
<td class="alc">
|
||||||
<% if (show_admin && app.pageOptions.is_pro) { %>
|
<% if (app.pageOptions.is_pro && is_admin) { %>
|
||||||
<% if (is_admin) { %>
|
<a href="#" class="sf2-icon-share sf2-x repo-share-btn op-icon vh" title="{% trans "Share" %}" aria-label="{% trans "Share" %}"></a>
|
||||||
<a href="#" class="sf2-icon-share sf2-x repo-share-btn op-icon vh" title="{% trans "Share" %}" aria-label="{% trans "Share" %}"></a>
|
|
||||||
<% } %>
|
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (is_staff || share_from_me || is_admin) { %>
|
<% if (is_staff || share_from_me) { %>
|
||||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
@@ -224,6 +222,9 @@
|
|||||||
<span class="repo-meta-info"><%= mtime_relative %></span>
|
<span class="repo-meta-info"><%= mtime_relative %></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="alc">
|
<td class="alc">
|
||||||
|
<% if (app.pageOptions.is_pro && is_admin) { %>
|
||||||
|
<a href="#" class="sf2-icon-share sf2-x repo-share-btn op-icon" title="{% trans "Share" %}" aria-label="{% trans "Share" %}"></a>
|
||||||
|
<% } %>
|
||||||
<% if (is_staff || share_from_me) { %>
|
<% if (is_staff || share_from_me) { %>
|
||||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||||
<% } %>
|
<% } %>
|
||||||
@@ -1117,6 +1118,9 @@
|
|||||||
<span class="repo-meta-info"><%= mtime_relative %></span>
|
<span class="repo-meta-info"><%= mtime_relative %></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="alc">
|
<td class="alc">
|
||||||
|
<% if (app.pageOptions.is_pro && is_admin) { %>
|
||||||
|
<a href="#" class="sf2-icon-share sf2-x repo-share-btn op-icon" title="{% trans "Share" %}"></a>
|
||||||
|
<% } %>
|
||||||
<a href="#" class="sf2-icon-delete sf2-x unshare-btn op-icon" title="{% trans "Leave Share" %}"></a>
|
<a href="#" class="sf2-icon-delete sf2-x unshare-btn op-icon" title="{% trans "Leave Share" %}"></a>
|
||||||
</td>
|
</td>
|
||||||
</script>
|
</script>
|
||||||
@@ -1521,12 +1525,12 @@
|
|||||||
<script type="text/template" id="shared-repos-hd-mobile-tmpl">
|
<script type="text/template" id="shared-repos-hd-mobile-tmpl">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="4%"><span class="sr-only">{% trans "Library Type" %}</span><!--icon--></th>
|
<th width="4%"><span class="sr-only">{% trans "Library Type" %}</span><!--icon--></th>
|
||||||
<th width="92%">
|
<th width="90%">
|
||||||
{% trans "Sort:" %}
|
{% trans "Sort:" %}
|
||||||
<a class="table-sort-op mobile-table-sort-op by-name" href="#">{% trans "name" %} <span class="sort-icon icon-caret-down hide"></span></a>
|
<a class="table-sort-op mobile-table-sort-op by-name" href="#">{% trans "name" %} <span class="sort-icon icon-caret-down hide"></span></a>
|
||||||
<a class="table-sort-op mobile-table-sort-op by-time" href="#">{% trans "last update" %} <span class="sort-icon icon-caret-up"></span></a>
|
<a class="table-sort-op mobile-table-sort-op by-time" href="#">{% trans "last update" %} <span class="sort-icon icon-caret-up"></span></a>
|
||||||
</th>
|
</th>
|
||||||
<th width="4%"><span class="sr-only">{% trans "Actions" %}</span><!--op--></th>
|
<th width="6%"><span class="sr-only">{% trans "Actions" %}</span><!--op--></th>
|
||||||
</tr>
|
</tr>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -43,8 +43,7 @@ define([
|
|||||||
model: new GroupRepo(item, {collection: groupRepos}),
|
model: new GroupRepo(item, {collection: groupRepos}),
|
||||||
group_id: group_id,
|
group_id: group_id,
|
||||||
is_staff: is_staff,
|
is_staff: is_staff,
|
||||||
show_shared_by: false, // don't show 'Shared By'
|
show_shared_by: false // don't show 'Shared By'
|
||||||
show_admin: false
|
|
||||||
});
|
});
|
||||||
$listContainer.append(view.render().el);
|
$listContainer.append(view.render().el);
|
||||||
});
|
});
|
||||||
|
@@ -31,7 +31,6 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.listenTo(this.model, 'destroy', this.remove);
|
this.listenTo(this.model, 'destroy', this.remove);
|
||||||
this.show_admin = options.show_admin
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@@ -43,22 +42,23 @@ define([
|
|||||||
group_id: this.group_id,
|
group_id: this.group_id,
|
||||||
is_staff: this.is_staff,
|
is_staff: this.is_staff,
|
||||||
// for '#groups' (no 'share_from_me')
|
// for '#groups' (no 'share_from_me')
|
||||||
share_from_me: app.pageOptions.username == this.model.get('owner') ? true : false,
|
share_from_me: app.pageOptions.username == this.model.get('owner'),
|
||||||
// 'owner_name' for '#groups', 'owner_nickname' for '#group/id/'
|
// 'owner_name' for '#groups', 'owner_nickname' for '#group/id/'
|
||||||
owner_name: this.model.get('owner_nickname') || this.model.get('owner_name'),
|
owner_name: this.model.get('owner_nickname') || this.model.get('owner_name'),
|
||||||
show_shared_by: this.show_shared_by,
|
show_shared_by: this.show_shared_by,
|
||||||
icon_url: icon_url,
|
icon_url: icon_url,
|
||||||
icon_title: this.model.getIconTitle(),
|
icon_title: this.model.getIconTitle()
|
||||||
is_admin: this.model.get('is_admin'),
|
|
||||||
show_admin: this.show_admin
|
|
||||||
});
|
});
|
||||||
this.$el.html(tmpl(obj));
|
this.$el.html(tmpl(obj));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// only for 'is_admin:true'
|
||||||
share: function() {
|
share: function() {
|
||||||
var options = {
|
var options = {
|
||||||
'is_repo_owner': true,
|
'is_repo_owner': app.pageOptions.username == this.model.get('owner'),
|
||||||
|
'is_admin': true, // only for shared repo
|
||||||
|
'is_virtual': false,
|
||||||
'user_perm': 'rw',
|
'user_perm': 'rw',
|
||||||
'repo_id': this.model.get('id'),
|
'repo_id': this.model.get('id'),
|
||||||
'repo_encrypted': this.model.get('encrypted'),
|
'repo_encrypted': this.model.get('encrypted'),
|
||||||
@@ -66,6 +66,7 @@ define([
|
|||||||
'dirent_path': '/',
|
'dirent_path': '/',
|
||||||
'obj_name': this.model.get('name')
|
'obj_name': this.model.get('name')
|
||||||
};
|
};
|
||||||
|
|
||||||
new ShareView(options);
|
new ShareView(options);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
@@ -47,8 +47,7 @@ define([
|
|||||||
var view = new GroupRepoView({
|
var view = new GroupRepoView({
|
||||||
model: repo,
|
model: repo,
|
||||||
group_id: this.group_id,
|
group_id: this.group_id,
|
||||||
is_staff: this.repos.is_staff,
|
is_staff: this.repos.is_staff
|
||||||
show_admin: true
|
|
||||||
});
|
});
|
||||||
if (options.prepend) {
|
if (options.prepend) {
|
||||||
this.$tableBody.prepend(view.render().el);
|
this.$tableBody.prepend(view.render().el);
|
||||||
|
@@ -848,8 +848,8 @@ define([
|
|||||||
$add_item.after(new_item.el);
|
$add_item.after(new_item.el);
|
||||||
});
|
});
|
||||||
$groups_input.select2("val", "");
|
$groups_input.select2("val", "");
|
||||||
|
$('option', $perm).removeAttr('selected');
|
||||||
$('[value="rw"]', $perm).attr('selected', 'selected');
|
$('[value="rw"]', $perm).attr('selected', 'selected');
|
||||||
$('[value="r"]', $perm).removeAttr('selected');
|
|
||||||
$error.addClass('hide');
|
$error.addClass('hide');
|
||||||
}
|
}
|
||||||
if (data.failed.length > 0) {
|
if (data.failed.length > 0) {
|
||||||
|
@@ -15,8 +15,8 @@ define([
|
|||||||
mobileTemplate: _.template($('#shared-repo-mobile-tmpl').html()),
|
mobileTemplate: _.template($('#shared-repo-mobile-tmpl').html()),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .unshare-btn': 'removeShare',
|
'click .repo-share-btn': 'share',
|
||||||
'click .repo-share-btn': 'share'
|
'click .unshare-btn': 'removeShare'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
Reference in New Issue
Block a user