mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-02 07:47:32 +00:00
modified 'group-repo'
This commit is contained in:
parent
667afb6a59
commit
dafedd5f7f
@ -196,16 +196,25 @@
|
||||
</td>
|
||||
<td><a href="#group/<%= group_id %>/lib/<%= id %>" class="normal"><%- name %></a></td>
|
||||
<td class="alc">
|
||||
<% if (app.pageOptions.is_pro && is_admin) { %>
|
||||
<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) { %>
|
||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||
<% if (app.pageOptions.is_pro) { %>
|
||||
<% if (is_repo_owner || is_admin) { %>
|
||||
<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 || is_repo_owner || is_admin) { %>
|
||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<% if (is_repo_owner) { %>
|
||||
<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 || is_repo_owner) { %>
|
||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</td>
|
||||
<td><%= size_formatted %></td>
|
||||
<td><%= mtime_relative %></td>
|
||||
<% if (show_shared_by) { %>
|
||||
<% if (show_repo_owner) { %>
|
||||
<td><span title="<%- owner %>"><%- owner_name %></span></td>
|
||||
<% } %>
|
||||
</script>
|
||||
@ -215,18 +224,27 @@
|
||||
</td>
|
||||
<td>
|
||||
<a href="#group/<%= group_id %>/lib/<%= id %>" class="normal"><%- name %></a><br />
|
||||
<% if (show_shared_by) { %>
|
||||
<% if (show_repo_owner) { %>
|
||||
<span class="repo-meta-info" title="<%- owner %>"><%- owner_name %></span>
|
||||
<% } %>
|
||||
<span class="repo-meta-info"><%= size_formatted %></span>
|
||||
<span class="repo-meta-info"><%= mtime_relative %></span>
|
||||
</td>
|
||||
<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) { %>
|
||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||
<% if (app.pageOptions.is_pro) { %>
|
||||
<% if (is_repo_owner || 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 || is_repo_owner || is_admin) { %>
|
||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<% if (is_repo_owner) { %>
|
||||
<a href="#" class="sf2-icon-share sf2-x repo-share-btn op-icon" title="{% trans "Share" %}" aria-label="{% trans "Share" %}"></a>
|
||||
<% } %>
|
||||
<% if (is_staff || is_repo_owner) { %>
|
||||
<a href="#" class="sf2-icon-delete sf2-x cancel-share op-icon" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</td>
|
||||
</script>
|
||||
|
@ -43,7 +43,7 @@ define([
|
||||
model: new GroupRepo(item, {collection: groupRepos}),
|
||||
group_id: group_id,
|
||||
is_staff: is_staff,
|
||||
show_shared_by: false // don't show 'Shared By'
|
||||
show_repo_owner: false // don't show 'Owner'
|
||||
});
|
||||
$listContainer.append(view.render().el);
|
||||
});
|
||||
|
@ -24,11 +24,7 @@ define([
|
||||
|
||||
this.group_id = options.group_id;
|
||||
this.is_staff = options.is_staff;
|
||||
|
||||
this.show_shared_by = true; // default
|
||||
if (options.show_shared_by !== undefined) { // e.g. views/group-item.js
|
||||
this.show_shared_by = options.show_shared_by;
|
||||
}
|
||||
this.show_repo_owner = options.show_repo_owner;
|
||||
|
||||
this.listenTo(this.model, 'destroy', this.remove);
|
||||
},
|
||||
@ -42,10 +38,10 @@ define([
|
||||
group_id: this.group_id,
|
||||
is_staff: this.is_staff,
|
||||
// for '#groups' (no 'share_from_me')
|
||||
share_from_me: app.pageOptions.username == this.model.get('owner'),
|
||||
// 'owner_name' for '#groups', 'owner_nickname' for '#group/id/'
|
||||
is_repo_owner: app.pageOptions.username == this.model.get('owner'),
|
||||
//'owner_nickname' for '#group/id/', 'owner_name' for '#groups'
|
||||
owner_name: this.model.get('owner_nickname') || this.model.get('owner_name'),
|
||||
show_shared_by: this.show_shared_by,
|
||||
show_repo_owner: this.show_repo_owner,
|
||||
icon_url: icon_url,
|
||||
icon_title: this.model.getIconTitle()
|
||||
});
|
||||
@ -53,11 +49,9 @@ define([
|
||||
return this;
|
||||
},
|
||||
|
||||
// only for 'is_admin:true'
|
||||
share: function() {
|
||||
var options = {
|
||||
'is_repo_owner': app.pageOptions.username == this.model.get('owner'),
|
||||
'is_admin': true, // only for shared repo
|
||||
'is_virtual': false,
|
||||
'user_perm': 'rw',
|
||||
'repo_id': this.model.get('id'),
|
||||
@ -67,6 +61,10 @@ define([
|
||||
'obj_name': this.model.get('name')
|
||||
};
|
||||
|
||||
if (app.pageOptions.is_pro) {
|
||||
options.is_admin = this.model.get('is_admin'); // 'is_admin': repo is shared to the group with 'admin' perm
|
||||
}
|
||||
|
||||
new ShareView(options);
|
||||
return false;
|
||||
},
|
||||
|
@ -47,6 +47,7 @@ define([
|
||||
var view = new GroupRepoView({
|
||||
model: repo,
|
||||
group_id: this.group_id,
|
||||
show_repo_owner: true,
|
||||
is_staff: this.repos.is_staff
|
||||
});
|
||||
if (options.prepend) {
|
||||
|
Loading…
Reference in New Issue
Block a user