mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-20 07:55:06 +00:00
modified 'group-repo'
This commit is contained in:
parent
667afb6a59
commit
dafedd5f7f
@ -196,16 +196,25 @@
|
|||||||
</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 (app.pageOptions.is_pro && is_admin) { %>
|
<% 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>
|
<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) { %>
|
<% 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>
|
<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>
|
||||||
<td><%= size_formatted %></td>
|
<td><%= size_formatted %></td>
|
||||||
<td><%= mtime_relative %></td>
|
<td><%= mtime_relative %></td>
|
||||||
<% if (show_shared_by) { %>
|
<% if (show_repo_owner) { %>
|
||||||
<td><span title="<%- owner %>"><%- owner_name %></span></td>
|
<td><span title="<%- owner %>"><%- owner_name %></span></td>
|
||||||
<% } %>
|
<% } %>
|
||||||
</script>
|
</script>
|
||||||
@ -215,19 +224,28 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#group/<%= group_id %>/lib/<%= id %>" class="normal"><%- name %></a><br />
|
<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" title="<%- owner %>"><%- owner_name %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
<span class="repo-meta-info"><%= size_formatted %></span>
|
<span class="repo-meta-info"><%= size_formatted %></span>
|
||||||
<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) { %>
|
<% 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>
|
<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 || 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>
|
<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>
|
</td>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -43,7 +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_repo_owner: false // don't show 'Owner'
|
||||||
});
|
});
|
||||||
$listContainer.append(view.render().el);
|
$listContainer.append(view.render().el);
|
||||||
});
|
});
|
||||||
|
@ -24,11 +24,7 @@ define([
|
|||||||
|
|
||||||
this.group_id = options.group_id;
|
this.group_id = options.group_id;
|
||||||
this.is_staff = options.is_staff;
|
this.is_staff = options.is_staff;
|
||||||
|
this.show_repo_owner = options.show_repo_owner;
|
||||||
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.listenTo(this.model, 'destroy', this.remove);
|
this.listenTo(this.model, 'destroy', this.remove);
|
||||||
},
|
},
|
||||||
@ -42,10 +38,10 @@ 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'),
|
is_repo_owner: app.pageOptions.username == this.model.get('owner'),
|
||||||
// 'owner_name' for '#groups', 'owner_nickname' for '#group/id/'
|
//'owner_nickname' for '#group/id/', 'owner_name' for '#groups'
|
||||||
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_repo_owner: this.show_repo_owner,
|
||||||
icon_url: icon_url,
|
icon_url: icon_url,
|
||||||
icon_title: this.model.getIconTitle()
|
icon_title: this.model.getIconTitle()
|
||||||
});
|
});
|
||||||
@ -53,11 +49,9 @@ define([
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
// only for 'is_admin:true'
|
|
||||||
share: function() {
|
share: function() {
|
||||||
var options = {
|
var options = {
|
||||||
'is_repo_owner': app.pageOptions.username == this.model.get('owner'),
|
'is_repo_owner': app.pageOptions.username == this.model.get('owner'),
|
||||||
'is_admin': true, // only for shared repo
|
|
||||||
'is_virtual': false,
|
'is_virtual': false,
|
||||||
'user_perm': 'rw',
|
'user_perm': 'rw',
|
||||||
'repo_id': this.model.get('id'),
|
'repo_id': this.model.get('id'),
|
||||||
@ -67,6 +61,10 @@ define([
|
|||||||
'obj_name': this.model.get('name')
|
'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);
|
new ShareView(options);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
@ -47,6 +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,
|
||||||
|
show_repo_owner: true,
|
||||||
is_staff: this.repos.is_staff
|
is_staff: this.repos.is_staff
|
||||||
});
|
});
|
||||||
if (options.prepend) {
|
if (options.prepend) {
|
||||||
|
Loading…
Reference in New Issue
Block a user