Apply RDO styling to the docs.

Change-Id: Ibc20b29ae3918446419bb1d90464041ad7d07945
This commit is contained in:
Jaromir Coufal 2015-04-27 14:06:23 +02:00
parent 2521b51d4c
commit 9780e8a9b6
7 changed files with 671 additions and 17 deletions

View File

@ -1,5 +1,5 @@
@import url("css/theme.css");
@import url("rdo_styling.css");
/* CUSTOM CSS OVERRIDES GO HERE */
/* ============================ */
@ -45,6 +45,28 @@ h2 {
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
/* BREADCRUMBS */
.wy-breadcrumbs {
font-size: 85%;
color: rgba(0, 0, 0, 0.45);
}
.wy-breadcrumbs a {
text-decoration: underline;
color: inherit;
}
.wy-breadcrumbs a:hover,
.wy-breadcrumbs a:focus {
color: rgba(0, 0, 0, 0.75);
text-decoration: none;
}
/* FOOTER */
footer {
font-size: 70%;
margin-top: 48px;
@ -84,6 +106,7 @@ footer p {
.rst-content .note {
background: rgb(240, 240, 240);
}
.note > p.first.admonition-title {
display: inline-block;
background: rgba(0, 0, 0, 0.55);
@ -106,7 +129,6 @@ footer p {
line-height: 1.4;
background: #2980b9;
border-top: 1px solid rgba(255, 255, 255, 0.4);
margin-bottom: 0.5em;
}
.trigger {

View File

@ -0,0 +1,223 @@
/*
* jQuery One Page Nav Plugin
* http://github.com/davist11/jQuery-One-Page-Nav
*
* Copyright (c) 2010 Trevor Davis (http://trevordavis.net)
* Dual licensed under the MIT and GPL licenses.
* Uses the same license as jQuery, see:
* http://jquery.org/license
*
* @version 3.0.0
*
* Example usage:
* $('#nav').onePageNav({
* currentClass: 'current',
* changeHash: false,
* scrollSpeed: 750
* });
*/
;(function($, window, document, undefined){
// our plugin constructor
var OnePageNav = function(elem, options){
this.elem = elem;
this.$elem = $(elem);
this.options = options;
this.metadata = this.$elem.data('plugin-options');
this.$win = $(window);
this.sections = {};
this.didScroll = false;
this.$doc = $(document);
this.docHeight = this.$doc.height();
};
// the plugin prototype
OnePageNav.prototype = {
defaults: {
navItems: 'a',
currentClass: 'active',
changeHash: false,
easing: 'swing',
filter: '',
scrollSpeed: 750,
scrollThreshold: 0.2,
begin: false,
end: false,
scrollChange: false
},
init: function() {
// Introduce defaults that can be extended either
// globally or using an object literal.
this.config = $.extend({}, this.defaults, this.options, this.metadata);
this.$nav = this.$elem.find(this.config.navItems);
//Filter any links out of the nav
if(this.config.filter !== '') {
this.$nav = this.$nav.filter(this.config.filter);
}
//Handle clicks on the nav
this.$nav.on('click.onePageNav', $.proxy(this.handleClick, this));
//Get the section positions
this.getPositions();
//Handle scroll changes
this.bindInterval();
//Update the positions on resize too
this.$win.on('resize.onePageNav', $.proxy(this.getPositions, this));
return this;
},
adjustNav: function(self, $parent) {
self.$elem.find('.' + self.config.currentClass).removeClass(self.config.currentClass);
$parent.addClass(self.config.currentClass);
},
bindInterval: function() {
var self = this;
var docHeight;
self.$win.on('scroll.onePageNav', function() {
self.didScroll = true;
});
self.t = setInterval(function() {
docHeight = self.$doc.height();
//If it was scrolled
if(self.didScroll) {
self.didScroll = false;
self.scrollChange();
}
//If the document height changes
if(docHeight !== self.docHeight) {
self.docHeight = docHeight;
self.getPositions();
}
}, 250);
},
getHash: function($link) {
return $link.attr('href').split('#')[1];
},
getPositions: function() {
var self = this;
var linkHref;
var topPos;
var $target;
self.$nav.each(function() {
linkHref = self.getHash($(this));
$target = $('#' + linkHref);
if($target.length) {
topPos = $target.offset().top;
self.sections[linkHref] = Math.round(topPos);
}
});
},
getSection: function(windowPos) {
var returnValue = null;
var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold);
for(var section in this.sections) {
if((this.sections[section] - windowHeight) < windowPos) {
returnValue = section;
}
}
return returnValue;
},
handleClick: function(e) {
var self = this;
var $link = $(e.currentTarget);
var $parent = $link.parent();
var newLoc = '#' + self.getHash($link);
if(!$parent.hasClass(self.config.currentClass)) {
//Start callback
if(self.config.begin) {
self.config.begin();
}
//Change the highlighted nav item
self.adjustNav(self, $parent);
//Removing the auto-adjust on scroll
self.unbindInterval();
//Scroll to the correct position
self.scrollTo(newLoc, function() {
//Do we need to change the hash?
if(self.config.changeHash) {
window.location.hash = newLoc;
}
//Add the auto-adjust on scroll back in
self.bindInterval();
//End callback
if(self.config.end) {
self.config.end();
}
});
}
e.preventDefault();
},
scrollChange: function() {
var windowTop = this.$win.scrollTop();
var position = this.getSection(windowTop);
var $parent;
//If the position is set
if(position !== null) {
$parent = this.$elem.find('a[href$="#' + position + '"]').parent();
//If it's not already the current section
if(!$parent.hasClass(this.config.currentClass)) {
//Change the highlighted nav item
this.adjustNav(this, $parent);
//If there is a scrollChange callback
if(this.config.scrollChange) {
this.config.scrollChange($parent);
}
}
}
},
scrollTo: function(target, callback) {
var offset = $(target).offset().top;
$('html, body').animate({
scrollTop: offset
}, this.config.scrollSpeed, this.config.easing, callback);
},
unbindInterval: function() {
clearInterval(this.t);
this.$win.unbind('scroll.onePageNav');
}
};
OnePageNav.defaults = OnePageNav.prototype.defaults;
$.fn.onePageNav = function(options) {
return this.each(function() {
new OnePageNav(this, options).init();
});
};
})( jQuery, window , document );

View File

@ -0,0 +1,208 @@
/*!
* jQuery.scrollTo
* Copyright (c) 2007-2015 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
* Licensed under MIT
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* @projectDescription Easy element scrolling using jQuery.
* @author Ariel Flesler
* @version 2.1.0
*/
;(function(define) {
'use strict';
define(['jquery'], function($) {
var $scrollTo = $.scrollTo = function(target, duration, settings) {
return $(window).scrollTo(target, duration, settings);
};
$scrollTo.defaults = {
axis:'xy',
duration: 0,
limit:true
};
function isWin(elem) {
return !elem.nodeName ||
$.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1;
}
$.fn.scrollTo = function(target, duration, settings) {
if (typeof duration === 'object') {
settings = duration;
duration = 0;
}
if (typeof settings === 'function') {
settings = { onAfter:settings };
}
if (target === 'max') {
target = 9e9;
}
settings = $.extend({}, $scrollTo.defaults, settings);
// Speed is still recognized for backwards compatibility
duration = duration || settings.duration;
// Make sure the settings are given right
var queue = settings.queue && settings.axis.length > 1;
if (queue) {
// Let's keep the overall duration
duration /= 2;
}
settings.offset = both(settings.offset);
settings.over = both(settings.over);
return this.each(function() {
// Null target yields nothing, just like jQuery does
if (target === null) return;
var win = isWin(this),
elem = win ? this.contentWindow || window : this,
$elem = $(elem),
targ = target,
attr = {},
toff;
switch (typeof targ) {
// A number will pass the regex
case 'number':
case 'string':
if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
targ = both(targ);
// We are done
break;
}
// Relative/Absolute selector
targ = win ? $(targ) : $(targ, elem);
if (!targ.length) return;
/* falls through */
case 'object':
// DOMElement / jQuery
if (targ.is || targ.style) {
// Get the real position of the target
toff = (targ = $(targ)).offset();
}
}
var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset;
$.each(settings.axis.split(''), function(i, axis) {
var Pos = axis === 'x' ? 'Left' : 'Top',
pos = Pos.toLowerCase(),
key = 'scroll' + Pos,
prev = $elem[key](),
max = $scrollTo.max(elem, axis);
if (toff) {// jQuery / DOMElement
attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]);
// If it's a dom element, reduce the margin
if (settings.margin) {
attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0;
attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0;
}
attr[key] += offset[pos] || 0;
if (settings.over[pos]) {
// Scroll to a fraction of its width/height
attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos];
}
} else {
var val = targ[pos];
// Handle percentage values
attr[key] = val.slice && val.slice(-1) === '%' ?
parseFloat(val) / 100 * max
: val;
}
// Number or 'number'
if (settings.limit && /^\d+$/.test(attr[key])) {
// Check the limits
attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
}
// Don't waste time animating, if there's no need.
if (!i && settings.axis.length > 1) {
if (prev === attr[key]) {
// No animation needed
attr = {};
} else if (queue) {
// Intermediate animation
animate(settings.onAfterFirst);
// Don't animate this axis again in the next iteration.
attr = {};
}
}
});
animate(settings.onAfter);
function animate(callback) {
var opts = $.extend({}, settings, {
// The queue setting conflicts with animate()
// Force it to always be true
queue: true,
duration: duration,
complete: callback && function() {
callback.call(elem, targ, settings);
}
});
$elem.animate(attr, opts);
}
});
};
// Max scrolling position, works on quirks mode
// It only fails (not too badly) on IE, quirks mode.
$scrollTo.max = function(elem, axis) {
var Dim = axis === 'x' ? 'Width' : 'Height',
scroll = 'scroll'+Dim;
if (!isWin(elem))
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
var size = 'client' + Dim,
doc = elem.ownerDocument || elem.document,
html = doc.documentElement,
body = doc.body;
return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]);
};
function both(val) {
return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };
}
// Add special hooks so that window scroll properties can be animated
$.Tween.propHooks.scrollLeft =
$.Tween.propHooks.scrollTop = {
get: function(t) {
return $(t.elem)[t.prop]();
},
set: function(t) {
var curr = this.get(t);
// If interrupt is true and user scrolled, stop animating
if (t.options.interrupt && t._last && t._last !== curr) {
return $(t.elem).stop();
}
var next = Math.round(t.now);
// Don't waste CPU
// Browsers don't render floating point scroll
if (curr !== next) {
$(t.elem)[t.prop](next);
t._last = this.get(t);
}
}
};
// AMD requirement
return $scrollTo;
});
}(typeof define === 'function' && define.amd ? define : function(deps, factory) {
'use strict';
if (typeof module !== 'undefined' && module.exports) {
// Node
module.exports = factory(require('jquery'));
} else {
factory(jQuery);
}
}));

