You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2012/10/16 11:32:44 UTC
svn commit: r1398706 - in
/incubator/bloodhound/trunk/bloodhound_theme/bhtheme: htdocs/bloodhound.css
htdocs/js/theme.js templates/bh_ticket.html theme.py
Author: gjm
Date: Tue Oct 16 09:32:43 2012
New Revision: 1398706
URL: http://svn.apache.org/viewvc?rev=1398706&view=rev
Log:
adding the basic scrollspy - towards #174 (from olemis)
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css?rev=1398706&r1=1398705&r2=1398706&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css Tue Oct 16 09:32:43 2012
@@ -416,6 +416,22 @@ input[type="submit"].btn.btn-micro {
margin-top: 2px !important;
}
+.visible-affix {
+ display: none !important;
+}
+
+.affix .visible-affix {
+ display: inherit !important;
+}
+
+.hidden-affix {
+ display: inherit !important;
+}
+
+.affix .hidden-affix {
+ display: none !important;
+}
+
/* Revert some changes introduced in 2.1.0 */
h6 {
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js?rev=1398706&r1=1398705&r2=1398706&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js Tue Oct 16 09:32:43 2012
@@ -115,11 +115,13 @@ function setup_sticky_panel(selector) {
target.parent('.stickyBox').height(target.height());
target = null;
$(window).on('scroll.affix.data-api', function() {
- affix_data = $(selector).data('affix');
- if (affix_data && !affix_data.affixed) {
- var target = $(selector);
+ var affix_data = $(selector).data('affix');
+ var target = $(selector);
+
+ if (affix_data && !affix_data.affixed)
target.parent('.stickyBox').height(target.height());
- }
+ else
+ target.parent('.stickyBox').css('height', '');
})
}
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html?rev=1398706&r1=1398705&r2=1398706&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html Tue Oct 16 09:32:43 2012
@@ -37,6 +37,15 @@
<script py:if="ticket.exists" type="text/javascript" src="${chrome.htdocs_location}js/threaded_comments.js"></script>
<script type="text/javascript" py:choose="">
jQuery(document).ready(function($) {
+ /* Affixed navbar */
+ $(".navbar a").click(function() { $($(this).attr('href')).removeClass('collapsed').parent().removeClass("collapsed"); });
+ $('.trac-nav').hide();
+ $('.trac-topnav').hide();
+ $('body').scrollspy({
+ 'target' : '.navbar' ,
+ 'offset' : $('.stickyBox').height() + 40
+ })
+
$("div.description").find("h1,h2,h3,h4,h5,h6").addAnchor(_("Link to this section"));
$(".foldable").enableFolding(false, true);
<py:when test="ticket.exists">/*<![CDATA[*/
@@ -163,6 +172,22 @@
</h6>
</div>
</div>
+ <div class="navbar visible-affix" py:if="ticket.exists"
+ py:with="sections = (
+ (_('Overview'), 'content', True, _('View ticket fields and description')),
+ (_('Attachments'), 'attachments', True, _('Go to the list of attachments')),
+ (_('Comments'), 'changelog', True, _('Go to the changelog')),
+ (_('Add comment'), 'propertyform', ticket.exists and can_append, _('Go to the ticket editor')),
+ (_('Modify Ticket'), 'modify', can_modify or can_edit or can_create, _('Modify ticket fields and description')),
+ )">
+ <div class="navbar-inner">
+ <ul class="nav">
+ <li py:for="s in sections" py:if="s[2]">
+ <a href="#${s[1]}" title="${s[3]}">${s[0]}</a>
+ </li>
+ </ul>
+ </div>
+ </div>
<div class="stickyEndMark"></div>
</div>
</div>
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1398706&r1=1398705&r2=1398706&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue Oct 16 09:32:43 2012
@@ -29,7 +29,7 @@ from trac.util.compat import set
from trac.util.translation import _
from trac.versioncontrol.web_ui.browser import BrowserModule
from trac.web.api import IRequestFilter, IRequestHandler, ITemplateStreamFilter
-from trac.web.chrome import (add_stylesheet, INavigationContributor,
+from trac.web.chrome import (add_script, add_stylesheet, INavigationContributor,
ITemplateProvider, prevnext_nav)
from themeengine.api import ThemeBase, ThemeEngineSystem
@@ -94,7 +94,7 @@ class BloodhoundTheme(ThemeBase):
'report_edit.html' : ('bh_report_edit.html', None),
'report_list.html' : ('bh_report_list.html', None),
'report_view.html' : ('bh_report_view.html', None),
- 'ticket.html' : ('bh_ticket.html', None),
+ 'ticket.html' : ('bh_ticket.html', '_modify_scrollspy'),
'ticket_preview.html' : ('bh_ticket_preview.html', None),
# Multi Product
@@ -224,6 +224,11 @@ class BloodhoundTheme(ThemeBase):
"""
add_stylesheet(req, 'dashboard/css/roadmap.css')
+ def _modify_scrollspy(self, req, template, data, content_type, is_active):
+ """Insert Bootstrap scroll spy files.
+ """
+ add_script(req, 'dashboard/js/bootstrap-scrollspy.js')
+
# INavigationContributor methods
def get_active_navigation_item(self, req):