1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

[address book] group: show repo owner and etc.

This commit is contained in:
llj
2018-06-12 18:34:49 +08:00
parent ce23a58edf
commit 040348e6f4
5 changed files with 28 additions and 24 deletions

View File

@@ -453,10 +453,10 @@
<td><%= file_count %> / <%= size_formatted %></td>
<td style="font-size:11px;"><%= id %></td>
<td>
<% if (owner && owner.indexOf('@seafile_group') == -1) { %>
<% if (owner.indexOf('@seafile_group') == -1) { %>
<a href="{{ SITE_ROOT }}useradmin/info/<% print(encodeURIComponent(owner)); %>/"><%- owner %></a>
<% } else { %>
--
<a href="{{ SITE_ROOT }}sysadmin/#address-book/groups/<% print(owner_name); %>/"><%- group_name %></a>
<% } %>
</td>
<td>
@@ -531,7 +531,7 @@
<% if (owner.indexOf('@seafile_group') == -1) { %>
<a href="{{ SITE_ROOT }}useradmin/info/<% print(encodeURIComponent(owner)); %>/"><%- owner %></a>
<% } else { %>
--
<%- group_name %>
<% } %>
</td>
<td><time title="<%= time %>"><%= time_from_now %></time></td>

View File

@@ -259,10 +259,11 @@
<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>
<a href="#" class="sf2-icon-x2 sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
<% } %>
<% } else { %>
<% } else { %> {# It is an address book group #}
<% if (is_staff) { %>
<% if (owner == group_id + '@seafile_group') { %> {# this repo belongs to the current group #}
<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-delete sf2-x delete-repo op-icon vh" title="{% trans "Delete" %}" aria-label="{% trans "Delete" %}"></a>
<div class="sf-dropdown sf-dropdown-inline">
@@ -275,6 +276,9 @@
<li><a class="op js-repo-details" href="#">{% trans "Details" %}</a></li>
</ul>
</div>
<% } else { %>
<a href="#" class="sf2-icon-x2 sf2-x cancel-share op-icon vh" title="{% trans "Unshare" %}" aria-label="{% trans "Unshare" %}"></a>
<% } %>
<% } %>
<% } %>
<% } else { %>
@@ -1828,15 +1832,6 @@
<th width="16%">{% trans "Owner" %}</th>
</tr>
</script>
<script type="text/template" id="group-owned-repos-hd-tmpl">
<tr>
<th width="4%"><span class="sr-only">{% trans "Library Type" %}</span><!--icon--></th>
<th width="46%"><a class="table-sort-op by-name" href="#">{% trans "Name" %} <span class="sort-icon icon-caret-down hide"></span></a></th>
<th width="10%"><span class="sr-only">{% trans "Actions" %}</span><!--op--></th>
<th width="20%">{% trans "Size" %}</th>
<th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Last Update" %} <span class="sort-icon icon-caret-up"></span></a></th>
</tr>
</script>
<script type="text/template" id="shared-repos-hd-mobile-tmpl">
<tr>
<th width="4%"><span class="sr-only">{% trans "Library Type" %}</span><!--icon--></th>

View File

@@ -157,7 +157,7 @@ define([
});
data = {
'group_id': item_data.group_id,
'p': this.path // TODO: 'p'?
'path': this.path
};
}
} else {

View File

@@ -221,14 +221,23 @@ define([
var icon_size = Common.isHiDPI() ? 48 : 24;
var icon_url = this.model.getIconUrl(icon_size);
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
var owner_name;
if (obj.owner.indexOf('@seafile_group') == -1) {
// 'owner_nickname' for '#group/id/'
// 'owner_name' for '#groups'
owner_name = this.model.get('owner_nickname') || this.model.get('owner_name');
} else {
// owner: "18@seafile_group"
// It's a group owned repo
owner_name = obj.group_name;
}
$.extend(obj, {
group_id: this.group_id,
parent_group_id: this.parent_group_id,
is_staff: this.is_staff,
// for '#groups' (no 'share_from_me')
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'),
owner_name: owner_name,
show_repo_owner: this.show_repo_owner,
icon_url: icon_url,
icon_title: this.model.getIconTitle()

View File

@@ -25,7 +25,6 @@ define([
toolbar2Template: _.template($('#group-toolbar2-tmpl').html()),
pathTemplate: _.template($('#group-path-tmpl').html()),
theadTemplate: _.template($('#shared-repos-hd-tmpl').html()),
ownedReposTheadTemplate: _.template($('#group-owned-repos-hd-tmpl').html()),
theadMobileTemplate: _.template($('#shared-repos-hd-mobile-tmpl').html()),
events: {
@@ -69,7 +68,7 @@ define([
model: repo,
group_id: this.group_id,
parent_group_id: this.group.parent_group_id,
show_repo_owner: this.group.is_address_book_group ? false : true,
show_repo_owner: true,
repoDetailsView: this.repoDetailsView,
is_staff: this.repos.is_staff
});
@@ -86,11 +85,7 @@ define([
if ($(window).width() < 768) {
tmpl = this.theadMobileTemplate;
} else {
if (this.group.parent_group_id == 0) {
tmpl = this.theadTemplate;
} else {
tmpl = this.ownedReposTheadTemplate;
}
}
this.$tableHead.html(tmpl());
},
@@ -175,6 +170,11 @@ define([
'id': data.id,
'wiki_enabled': data.wiki_enabled
});
// for common member in a group, there is only 'leave group' option in the 'settings' popup
// in an address book group, a common member can't 'leave group'
if (data.parent_group_id != 0 && !user_is_admin) {
$('#group-settings-icon').hide();
}
_this.showRepoList();
if (options) {
if (options.showDiscussions) {