couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [04/14] git commit: updated refs/heads/index-pagination to db85b98
Date Tue, 10 Sep 2013 14:03:50 GMT
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/0bc81f93
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0bc81f93
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0bc81f93

Branch: refs/heads/index-pagination
Commit: 0bc81f93430153b678d4484371263de8b504b0a6
Parents: 8c8e5a4
Author: suelockwood <deathbearbrown@gmail.com>
Authored: Fri Sep 6 14:19:39 2013 -0400
Committer: suelockwood <deathbearbrown@gmail.com>
Committed: Fri Sep 6 14:19:39 2013 -0400

----------------------------------------------------------------------
 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/0bc81f93/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/0bc81f93/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/0bc81f93/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/0bc81f93/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;
+}


Mime
View raw message