Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 88C8F17C4D for ; Tue, 30 Sep 2014 16:43:13 +0000 (UTC) Received: (qmail 16058 invoked by uid 500); 30 Sep 2014 16:43:13 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 16005 invoked by uid 500); 30 Sep 2014 16:43:13 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 15996 invoked by uid 99); 30 Sep 2014 16:43:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2014 16:43:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 24F47A0451F; Tue, 30 Sep 2014 16:43:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: garren@apache.org To: commits@couchdb.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to 2595b4b Date: Tue, 30 Sep 2014 16:43:13 +0000 (UTC) Repository: couchdb-fauxton Updated Branches: refs/heads/master c0af4a2ef -> 2595b4bd2 added ">" delimiter to breadcrumbs - includes @robertkowalski’s unit test - I snuck in a minor fix for the login page (HTML+typo fix) Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/2595b4bd Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/2595b4bd Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/2595b4bd Branch: refs/heads/master Commit: 2595b4bd2375418c8d1d98a15794a80ea2ec69fb Parents: c0af4a2 Author: Benjamin Keen Authored: Mon Sep 29 11:26:17 2014 -0700 Committer: Garren Smith Committed: Tue Sep 30 18:42:12 2014 +0200 ---------------------------------------------------------------------- app/addons/auth/templates/noAccess.html | 13 ++- app/addons/fauxton/components.js | 10 +- app/addons/fauxton/templates/breadcrumbs.html | 13 ++- app/addons/fauxton/tests/breadcrumbsViewSpec.js | 103 +++++++++++++++++++ assets/less/fauxton.less | 6 ++ 5 files changed, 133 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2595b4bd/app/addons/auth/templates/noAccess.html ---------------------------------------------------------------------- diff --git a/app/addons/auth/templates/noAccess.html b/app/addons/auth/templates/noAccess.html index ffa736e..ab2cf7f 100644 --- a/app/addons/auth/templates/noAccess.html +++ b/app/addons/auth/templates/noAccess.html @@ -12,11 +12,10 @@ License for the specific language governing permissions and limitations under the License. --> -
-

Access Denied

-

You do not have permission to view this page.
- You might need to login to view this page/ -

- -
+

Access Denied

+

+ You do not have permission to view this page.
+ You might need to login. +

+ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2595b4bd/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index 5d0ea90..8499299 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -78,8 +78,16 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { template: "addons/fauxton/templates/breadcrumbs", serialize: function() { var crumbs = _.clone(this.crumbs); + + // helper template function to determine when to insert a delimiter char + var nextCrumbHasLabel = function(crumb, index) { + var nextHasLabel = crumbs[index+1].name !== ""; + return index < crumbs.length && crumb.name && nextHasLabel; + }; + return { - crumbs: crumbs + crumbs: crumbs, + nextCrumbHasLabel: nextCrumbHasLabel }; }, update: function(crumbs) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2595b4bd/app/addons/fauxton/templates/breadcrumbs.html ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/templates/breadcrumbs.html b/app/addons/fauxton/templates/breadcrumbs.html index 729dbca..52a5f94 100644 --- a/app/addons/fauxton/templates/breadcrumbs.html +++ b/app/addons/fauxton/templates/breadcrumbs.html @@ -12,11 +12,16 @@ License for the specific language governing permissions and limitations under the License. --> -<% _.each(_.initial(crumbs), function(crumb) { %> +<% _.each(_.initial(crumbs), function(crumb, index) { %>
  • -<%- crumb.name %> + <%- crumb.name %>
  • + +<% if (nextCrumbHasLabel(crumb, index)) { %> +
  • +<% } %> + <% }); %> -<% var last = _.last(crumbs) || {name: ''} %> -
  • <%- last.name %>
  • +<% var last = _.last(crumbs) || {name: ''} %> +
  • <%- last.name %>
  • \ No newline at end of file http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2595b4bd/app/addons/fauxton/tests/breadcrumbsViewSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/tests/breadcrumbsViewSpec.js b/app/addons/fauxton/tests/breadcrumbsViewSpec.js new file mode 100644 index 0000000..4efde10 --- /dev/null +++ b/app/addons/fauxton/tests/breadcrumbsViewSpec.js @@ -0,0 +1,103 @@ +// 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', + 'addons/fauxton/components', + 'testUtils' +], function (app, Components, testUtils) { + var assert = testUtils.assert, + ViewSandbox = testUtils.ViewSandbox; + + describe('Breadcrumbs', function () { + + describe('3 Breadcrumbs', function () { + var breadcrumbs, viewSandbox; + + // async setup with done-callback + beforeEach(function (done) { + + // initialize a Breadcrumb-View with fake data + breadcrumbs = new Components.Breadcrumbs({ + crumbs: [ + { link: "/root", name: "root" }, + { link: "/first", name: "first" }, + { link: "/second", name: "second" } + ] + }); + + // render in a view-sandbox, which attaches it to the DOM + // for us, so we can test it + viewSandbox = new ViewSandbox(); + viewSandbox.renderView(breadcrumbs, done); + }); + + afterEach(function () { + // sync cleanup (done callback not provided)! + viewSandbox.remove(); + }); + + // sync test + it('should have 2 dividers between 3 breadcrumbs', function () { + assert.equal(2, breadcrumbs.$('.divider').length, $(breadcrumbs).html()); + }); + }); + + + describe('2 Breadcrumbs, one empty', function () { + var breadcrumbs, viewSandbox; + + beforeEach(function (done) { + breadcrumbs = new Components.Breadcrumbs({ + crumbs: [ + {link: "/root", name: "" }, + {link: "/root", name: "crumb 2" } + ] + }); + viewSandbox = new ViewSandbox(); + viewSandbox.renderView(breadcrumbs, done); + }); + + afterEach(function () { + viewSandbox.remove(); + }); + + it('should have 0 dividers for 2 breadcrumb when one is empty', function () { + assert.equal(0, breadcrumbs.$('.divider').length); + }); + }); + + + describe('1 Breadcrumb', function () { + var breadcrumbs, viewSandbox; + + beforeEach(function (done) { + breadcrumbs = new Components.Breadcrumbs({ + crumbs: [ + {link: "/root", name: "root"} + ] + }); + viewSandbox = new ViewSandbox(); + viewSandbox.renderView(breadcrumbs, done); + }); + + afterEach(function () { + viewSandbox.remove(); + }); + + it('should have 0 dividers for 1 breadcrumb', function () { + assert.equal(0, breadcrumbs.$('.divider').length); + }); + }); + + }); +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2595b4bd/assets/less/fauxton.less ---------------------------------------------------------------------- diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less index 255bd5f..dab0c63 100644 --- a/assets/less/fauxton.less +++ b/assets/less/fauxton.less @@ -1159,6 +1159,12 @@ div.add-dropdown { &.active{ color: #333; } + &.divider { + font-size: 14px; + color: #ccc; + padding: 20px 0px; + width: 10px; + } a{ text-decoration: none; color: @breadcrumbText;