mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 10:58:33 +00:00
[backbone] Add dirView for organizational libs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
define([
|
||||
'app/routers/organization'
|
||||
], function(Router){
|
||||
new Router();
|
||||
app.router = new Router();
|
||||
Backbone.history.start();
|
||||
});
|
||||
|
@@ -8,21 +8,26 @@ define([
|
||||
|
||||
var OrganizationRouter = Backbone.Router.extend({
|
||||
routes: {
|
||||
'libs/:id(/*path)': 'showDir',
|
||||
'lib/:repo_id(/*path)': 'showDir',
|
||||
// Default
|
||||
'*actions': 'defaultAction'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.organizationView = new OrganizationView();
|
||||
this.orgView = new OrganizationView();
|
||||
},
|
||||
|
||||
showDir: function() {
|
||||
alert('todo');
|
||||
showDir: function(repo_id, path) {
|
||||
if (path) {
|
||||
path = '/' + path;
|
||||
} else {
|
||||
path = '/';
|
||||
}
|
||||
this.orgView.showDir(repo_id, path);
|
||||
},
|
||||
|
||||
defaultAction: function(){
|
||||
this.organizationView.showPublicRepos();
|
||||
this.orgView.showPublicRepos();
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -16,7 +16,6 @@ define([
|
||||
el: '#main',
|
||||
|
||||
initialize: function() {
|
||||
console.log('init MyHomePage');
|
||||
Common.prepareApiCsrf();
|
||||
|
||||
//_.bindAll(this, 'ajaxLoadingShow', 'ajaxLoadingHide');
|
||||
|
@@ -3,7 +3,7 @@ define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common',
|
||||
'text!' + app.config._tmplRoot + 'organization-repos.html'
|
||||
'text!' + app.config._tmplRoot + 'organization-repo.html'
|
||||
], function($, _, Backbone, Common, reposTemplate) {
|
||||
'use strict';
|
||||
|
||||
|
@@ -4,15 +4,17 @@ define([
|
||||
'backbone',
|
||||
'common',
|
||||
'app/collections/repos',
|
||||
'app/views/organization-repo'
|
||||
], function($, _, Backbone, Common, RepoCollection, OrganizationRepoView) {
|
||||
'app/views/organization-repo',
|
||||
'app/views/dir',
|
||||
], function($, _, Backbone, Common, RepoCollection, OrganizationRepoView,
|
||||
DirView) {
|
||||
'use strict';
|
||||
|
||||
var OrganizationView = Backbone.View.extend({
|
||||
el: '#main',
|
||||
|
||||
initialize: function() {
|
||||
|
||||
this.$reposDiv = $('#organization-repos');
|
||||
this.$table = $('#organization-repos table');
|
||||
this.$tableBody = $('tbody', this.$table);
|
||||
this.$loadingTip = $('#organization-repos .loading-tip');
|
||||
@@ -21,6 +23,8 @@ define([
|
||||
this.repos = new RepoCollection({type: 'org'});
|
||||
this.listenTo(this.repos, 'add', this.addOne);
|
||||
this.listenTo(this.repos, 'reset', this.reset);
|
||||
|
||||
this.dirView = new DirView();
|
||||
},
|
||||
|
||||
events: {
|
||||
@@ -54,7 +58,23 @@ define([
|
||||
},
|
||||
|
||||
showPublicRepos: function() {
|
||||
this.dirView.hide();
|
||||
this.$reposDiv.show();
|
||||
this.repos.fetch({reset: true});
|
||||
this.$loadingTip.show();
|
||||
},
|
||||
|
||||
hideRepos: function() {
|
||||
this.$reposDiv.hide();
|
||||
},
|
||||
|
||||
showDir: function(repo_id, path) {
|
||||
var path = path || '/';
|
||||
this.hideRepos();
|
||||
this.dirView.showDir('', repo_id, path);
|
||||
// this.dirent_list = new app.DirentListView({id: id, path: path});
|
||||
// $('#my-own-repos table').children().remove();
|
||||
// $('#my-own-repos table').append(this.dirent_list.render().el);
|
||||
}
|
||||
|
||||
});
|
||||
|
@@ -10,8 +10,7 @@
|
||||
<% } %>
|
||||
<% } %>
|
||||
</td>
|
||||
{# TODO #}
|
||||
<td><a href="#/libs/<%= id %>"><%- name %></a></td>
|
||||
<td><a href="#/lib/<%= id %>"><%- name %></a></td>
|
||||
<td><%- desc %></td>
|
||||
<td><%- mtime_relative %></td>
|
||||
<td><%- share_from %></td>
|
||||
@@ -20,4 +19,3 @@
|
||||
<img src="<%= app.config.mediaUrl%>img/rm.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
|
||||
<% } %>
|
||||
</td>
|
||||
|
@@ -4,6 +4,24 @@
|
||||
|
||||
{% block sub_title %}{% trans "Organization" %} - {% endblock %}
|
||||
|
||||
{% block extra_style %}
|
||||
<style type="text/css">
|
||||
/* lib view */
|
||||
.repo-file-list .dirent-name {
|
||||
width:260px;
|
||||
}
|
||||
.repo-file-list .dirent-size {
|
||||
width:114px;
|
||||
}
|
||||
.repo-file-list .dirent-update {
|
||||
width:123px;
|
||||
}
|
||||
.repo-file-list .dirent-op {
|
||||
width:110px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block left_panel %}
|
||||
<div class="side-tabnav">
|
||||
<h3 class="hd">{% trans "Organization" %}</h3>
|
||||
@@ -16,12 +34,12 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block right_panel %}
|
||||
<div class="hd ovhd">
|
||||
<h3 class="fleft">{% trans "Libraries" %}</h3>
|
||||
<button id="repo-create" class="fright"><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "New Library"%}</span></button>
|
||||
</div>
|
||||
|
||||
<div id="organization-repos">
|
||||
<div class="hd ovhd">
|
||||
<h3 class="fleft">{% trans "Libraries" %}</h3>
|
||||
<button id="repo-create" class="fright"><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "New Library"%}</span></button>
|
||||
</div>
|
||||
|
||||
<table class="repo-list hide">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -43,10 +61,35 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dir-view" class="hide">
|
||||
<div class="repo-file-list-topbar">
|
||||
<p class="path"></p>
|
||||
<div class="repo-op"></div>
|
||||
</div>
|
||||
<table class="repo-file-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="select">
|
||||
<span class="checkbox"><input type="checkbox" class="checkbox-orig" /></span>
|
||||
</th>
|
||||
<th class="star"></th>
|
||||
<th class="dirent-icon"></th>
|
||||
<th><span class="dirent-name">{% trans "Name"%} <span id="by-name" class="icon-caret-up cspt"></span></span></th>
|
||||
<th class="dirent-size">{% trans "Size"%}</th>
|
||||
<th class="dirent-update">{% trans "Last Update" %} <span id="by-time" class="icon-caret-down cspt"></span></th>
|
||||
<th class="dirent-op">{% trans "Operations"%}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<img class="loading-tip" src="{{MEDIA_URL}}img/loading-icon.gif" alt="{% trans 'Loading...' %}" />
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
{% include "js/lib-op-popups.html" %}
|
||||
<script>
|
||||
app["pageOptions"] = {
|
||||
base_url: "{{ SITE_ROOT }}" + "home/my/",
|
||||
|
Reference in New Issue
Block a user