diff --git a/code/controllers/DocumentationOpenSearchController.php b/code/controllers/DocumentationOpenSearchController.php index 603818f..b196558 100644 --- a/code/controllers/DocumentationOpenSearchController.php +++ b/code/controllers/DocumentationOpenSearchController.php @@ -7,17 +7,17 @@ * @package docsviewer */ -class DocumentationOpenSearchController extends ContentController { +class DocumentationOpenSearchController extends Controller { - static $allowed_actions = array( + public static $allowed_actions = array( 'description' ); - function index() { + public function index() { return $this->httpError(404); } - function description() { + public function description() { $viewer = new DocumentationViewer(); if(!$viewer->canView()) return Security::permissionFailure($this); diff --git a/css/DocumentationViewer.css b/css/DocumentationViewer.css old mode 100755 new mode 100644 index 7a95723..0048c16 --- a/css/DocumentationViewer.css +++ b/css/DocumentationViewer.css @@ -1,54 +1,89 @@ /** * Documentation Viewer Styles. * - * @author Will Rossiter + * Vertical grid = 7px */ -/* Reset */ -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{ margin:0;padding: 0;} +/*! reset */ +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td { + margin: 0; padding: 0; +} -/* Core */ -html { background: #f4f4f4;} -body { font: 14px/1.1 Arial,sans-serif; color: #444; } +/*! core */ +html { + background: #eff1f2; +} + +body { + font: 14px/21px Helvetica, Arial,sans-serif; + color: #444; +} a { color: #1389ce; text-decoration: none; } a:hover, a:focus { text-decoration: underline;} -p { font-size: 14px; line-height: 22px; margin-bottom: 22px; } +p { + font-size: 14px; line-height: 21px; margin-bottom: 21px; +} -ul { margin: 11px 0 22px 20px; } - li, dd { font-size: 12px; line-height: 13px; margin-bottom: 8px;} - -dl { margin: 11px 0 22px 0; } +ul { margin: 14px 0 21px 20px; } + li, dd { font-size: 14px; line-height: 21px; margin-bottom: 14px;} + li { list-style-position: inside; } +dl { margin: 7px 0 21px 0; } dt { font-weight: bold; } - dd { margin: 5px 0 8px 20px; } + dd { margin: 7px 0 7px 20px; } -h1 { font-size: 33px; line-height: 33px; margin-bottom: 22px; color: #111; letter-spacing: -1px;} -h2 { font-size: 24px; line-height: 33px; margin-bottom: 11px; color: #111; } -h3 { font-size: 18px; line-height: 22px; margin-bottom: 11px; color: #111; } -h4 { font-size: 16px; margin-bottom: 11px; line-height: 22px;} -h5 { font-size: 14px; line-height: 22px; margin-bottom: 11px;} +h1 { font-size: 33px; line-height: 35px; margin-bottom: 14px; color: #111; letter-spacing: -1px;} +h2 { font-size: 24px; line-height: 28px; margin-bottom: 14px; color: #111; } +h3 { font-size: 18px; line-height: 21px; margin-bottom: 7px; color: #111; } +h4 { font-size: 16px; margin-bottom: 14px; line-height: 21px;} +h5 { font-size: 14px; line-height: 14px; margin-bottom: 7px;} +img { + max-width: 600px; +} pre { - margin-bottom: 22px; - font-family:'Bitstream Vera Sans Mono',Monaco, 'Courier New', monospace; + margin-bottom: 21px; + font-family: 'Bitstream Vera Sans Mono',Monaco, 'Courier New', monospace; background: #f4f4f4; - padding: 11px; - font-size: 11px; + border: 1px solid #f6fbfe; + padding: 6px; + font-size: 12px; + color: #444; +} + +code { + background: none repeat scroll 0 0 #F9FAF4; + font: 11px/14px Monaco, 'Bitstream Vera Sans Mono', Courier, monospace; } /* Forms */ fieldset { border: none; } /* Container */ -#container { width: 960px; margin: 44px auto 22px auto; padding: 22px 30px; background: #fff; overflow: hidden; - -webkit-box-shadow: 0 0 20px #ccc; -moz-box-shadow: 0 0 20px #ccc;} +#container { + width: 960px; + margin: 28px auto 21px auto; padding: 14px 20px; + background: #fff; + overflow: hidden; + -webkit-box-shadow: 0 0 15px #e0e3e4; + -moz-box-shadow: 0 0 15px #e0e3e4; + box-shadow: 0 0 15px #e0e3e4; + + -moz-border-radius: 4px; + border-radius: 4px; +} /* Header */ -#header { padding: 11px 0 0 0; margin-bottom: 22px; } - #header h1 { margin-bottom: 0px; line-height: 33px;} - #header h1 a { text-decoration: none; font-size: 30px; color: #121929; letter-spacing: -1px;} +#header { +} + #header h1 { + margin-bottom: 0px; + } + #header h1 a { + text-decoration: none; letter-spacing: -1px; + } #header #breadcrumbs p { font-size: 11px; margin: 0 0 10px 0; color: #798D85;} #header #breadcrumbs p a { color: #798D85;} @@ -60,8 +95,12 @@ fieldset { border: none; } #language input.action { float: right; margin-top: 4px;} /* Footer */ -#footer { width: 960px; margin: 22px auto; } - #footer p { font-size: 11px; line-height: 11px; color: #798D85;} +#footer { width: 960px; + margin: 21px auto; +} + #footer p { + font-size: 11px; line-height: 21px; color: #798D85; + } #footer p a { color: #798D85;} /* Search */ @@ -69,6 +108,7 @@ fieldset { border: none; } #search label { display: none; } /* Breadcrumbs */ #breadcrumbs { float: left; } + /* Content */ #layout { } #content { } @@ -76,29 +116,57 @@ fieldset { border: none; } /* Versions */ .documentation-nav { clear: both; - margin: 0 0 5px; - overflow: hidden; color: #999999; + padding: 7px 0 0; + overflow: hidden; color: #999; font-size: 11px; + line-height: 20px; } - .documentation-nav h2 { font-size: 11px; font-weight: normal; float: left; margin-right: 5px;} - .documentation-nav ul { margin: 0; padding: 0; float: left;} - .documentation-nav li { display: inline; list-style: none; padding: 0; margin: 0; font-size: 11px; } - .documentation-nav li a { margin-left: 5px; padding: 0px; } + .documentation-nav h2 { + font-size: 11px; + font-weight: normal; + float: left; + margin: 0 5px 0 0; + color: #999; + line-height: 20px; + } + + .documentation-nav ul { + margin: 0; padding: 0; float: left; + } + .documentation-nav li { + display: inline; list-style: none; + padding: 0; margin: 0; + font-size: 11px; + } + .documentation-nav li a { + margin-left: 5px; padding: 0px; + } .documentation-nav li a.current { - background: #0973A6; color: #fff; font-weight: bold; + background: #0973A6; color: #fff; + font-weight: bold; padding: 4px; - -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; } .documentation-nav li a.current:hover, .documentation-nav li a.current:focus { text-decoration: none; } - -#content-column { width: 640px; float: left; } + + + +/* Links to API */ +#left-column a[href^="http://api."] { + padding: 2px; + font-family: Monaco, 'Bitstream Vera Sans Mono', Courier, monospace; + background: url(../../ssorgsites/images/external_link.png) no-repeat right 3px; + padding-right: 14px; +} +#content-column { + +} #sidebar-column { - width: 260px; - float: right; } #sidebar-column .box { @@ -126,17 +194,19 @@ fieldset { border: none; } font-style: italic; } -.module { margin: 10px -; } +.module { margin: 10px 0; } /** * TOC */ - .sidebar-box { margin: 0 0 11px 0; - padding: 11px 15px; - background: #f4f4f4; - width: 220px; + padding: 7px 15px; + background: #f6fbfe; + border: 1px solid #DDE8ED; + + -moz-border-radius: 4px; + border-radius: 4px; } .sidebar-box ul { margin: 0; padding: 0;} .sidebar-box h4 { font-size: 12px; margin-bottom: 11px;} @@ -149,4 +219,56 @@ fieldset { border: none; } .sidebar-box ul li.h3, .sidebar-box ul li li li { margin-left: 20px; font-size: 10px; margin-left: 20px;} .sidebar-box ul li.h4, - .sidebar-box ul li li li li { margin-right: 30px; font-size: 10px; margin-left: 20px; } \ No newline at end of file + .sidebar-box ul li li li li { margin-right: 30px; font-size: 10px; margin-left: 20px; } + + +/* Code styles - each site should have syntaxhighlighter installed for + code blocks */ +.syntaxhighlighter { padding: 9px 0; } + +#edit-link { + margin: 7px 0; +} + #edit-link p { + margin: 0; + overflow: hidden; + } + + #edit-link a { + display: block; + background: #fafafa; /* Old browsers */ + background: -moz-linear-gradient(top, #fafafa 1%, #e6e6e6 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#fafafa), color-stop(100%,#e6e6e6)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #fafafa 1%,#e6e6e6 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #fafafa 1%,#e6e6e6 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #fafafa 1%,#e6e6e6 100%); /* IE10+ */ + background: linear-gradient(to bottom, #fafafa 1%,#e6e6e6 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fafafa', endColorstr='#e6e6e6',GradientType=0 ); /* IE6-9 */ + + border: 1px solid #d4d4d4; + border-bottom-color: #bcbcbc; + text-shadow: 0 1px 0 #fff; + color: #333; + font-weight: bold; + margin-bottom: 5px; + text-decoration: none; + padding: 5px 10px; + + -moz-border-radius: 3px; + border-radius: 3px; + float: left; + } + #edit-link a:hover, + #edit-link a:focus { + color: #fff; + text-shadow: 0 -1px 1px #3072B3; + border-color: #518CC6; + background: #599BDC; + background: -moz-linear-gradient(top, #599BDC 1%, #3072B3 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#3072B3), color-stop(100%,#3072B3)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #599BDC 1%,#3072B3 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #599BDC 1%,#3072B3 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #599BDC 1%,#3072B3 100%); /* IE10+ */ + background: linear-gradient(to bottom, #599BDC 1%,#3072B3 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#599BDC', endColorstr='#3072B3',GradientType=0 ); /* IE6-9 */ + } \ No newline at end of file diff --git a/css/shSilverStripeDocs.css b/css/shSilverStripeDocs.css index 124ddfa..81f3b33 100644 --- a/css/shSilverStripeDocs.css +++ b/css/shSilverStripeDocs.css @@ -16,7 +16,7 @@ float: none !important; height: auto !important; left: auto !important; - line-height: 1.3 !important; + line-height: 14px !important; margin: 0 !important; outline: 0 !important; overflow: visible !important; @@ -33,17 +33,18 @@ font-size: 1em !important; min-height: inherit !important; min-height: auto !important; - font-family:'Bitstream Vera Sans Mono',Monaco, 'Courier New', monospace !important; + font-family: Monaco, 'Courier New', monospace !important; } .syntaxhighlighter { width: 100% !important; - margin: 1em 0 1em 0 !important; + margin: 7px 0 21px !important; position: relative !important; overflow: auto !important; - font-size: 12px !important; - line-height: 20px !important; - background-color: #F8F8FF !important; + font-size: 11px !important; + line-height: 14px !important; + background-color: #f9faf4 !important; + border: 1px solid #ddd !important; } .syntaxhighlighter.source { overflow: hidden !important; diff --git a/javascript/DocumentationViewer.js b/javascript/DocumentationViewer.js index e0100aa..c6acda7 100755 --- a/javascript/DocumentationViewer.js +++ b/javascript/DocumentationViewer.js @@ -14,7 +14,10 @@ $('#content-column h1[id], #content-column h2[id], #content-column h3[id], #content-column h4[id]').each(function(i) { var current = $(this); - toc += '
  • ' + current.html() + '
  • '; + var tagName = current.attr("tagName"); + if(typeof tagName == "String") tagName = tagName.toLowerCase(); + + toc += '
  • ' + current.html() + '
  • '; }); toc += '';