Skip to content

Commit

Permalink
[ckan#1788][l]: Rewrote minornavigation using bootstrap. Simpler. Onl…
Browse files Browse the repository at this point in the history
…y works on Groups currently. IE7 compatible.
teajaymars committed Mar 27, 2012

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent cbb9c28 commit 223a5e5
Showing 5 changed files with 51 additions and 108 deletions.
107 changes: 29 additions & 78 deletions ckan/public/css/style.css
Original file line number Diff line number Diff line change
@@ -232,8 +232,8 @@ img.gravatar {
}

.inline-icon {
margin-bottom: -4px;
padding-right: 5px;
vertical-align: top;
}

.drag-drop-list {
@@ -280,19 +280,40 @@ ul.no-break li {
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
padding: 2px 4px;
font-weight: bold;
}
#minornavigation ul {
list-style: none;
padding: 4px;
#minornavigation .nav {
margin: 0;
}
#minornavigation li a {
border: 1px solid transparent;
border-bottom: none;
border-right: none;
height: 14px;
margin-right: 5px;
padding-top: 7px;
}
#minornavigation li.active a {
background: #fff;
border-color: #666;
color: #000;
}
#minornavigation li a:hover {
border-color: #bbb;

}
#minornavigation .divider {
padding: 8px 10px;
font-size: 14px;
color: #888;
}
/*
#minornavigation li {
display: inline-block;
/* IE6-IE7 fix to get something like inline-block, which is not supported
on those browser. Ref:
http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/ */
zoom: 1;
*display: inline;
margin-right: 3px;
padding: 5px 11px 5px 9px;
@@ -320,81 +341,11 @@ ul.no-break li {
#minornavigation li.current-tab a:visited {
color: #222;
}
#minornavigation .divider {
font-size: 14px;
color: #888;
}
#minornavigation li.disabled {
font-weight: bold;
color: #777;
}

/* ======================================== */
/* MinorNavigation extension: Dropdown Menu */
/* ======================================== */
.dropdown-appears hr {
margin: 5px 0;
}
#minornavigation .dropdown {
position: relative;
display: inline-block;
}
#minornavigation .dropdown .dropdown-appears {
display: none;
z-index: 2;
position: absolute;
top: 24px;
left: -1px;
width: 100%;
}
#minornavigation .dropdown:hover {
background: #fff;
border-color: #ddd;
}
#minornavigation .dropdown:hover .dropdown-appears {
display: block;
}
#minornavigation .dropdown-items {
margin-top: 9px;
width: 250px;
background: #fff;
border: 1px solid #ddd;
border-top: none;
padding: 2px 0 6px 0;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
box-shadow: 1px 1px 3px #aaa;
}
#minornavigation .dropdown-items a {
display: block;
padding: 5px 12px;
margin: 2px 0;
}
#minornavigation .dropdown-items a:hover {
background: #f0f0f0;
}
/* White box is a hack to connect the LI to the DIV beneath it, covering up
* that bottom bit of the mainnavigation bar. */
#minornavigation .dropdown .white-box {
border-left: 1px solid #ddd;
background: #fff;
margin-right: -1px;
height: 9px;
position: absolute:
top: 0;
left: 0;
}
/* Rules are different on current tab */
#minornavigation .dropdown.current-tab:hover,
#minornavigation .dropdown.current-tab .dropdown-items,
#minornavigation .dropdown.current-tab .white-box {
border-color: #777;
}
#minornavigation .dropdown.current-tab .dropdown-items a,
#minornavigation .dropdown.current-tab .dropdown-items a:visited {
color: #bb2222;
}

*/


/* ======= */
2 changes: 1 addition & 1 deletion ckan/templates/group/history.html
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ <h3 py:if="c.error" class="form-errors">
</table>
<input type="submit" name="diff" value="${_('Compare &raquo;')}" class="btn primary" />
</form>
</div> <!-- content -->
</div>

<py:def function="optional_feed">
<link rel="alternate" type="application/atom+xml" title="Group History"
46 changes: 19 additions & 27 deletions ckan/templates/group/layout.html
Original file line number Diff line number Diff line change
@@ -7,42 +7,34 @@
>

