You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/08/13 15:27:18 UTC
[1/4] git commit: updated refs/heads/master to 4d1dd2d
Updated Branches:
refs/heads/master e40eab36a -> 4d1dd2d55
Fauxton: Move logout to footer bar
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/1490f18a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/1490f18a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/1490f18a
Branch: refs/heads/master
Commit: 1490f18a49937fab1c9e0bfb38f1b6a74124a2be
Parents: cab37a1
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Aug 13 14:23:14 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Aug 13 15:26:52 2013 +0200
----------------------------------------------------------------------
src/fauxton/Gruntfile.js | 6 +-
src/fauxton/app/addons/auth/base.js | 10 ++
src/fauxton/app/addons/auth/resources.js | 15 ++-
.../app/addons/auth/templates/nav_dropdown.html | 1 -
src/fauxton/app/api.js | 4 +
src/fauxton/app/modules/fauxton/base.js | 35 +++++-
src/fauxton/app/templates/fauxton/nav_bar.html | 10 ++
src/fauxton/test/core/navbarSpec.js | 107 +++++++++++++++++++
8 files changed, 177 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/Gruntfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js
index 9cb7e2e..e9cb13c 100644
--- a/src/fauxton/Gruntfile.js
+++ b/src/fauxton/Gruntfile.js
@@ -214,9 +214,9 @@ module.exports = function(grunt) {
port: 8000,
proxy: {
target: {
- host: 'localhost',
- port: 5984,
- https: false
+ host: 'garrensmith.cloudant.com',
+ port: 443,
+ https: true
},
// This sets the Host header in the proxy so that you can use external
// CouchDB instances and not have the Host set to 'localhost'
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/app/addons/auth/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/base.js b/src/fauxton/app/addons/auth/base.js
index 78f95e0..3502edd 100644
--- a/src/fauxton/app/addons/auth/base.js
+++ b/src/fauxton/app/addons/auth/base.js
@@ -32,6 +32,7 @@ function(app, FauxtonAPI, Auth) {
bottomNav: true,
establish: [FauxtonAPI.session.fetchUser()]
});
+
var auth = function (session, roles) {
var deferred = $.Deferred();
@@ -54,7 +55,16 @@ function(app, FauxtonAPI, Auth) {
FauxtonAPI.auth.registerAuth(auth);
FauxtonAPI.auth.registerAuthDenied(authDenied);
+
+ FauxtonAPI.session.on('change', function () {
+ if (FauxtonAPI.session.isLoggedIn()) {
+ FauxtonAPI.addHeaderLink({footerNav: true, href:"#logout", title:"Logout", icon: "", className: 'logout'});
+ } else {
+ FauxtonAPI.removeHeaderLink({title: "Logout", footerNav: true});
+ }
+ });
};
+
return Auth;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js
index da3acb2..dd900c5 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -72,6 +72,16 @@ function (app, FauxtonAPI) {
return false;
},
+ isLoggedIn: function () {
+ var userCtx = this.get('userCtx');
+
+ if (userCtx.name) {
+ return true;
+ }
+
+ return false;
+ },
+
userRoles: function () {
var user = this.user();
@@ -237,7 +247,7 @@ function (app, FauxtonAPI) {
"submit #login": "login"
},
- login: function () {
+ login: function (event) {
event.preventDefault();
var that = this,
@@ -251,7 +261,7 @@ function (app, FauxtonAPI) {
});
promise.fail(function (xhr, type, msg) {
- if (arguments.length === 3 && msg === 'Unauthorized') {
+ if (arguments.length === 3) {
msg = FauxtonAPI.session.messages.incorrectCredentials;
} else {
msg = xhr;
@@ -349,6 +359,5 @@ function (app, FauxtonAPI) {
template: "addons/auth/templates/noAccess"
});
-
return Auth;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/app/addons/auth/templates/nav_dropdown.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/nav_dropdown.html b/src/fauxton/app/addons/auth/templates/nav_dropdown.html
index 880a7c1..d61c24a 100644
--- a/src/fauxton/app/addons/auth/templates/nav_dropdown.html
+++ b/src/fauxton/app/addons/auth/templates/nav_dropdown.html
@@ -20,7 +20,6 @@ the License.
<ul class="nav nav-list">
<li class="active" ><a data-select="change-password" id="user-change-password" href="#changePassword"> Change Password </a></li>
<li ><a data-select="add-admin" href="#addAdmin"> Create Admins </a></li>
- <li ><a data-select"user-logout" href="#logout"> Logout </a> </li>
</ul>
</nav>
</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index 5e8e424..0a2351d 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -65,6 +65,10 @@ function(app, Fauxton) {
app.masterLayout.navBar.addLink(link);
};
+ FauxtonAPI.removeHeaderLink = function(link) {
+ app.masterLayout.navBar.removeLink(link);
+ };
+
FauxtonAPI.Deferred = function() {
return $.Deferred();
};
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/app/modules/fauxton/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js
index ea5f3ec..2715ab2 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -77,23 +77,28 @@ function(app, Backbone, resizeColumns) {
],
bottomNavLinks: [],
-
- initialize: function() {
- },
+ footerNavLinks: [],
serialize: function() {
- return {navLinks: this.navLinks, bottomNavLinks: this.bottomNavLinks};
+ return {
+ navLinks: this.navLinks,
+ bottomNavLinks: this.bottomNavLinks,
+ footerNavLinks: this.footerNavLinks
+ };
},
addLink: function(link) {
// link.top means it gets pushed to the top of the array,
// link.bottomNav means it goes to the additional bottom nav
+ // link.footerNav means goes to the footer nav
if (link.top && !link.bottomNav){
this.navLinks.unshift(link);
} else if (link.top && link.bottomNav){
this.bottomNavLinks.unshift(link);
} else if (link.bottomNav) {
this.bottomNavLinks.push(link);
+ } else if (link.footerNav) {
+ this.footerNavLinks.push(link);
} else {
this.navLinks.push(link);
}
@@ -103,6 +108,28 @@ function(app, Backbone, resizeColumns) {
//this.render();
},
+ removeLink: function (removeLink) {
+ var links = this.navlinks;
+
+ if (removeLink.bottomNav) {
+ links = this.bottomNavLinks;
+ } else if (removeLink.footerNav) {
+ links = this.footerNavLinks;
+ }
+
+ var foundIndex = -1;
+
+ _.each(links, function (link, index) {
+ if (link.title === removeLink.title) {
+ foundIndex = index;
+ }
+ });
+
+ if (foundIndex === -1) {return;}
+ links.splice(foundIndex, 1);
+ this.render();
+ },
+
afterRender: function(){
$('#primary-navbar li[data-nav-name="' + app.selectedHeader + '"]').addClass('active');
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/app/templates/fauxton/nav_bar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/nav_bar.html b/src/fauxton/app/templates/fauxton/nav_bar.html
index 3733775..636d176 100644
--- a/src/fauxton/app/templates/fauxton/nav_bar.html
+++ b/src/fauxton/app/templates/fauxton/nav_bar.html
@@ -39,6 +39,16 @@ the License.
</li>
<% }); %>
</ul>
+ <ul id="footer-nav-links" class="nav">
+ <% _.each(footerNavLinks, function(link) { %>
+ <% if (link.view) {return;} %>
+ <li data-nav-name= "<%= link.title %>">
+ <a class="<%= link.icon %> fonticon" href="<%= link.href %>">
+ <%= link.title %>
+ </a>
+ </li>
+ <% }); %>
+ </ul>
</nav>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1490f18a/src/fauxton/test/core/navbarSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/test/core/navbarSpec.js b/src/fauxton/test/core/navbarSpec.js
new file mode 100644
index 0000000..ec3e71f
--- /dev/null
+++ b/src/fauxton/test/core/navbarSpec.js
@@ -0,0 +1,107 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+define([
+ 'modules/fauxton/base',
+ 'testUtils'
+], function (Fauxton, testUtils) {
+ var assert = testUtils.assert,
+ NavBar = Fauxton.NavBar;
+
+ describe('NavBar', function () {
+
+ describe('adding links', function () {
+ var navBar;
+
+ beforeEach(function () {
+ navBar = new NavBar();
+ navBar.navLinks = [];
+ navBar.bottomNavLinks = [];
+ navBar.footerNavLinks = [];
+ });
+
+ it('Should add link to navlinks', function () {
+ navBar.addLink({href: '#/test', title: 'Test Title'});
+
+ assert.equal(navBar.navLinks.length, 1);
+ assert.equal(navBar.footerNavLinks.length, 0);
+ assert.equal(navBar.bottomNavLinks.length, 0);
+ });
+
+ it('Should add link to bottom links', function () {
+ navBar.addLink({href: '#/test', bottomNav: true, title: 'Test Title'});
+
+ assert.equal(navBar.bottomNavLinks.length, 1);
+ assert.equal(navBar.navLinks.length, 0);
+ assert.equal(navBar.footerNavLinks.length, 0);
+ });
+
+ it('Should add link to footer links', function () {
+ navBar.addLink({href: '#/test', footerNav: true, title: 'Test Title'});
+
+ assert.equal(navBar.footerNavLinks.length, 1);
+ assert.equal(navBar.bottomNavLinks.length, 0);
+ assert.equal(navBar.navLinks.length, 0);
+ });
+ });
+
+ describe('removing links', function () {
+ var navBar;
+
+ beforeEach(function () {
+ navBar = new NavBar();
+ navBar.navLinks = [];
+ navBar.bottomNavLinks = [];
+ navBar.footerNavLinks = [];
+ navBar.addLink({
+ href: '#/test',
+ footerNav: true,
+ title: 'Test Title Footer'
+ });
+
+ navBar.addLink({
+ href: '#/test',
+ bottomNav: true,
+ title: 'Test Title Bottom'
+ });
+
+ navBar.addLink({
+ href: '#/test',
+ title: 'Test Title'
+ });
+ });
+
+ it("should remove links from list", function () {
+ navBar.removeLink({
+ title: 'Test Title Footer',
+ footerNav: true
+ });
+
+ assert.equal(navBar.footerNavLinks.length, 0);
+ assert.equal(navBar.bottomNavLinks.length, 1);
+ assert.equal(navBar.navLinks.length, 1);
+ });
+
+ it("Should call render after removing links", function () {
+ var renderSpy = sinon.stub(navBar,'render');
+
+ navBar.removeLink({
+ title: 'Test Title Footer',
+ footerNav: true
+ });
+
+ assert.ok(renderSpy.calledOnce);
+ });
+
+ });
+ });
+
+});
[2/4] git commit: updated refs/heads/master to 4d1dd2d
Posted by ga...@apache.org.
fixing failing test
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cab37a1e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cab37a1e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cab37a1e
Branch: refs/heads/master
Commit: cab37a1e117fb9c7c05858bad7cd45049e091145
Parents: 9d99f06
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Aug 13 10:50:50 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Aug 13 15:26:52 2013 +0200
----------------------------------------------------------------------
.gitignore | 1 +
src/fauxton/test/core/routeObjectSpec.js | 15 +++++-
src/fauxton/test/test.config.js | 71 ---------------------------
3 files changed, 14 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cab37a1e/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 43d4773..a022b14 100644
--- a/.gitignore
+++ b/.gitignore
@@ -122,3 +122,4 @@ test/javascript/run_js_tests.sh
test/local.ini
tmp
utils/run
+src/fauxton/test/test.config.js
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cab37a1e/src/fauxton/test/core/routeObjectSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/test/core/routeObjectSpec.js b/src/fauxton/test/core/routeObjectSpec.js
index 45d95ac..d043d63 100644
--- a/src/fauxton/test/core/routeObjectSpec.js
+++ b/src/fauxton/test/core/routeObjectSpec.js
@@ -1,3 +1,14 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
define([
'api',
'testUtils'
@@ -65,7 +76,7 @@ define([
getViewsSpy = sinon.stub(testRouteObject,"getViews"),
viewSpy = sinon.stub(view, "establish");
- sinon.stub(view, "hasRendered").returns(false);
+ view.hasRendered = false;
getViewsSpy.returns({'#view': view});
testRouteObject.renderWith('the-route', mockLayout, 'args');
@@ -77,7 +88,7 @@ define([
getViewsSpy = sinon.stub(testRouteObject,"getViews"),
viewSpy = sinon.stub(view, "establish");
- sinon.stub(view, "hasRendered").returns(true);
+ view.hasRendered = true;
getViewsSpy.returns({'#view': view});
testRouteObject.renderWith('the-route', mockLayout, 'args');
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cab37a1e/src/fauxton/test/test.config.js
----------------------------------------------------------------------
diff --git a/src/fauxton/test/test.config.js b/src/fauxton/test/test.config.js
deleted file mode 100644
index f876bb3..0000000
--- a/src/fauxton/test/test.config.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// vim: set ft=javascript:
-// Set the require.js configuration for your test setup.
-require.config(
-{
- "paths": {
- "libs": "../assets/js/libs",
- "plugins": "../assets/js/plugins",
- "jquery": "../assets/js/libs/jquery",
- "lodash": "../assets/js/libs/lodash",
- "backbone": "../assets/js/libs/backbone",
- "bootstrap": "../assets/js/libs/bootstrap",
- "codemirror": "../assets/js/libs/codemirror",
- "jshint": "../assets/js/libs/jshint",
- "d3": "../assets/js/libs/d3",
- "nv.d3": "../assets/js/libs/nv.d3",
- "chai": "../test/mocha/chai",
- "sinon-chai": "../test/mocha/sinon-chai",
- "testUtils": "../test/mocha/testUtils"
- },
- "baseUrl": "../app",
- "shim": {
- "backbone": {
- "deps": [
- "lodash",
- "jquery"
- ],
- "exports": "Backbone"
- },
- "bootstrap": {
- "deps": [
- "jquery"
- ],
- "exports": "Bootstrap"
- },
- "codemirror": {
- "deps": [
- "jquery"
- ],
- "exports": "CodeMirror"
- },
- "jshint": {
- "deps": [
- "jquery"
- ],
- "exports": "JSHINT"
- },
- "plugins/backbone.layoutmanager": [
- "backbone"
- ],
- "plugins/codemirror-javascript": [
- "codemirror"
- ],
- "plugins/prettify": [],
- "plugins/jquery.form": [
- "jquery"
- ]
- }
-}
-);
-
-require([
-
- '.././test/core/routeObjectSpec.js',
-
- '.././app/addons/logs/tests/logSpec.js',
-
-], function() {
- if (window.mochaPhantomJS) { mochaPhantomJS.run(); }
- else { mocha.run(); }
-});
-
[3/4] git commit: updated refs/heads/master to 4d1dd2d
Posted by ga...@apache.org.
Fauxton move auth to nav
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9d99f069
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9d99f069
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9d99f069
Branch: refs/heads/master
Commit: 9d99f069371ea6c8abe7cf14c2ca6e43966705db
Parents: e40eab3
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Aug 12 18:51:43 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Aug 13 15:26:52 2013 +0200
----------------------------------------------------------------------
src/fauxton/app/addons/auth/resources.js | 35 ++++++---------
src/fauxton/app/addons/auth/routes.js | 47 +++++++++++++-------
.../addons/auth/templates/change_password.html | 1 +
.../app/addons/auth/templates/create_admin.html | 1 +
.../app/addons/auth/templates/nav_dropdown.html | 20 +++++----
.../addons/auth/templates/nav_link_title.html | 17 +++----
src/fauxton/app/api.js | 5 +--
7 files changed, 68 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js
index d365634..da3acb2 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -301,10 +301,9 @@ function (app, FauxtonAPI) {
}
});
- Auth.NavLinkTitle = FauxtonAPI.View.extend({
+ Auth.NavLink = FauxtonAPI.View.extend({
template: 'addons/auth/templates/nav_link_title',
tagName: 'li',
- className: 'menuDropdownToggle openMenu',
beforeRender: function () {
this.listenTo(this.model, 'change', this.render);
@@ -325,6 +324,19 @@ function (app, FauxtonAPI) {
this.listenTo(this.model, 'change', this.render);
},
+ setTab: function (selectedTab) {
+ this.selectedTab = selectedTab;
+ this.$('.active').removeClass('active');
+ var $tab = this.$('a[data-select="' + selectedTab +'"]');
+ $tab.parent().addClass('active');
+ },
+
+ afterRender: function () {
+ if (this.selectedTab) {
+ this.setTab(this.selectedTab);
+ }
+ },
+
serialize: function () {
return {
admin_party: this.model.isAdminParty(),
@@ -333,25 +345,6 @@ function (app, FauxtonAPI) {
}
});
- Auth.NavLink = FauxtonAPI.View.extend({
- className: "dropdown openMenu",
-
- beforeRender: function () {
- this.nav_link_name = this.insertView(new Auth.NavLinkTitle({model: this.model}));
- if (this.model.isAdminParty() || this.model.user()) {
- this.nav_link_list = this.insertView(new Auth.NavDropDown({model: this.model}));
- }
- },
-
- afterRender: function () {
- var that = this;
- //unbind this click incase it has been registered before
- this.$('.menuDropdownToggle').unbind('click').click(function () {
- that.$('.menuDropdown').toggle('slow');
- });
- },
- });
-
Auth.NoAccessView = FauxtonAPI.View.extend({
template: "addons/auth/templates/noAccess"
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/routes.js b/src/fauxton/app/addons/auth/routes.js
index 779a6a3..ecd45f2 100644
--- a/src/fauxton/app/addons/auth/routes.js
+++ b/src/fauxton/app/addons/auth/routes.js
@@ -17,22 +17,13 @@ define([
],
function(app, FauxtonAPI, Auth) {
-
var authRouteObject = FauxtonAPI.RouteObject.extend({
layout: 'one_pane',
routes: {
'login': 'login',
'logout': 'logout',
- 'changePassword': {
- route: 'changePassword',
- roles: ['_admin', '_reader', '_replicator']
- },
'createAdmin': 'createAdmin',
- 'addAdmin': {
- roles: ['_admin'],
- route: 'addAdmin',
- },
'noAccess': 'noAccess'
},
@@ -40,6 +31,7 @@ function(app, FauxtonAPI, Auth) {
this.crumbs = [{name: 'Login', link:"#"}];
this.setView('#dashboard-content', new Auth.LoginView({model: FauxtonAPI.session}));
},
+
logout: function () {
FauxtonAPI.addNotification({msg: 'You have been logged out.'});
FauxtonAPI.session.logout().then(function () {
@@ -57,19 +49,44 @@ function(app, FauxtonAPI, Auth) {
this.setView('#dashboard-content', new Auth.CreateAdminView({model: FauxtonAPI.session}));
},
- addAdmin: function () {
- this.crumbs = [{name: 'Add Admin', link:"#"}];
- this.setView('#dashboard-content', new Auth.CreateAdminView({login_after: false, model: FauxtonAPI.session}));
- },
-
noAccess: function () {
this.crumbs = [{name: 'Access Denied', link:"#"}];
this.setView('#dashboard-content', new Auth.NoAccessView());
},
+ });
+
+ var userRouteObject = FauxtonAPI.RouteObject.extend({
+ layout: 'with_sidebar',
+
+ routes: {
+ 'changePassword': {
+ route: 'changePassword',
+ roles: ['_admin', '_reader', '_replicator']
+ },
+ 'addAdmin': {
+ roles: ['_admin'],
+ route: 'addAdmin',
+ },
+ },
+
+ initialize: function () {
+ this.navDrop = this.setView('#sidebar-content', new Auth.NavDropDown({model: FauxtonAPI.session}));
+ },
+
+ changePassword: function () {
+ this.navDrop.setTab('change-password');
+ this.setView('#dashboard-content', new Auth.ChangePassword({model: FauxtonAPI.session}));
+ },
+
+ addAdmin: function () {
+ this.navDrop.setTab('add-admin');
+ this.setView('#dashboard-content', new Auth.CreateAdminView({login_after: false, model: FauxtonAPI.session}));
+ },
+ crumbs: [{name: 'User Management', link: '#'}]
});
- Auth.RouteObjects = [authRouteObject];
+ Auth.RouteObjects = [authRouteObject, userRouteObject];
return Auth;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/addons/auth/templates/change_password.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/change_password.html b/src/fauxton/app/addons/auth/templates/change_password.html
index 39b8778..64b7d1f 100644
--- a/src/fauxton/app/addons/auth/templates/change_password.html
+++ b/src/fauxton/app/addons/auth/templates/change_password.html
@@ -13,6 +13,7 @@ the License.
-->
<div class="span12">
+ <h2> Change Password </h2>
<form id="change-password">
<p class="help-block">
Enter your new password.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/addons/auth/templates/create_admin.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/create_admin.html b/src/fauxton/app/addons/auth/templates/create_admin.html
index 5e9d260..4715be5 100644
--- a/src/fauxton/app/addons/auth/templates/create_admin.html
+++ b/src/fauxton/app/addons/auth/templates/create_admin.html
@@ -13,6 +13,7 @@ the License.
-->
<div class="span12">
+ <h2> Add Admin </h2>
<form id="create-admin-form">
<input id="username" type="text" name="name" placeholder= "Username:" size="24">
<br/>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/addons/auth/templates/nav_dropdown.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/nav_dropdown.html b/src/fauxton/app/addons/auth/templates/nav_dropdown.html
index 5d40e08..880a7c1 100644
--- a/src/fauxton/app/addons/auth/templates/nav_dropdown.html
+++ b/src/fauxton/app/addons/auth/templates/nav_dropdown.html
@@ -12,12 +12,16 @@ License for the specific language governing permissions and limitations under
the License.
-->
-<!-- dropdown menu links -->
- <% if (admin_party) { %>
- <li class="menuDropdown"><a id="user-create-admin" href="#createAdmin"> Create Admin </a></li>
- <% } else if (user) { %>
- <li class="menuDropdown"><a id="user-create-more-admin" href="#addAdmin"> Create Admins </a></li>
- <li class="menuDropdown"><a id="user-change-password" href="#changePassword"> Change Password </a></li>
- <li class="menuDropdown"><a id="user-logout" href="#logout"> Logout </a> </li>
- <% } %>
+<div id="sidenav">
+<header class="row-fluid">
+ <h3> <%= user.name %> </h3>
+</header>
+<nav>
+<ul class="nav nav-list">
+ <li class="active" ><a data-select="change-password" id="user-change-password" href="#changePassword"> Change Password </a></li>
+ <li ><a data-select="add-admin" href="#addAdmin"> Create Admins </a></li>
+ <li ><a data-select"user-logout" href="#logout"> Logout </a> </li>
+</ul>
+</nav>
+</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/addons/auth/templates/nav_link_title.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/nav_link_title.html b/src/fauxton/app/addons/auth/templates/nav_link_title.html
index 2d38b75..8a4469a 100644
--- a/src/fauxton/app/addons/auth/templates/nav_link_title.html
+++ b/src/fauxton/app/addons/auth/templates/nav_link_title.html
@@ -11,15 +11,12 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
-<a <% if (!user && !admin_party) { %> href="#login" <% } %> class="fonticon-user fonticon" >
- <% if (admin_party) { %>
- Admin Party!
- <% } else if (user) { %>
- <%= user.name %>
- <% } else { %>
- Login
- <% } %>
- <b class="caret"></b>
-</a>
+<% if (admin_party) { %>
+ <a id="user-create-admin" class="fonticon-user fonticon" href="#createAdmin"> Admin Party! </a>
+<% } else if (user) { %>
+ <a href="#changePassword" class="fonticon-user fonticon" > <%= user.name %> </a>
+<% } else { %>
+ <a href="#login" class="fonticon-user fonticon" > Login </a>
+<% } %>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9d99f069/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index fc98866..5e8e424 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -51,10 +51,6 @@ function(app, Fauxton) {
disableLoader: false,
- /*hasRendered: function () {
- return !!this.__manager__.hasRendered;
- },*/
-
forceRender: function () {
this.hasRendered = false;
}
@@ -301,6 +297,7 @@ function(app, Fauxton) {
if (!routeObject.disableLoader) {
routeObjectSpinner.stop();
+ $('.spinner').remove();
}
if (!view.disableLoader){
[4/4] git commit: updated refs/heads/master to 4d1dd2d
Posted by ga...@apache.org.
Fauxton: bug fix on view editor
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4d1dd2d5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4d1dd2d5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4d1dd2d5
Branch: refs/heads/master
Commit: 4d1dd2d55d5d99cb4c4f08fe1171549ab25d4997
Parents: 1490f18
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Aug 13 15:13:36 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Aug 13 15:26:53 2013 +0200
----------------------------------------------------------------------
src/fauxton/Gruntfile.js | 6 +++---
src/fauxton/app/modules/documents/resources.js | 4 ++++
src/fauxton/app/templates/documents/view_editor.html | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4d1dd2d5/src/fauxton/Gruntfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js
index e9cb13c..9cb7e2e 100644
--- a/src/fauxton/Gruntfile.js
+++ b/src/fauxton/Gruntfile.js
@@ -214,9 +214,9 @@ module.exports = function(grunt) {
port: 8000,
proxy: {
target: {
- host: 'garrensmith.cloudant.com',
- port: 443,
- https: true
+ host: 'localhost',
+ port: 5984,
+ https: false
},
// This sets the Host header in the proxy so that you can use external
// CouchDB instances and not have the Host set to 'localhost'
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4d1dd2d5/src/fauxton/app/modules/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/resources.js b/src/fauxton/app/modules/documents/resources.js
index 826b44a..0a80ad8 100644
--- a/src/fauxton/app/modules/documents/resources.js
+++ b/src/fauxton/app/modules/documents/resources.js
@@ -22,6 +22,10 @@ function(app, FauxtonAPI) {
Documents.Doc = Backbone.Model.extend({
idAttribute: "_id",
+ defaults: {
+ views: {}
+ },
+
url: function(context) {
if (context === "app") {
return this.getDatabase().url("app") + "/" + this.safeID();
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4d1dd2d5/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index fd35873..08b8ad4 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -48,7 +48,7 @@ the License.
</select>
</div>
</div>
- <div id="new-ddoc-section" class="span5" style="display:none">
+ <div id="new-ddoc-section" class="span5 offset1" style="display:none">
<label class="control-label" for="new-ddoc"> _design/ </label>
<div class="controls">
<input type="text" id="new-ddoc" placeholder="newDesignDoc">