Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 00c737a50 -> f183176e3


Add support for extensions on doc list

This PR allows extensions to add buttons to the list of
documents in the React DocList. This functionality used to be
there but was removed with the recent React code refactor.


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

Branch: refs/heads/master
Commit: f183176e35c785d26e0e48acb5f2e90e717d665c
Parents: 00c737a
Author: Ben Keen <ben.k...@gmail.com>
Authored: Tue Mar 31 12:46:24 2015 -0700
Committer: Ben Keen <ben.k...@gmail.com>
Committed: Wed Apr 1 08:49:20 2015 -0700

----------------------------------------------------------------------
 app/addons/components/react-components.react.jsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f183176e/app/addons/components/react-components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/react-components.react.jsx 
b/app/addons/components/react-components.react.jsx
index 26d27cd..5209f0f 100644
--- a/app/addons/components/react-components.react.jsx
+++ b/app/addons/components/react-components.react.jsx
@@ -211,12 +211,19 @@ function (app, FauxtonAPI, React, Components, 
beautifyHelper) {
       }
 
       return (
-        <div className="doc-edit-symbol pull-right">
+        <div className="doc-edit-symbol pull-right" title="Edit document">
           {this.props.children}
         </div>
       );
     },
 
+    getExtensionIcons: function () {
+      var extensions = FauxtonAPI.getExtensions('DocList:icons');
+      return _.map(extensions, function (Extension, i) {
+        return (<Extension doc={this.props.doc} key={i} />);
+      }, this);
+    },
+
     getCheckbox: function () {
 
       if (!this.props.isDeletable) {
@@ -257,6 +264,7 @@ function (app, FauxtonAPI, React, Components, 
beautifyHelper) {
                 "{this.props.docIdentifier}"
               </span>
               {this.getUrlFragment()}
+              <div className="doc-item-extension-icons 
pull-right">{this.getExtensionIcons()}</div>
             </header>
             <div className="doc-data">
               <pre className="prettyprint">{this.props.docContent}</pre>

Reply via email to