You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/09/09 11:54:07 UTC

[47/50] [abbrv] git commit: updated refs/heads/1867-feature-plugins to 8aad450

Fix order of action buttons in the editor


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

Branch: refs/heads/1867-feature-plugins
Commit: f44dd92bc6d4d3180524a3a7e877e6f7150551ba
Parents: 2cb5799
Author: suelockwood <de...@gmail.com>
Authored: Fri Sep 6 14:19:39 2013 -0400
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Mon Sep 9 11:16:46 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js      | 127 +++++++++----------
 src/fauxton/app/templates/documents/doc.html    |  15 ++-
 .../documents/doc_field_editor_tabs.html        |  15 +--
 src/fauxton/assets/less/database.less           |   9 ++
 4 files changed, 85 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f44dd92b/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 805116e..83e1e8f 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -298,71 +298,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
     },
 
     events: {
-      "click button.delete": "destroy",
-      "click button.duplicate": "duplicate",
-      "click button.upload": "upload"
-    },
-
-    destroy: function(event) {
-      if (this.model.isNewDoc()) {
-        FauxtonAPI.addNotification({
-          msg: 'This document has not been saved yet.',
-          type: 'warning'
-        });
-        return;
-      }
-
-      if (!window.confirm("Are you sure you want to delete this doc?")) {
-        return false;
-      }
-
-      var database = this.model.database;
-
-      this.model.destroy().then(function(resp) {
-        FauxtonAPI.addNotification({
-          msg: "Succesfully destroyed your doc"
-        });
-        FauxtonAPI.navigate(database.url("index"));
-      }, function(resp) {
-        FauxtonAPI.addNotification({
-          msg: "Failed to destroy your doc!",
-          type: "error"
-        });
-      });
-    },
-
-    beforeRender: function () {
-      this.uploadModal = this.setView('#upload-modal', new Views.UploadModal({model: this.model}));
-      this.uploadModal.render();
-
-      this.duplicateModal = this.setView('#duplicate-modal', new Views.DuplicateDocModal({model: this.model}));
-      this.duplicateModal.render();
-    },
-
-    upload: function (event) {
-      event.preventDefault();
-      if (this.model.isNewDoc()) {
-        FauxtonAPI.addNotification({
-          msg: 'Please save the document before uploading an attachment.',
-          type: 'warning'
-        });
-        return;
-      }
-      this.uploadModal.showModal();
-    },
-
-    duplicate: function(event) {
-      if (this.model.isNewDoc()) {
-        FauxtonAPI.addNotification({
-          msg: 'Please save the document before duplicating it.',
-          type: 'warning'
-        });
-        return;
-      }
-      event.preventDefault();
-      this.duplicateModal.showModal();
     },
