mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 14:42:10 +00:00
show group name in path for 'group dir view'; fix updateGroups in side-nav.js
This commit is contained in:
@@ -137,7 +137,8 @@
|
||||
</script>
|
||||
<script type="text/template" id="dir-path-bar-tmpl">
|
||||
<% if (context == 'group') { %>
|
||||
<a href="#<%= category %>/" class="path-link normal">{% trans "Group" %}</a> /
|
||||
<a href="#groups/" class="path-link normal">{% trans "Groups" %}</a> /
|
||||
<a href="#<%= category %>/" class="path-link normal"><%- group_name %></a> /
|
||||
<% } else if (context == 'org') { %>
|
||||
<a href="#<%= category %>/" class="path-link normal">{% trans "Organization" %}</a> /
|
||||
<% } else if (context == 'common') { %>
|
||||
|
@@ -110,7 +110,9 @@ define([
|
||||
});
|
||||
},
|
||||
|
||||
showDir: function(category, repo_id, path) {
|
||||
// 'category' is sth. like url prefix
|
||||
// options is for 'group dir view', at present (Wed Jan 13 12:44:17 CST 2016)
|
||||
showDir: function(category, repo_id, path, options) {
|
||||
$('#top-search-form').html(this.top_search_form_template({
|
||||
search_repo_id: repo_id
|
||||
}));
|
||||
@@ -118,6 +120,9 @@ define([
|
||||
this.$el.show();
|
||||
this.$dirent_list.empty();
|
||||
var loading_tip = this.$('.loading-tip').show();
|
||||
|
||||
this.contextOptions = options;
|
||||
|
||||
var dir = this.dir;
|
||||
dir.setPath(category, repo_id, path);
|
||||
var _this = this;
|
||||
@@ -280,6 +285,9 @@ define([
|
||||
category: dir.category,
|
||||
context: context
|
||||
};
|
||||
if (this.contextOptions) {
|
||||
$.extend(obj, this.contextOptions);
|
||||
}
|
||||
|
||||
var path_list = path.substr(1).split('/');
|
||||
var path_list_encoded = Common.encodePath(path.substr(1)).split('/');
|
||||
|
@@ -146,7 +146,22 @@ define([
|
||||
showDir: function(group_id, repo_id, path) {
|
||||
this.group_id = group_id;
|
||||
this.hideRepoList();
|
||||
this.dirView.showDir('group/' + this.group_id, repo_id, path);
|
||||
|
||||
var group_name;
|
||||
var groups = app.pageOptions.groups;
|
||||
for (var i = 0, len = groups.length; i < len; i++) {
|
||||
if (group_id == groups[i].id) {
|
||||
group_name = groups[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (group_name) {
|
||||
this.dirView.showDir('group/' + this.group_id, repo_id, path, {'group_name': group_name});
|
||||
} else {
|
||||
// the group does not exist
|
||||
Common.feedback(gettext("Group not found"), 'error');
|
||||
app.router.navigate('my-libs/', {trigger: true});
|
||||
}
|
||||
},
|
||||
|
||||
createRepo: function() {
|
||||
|
@@ -103,10 +103,21 @@ define([
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
data.sort(function(a, b) {
|
||||
var groups = [];
|
||||
for (var i = 0, len = data.length; i < len; i++) {
|
||||
groups.push({
|
||||
'id': data[i].id,
|
||||
'name': data[i].name
|
||||
});
|
||||
}
|
||||
groups.sort(function(a, b) {
|
||||
return Common.compareTwoWord(a.name, b.name);
|
||||
});
|
||||
_this.data.groups = data;
|
||||
|
||||
// update app.pageOptions.groups
|
||||
app.pageOptions.groups = groups;
|
||||
|
||||
_this.data.groups = groups;
|
||||
_this.render();
|
||||
},
|
||||
error: function() {
|
||||
|
Reference in New Issue
Block a user