You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2014/05/21 15:10:52 UTC
[4/4] couchdb commit: updated refs/heads/Update-Sidebar-Ui to 1cccd0b
Create components and css fixes
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/1cccd0b4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/1cccd0b4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/1cccd0b4
Branch: refs/heads/Update-Sidebar-Ui
Commit: 1cccd0b40dbdc1ce1941c9b72e7121ec2ec737f9
Parents: a4f9085
Author: Garren Smith <ga...@gmail.com>
Authored: Wed May 21 15:10:16 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed May 21 15:10:16 2014 +0200
----------------------------------------------------------------------
.../addons/documents/assets/less/documents.less | 24 --------------
.../app/addons/documents/sidebarviews.js | 35 +++++++++++++++-----
.../documents/templates/design_doc_menu.html | 2 +-
.../documents/templates/index_menu_item.html | 5 ++-
.../app/addons/documents/templates/sidebar.html | 10 ++++--
src/fauxton/app/addons/fauxton/components.js | 10 ++++++
src/fauxton/assets/less/fauxton.less | 29 +++++++++++++++-
7 files changed, 77 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/app/addons/documents/assets/less/documents.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/assets/less/documents.less b/src/fauxton/app/addons/documents/assets/less/documents.less
index 0df0601..4e87dd6 100644
--- a/src/fauxton/app/addons/documents/assets/less/documents.less
+++ b/src/fauxton/app/addons/documents/assets/less/documents.less
@@ -195,30 +195,6 @@ button.beautify {
-webkit-transform:rotate(90deg); /* Opera, Chrome, and Safari */
}
}
- div.new-button {
- position: absolute;
- top: 2px;
- right: 15px;
- .dropdown-menu{
- left: -82px;
- padding-bottom: 0;
- width: auto;
- min-width: 0;
- li a {
- padding: 10px 15px 10px 12px;
- }
- }
- .dropdown-toggle{
- text-decoration: none;
- }
- > a {
- border-bottom: none;
- text-decoration: none;
- font-size: 16px;
-
- }
- }
}
}
-
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/app/addons/documents/sidebarviews.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/sidebarviews.js b/src/fauxton/app/addons/documents/sidebarviews.js
index f732fc2..88233f6 100644
--- a/src/fauxton/app/addons/documents/sidebarviews.js
+++ b/src/fauxton/app/addons/documents/sidebarviews.js
@@ -67,6 +67,30 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
new Views.DeleteDBModal({database: this.database})
);
+ var database = this.collection.database,
+ newurl = "#" + database.url('app') + '/new';
+
+ var newLinks = [{
+ title: 'Add new',
+ links: [{
+ title: 'New Doc',
+ url: newurl,
+ icon: 'fonticon-circle-plus'
+ },{
+ title: 'New Design Doc',
+ url: newurl,
+ icon: 'fonticon-circle-plus'
+ }]
+ }];
+
+ this.insertView("#new-all-docs-button", new Components.MenuDropDown({
+ links: newLinks,
+ }));
+
+ this.insertView("#new-design-docs-button", new Components.MenuDropDown({
+ links: newLinks,
+ }));
+
this.collection.each(function(design) {
if (design.has('doc')){
this.insertView(new Views.DdocSidenav({
@@ -120,6 +144,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
},
buildIndexList: function(collection, selector, ddocType){
var design = this.model.id.replace(/^_design\//,"");
+
_.each(_.keys(collection[selector]), function(key){
this.insertView(".accordion-body", new Views.IndexItem({
selector: selector,
@@ -186,11 +211,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
this.insertView(".new-button", new Components.MenuDropDown({
links: sideBarMenuLinks,
- database: this.collection.database,
- ddocSafeName: app.utils.safeURLName(ddocName),
- fullMenu: false
}));
-
}
});
@@ -209,15 +230,11 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
serialize: function() {
return {
+ icon: this.ddocType,
type: this.ddocType,
index: this.index,
ddoc: this.ddoc,
database: this.database,
- // index_clean: app.utils.removeSpecialCharacters(this.index),
- // ddoc_clean: app.utils.removeSpecialCharacters(this.ddoc),
- // index_encoded: app.utils.safeURLName(this.index),
- // ddoc_encoded: app.utils.safeURLName(this.ddoc),
- // database_encoded: app.utils.safeURLName(this.database),
selected: this.selected
};
},
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/app/addons/documents/templates/design_doc_menu.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/design_doc_menu.html b/src/fauxton/app/addons/documents/templates/design_doc_menu.html
index 3724d01..63d6016 100644
--- a/src/fauxton/app/addons/documents/templates/design_doc_menu.html
+++ b/src/fauxton/app/addons/documents/templates/design_doc_menu.html
@@ -12,10 +12,10 @@ License for the specific language governing permissions and limitations under
the License.
-->
<li class="nav-header">
+ <div class="new-button add-dropdown"></div>
<span class="fonticon-play js-collapse-toggle" data-toggle="collapse" data-target="#<%= ddoc_clean %>">
<%= designDoc%>
</span>
- <div class="new-button"></div>
<ul class="accordion-body collapse" id="<%= ddoc_clean %>">
<li>
<a id="<%= ddoc_clean %>_metadata" href="#/database/<%- database_encoded %>/_design/<%- ddoc_encoded %>/metadata" class="toggle-view">
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/app/addons/documents/templates/index_menu_item.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/index_menu_item.html b/src/fauxton/app/addons/documents/templates/index_menu_item.html
index 747dc4f..04995f3 100644
--- a/src/fauxton/app/addons/documents/templates/index_menu_item.html
+++ b/src/fauxton/app/addons/documents/templates/index_menu_item.html
@@ -13,5 +13,8 @@ the License.
-->
<a id="<%- removeSpecialCharacters(ddoc) %>_<%- removeSpecialCharacters(index) %>" href="#/database/<%- safeURL(database) %>/_design/<%= safeURL(ddoc)%>/_<%=type%>/<%= safeURL(index) %>" class="toggle-view">
- <%= index %>
+ <% if (icon) { %>
+ <i class="fonticon-<%- icon %>"></i>
+ <% } %>
+ <%- index %>
</a>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/app/addons/documents/templates/sidebar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/sidebar.html b/src/fauxton/app/addons/documents/templates/sidebar.html
index 8961606..b90a7b6 100644
--- a/src/fauxton/app/addons/documents/templates/sidebar.html
+++ b/src/fauxton/app/addons/documents/templates/sidebar.html
@@ -18,8 +18,14 @@ the License.
<% _.each(docLinks, function (link) { %>
<li><a href="<%= database_url + '/' + link.url %>"><%= link.title %></a></li>
<% }); %>
- <li class="active"><a id="all-docs" href="#<%= database.url('index') %>" class="toggle-view"> All Documents</a></li>
- <li><a id="design-docs" href='#<%= database.url("index") %>?startkey="_design"&endkey="_e"' class="toggle-view"> All Design Docs</a></li>
+ <li class="active">
+ <div id="new-all-docs-button" class="add-dropdown"> </div>
+ <a id="all-docs" href="#<%= database.url('index') %>" class="toggle-view"> All Documents</a>
+ </li>
+ <li>
+ <div id="new-design-docs-button" class="add-dropdown"> </div>
+ <a id="design-docs" href='#<%= database.url("index") %>?startkey="_design"&endkey="_e"' class="toggle-view"> All Design Docs</a>
+ </li>
</ul>
<div id="delete-db-modal"> </div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js
index ff9608c..c3c0e4f 100644
--- a/src/fauxton/app/addons/fauxton/components.js
+++ b/src/fauxton/app/addons/fauxton/components.js
@@ -529,6 +529,16 @@ function(app, FauxtonAPI, ace, spin) {
});
+
+ //Menu Drop down component. It takes links in this format and renders the Dropdown:
+ // [{
+ // title: 'Section Title (optional)',
+ // links: [{
+ // icon: 'icon-class (optional)',
+ // url: 'clickalble-url',
+ // title: 'name of link'
+ // }]
+ // }]
Components.MenuDropDown = FauxtonAPI.View.extend({
template: "addons/fauxton/templates/menu_dropdown",
className: "dropdown",
http://git-wip-us.apache.org/repos/asf/couchdb/blob/1cccd0b4/src/fauxton/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less
index ce222b0..bc10479 100644
--- a/src/fauxton/assets/less/fauxton.less
+++ b/src/fauxton/assets/less/fauxton.less
@@ -700,7 +700,7 @@ table.databases {
color: #fff;
}
- li.active a {
+ li.active > a {
color: @darkRed;
}
> li > a{
@@ -728,6 +728,10 @@ table.databases {
text-shadow: none;
color: #333333;
margin-bottom: -4px;
+
+ & > span:hover {
+ color: @red;
+ }
}
}
}
@@ -931,3 +935,26 @@ div.spinner {
list-style-type: none;
}
}
+
+div.add-dropdown {
+
+ position: absolute;
+ right: 15px;
+ .dropdown-menu{
+ left: -82px;
+ padding-bottom: 0;
+ width: auto;
+ min-width: 0;
+ li a {
+ padding: 10px 15px 10px 12px;
+ }
+ }
+ .dropdown-toggle{
+ text-decoration: none;
+ }
+ > a {
+ border-bottom: none;
+ text-decoration: none;
+ font-size: 16px;
+ }
+}