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([
|
define([
|
||||||
'app/routers/organization'
|
'app/routers/organization'
|
||||||
], function(Router){
|
], function(Router){
|
||||||
new Router();
|
app.router = new Router();
|
||||||
Backbone.history.start();
|
Backbone.history.start();
|
||||||
});
|
});
|
||||||
|
@@ -8,21 +8,26 @@ define([
|
|||||||
|
|
||||||
var OrganizationRouter = Backbone.Router.extend({
|
var OrganizationRouter = Backbone.Router.extend({
|
||||||
routes: {
|
routes: {
|
||||||
'libs/:id(/*path)': 'showDir',
|
'lib/:repo_id(/*path)': 'showDir',
|
||||||
// Default
|
// Default
|
||||||
'*actions': 'defaultAction'
|
'*actions': 'defaultAction'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.organizationView = new OrganizationView();
|
this.orgView = new OrganizationView();
|
||||||
},
|
},
|
||||||
|
|
||||||
showDir: function() {
|
showDir: function(repo_id, path) {
|
||||||
alert('todo');
|
if (path) {
|
||||||
|
path = '/' + path;
|
||||||
|
} else {
|
||||||
|
path = '/';
|
||||||
|
}
|
||||||
|
this.orgView.showDir(repo_id, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultAction: function(){
|
defaultAction: function(){
|
||||||
this.organizationView.showPublicRepos();
|
this.orgView.showPublicRepos();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@ define([
|
|||||||
el: '#main',
|
el: '#main',
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
console.log('init MyHomePage');
|
|
||||||
Common.prepareApiCsrf();
|
Common.prepareApiCsrf();
|
||||||
|
|
||||||
//_.bindAll(this, 'ajaxLoadingShow', 'ajaxLoadingHide');
|
//_.bindAll(this, 'ajaxLoadingShow', 'ajaxLoadingHide');
|
||||||
|
@@ -3,7 +3,7 @@ define([
|
|||||||
'underscore',
|
'underscore',
|
||||||
'backbone',
|
'backbone',
|
||||||
'common',
|
'common',
|
||||||
'text!' + app.config._tmplRoot + 'organization-repos.html'
|
'text!' + app.config._tmplRoot + 'organization-repo.html'
|
||||||
], function($, _, Backbone, Common, reposTemplate) {
|
], function($, _, Backbone, Common, reposTemplate) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@@ -4,15 +4,17 @@ define([
|
|||||||
'backbone',
|
'backbone',
|
||||||
'common',
|
'common',
|
||||||
'app/collections/repos',
|
'app/collections/repos',
|
||||||
'app/views/organization-repo'
|
'app/views/organization-repo',
|
||||||
], function($, _, Backbone, Common, RepoCollection, OrganizationRepoView) {
|
'app/views/dir',
|
||||||
|
], function($, _, Backbone, Common, RepoCollection, OrganizationRepoView,
|
||||||
|
DirView) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var OrganizationView = Backbone.View.extend({
|
var OrganizationView = Backbone.View.extend({
|
||||||
el: '#main',
|
el: '#main',
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
this.$reposDiv = $('#organization-repos');
|
||||||
this.$table = $('#organization-repos table');
|
this.$table = $('#organization-repos table');
|
||||||
this.$tableBody = $('tbody', this.$table);
|
this.$tableBody = $('tbody', this.$table);
|
||||||
this.$loadingTip = $('#organization-repos .loading-tip');
|
this.$loadingTip = $('#organization-repos .loading-tip');
|
||||||
@@ -21,6 +23,8 @@ define([
|
|||||||
this.repos = new RepoCollection({type: 'org'});
|
this.repos = new RepoCollection({type: 'org'});
|
||||||
this.listenTo(this.repos, 'add', this.addOne);
|
this.listenTo(this.repos, 'add', this.addOne);
|
||||||
this.listenTo(this.repos, 'reset', this.reset);
|
this.listenTo(this.repos, 'reset', this.reset);
|
||||||
|
|
||||||
|
this.dirView = new DirView();
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
@@ -54,7 +58,23 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
showPublicRepos: function() {
|
showPublicRepos: function() {
|
||||||
|
this.dirView.hide();
|
||||||
|
this.$reposDiv.show();
|
||||||
this.repos.fetch({reset: true});
|
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>
|
</td>
|
||||||
{# TODO #}
|
<td><a href="#/lib/<%= id %>"><%- name %></a></td>
|
||||||
<td><a href="#/libs/<%= id %>"><%- name %></a></td>
|
|
||||||
<td><%- desc %></td>
|
<td><%- desc %></td>
|
||||||
<td><%- mtime_relative %></td>
|
<td><%- mtime_relative %></td>
|
||||||
<td><%- share_from %></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" %}" />
|
<img src="<%= app.config.mediaUrl%>img/rm.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
|
|
@@ -4,6 +4,24 @@
|
|||||||
|
|
||||||
{% block sub_title %}{% trans "Organization" %} - {% endblock %}
|
{% 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 %}
|
{% block left_panel %}
|
||||||
<div class="side-tabnav">
|
<div class="side-tabnav">
|
||||||
<h3 class="hd">{% trans "Organization" %}</h3>
|
<h3 class="hd">{% trans "Organization" %}</h3>
|
||||||
@@ -16,12 +34,12 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block right_panel %}
|
{% block right_panel %}
|
||||||
<div class="hd ovhd">
|
<div id="organization-repos">
|
||||||
|
<div class="hd ovhd">
|
||||||
<h3 class="fleft">{% trans "Libraries" %}</h3>
|
<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>
|
<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>
|
||||||
|
|
||||||
<div id="organization-repos">
|
|
||||||
<table class="repo-list hide">
|
<table class="repo-list hide">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -43,10 +61,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_script %}
|
{% block extra_script %}
|
||||||
|
{% include "js/lib-op-popups.html" %}
|
||||||
<script>
|
<script>
|
||||||
app["pageOptions"] = {
|
app["pageOptions"] = {
|
||||||
base_url: "{{ SITE_ROOT }}" + "home/my/",
|
base_url: "{{ SITE_ROOT }}" + "home/my/",
|
||||||
|
Reference in New Issue
Block a user