couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to 2e64de7
Date Thu, 02 Apr 2015 12:02:51 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master a03be3c54 -> 2e64de7fe


alldocs: make text configurable

the current text says: `no index created yet`. For all-docs it
must be something like `no document created yet`

PR: #337
PR-URL: https://github.com/apache/couchdb-fauxton/pull/337
Reviewed-By: Benjamin Keen <ben.keen@gmail.com>


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

Branch: refs/heads/master
Commit: 2e64de7fe34a606623040ed422fceb154ab205c9
Parents: a03be3c
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Thu Mar 26 20:03:16 2015 +0100
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Thu Apr 2 14:03:20 2015 +0200

----------------------------------------------------------------------
 .../index-results.components.react.jsx          |  7 +++--
 app/addons/documents/index-results/stores.js    |  9 ++++++
 .../index-results.componentsSpec.react.jsx      | 32 +++++++++++++++++---
 app/addons/documents/routes-documents.js        |  3 +-
 4 files changed, 43 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e64de7f/app/addons/documents/index-results/index-results.components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/index-results.components.react.jsx b/app/addons/documents/index-results/index-results.components.react.jsx
index 0d0d8d1..49dd643 100644
--- a/app/addons/documents/index-results/index-results.components.react.jsx
+++ b/app/addons/documents/index-results/index-results.components.react.jsx
@@ -30,7 +30,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, Documents)
{
     render: function () {
       return (
         <div className="watermark-logo">
-          <h3>No Index Created Yet!</h3>
+          <h3>{this.props.text}</h3>
         </div>
       );
     }
@@ -116,7 +116,8 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, Documents)
{
         isListDeletable: store.isListDeletable(),
         isSelected: store.isSelected,
         isLoading: store.isLoading(),
-        isEditable: store.isEditable()
+        isEditable: store.isEditable(),
+        textEmptyIndex: store.getTextEmptyIndex()
       };
     },
 
@@ -145,7 +146,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, Documents)
{
     },
 
     render: function () {
-      var view = <NoResultScreen />;
+      var view = <NoResultScreen text={this.state.textEmptyIndex}/>;
 
       if (this.state.hasResults) {
         view = <ResultsScreen

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e64de7f/app/addons/documents/index-results/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/stores.js b/app/addons/documents/index-results/stores.js
index 52cf03e..464df12 100644
--- a/app/addons/documents/index-results/stores.js
+++ b/app/addons/documents/index-results/stores.js
@@ -32,6 +32,7 @@ function (FauxtonAPI, ActionTypes, HeaderActionTypes, Documents) {
       this.clearSelectedItems();
       this.clearCollapsedDocs();
       this._isLoading = false;
+      this._textEmptyIndex = 'No Index Created Yet!';
     },
 
     clearSelectedItems: function () {
@@ -47,6 +48,10 @@ function (FauxtonAPI, ActionTypes, HeaderActionTypes, Documents) {
       this._isListDeletable = options.isListDeletable;
       this.clearSelectedItems();
       this.clearCollapsedDocs();
+
+      if (options.textEmptyIndex) {
+        this._textEmptyIndex = options.textEmptyIndex;
+      }
     },
 
     isEditable: function (doc) {
@@ -167,6 +172,10 @@ function (FauxtonAPI, ActionTypes, HeaderActionTypes, Documents) {
       return this._collection.database;
     },
 
+    getTextEmptyIndex: function () {
+      return this._textEmptyIndex;
+    },
+
     createBulkDeleteFromSelected: function () {
       var items = _.map(_.keys(this._selectedItems), function (id) {
         var doc = this._collection.get(id);

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e64de7f/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
b/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
index 8d22f2c..22d9366 100644
--- a/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
+++ b/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
@@ -12,16 +12,17 @@
 define([
   'api',
   'addons/documents/index-results/index-results.components.react',
+  'addons/documents/index-results/actions',
   'testUtils',
   "react"
-], function (FauxtonAPI, Views, utils, React) {
+], function (FauxtonAPI, Views, IndexResultsActions, utils, React) {
   FauxtonAPI.router = new FauxtonAPI.Router([]);
 
   var assert = utils.assert;
   var TestUtils = React.addons.TestUtils;
 
   describe('Index Results', function () {
-    var container;
+    var container, el;
 
     beforeEach(function () {
       container = document.createElement('div');
@@ -32,6 +33,31 @@ define([
       React.unmountComponentAtNode(container);
     });
 
+    it('renders a default text', function () {
+      IndexResultsActions.newResultsList({
+        collection: [],
+        deleteable: true
+      });
+      IndexResultsActions.resultsListReset();
+
+      el = TestUtils.renderIntoDocument(<Views.List />, container);
+      var $el = $(el.getDOMNode());
+      assert.equal($el.text(), 'No Index Created Yet!');
+    });
+
+    it('you can change the default text', function () {
+      IndexResultsActions.newResultsList({
+        collection: [],
+        deleteable: true,
+        textEmptyIndex: 'No Document Created Yet!'
+      });
+      IndexResultsActions.resultsListReset();
+
+      el = TestUtils.renderIntoDocument(<Views.List />, container);
+      var $el = $(el.getDOMNode());
+      assert.equal($el.text(), 'No Document Created Yet!');
+    });
+
     describe('loading', function () {
 
       it('should show loading component', function () {
@@ -53,8 +79,6 @@ define([
 
         assert.ok($el.find('.loading-lines').length === 0);
       });
-
     });
-
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2e64de7f/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 2cf8907..39617e3 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -138,7 +138,8 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, Index, DocEditor,
Mang
 
         IndexResultsActions.newResultsList({
           collection: collection,
-          isListDeletable: true
+          isListDeletable: true,
+          textEmptyIndex: 'No Document Created Yet!'
         });
 
         this.database.allDocs.paging.pageSize = PaginationStores.indexPaginationStore.getPerPage();


Mime
View raw message