View File

@ -0,0 +1,3 @@
$(document).ready(function() {
$('.wy-menu').onePageNav();
});

View File

@ -0,0 +1,195 @@
/* general settings */
body {
font-family: "Open Sans", Helvetica, Arial, sans-serif;
font-weight: 300;
font-size: 16px;
}
/* remove backgrounds */
.wy-nav-content,
.wy-body-for-nav,
.wy-nav-side,
#admonition_selector {
background: none !important;
color: black !important;
}
/* page header */
.wy-side-nav-search {
background: rgba(0, 0, 0, 0.05) !important;
}
.wy-side-nav-search a {
color: rgb(160, 0, 0) !important;
}
.wy-side-nav-search input[type="text"] {
border-color: rgba(0, 0, 0, 0.25);
}
/* sidebar*/
.wy-nav-side {
border-right: 1px solid rgba(0, 0, 0, 0.2);
}
/* admonition selector */
#admonition_selector {
border-top: 0 none !important;
}
.trigger {
color: rgba(0, 0, 0, 0.7) !important;
border-top: 1px solid rgba(0, 0, 0, 0.2);
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
background: rgba(0, 0, 0, 0.05);
}
.trigger:hover {
color: rgba(0, 0, 0, 0.9) !important;
}
.content {
border-top: 0 none !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
background: rgba(0, 0, 0, 0.025) !important;
}
#admonition_selector .title {
color: rgba(0, 0, 0, 0.6) !important;
}
/* menu */
.wy-menu li a,
.wy-menu-vertical li a {
font-size: 100%;
line-height: 1.6;
color: rgb(80, 80, 80);
}
.wy-menu-vertical li a:hover,
.wy-menu-vertical li a:focus,
.wy-menu-vertical li.current a:hover,
.wy-menu-vertical li.current a:focus {
color: black;
text-decoration: underline;
background: none;
}
.wy-menu-vertical li.current,
.wy-menu-vertical li.current a {
border: 0 none;
color: rgb(80, 80, 80);
font-weight: inherit;
background: none;
}
/* level-1 menu item */
.wy-menu-vertical li.toctree-l1.current > a,
.wy-menu-vertical li.toctree-l1.current > a:hover,
.wy-menu-vertical li.toctree-l1.current > a:focus {
background: rgb(230, 230, 230);
}
.wy-menu li.toctree-l1 > a:before {
font-family: FontAwesome;
content: "";
display: inline-block;
position: relative;
padding-right: 0.5em;
}
/* level-2 menu item */
.toctree-l2 {
font-size: 90%;
color: inherit;
}
.wy-menu-vertical .toctree-l2 a {
padding: 0.4045em 0.5em 0.4045em 2.8em !important;
}
.wy-menu-vertical li.toctree-l2.current > a,
.wy-menu-vertical li.toctree-l2.current > a:hover,
.wy-menu-vertical li.toctree-l2.current > a:focus,
.wy-menu-vertical li.toctree-l2.active > a,
.wy-menu-vertical li.toctree-l2.active > a:hover,
.wy-menu-vertical li.toctree-l2.active > a:focus {
background: rgb(242, 242, 242);
}
.wy-menu li.toctree-l2 > a:before {
font-family: FontAwesome;
content: "";
font-size: 30%;
display: inline-block;
position: relative;
bottom: 0.55em;
padding-right: 1.5em;
}
/* typography */
h1 {
color: rgb(160, 0, 0);
font-weight: 300;
margin-top: 36px !important;
}
h3 {
font-size: 135%;
}
h2, h3, h4, h5 {
font-weight: 200;
}
a, a:visited {
color: #2275b4;
text-decoration: none;
}
a:hover, a:focus {
color: #1c6094;
text-decoration: underline;
}
.rst-content .toc-backref {
color: inherit;
}
strong {
font-weight: 600;
}
/* code */
.codeblock,
pre.literal-block,
.rst-content .literal-block,
.rst-content pre.literal-block,
div[class^="highlight"] {
background: rgba(0, 0, 0, 0.05);
color: black;
}
/* notes */
.admonition {
color: rgba(0, 0, 0, 0.5) !important;
font-weight: 400;
}
.rst-content .note {
background: none !important;
}
.note > p.first.admonition-title {
background: rgba(0, 0, 0, 0.5) !important;
color: rgba(255, 255, 255, 0.9) !important;
}

