couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [03/50] git commit: updated refs/heads/route-events to c33e390
Date Thu, 09 May 2013 14:01:00 GMT
rename to auth module


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

Branch: refs/heads/route-events
Commit: ce2f879c99290ac6336447fa5b9881f1f137a64a
Parents: df184fc
Author: Garren Smith <garren.smith@gmail.com>
Authored: Tue Apr 2 10:27:07 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Tue Apr 2 10:27:07 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/user/base.js            |   26 -----
 src/fauxton/app/addons/user/resources.js       |  111 -------------------
 src/fauxton/app/addons/user/routes.js          |   30 -----
 src/fauxton/app/modules/fauxton/base.js        |   11 ++
 src/fauxton/app/templates/fauxton/nav_bar.html |    4 +-
 src/fauxton/settings.json.default              |    2 +-
 6 files changed, 15 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ce2f879c/src/fauxton/app/addons/user/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/user/base.js b/src/fauxton/app/addons/user/base.js
deleted file mode 100644
index d1c9334..0000000
--- a/src/fauxton/app/addons/user/base.js
+++ /dev/null
@@ -1,26 +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.
-
-define([
-       "app",
-       "api",
-       "addons/user/routes"
-],
-
-function(app, FauxtonAPI, User) {
-
-  User.initialize = function() {
-    FauxtonAPI.addHeaderLink({title: "User", href: "#_user"});
-  };
-
-  return User;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ce2f879c/src/fauxton/app/addons/user/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/user/resources.js b/src/fauxton/app/addons/user/resources.js
deleted file mode 100644
index f6bd180..0000000
--- a/src/fauxton/app/addons/user/resources.js
+++ /dev/null
@@ -1,111 +0,0 @@
-define([
-       "app",
-       "api",
-       "addons/config/resources"
-],
-
-function (app, FauxtonAPI, Config) {
-  var User = new FauxtonAPI.addon();
-
-  User.Session = Backbone.Model.extend({
-    url: '/_session',
-
-    is_admin_party: function () {
-      var userCtx = this.get('userCtx');
-      if (!userCtx.name && userCtx.roles.indexOf("_admin") !== -1) {
-        return true;
-      }
-
-      return false;
-    },
-
-    create_admin: function (username, password) {
-      if (_.isEmpty(username) || _.isEmpty(password)) {
-        var deferred = $.Deferred();
-        
-        deferred.reject('Username or password cannot be blank.');
-        return deferred;
-      }
-
-      var admin = new Config.OptionModel({
-        section: "admins",
-        name: username,
-        value: password
-      });
-      return admin.save();
-    }
-  });
-
-  User.CreateAdminModal = FauxtonAPI.View.extend({
-    template: 'addons/user/templates/create_admin_modal',
-
-    events: {
-      "click #create-admin": "create_admin"
-    },
-
-    create_admin: function (event) {
-      event.preventDefault();
-      var self = this,
-          username = this.$('#username').val(),
-          password = this.$('#password').val();
-
-      var promise = this.model.create_admin(username, password);
-
-      promise.done(function () {
-        self.$('.modal').modal('hide');
-        self.trigger('admin_created');
-      });
-
-      promise.fail(function (msg) {
-        self.$('#modal-error').text(msg).removeClass('hide');
-      });
-    },
-
-    show_modal: function () {
-      this.$('.modal').modal();
-    }
-  });
-
-  User.Info = FauxtonAPI.View.extend({
-    template: 'addons/user/templates/info',
-
-    initialize:function (options) {
-      this.model.on('change', this.update_session, this);
-    },
-
-    serialize: function () {
-      return {
-        admin_party: this.model.is_admin_party()
-      };
-    },
-
-    events: {
-      "click #user-create-admin": 'show_admin_modal'
-    },
-
-    beforeRender: function () {
-      this.create_admin_modal = this.setView('#user-create-admin-modal', new  User.CreateAdminModal({model:
this.model}));
-      this.create_admin_modal.on('admin_created', this.render);
-    },
-
-    afterRender: function () {
-      if (this.model.is_admin_party()) {
-        console.log('admin party');
-        return;
-      } else {
-        console.log('not admin');
-      }
-    },
-
-    show_admin_modal: function (event) {
-      event.preventDefault();
-      this.create_admin_modal.show_modal();
-    },
-
-    update_session: function () {
-      console.log(this.model);
-    }
-  });
-
-  return User;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ce2f879c/src/fauxton/app/addons/user/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/user/routes.js b/src/fauxton/app/addons/user/routes.js
deleted file mode 100644
index 9108072..0000000
--- a/src/fauxton/app/addons/user/routes.js
+++ /dev/null
@@ -1,30 +0,0 @@
-define([
-       "app",
-       "api",
-       "addons/user/resources"
-],
-
-function(app, FauxtonAPI, User) {
-
-  var userRoutes = function () {
-
-    var session = new User.Session();
-    return {
-      layout: 'one_pane',
-      crumbs: [{"name": "User","link": "_user"}],
-      views: {
-        "#dashboard-content": new User.Info({model: session})
-      },
-      establish: function () {
-        return [session.fetch()];
-      },
-      apiUrl: 'boom'
-    };
-  };
-
-  User.Routes = {
-    "_user": userRoutes
-  };
-
-  return User;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ce2f879c/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 a8bf430..e01c344 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -58,7 +58,18 @@ function(app, Backbone) {
         this.navLinks.push(link);
       }
       this.trigger("link:add");
+
       this.render();
+    },
+
+    afterRender: function () {
+      _.each(this.navLinks, function (link) {
+        if (link.view) {
+          this.insertView('#nav-links', link.view).render();
+        }
+
+      }, this);
+
     }
 
     // TODO: ADD ACTIVE CLASS

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ce2f879c/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 c9800bf..5282e68 100644
--- a/src/fauxton/app/templates/fauxton/nav_bar.html
+++ b/src/fauxton/app/templates/fauxton/nav_bar.html
@@ -22,9 +22,11 @@ the License.
       </a>
       <a class="brand" href="#">Project Fauxton</a>
       <div class="nav-collapse">
-        <ul class="nav pull-right">
+        <ul id="nav-links" class="nav pull-right">
           <% _.each(navLinks, function(link) { %>
+          <% if (!link.view) { %>
             <li><a href="<%= link.href %>"><%= link.title %></a></li>
+            <% } %>
           <% }); %>
           <!-- TODO: pick this up from code - nested dicts in the above -->
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ce2f879c/src/fauxton/settings.json.default
----------------------------------------------------------------------
diff --git a/src/fauxton/settings.json.default b/src/fauxton/settings.json.default
index ef986ba..9716ceb 100644
--- a/src/fauxton/settings.json.default
+++ b/src/fauxton/settings.json.default
@@ -4,7 +4,7 @@
   { "name": "logs" },
   { "name": "stats" },
   { "name": "contribute" },
-  { "name": "user" }
+  { "name": "auth" }
   ],
     "template": {
       "src": "assets/index.underscore",


Mime
View raw message