<py:match path="minornavigation">
<ul py:if="c.group" class="tabbed">
<li py:attrs="{'class':'current-tab'} if c.action=='read' else {}">${h.subnav_named_route(c, h.icon('group') + _('View'), c.group.type + '_read',controller='group', action='read', id=c.group.name)}</li>
<li py:attrs="{'class':'current-tab'} if c.action=='history' else {}">${h.subnav_named_route(c, h.icon('page_white_stack') + _('History'), c.group.type + '_action', controller='group', action='history', id=c.group.name)}</li>
<span class="divider" py:if="h.check_access('group_update',{'id':c.group.id})">&nbsp;&nbsp;|&nbsp;&nbsp;</span>
<li class="dropdown" py:attrs="{'class':'current-tab dropdown'} if c.action=='resource_read' else {'class':'dropdown'}" py:if="h.check_access('group_update',{'id':c.group.id})">
<div class="dropdown-appears">
<div class="dropdown-items">
<a href="${h.url_for(controller='package', action='new')}?groups__0__id=${c.group.id}">New Dataset...</a>
<a href="${h.url_for(controller='group', action='edit', id=c.group.name)}#datasets">Existing Dataset...</a>
</div>
</div>
<div class="dropdown-appears"><div class="white-box"></div></div>
<a href="${h.url_for(controller='package', action='new')}?groups__0__id=${c.group.id}">
${h.icon('add') + _('Add Dataset')}</a>
&nbsp;&nbsp;<img class="dropdown-arrow" src="/images/icons/arrow-open.gif"/>
<ul py:if="c.group" class="nav nav-pills">
<li class="${'active' if c.action=='read' else ''}">${h.subnav_named_route(c, h.icon('group') + _('View'), c.group.type + '_read',controller='group', action='read', id=c.group.name)}</li>
<li class="${'active' if c.action=='history' else ''}">${h.subnav_named_route(c, h.icon('page_white_stack') + _('History'), c.group.type + '_action', controller='group', action='history', id=c.group.name)}</li>
<li class="divider" py:if="h.check_access('group_update',{'id':c.group.id})">|</li>
<li class="dropdown ${'active' if c.action=='resource_read' else ''}" py:if="h.check_access('group_update',{'id':c.group.id})">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">${h.icon('add') + _('Add Dataset')} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="${h.url_for(controller='package', action='new')}?groups__0__id=${c.group.id}">New Dataset...</a></li>
<li><a href="${h.url_for(controller='group', action='edit', id=c.group.name)}#datasets">Existing Dataset...</a></li>
</ul>
</li>
<li py:attrs="{'class':'current-tab'} if c.action=='edit' else {}" py:if="h.check_access('group_update',{'id':c.group.id})">
<li class="${'active' if c.action=='edit' else ''}" py:if="h.check_access('group_update',{'id':c.group.id})">
<!-- TODO: We need to be able to change the URL below based on the type of the group -->
${h.subnav_named_route( c,h.icon('group_edit') + _('Edit'), c.group.type + '_action', action='edit', id=c.group.name )}
</li>
<li py:attrs="{'class':'current-tab'} if c.action=='authz' else {}" py:if="h.check_access('group_edit_permissions',{'id':c.group.id})">
<li class="${'active' if c.action=='authz' else ''}" py:if="h.check_access('group_edit_permissions',{'id':c.group.id})">
${h.subnav_named_route(c, h.icon('lock') + _('Authorization'), c.group.type + '_action', controller='group', action='authz', id=c.group.name)}
</li>

<!-- li class="action">
${h.subnav_link(c, h.icon('atom_feed') + _('Subscribe'),
controller='group', action='history', id=c.group.name, format='atom', days=7)}
</li-->
</ul>
<ul py:if="not c.group" class="tabbed">
<li py:attrs="{'class':'current-tab'} if c.action=='index' else {}">
<ul py:if="not c.group" class="nav nav-pills">
<li class="${'active' if c.action=='index' else ''}">
${h.subnav_named_route(c, h.icon('group') + _('List Groups'), "%s_index" % h.default_group_type(), action="index" )}
</li>
<li py:attrs="{'class':'current-tab'} if c.action=='new' else {}">
<span class="ckan-logged-in" style="display: none;">${ h.subnav_named_route(c, h.icon('group_add') + _('Add a Group'), "%s_new" % h.default_group_type(), action='new')}</span>
<span class="ckan-logged-out">${h.subnav_link(c, h.icon('group_add') + _('Login to Add a Group'), controller='group', action='new')}</span>
<li style="display:none;" class="ckan-logged-in ${'active' if c.action=='new' else ''}">
${ h.subnav_named_route(c, h.icon('group_add') + _('Add a Group'), "%s_new" % h.default_group_type(), action='new')}
</li>
<li class="ckan-logged-out ${'active' if c.action=='new' else ''}">
${h.subnav_link(c, h.icon('group_add') + _('Login to Add a Group'), controller='group', action='new')}
</li>
</ul>
</py:match>
2 changes: 1 addition & 1 deletion ckan/templates/package/layout.html
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
</py:choose>
<li py:attrs="{'class':'current-tab'} if c.action=='history' else {}">${h.subnav_link(c, h.icon('page_stack') + _('History'), controller='package', action='history', id=c.pkg.name)}</li>
<py:if test="h.check_access('package_update',{'id':c.pkg.id})">
<span class="divider">&nbsp;&nbsp;|&nbsp;&nbsp;</span>
<div class="divider">&nbsp;&nbsp;|&nbsp;&nbsp;</div>
<li py:attrs="{'class':'current-tab'} if c.action=='edit' else {}">
${h.subnav_link(c, h.icon('package_edit') + _('Settings'), controller='package', action='edit', id=c.pkg.name)}
</li>
2 changes: 1 addition & 1 deletion ckan/templates/user/read.html
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ <h2>Public Activity</h2>
</div>
</div><!-- /row -->
</div><!-- /listing -->
</div><!-- /content -->
</div>

<xi:include href="layout.html" />
</html>

0 comments on commit 223a5e5

Please sign in to comment.