couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/3] couchdb commit: updated refs/heads/1.x.x to 7046724
Date Fri, 31 Oct 2014 02:32:57 GMT
Repository: couchdb
Updated Branches:
  refs/heads/1.x.x c3c9588ca -> 704672457


Futon: support document copying

Based on Patrick Antivackis work. Thanks!

COUCHDB-241


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

Branch: refs/heads/1.x.x
Commit: 704672457bd52e6ce1e01b4c49daa5e36b466582
Parents: ad2262a
Author: Alexander Shorin <kxepal@apache.org>
Authored: Thu Oct 30 18:02:31 2014 +0300
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Fri Oct 31 05:31:39 2014 +0300

----------------------------------------------------------------------
 share/Makefile.am                    |   2 ++
 share/www/dialog/_copy_document.html |  29 ++++++++++++++++++++++++++++
 share/www/document.html              |   2 ++
 share/www/image/copy.png             | Bin 0 -> 780 bytes
 share/www/script/futon.browse.js     |  31 ++++++++++++++++++++++++++++++
 share/www/style/layout.css           |   3 +++
 6 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/70467245/share/Makefile.am
----------------------------------------------------------------------
diff --git a/share/Makefile.am b/share/Makefile.am
index 4972339..1598dff 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -59,6 +59,7 @@ nobase_dist_localdata_DATA = \
     www/dialog/_admin_party.html \
     www/dialog/_change_password.html \
     www/dialog/_compact_cleanup.html \
+    www/dialog/_copy_document.html \
     www/dialog/_create_admin.html \
     www/dialog/_login.html \
     www/dialog/_signup.html \
@@ -101,6 +102,7 @@ nobase_dist_localdata_DATA = \
     www/image/bg.png \
     www/image/cancel.gif \
     www/image/compact.png \
+    www/image/copy.png \
     www/image/delete-mini.png \
     www/image/delete.png \
     www/image/grippie.gif \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/70467245/share/www/dialog/_copy_document.html
----------------------------------------------------------------------
diff --git a/share/www/dialog/_copy_document.html b/share/www/dialog/_copy_document.html
new file mode 100644
index 0000000..fe49e81
--- /dev/null
+++ b/share/www/dialog/_copy_document.html
@@ -0,0 +1,29 @@
+<!--
+
+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.
+
+-->
+<form action="" method="post">
+  <h2>Copy Document</h2>
+  <fieldset>
+    <p class="help help-copy">
+      Please enter a unique ID of the document:
+    </p>
+    <table summary="" class="help-copy"><tbody><tr>
+      <td><input type="text" name="docid" size="32"></td>
+    </tr></table>
+  </fieldset>
+  <div class="buttons">
+    <button type="submit">Copy</button>
+    <button type="button" class="cancel">Cancel</button>
+  </div>
+</form>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/70467245/share/www/document.html
----------------------------------------------------------------------
diff --git a/share/www/document.html b/share/www/document.html
index e041cd9..1509475 100644
--- a/share/www/document.html
+++ b/share/www/document.html
@@ -55,6 +55,7 @@ specific language governing permissions and limitations under the License.
         $("#toolbar button.save").click(page.saveDocument);
         $("#toolbar button.add").click(page.addField);
         $("#toolbar button.load").click(page.uploadAttachment);
+        $("#toolbar button.copy").click(page.copyDocument);
         if (page.isNew) {
           $("#toolbar button.delete").hide();
         } else {
@@ -76,6 +77,7 @@ specific language governing permissions and limitations under the License.
         <li><button class="save">Save Document</button></li>
         <li><button class="add">Add Field</button></li>
         <li><button class="load">Upload Attachment…</button></li>
+        <li><button class="copy">Copy Document…</button></li>
         <li><button class="delete">Delete Document…</button></li>
       </ul>
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/70467245/share/www/image/copy.png
----------------------------------------------------------------------
diff --git a/share/www/image/copy.png b/share/www/image/copy.png
new file mode 100644
index 0000000..07b4f79
Binary files /dev/null and b/share/www/image/copy.png differ

http://git-wip-us.apache.org/repos/asf/couchdb/blob/70467245/share/www/script/futon.browse.js
----------------------------------------------------------------------
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index 241164c..75b1624 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -1094,6 +1094,37 @@
         });
       }
 
+      this.copyDocument = function() {
+        if (page.isDirty) {
+          alert("You need to save or revert any changes you have made to the " +
+                "document before you can copy it.");
+            return false;
+        }
+        $.showDialog("dialog/_copy_document.html", {
+          submit: function (data, callback) {
+            if (!data.docid || data.docid.length == 0) {
+              callback({docid: "Please enter a document ID."});
+              return;
+            }
+            db.copyDoc(
+              page.doc._id,
+              {
+                docid: data.docid
+              },
+              {
+                error: function (status, error, reason) {
+                  callback({docid: reason});
+              },
+                success: function (resp) {
+                  location.href = "document.html?"
+                                + encodeURIComponent(dbName)
+                                + "/" + $.couch.encodeDocId(resp.id);
+              }
+            });
+          }
+        });
+      };
+
       window.onbeforeunload = function() {
         if (page.isDirty) {
           return "You've made changes to this document that have not been " +

http://git-wip-us.apache.org/repos/asf/couchdb/blob/70467245/share/www/style/layout.css
----------------------------------------------------------------------
diff --git a/share/www/style/layout.css b/share/www/style/layout.css
index 54a183a..055e791 100644
--- a/share/www/style/layout.css
+++ b/share/www/style/layout.css
@@ -246,6 +246,7 @@ body.fullwidth #wrap { margin-right: 0; }
 #toolbar button.run { background-image: url(../image/run.png); }
 #toolbar button.save { background-image: url(../image/save.png); }
 #toolbar button.share { background-image: url(../image/compact.png); }
+#toolbar button.copy { background-image: url(../image/copy.png); }
 
 /* Dialogs */
 
@@ -282,7 +283,9 @@ body.loading #dialog h2 {
   -webkit-border-bottom-right-radius: 7px;
 }
 #dialog p.help { color: #bbb; font-size: 95%; margin: 0 0 1em; }
+#dialog p.help-copy { margin-top: 1em; margin-bottom: 0; padding-left: 0.6em; }
 #dialog fieldset table { margin-top: 1em; }
+#dialog fieldset table.help-copy { margin-top: 0; }
 #dialog fieldset th, #dialog fieldset td { padding: .5em;
   vertical-align: top;
 }


Mime
View raw message