View File

@ -3,6 +3,9 @@
{% set script_files = script_files + ["_static/cookies.js"] %}
{% set script_files = script_files + ["_static/expandable.js"] %}
{% set script_files = script_files + ["_static/admonition_selector.js"] %}
{% set script_files = script_files + ["_static/jquery.scrollTo.js"] %}
{% set script_files = script_files + ["_static/jquery.nav.js"] %}
{% set script_files = script_files + ["_static/menu.js"] %}
{% block menu %}

View File

@ -41,17 +41,17 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'instack-undercloud'
copyright = u'2015, RDO'
project = u'RDO-Manager'
copyright = u'2015, RDO Community'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.0.0'
version = '3.0.0'
# The full version, including alpha/beta/rc tags.
release = '2.0.0'
release = '3.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -127,7 +127,7 @@ html_style = 'custom.css'
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@ -150,13 +150,13 @@ html_style = 'custom.css'
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
@ -167,7 +167,7 @@ html_style = 'custom.css'
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'instack-underclouddoc'
htmlhelp_basename = 'rdo-manager-doc'
# -- Options for LaTeX output --------------------------------------------------
@ -186,8 +186,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'instack-undercloud.tex', u'instack-undercloud Documentation',
u'RDO', 'manual'),
('index', 'rdo-manager.tex', u'RDO-Manager Documentation',
u'RDO Community', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -216,8 +216,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'instack-undercloud', u'instack-undercloud Documentation',
[u'RDO'], 1)
('index', 'rdo-manager', u'RDO-Manager Documentation',
[u'RDO Community'], 1)
]
# If true, show URL addresses after external links.
@ -230,8 +230,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'instack-undercloud', u'instack-undercloud Documentation',
u'RDO', 'instack-undercloud', 'One line description of project.',
('index', 'rdo-manager', u'RDO-Manager Documentation',
u'RDO Community', 'RDO-Manager', 'One line description of project.',
'Miscellaneous'),
]