couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [07/13] git commit: updated refs/heads/master to a9c390e
Date Thu, 08 Aug 2013 13:26:15 GMT
get auth working with new UI


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/48350cb6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/48350cb6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/48350cb6

Branch: refs/heads/master
Commit: 48350cb690e096ae20f600d7d0e9c478f11bdfbf
Parents: 7d37619
Author: Garren Smith <garren.smith@gmail.com>
Authored: Wed Jul 31 15:56:26 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Thu Aug 8 15:21:26 2013 +0200

----------------------------------------------------------------------
 .../app/addons/auth/assets/less/auth.less       |   4 +
 src/fauxton/app/addons/auth/resources.js        | 182 +++++++------------
 src/fauxton/app/addons/auth/routes.js           |  53 ++++++
 .../addons/auth/templates/change_password.html  |  25 +++
 .../auth/templates/change_password_modal.html   |  35 ----
 .../app/addons/auth/templates/create_admin.html |  36 ++++
 .../auth/templates/create_admin_modal.html      |  46 -----
 .../app/addons/auth/templates/login.html        |  26 +++
 .../app/addons/auth/templates/login_modal.html  |  35 ----
 .../app/addons/auth/templates/nav_dropdown.html |  11 +-
 .../app/addons/auth/templates/nav_link.html     |  19 --
 .../addons/auth/templates/nav_link_title.html   |   3 +-
 .../app/addons/auth/templates/noAccess.html     |   9 +-
 src/fauxton/app/modules/fauxton/base.js         |  16 +-
 src/fauxton/app/templates/fauxton/nav_bar.html  |   4 +-
 src/fauxton/app/windowResize.js                 |   1 +
 16 files changed, 238 insertions(+), 267 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/assets/less/auth.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/assets/less/auth.less b/src/fauxton/app/addons/auth/assets/less/auth.less
new file mode 100644
index 0000000..cbab983
--- /dev/null
+++ b/src/fauxton/app/addons/auth/assets/less/auth.less
@@ -0,0 +1,4 @@
+
+.menuDropdown {
+  display: none;
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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 7118c70..087a247 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -54,7 +54,11 @@ function (app, FauxtonAPI) {
 
       this.messages = _.extend({},  { 
           missingCredentials: 'Username or password cannot be blank.',
-          passwordsNotMatch:  'Passwords do not match.'
+          passwordsNotMatch:  'Passwords do not match.',
+          incorrectCredentials: 'Incorrect username or password.',
+          loggedIn: 'You have been logged in.',
+          adminCreated: 'Couchdb admin created',
+          changePassword: 'Your password has been updated.'
         }, options.messages);
     },
 
@@ -182,81 +186,60 @@ function (app, FauxtonAPI) {
     }
   });
 