-
     updateSelected: function (selected) {
       this.selected = selected;
       this.$('.active').removeClass('active');
@@ -590,13 +526,74 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
   Views.Doc = FauxtonAPI.View.extend({
     template: "templates/documents/doc",
     events: {
-      "click button.save-doc": "saveDoc"
+      "click button.save-doc": "saveDoc",
+      "click button.delete": "destroy",
+      "click button.duplicate": "duplicate",
+      "click button.upload": "upload"
     },
     disableLoader: true,
     initialize: function (options) {
       this.database = options.database;
     },
+    destroy: function(event) {
+      if (this.model.isNewDoc()) {
+        FauxtonAPI.addNotification({
+          msg: 'This document has not been saved yet.',
+          type: 'warning'
+        });
+        return;
+      }
+
+      if (!window.confirm("Are you sure you want to delete this doc?")) {
+        return false;
+      }
+
+      var database = this.model.database;
+
+      this.model.destroy().then(function(resp) {
+        FauxtonAPI.addNotification({
+          msg: "Succesfully destroyed your doc"
+        });
+        FauxtonAPI.navigate(database.url("index"));
+      }, function(resp) {
+        FauxtonAPI.addNotification({
+          msg: "Failed to destroy your doc!",
+          type: "error"
+        });
+      });
+    },
 
+    beforeRender: function () {
+      this.uploadModal = this.setView('#upload-modal', new Views.UploadModal({model: this.model}));
+      this.uploadModal.render();
+
+      this.duplicateModal = this.setView('#duplicate-modal', new Views.DuplicateDocModal({model: this.model}));
+      this.duplicateModal.render();
+    },
+
+    upload: function (event) {
+      event.preventDefault();
+      if (this.model.isNewDoc()) {
+        FauxtonAPI.addNotification({
+          msg: 'Please save the document before uploading an attachment.',
+          type: 'warning'
+        });
+        return;
+      }
+      this.uploadModal.showModal();
+    },
+
+    duplicate: function(event) {
+      if (this.model.isNewDoc()) {
+        FauxtonAPI.addNotification({
+          msg: 'Please save the document before duplicating it.',
+          type: 'warning'
+        });
+        return;
+      }
+      event.preventDefault();
+      this.duplicateModal.showModal();
+    },
     updateValues: function() {
       var notification;
       if (this.model.changedAttributes()) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f44dd92b/src/fauxton/app/templates/documents/doc.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/doc.html b/src/fauxton/app/templates/documents/doc.html
index d6577af..6d4c8e5 100644
--- a/src/fauxton/app/templates/documents/doc.html
+++ b/src/fauxton/app/templates/documents/doc.html
@@ -14,8 +14,9 @@ the License.
 
 <div id="doc">
   <div class="errors-container"></div>
+   
+<div class="btn-group" style="margin-bottom: 15px"> 
   <% if (attachments) { %>
-  <div class="btn-group pull-right" style="margin-bottom: 15px">
     <a class="btn dropdown-toggle btn" data-toggle="dropdown" href="#">
       View Attachments
       <span class="caret"></span>
@@ -29,8 +30,16 @@ the License.
       </li>
       <% }) %>
     </ul>
-  </div>
-  <% } %>
+
+  <% } %> 
+  <button class="btn btn-small upload"><i class="icon-circle-arrow-up"></i> Upload Attachment</button>
+  <button class="btn btn-small duplicate"><i class="icon-repeat"></i> Duplicate document</button>
+  <button class="btn btn-small delete"><i class="icon-trash"></i> Delete document</button>
+  </ul>
+
+<div id="upload-modal"> </div>
+<div id="duplicate-modal"> </div> 
+</div>
 
   <textarea class="doc-code"><%- JSON.stringify(doc.attributes, null, "  ") %></textarea>
   <br />

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f44dd92b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
index 29c6d8b..af34b71 100644
--- a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
+++ b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
@@ -14,17 +14,6 @@ the License.
 
 <ul class="nav nav-tabs">
   <!--<li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li>-->
-  <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"></i> Code editor</a></li>
-  <ul class="nav pull-right" style="margin:5px 10px 0px 10px;">
-    <li>
-      <div class="btn-group">
-        <button class="btn btn-small upload"><i class="icon-circle-arrow-up"></i> Upload Attachment</button>
-        <button class="btn btn-small duplicate"><i class="icon-repeat"></i> Duplicate document</button>
-        <button class="btn btn-small delete"><i class="icon-trash"></i> Delete document</button>
-      </div>
-    </li>
-  </ul>
+  <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"> </i> Code editor</a>
+  </li>
 </ul>
-
-<div id="upload-modal"> </div>
-<div id="duplicate-modal"> </div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f44dd92b/src/fauxton/assets/less/database.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/database.less b/src/fauxton/assets/less/database.less
index 3854bcd..e1862d9 100644
--- a/src/fauxton/assets/less/database.less
+++ b/src/fauxton/assets/less/database.less
@@ -191,3 +191,12 @@ table.active-tasks{
     } 
 }
 
+
+#doc {
+    .dropdown-menu{
+        width: auto;
+    }
+}
+#tabs {
+    height: 40px;
+}