From 177d962f847af97f6224e3df16d8719ae451ed57 Mon Sep 17 00:00:00 2001 From: Daniel Pan Date: Tue, 14 Apr 2015 15:08:19 +0800 Subject: [PATCH] delete unused myhome.js, group.js, organization.js, redirect home/my/ to / --- seahub/urls.py | 1 - seahub/views/__init__.py | 19 +----- static/scripts/app/main/group.js | 6 -- static/scripts/app/main/myhome.js | 6 -- static/scripts/app/main/organization.js | 6 -- static/scripts/app/routers/group.js | 46 ------------- static/scripts/app/routers/myhome.js | 77 ---------------------- static/scripts/app/routers/organization.js | 35 ---------- static/scripts/app/routers/router.js | 34 ---------- 9 files changed, 1 insertion(+), 229 deletions(-) delete mode 100644 static/scripts/app/main/group.js delete mode 100644 static/scripts/app/main/myhome.js delete mode 100644 static/scripts/app/main/organization.js delete mode 100644 static/scripts/app/routers/group.js delete mode 100644 static/scripts/app/routers/myhome.js delete mode 100644 static/scripts/app/routers/organization.js delete mode 100644 static/scripts/app/routers/router.js diff --git a/seahub/urls.py b/seahub/urls.py index be83eb56b3..459a543578 100644 --- a/seahub/urls.py +++ b/seahub/urls.py @@ -92,7 +92,6 @@ urlpatterns = patterns('', ### lib (replace the old `repo` urls) ### # url(r'^lib/(?P[-0-9a-f]{36})/dir/(?P.*)$', view_lib_dir, name='view_lib_dir'), - url(r'^libs/$', libraries, name='libraries'), url(r'^lib/(?P[-0-9a-f]{36})/file/(?P.*)$', view_lib_file, name='view_lib_file'), # url(r'^home/my/lib/(?P[-0-9a-f]{36})/dir/(?P.*)$', myhome_lib, name='myhome_lib'), diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py index fb92fc069c..23a9fd7ded 100644 --- a/seahub/views/__init__.py +++ b/seahub/views/__init__.py @@ -1120,24 +1120,7 @@ def get_virtual_repos_by_owner(request): @login_required @user_mods_check def myhome(request): - username = request.user.username - - # options - if request.cloud_mode and request.user.org is None: - allow_public_share = False - else: - allow_public_share = True - sub_lib_enabled = UserOptions.objects.is_sub_lib_enabled(username) - guide_enabled = UserOptions.objects.is_user_guide_enabled(username) - max_upload_file_size = get_max_upload_file_size() - - return render_to_response('myhome.html', { - "allow_public_share": allow_public_share, - "guide_enabled": guide_enabled, - "sub_lib_enabled": sub_lib_enabled, - 'enable_upload_folder': settings.ENABLE_UPLOAD_FOLDER, - 'max_upload_file_size': max_upload_file_size, - }, context_instance=RequestContext(request)) + return HttpResponseRedirect(reverse('libraries')) @login_required @user_mods_check diff --git a/static/scripts/app/main/group.js b/static/scripts/app/main/group.js deleted file mode 100644 index 87968266c6..0000000000 --- a/static/scripts/app/main/group.js +++ /dev/null @@ -1,6 +0,0 @@ -define([ - 'app/routers/group' -], function(Router){ - app.router = new Router(); - Backbone.history.start(); -}); diff --git a/static/scripts/app/main/myhome.js b/static/scripts/app/main/myhome.js deleted file mode 100644 index 9da1c0da62..0000000000 --- a/static/scripts/app/main/myhome.js +++ /dev/null @@ -1,6 +0,0 @@ -define([ - 'app/routers/myhome' -], function(Router){ - app.router = new Router(); - Backbone.history.start(); -}); diff --git a/static/scripts/app/main/organization.js b/static/scripts/app/main/organization.js deleted file mode 100644 index eb3498e66a..0000000000 --- a/static/scripts/app/main/organization.js +++ /dev/null @@ -1,6 +0,0 @@ -define([ - 'app/routers/organization' -], function(Router){ - app.router = new Router(); - Backbone.history.start(); -}); diff --git a/static/scripts/app/routers/group.js b/static/scripts/app/routers/group.js deleted file mode 100644 index 3fa642cda3..0000000000 --- a/static/scripts/app/routers/group.js +++ /dev/null @@ -1,46 +0,0 @@ -/*global define*/ -define([ - 'jquery', - 'backbone', - 'app/collections/group-repos', - 'app/views/group' -], function($, Backbone, Repos, GroupView) { - "use strict"; - - var GroupRouter = Backbone.Router.extend({ - routes: { - 'lib/:repo_id(/*path)': 'showDir', - - 'recent-changes': 'showRecentChanges', - - // Default - '*actions': 'defaultAction' - }, - - initialize: function() { - this.groupView = new GroupView(); - }, - - showDir: function(repo_id, path) { - if (path) { - path = '/' + path; - } else { - path = '/'; - } - this.groupView.showDir(repo_id, path); - }, - - showRecentChanges: function() { - console.log('recent changes'); - this.groupView.showChanges(); - }, - - defaultAction: function(actions){ - // We have no matching route, lets just log what the URL was - console.log('No route:', actions); - this.groupView.showRepoList(); - } - }); - - return GroupRouter; -}); diff --git a/static/scripts/app/routers/myhome.js b/static/scripts/app/routers/myhome.js deleted file mode 100644 index 196b2e5779..0000000000 --- a/static/scripts/app/routers/myhome.js +++ /dev/null @@ -1,77 +0,0 @@ -/*global define*/ -define([ - 'jquery', - 'backbone', - 'app/collections/repos', - 'app/views/myhome' -], function($, Backbone, Repos, MyHomeView) { - "use strict"; - - var MyHomeRouter = Backbone.Router.extend({ - routes: { - 'my-libs': 'showMyRepos', - 'my-libs/lib/:repo_id(/*path)': 'showMyRepoDir', - 'my-sub-libs': 'showMySubRepos', - 'my-sub-libs/lib/:repo_id(/*path)': 'showMySubRepoDir', - 'shared-libs': 'showSharedRepos', - 'shared-libs/lib/:repo_id(/*path)': 'showSharedRepoDir', - - // Default - '*actions': 'defaultAction' - }, - - initialize: function() { - this.myHomeView = new MyHomeView(); - }, - - showMyRepos: function() { - this.myHomeView.showMyRepos(); - }, - - showMySubRepos: function() { - console.log("show My Sub Repos"); - this.myHomeView.showMySubRepos(); - }, - - showSharedRepos: function() { - console.log("show shared repos"); - this.myHomeView.showSharedRepos(); - }, - - showMyRepoDir: function(repo_id, path) { - if (path) { - path = '/' + path; - } else { - path = '/'; - } - this.myHomeView.showDir('my-libs', repo_id, path); - }, - - showMySubRepoDir: function(repo_id, path) { - if (path) { - path = '/' + path; - } else { - path = '/'; - } - this.myHomeView.showDir('my-sub-libs', repo_id, path); - }, - - showSharedRepoDir: function(repo_id, path) { - if (path) { - path = '/' + path; - } else { - path = '/'; - } - this.myHomeView.showDir('shared-libs', repo_id, path); - }, - - defaultAction: function(actions) { - // We have no matching route, lets just log what the URL was - console.log('No route:', actions); - - this.myHomeView.showMyRepos(); - } - }); - - return MyHomeRouter; -}); diff --git a/static/scripts/app/routers/organization.js b/static/scripts/app/routers/organization.js deleted file mode 100644 index 038ab0debc..0000000000 --- a/static/scripts/app/routers/organization.js +++ /dev/null @@ -1,35 +0,0 @@ -/*global define*/ -define([ - 'jquery', - 'backbone', - 'app/views/organization' -], function($, Backbone, OrganizationView) { - "use strict"; - - var OrganizationRouter = Backbone.Router.extend({ - routes: { - 'lib/:repo_id(/*path)': 'showDir', - // Default - '*actions': 'defaultAction' - }, - - initialize: function() { - this.orgView = new OrganizationView(); - }, - - showDir: function(repo_id, path) { - if (path) { - path = '/' + path; - } else { - path = '/'; - } - this.orgView.showDir(repo_id, path); - }, - - defaultAction: function(){ - this.orgView.showPublicRepos(); - } - }); - - return OrganizationRouter; -}); diff --git a/static/scripts/app/routers/router.js b/static/scripts/app/routers/router.js deleted file mode 100644 index c2a734f40e..0000000000 --- a/static/scripts/app/routers/router.js +++ /dev/null @@ -1,34 +0,0 @@ -/*global define*/ -define([ - 'jquery', - 'backbone' -], function($, Backbone) { - "use strict"; - - var MyHomeRouter = Backbone.Router.extend({ - routes: { - 'libs/:id(/*path)': 'showDirents', - - // Default - '*actions': 'defaultAction' - }, - - showDirents: function(id, path){ - console.log("Repo route has been called.." + "id:" + id + " path:" + path); - // if (!app.myHomePage) // XXX: is it good ? - // app.myHomePage = new app.MyHomePage(); - - // app.myHomePage.trigger('showDirents', id, path); - }, - - defaultAction: function(actions){ - // We have no matching route, lets just log what the URL was - console.log('No route:', actions); - // app.myHomePage = new app.MyHomePage(); - // app.myHomePage.showRepoList(); - } - - }); - - return MyHomeRouter; -});