-  Auth.ModalView = FauxtonAPI.View.extend({
-
-    show_modal: function () {
-      this.clear_error_msg();
-      this.$('.modal').modal();
-      // hack to get modal visible 
-      $('.modal-backdrop').css('z-index',1025);
-    },
-
-    hide_modal: function () {
-      this.$('.modal').modal('hide');
-      // force this removal as the navbar
-      //$('.modal-backdrop').remove();
-    },
-
-    set_error_msg: function (msg) {
-      var text;
-      if (typeof(msg) == 'string') {
-        text = msg;
-      } else {
-        text = JSON.parse(msg.responseText).reason;
-      }
-
-      this.$('#modal-error').text(text).removeClass('hide');
-    },
-
-    clear_error_msg: function () {
-      this.$('#modal-error').text(' ').addClass('hide');
-    }
-
-  });
-
-  Auth.CreateAdminModal = Auth.ModalView.extend({
-    template: 'addons/auth/templates/create_admin_modal',
+  Auth.CreateAdminView = FauxtonAPI.View.extend({
+    template: 'addons/auth/templates/create_admin',
 
     initialize: function (options) {
-      this.login_after = options.login_after || true;
+      options = options || {};
+      this.login_after = options.login_after === false ? false : true;
+      console.log(this.login_after, 'lo');
     },
 
     events: {
-      "click #create-admin": "createAdmin"
+      "submit #create-admin-form": "createAdmin"
     },
 
     createAdmin: function (event) {
       event.preventDefault();
-      this.clear_error_msg();
 
       var that = this,
-      username = this.$('#username').val(),
-      password = this.$('#password').val();
+          username = this.$('#username').val(),
+          password = this.$('#password').val();
 
       var promise = this.model.createAdmin(username, password, this.login_after);
 
       promise.then(function () {
-        that.$('.modal').modal('hide');
-        that.hide_modal();
+        FauxtonAPI.addNotification({
+          msg: FauxtonAPI.session.messages.adminCreated,
+        });
+
+        if (that.login_after) {
+          FauxtonAPI.navigate('/');
+        } else {
+          that.$('#username').val('');
+          that.$('#password').val('');
+        }
       });
 
       promise.fail(function (rsp) {
-        that.set_error_msg(rsp);
+        FauxtonAPI.addNotification({
+          msg: 'Could not create admin. Reason' + rsp + '.',
+          type: 'error'
+        });
       });
     }
 
   });
 
-  Auth.LoginModal = Auth.ModalView.extend({
-    template: 'addons/auth/templates/login_modal',
+  Auth.LoginView = FauxtonAPI.View.extend({
+    template: 'addons/auth/templates/login',
 
     events: {
-      "click #login": "login"
+      "submit #login": "login"
     },
 
     login: function () {
       event.preventDefault();
-      this.clear_error_msg();
 
       var that = this,
           username = this.$('#username').val(),
@@ -264,26 +247,35 @@ function (app, FauxtonAPI) {
           promise = this.model.login(username, password);
 
       promise.then(function () {
-        that.hide_modal();
+        FauxtonAPI.addNotification({msg:  FauxtonAPI.session.messages.loggedIn });
+        FauxtonAPI.navigate('/');
       });
 
-      promise.fail(function (rsp) {
-        that.set_error_msg(rsp);
+      promise.fail(function (xhr, type, msg) {
+        if (arguments.length === 3 && msg === 'Unauthorized') {
+          msg = FauxtonAPI.session.messages.incorrectCredentials;
+        } else {
+          msg = xhr;
+        }
+
+        FauxtonAPI.addNotification({
+          msg: msg,
+          type: 'error'
+        });
       });
     }
 
   });
 
-  Auth.ChangePasswordModal = Auth.ModalView.extend({
-    template: 'addons/auth/templates/change_password_modal',
+  Auth.ChangePassword = FauxtonAPI.View.extend({
+    template: 'addons/auth/templates/change_password',
 
     events: {
-      "click #change-password": "changePassword"
+      "submit #change-password": "changePassword"
     },
 
     changePassword: function () {
       event.preventDefault();
-      this.clear_error_msg();
 
       var that = this,
           new_password = this.$('#password').val(),
@@ -292,25 +284,28 @@ function (app, FauxtonAPI) {
       var promise = this.model.changePassword(new_password, password_confirm);
 
       promise.done(function () {
-        that.hide_modal();
+        FauxtonAPI.addNotification({msg: FauxtonAPI.session.messages.changePassword});
+        that.$('#password').val('');
+        that.$('#password-confirm').val('');
       });
 
-      promise.fail(function (rsp) {
-        that.set_error_msg(rsp);
+      promise.fail(function (xhr, error, msg) {
+        if (arguments.length < 3) {
+          msg = xhr;
+        }
+
+        FauxtonAPI.addNotification({
+          msg: xhr,
+          type: 'error'
+        });
       });
     }
   });
 
   Auth.NavLinkTitle = FauxtonAPI.View.extend({ 
     template: 'addons/auth/templates/nav_link_title',
-    tagName: 'a',
-    attributes: {
-      id: "user-drop",
-      "class": "dropdown-toggle",
-      role: "button",
-      "data-toggle": "dropdown",
-      href:"#"
-    },
+    tagName: 'li',
+    className: 'menuDropdownToggle openMenu',
 
     beforeRender: function () {
       this.listenTo(this.model, 'change', this.render);
@@ -326,12 +321,6 @@ function (app, FauxtonAPI) {
 
   Auth.NavDropDown = FauxtonAPI.View.extend({ 
     template: 'addons/auth/templates/nav_dropdown',
-    tagName: 'ul',
-    attributes: {
-      "class": "dropdown-menu",
-      role:"menu",
-      "aria-labelledby":"user-drop" 
-    },
 
     beforeRender: function () {
       this.listenTo(this.model, 'change', this.render);
@@ -346,57 +335,26 @@ function (app, FauxtonAPI) {
   });
 
   Auth.NavLink = FauxtonAPI.View.extend({
-    template: 'addons/auth/templates/nav_link',
-
-    tagName: "li",
-    className: "dropdown",
-
-    events: {
-      "click #user-create-admin": 'show_admin_modal',
-      "click #user-create-more-admin": 'show_create_more_admin_modal',
-      "click #user-login": 'show_login_modal',
-      "click #user-change-password": 'show_change_password_modal',
-      "click #user-logout": 'logout_user'
-    },
+    className: "dropdown openMenu",
 
     beforeRender: function () {
       this.nav_link_name = this.insertView(new Auth.NavLinkTitle({model: this.model}));
-      this.nav_link_name = this.insertView(new Auth.NavDropDown({model: this.model}));
-      this.create_admin_modal = this.setView('#user-create-admin-modal', new Auth.CreateAdminModal({model:
this.model}));
-      this.login_modal = this.setView('#login-modal', new Auth.LoginModal({model: this.model}));
-      this.change_password_modal = this.setView('#change-password-modal', new Auth.ChangePasswordModal({model:
this.model}));
-    },
-
-    show_admin_modal: function (event) {
-      event.preventDefault();
-      this.create_admin_modal.show_modal();
-    },
-
-    show_create_more_admin_modal: function (event) {
-      event.preventDefault();
-      this.create_admin_modal.login_after = false;
-      this.create_admin_modal.show_modal();
-    },
-
-    show_login_modal: function (event) {
-      event.preventDefault();
-      this.login_modal.show_modal();
+      if (this.model.isAdminParty() || this.model.user()) {
+        this.nav_link_list = this.insertView(new Auth.NavDropDown({model: this.model}));
+      }
     },
 
-    show_change_password_modal: function (event) {
-      event.preventDefault();
-      this.change_password_modal.show_modal();
+    afterRender: function () {
+      var that = this;
+      //unbind this click incase it has been registered before
+      this.$('.menuDropdownToggle').unbind('click').click(function () {
+        that.$('.menuDropdown').toggle('slow');
+      });
     },
-
-    logout_user: function () {
-      event.preventDefault();
-      this.model.logout();
-    }
   });
 
   Auth.NoAccessView = FauxtonAPI.View.extend({
     template: "addons/auth/templates/noAccess"
-
   });
 
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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 6ff7502..779a6a3 100644
--- a/src/fauxton/app/addons/auth/routes.js
+++ b/src/fauxton/app/addons/auth/routes.js
@@ -17,6 +17,59 @@ 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'
+    },
+
+    login: function () {
+      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 () {
+        FauxtonAPI.navigate('/');
+      });
+    },
+
+    changePassword: function () {
+      this.crumbs = [{name: 'Change Password', link:"#"}];
+      this.setView('#dashboard-content', new Auth.ChangePassword({model: FauxtonAPI.session}));
+    },
+
+    createAdmin: function () {
+      this.crumbs = [{name: 'Create Admin', link:"#"}];
+      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());
+    },
+
+  });
+
+  Auth.RouteObjects = [authRouteObject];
   
   return Auth;
 });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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
new file mode 100644
index 0000000..39b8778
--- /dev/null
+++ b/src/fauxton/app/addons/auth/templates/change_password.html
@@ -0,0 +1,25 @@
+<!--
+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.
+-->
+
+<div class="span12">
+  <form id="change-password">
+    <p class="help-block">
+    Enter your new password.
+    </p>
+    <input id="password" type="password" name="password" placeholder= "New Password:"
size="24">
+    <br/>
+    <input id="password-confirm" type="password" name="password_confirm" placeholder=
"Verify New Password" size="24">
+    <button type="submit" class="btn btn-primary">Change</button>
+  </form>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/templates/change_password_modal.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/change_password_modal.html b/src/fauxton/app/addons/auth/templates/change_password_modal.html
deleted file mode 100644
index 5e3db38..0000000
--- a/src/fauxton/app/addons/auth/templates/change_password_modal.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
-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.
--->
-
-<div class="modal hide fade">
-  <div class="modal-header">
-    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-    <h3>Change Password</h3>
-  </div>
-  <div class="modal-body">
-    <div id="modal-error" class="hide alert alert-error"/>
-    <form>
-      <p class="help-block">
-      Enter your new password.
-      </p>
-      <input id="password" type="password" name="password" placeholder= "New Password:"
size="24">
-      <br/>
-      <input id="password-confirm" type="password" name="password_confirm" placeholder=
"Verify New Password" size="24">
-    </form>
-  </div>
-  <div class="modal-footer">
-    <a href="#" data-dismiss="modal" class="btn">Cancel</a>
-    <a href="#" id="change-password" class="btn btn-primary">Change</a>
-  </div>
-</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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
new file mode 100644
index 0000000..5e9d260
--- /dev/null
+++ b/src/fauxton/app/addons/auth/templates/create_admin.html
@@ -0,0 +1,36 @@
+<!--
+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.
+-->
+
+<div class="span12">
+  <form id="create-admin-form">
+    <input id="username" type="text" name="name" placeholder= "Username:" size="24">
+    <br/>
+    <input id="password" type="password" name="password" placeholder= "Password" size="24">
+    <p class="help-block">
+    Before a server admin is configured, all clients have admin privileges.
+    This is fine when HTTP access is restricted 
+    to trusted users. <strong>If end-users will be accessing this CouchDB, you must
+      create an admin account to prevent accidental (or malicious) data loss.</strong>
+    </p>
+    <p class="help-block">Server admins can create and destroy databases, install 
+    and update _design documents, run the test suite, and edit all aspects of CouchDB 
+    configuration.
+    </p>
+    <p class="help-block">Non-admin users have read and write access to all databases,
which
+    are controlled by validation functions. CouchDB can be configured to block all
+    access to anonymous users.
+    </p>
+    <button type="submit" href="#" id="create-admin" class="btn btn-primary">Create
Admin</button>
+  </form>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/templates/create_admin_modal.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/create_admin_modal.html b/src/fauxton/app/addons/auth/templates/create_admin_modal.html
deleted file mode 100644
index 0d16ca1..0000000
--- a/src/fauxton/app/addons/auth/templates/create_admin_modal.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!--
-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.
--->
-
-<div class="modal hide fade">
-  <div class="modal-header">
-    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-    <h3>Create Server Admin</h3>
-  </div>
-  <div class="modal-body">
-    <div id="modal-error" class="hide alert alert-error"/>
-    <form>
-      <input id="username" type="text" name="name" placeholder= "Username:" size="24">
-      <br/>
-      <input id="password" type="password" name="password" placeholder= "Password" size="24">
-    </form>
-    <p class="help-block">
-    Before a server admin is configured, all clients have admin privileges.
-    This is fine when HTTP access is restricted 
-    to trusted users. <strong>If end-users will be accessing this CouchDB, you must
-      create an admin account to prevent accidental (or malicious) data loss.</strong>
-    </p>
-    <p class="help-block">Server admins can create and destroy databases, install 
-    and update _design documents, run the test suite, and edit all aspects of CouchDB 
-    configuration.
-    </p>
-    <p class="help-block">Non-admin users have read and write access to all databases,
which
-    are controlled by validation functions. CouchDB can be configured to block all
-    access to anonymous users.
-    </p>
-  </div>
-  <div class="modal-footer">
-    <a href="#" data-dismiss="modal" class="btn">Cancel</a>
-    <a href="#" id="create-admin" class="btn btn-primary">Create Admin</a>
-  </div>
-</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/templates/login.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/login.html b/src/fauxton/app/addons/auth/templates/login.html
new file mode 100644
index 0000000..a57f3f0
--- /dev/null
+++ b/src/fauxton/app/addons/auth/templates/login.html
@@ -0,0 +1,26 @@
+<!--
+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.
+-->
+<div class="span12">
+  <form id="login">
+    <p class="help-block">
+      Login to CouchDB with your name and password.
+    </p>
+    <input id="username" type="text" name="name" placeholder= "Username:" size="24">
+    <br/>
+    <input id="password" type="password" name="password" placeholder= "Password" size="24">
+    <br/>
+    <button id="submit" class="btn" type="submit"> Login </button>
+  </form>
+</div>
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/templates/login_modal.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/login_modal.html b/src/fauxton/app/addons/auth/templates/login_modal.html
deleted file mode 100644
index e0395da..0000000
--- a/src/fauxton/app/addons/auth/templates/login_modal.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
-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.
--->
-
-<div class="modal hide fade">
-  <div class="modal-header">
-    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-    <h3>Login</h3>
-  </div>
-  <div class="modal-body">
-    <div id="modal-error" class="hide alert alert-error"/>
-    <form>
-      <p class="help-block">
-      Login to CouchDB with your name and password.
-      </p>
-      <input id="username" type="text" name="name" placeholder= "Username:" size="24">
-      <br/>
-      <input id="password" type="password" name="password" placeholder= "Password" size="24">
-    </form>
-  </div>
-  <div class="modal-footer">
-    <a href="#" data-dismiss="modal" class="btn">Cancel</a>
-    <a href="#" id="login" class="btn btn-primary">Login</a>
-  </div>
-</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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 5e07ca0..5d40e08 100644
--- a/src/fauxton/app/addons/auth/templates/nav_dropdown.html
+++ b/src/fauxton/app/addons/auth/templates/nav_dropdown.html
@@ -14,13 +14,10 @@ the License.
 
 <!-- dropdown menu links -->
   <% if (admin_party) { %>
-  <li> <a id="user-create-admin" href="#"> Create Admin </a> </li>
+  <li class="menuDropdown"><a id="user-create-admin" href="#createAdmin"> Create
Admin </a></li>
   <% } else if (user) { %>
-  <li> <a id="user-create-more-admin" href="#"> Create Admins </a> </li>
-  <li> <a id="user-change-password" href="#"> Change Password </a> </li>
-  <li> <a id="user-logout" href="#"> Logout </a> </li> 
-  <% } else { %>
-  <li> <a id="user-login" href="#"> Login </a> </li> 
-  <!--<li> <a id="user-sign-up"> Sign up </a> </li>-->
+  <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> 
   <% } %>
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/templates/nav_link.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/nav_link.html b/src/fauxton/app/addons/auth/templates/nav_link.html
deleted file mode 100644
index add5b89..0000000
--- a/src/fauxton/app/addons/auth/templates/nav_link.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
-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.
--->
-
-<div id="nav-link-title"> </div>
-<div id="user-create-admin-modal"> </div>
-<div id="login-modal"> </div>
-<div id="change-password-modal"> </div>
-<div id="signup-modal"> </div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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 90004f3..2d38b75 100644
--- a/src/fauxton/app/addons/auth/templates/nav_link_title.html
+++ b/src/fauxton/app/addons/auth/templates/nav_link_title.html
@@ -11,7 +11,7 @@ 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) { %>
@@ -20,5 +20,6 @@ the License.
   Login
   <% } %>
   <b class="caret"></b>
+</a>
 
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/addons/auth/templates/noAccess.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/templates/noAccess.html b/src/fauxton/app/addons/auth/templates/noAccess.html
index f1a9506..ceff992 100644
--- a/src/fauxton/app/addons/auth/templates/noAccess.html
+++ b/src/fauxton/app/addons/auth/templates/noAccess.html
@@ -12,8 +12,9 @@ License for the specific language governing permissions and limitations
under
 the License.
 -->
 
-<div class="row-fluid" >
-  <div class="span6 offset4">
-  <h3> You do not have permission to view this page </h3>
-</div>
+
+<div class="span12">
+  <h2> Access Denied </h2>
+  <p> You do not have permission to view this page. <br/> You might need to <a
href="#login"> login </a> to view this page/ </p>
+  
 </div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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 097e85c..f8c3dad 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -100,8 +100,8 @@ function(app, Backbone, WindowResize) {
 
       $('#primary-navbar li[data-nav-name="' + app.selectedHeader + '"]').addClass('active');
 
-      var menuOpen = true;
-      var $selectorList = $('body');
+      var menuOpen = true,
+          $selectorList = $('body');
       $('.brand').off();
       $('.brand').on({
         click: function(e){
@@ -130,27 +130,31 @@ function(app, Backbone, WindowResize) {
         }
       });
 
+      $('#primary-navbar').on('click', ".nav li.openMenu", function () {
+        $selectorList.removeClass('closeMenu');
+      });
+
      app.windowResize = new WindowResize({
           columnType: "double",
           selectorElements: '#dashboard-content, #dashboard-content .editcase'
       });
-      app.windowResize.initialize();
     },
 
     beforeRender: function () {
-      //this.addLinkViews();
+      this.addLinkViews();
     },
 
     addLinkViews: function () {
       var that = this;
 
-      _.each(this.navLinks, function (link) {
+      _.each(_.union(this.navLinks, this.bottomNavLinks), function (link) {
         if (!link.view) { return; }
 
         //TODO check if establish is a function
         var establish = link.establish || [];
         $.when.apply(null, establish).then( function () {
-          that.insertView('#nav-links', link.view).render();
+          var selector =  link.bottomNav ? '#bottom-nav-links' : '#nav-links';
+          that.insertView(selector, link.view).render();
         });
       }, this);
     }

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/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 2c4184c..b8ef4ba 100644
--- a/src/fauxton/app/templates/fauxton/nav_bar.html
+++ b/src/fauxton/app/templates/fauxton/nav_bar.html
@@ -16,14 +16,14 @@ the License.
 <nav id="main_navigation">
   <ul id="nav-links" class="nav pull-right">
     <% _.each(navLinks, function(link) { %>
-      <% if (!link.view) { %>
+    <% if (link.view) {return;}  %>
         <li data-nav-name= "<%= link.title %>" ><a class="<%= link.icon
%> fonticon" href="<%= link.href %>"><%= link.title %></a></li>
-      <% } %>
     <% }); %>
   </ul>
 
     <ul id="bottom-nav-links" class="nav">
     <% _.each(bottomNavLinks, function(link) { %>
+    <% if (link.view) {return;}  %>
       <li data-nav-name= "<%= link.title %>">
           <a class="<%= link.icon %> fonticon" href="<%= link.href %>">
               <%= link.title %>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/48350cb6/src/fauxton/app/windowResize.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/windowResize.js b/src/fauxton/app/windowResize.js
index 1a1efe4..99fa8ce 100644
--- a/src/fauxton/app/windowResize.js
+++ b/src/fauxton/app/windowResize.js
@@ -6,6 +6,7 @@ function() {
   var Resize = function(options){
     this.options = options;
     this.options.selectorElements = options.selectorElements || "#dashboard-content";
+    this.initialize();
   };
 
   Resize.prototype = {


Mime
View raw message