Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

view source button stuff.

  • Loading branch information...
commit 1e37d12b0176bd4ee84f04e6fd65faab734c52a2 1 parent da87b42
@anutron authored
View
69 static/css/minibuttons.css
@@ -0,0 +1,69 @@
+#mt-test-buttons {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ z-index: 100;
+}
+
+/* button basics from github */
+a.minibutton {
+ outline: none;
+ display:inline-block;
+ height:23px;
+ padding:0 0 0 3px;
+ font-size:11px;
+ font-weight:bold;
+ color:#333;
+ text-shadow:1px 1px 0 #fff;
+ background:url(/static/art/minibutton_matrix.png) 0 0 no-repeat;
+ white-space:nowrap;
+ border:none;
+ overflow:visible;
+ cursor:pointer;
+ text-decoration:none;
+ vertical-align: middle;
+}
+
+a.minibutton>span {
+ display:block;
+ height:23px;
+ padding:0 10px 0 8px;
+ line-height:23px;
+ background:url(/static/art/minibutton_matrix.png) 100% 0 no-repeat;
+}
+a.btn-no-txt>span {
+ padding: 0 15px 0 8px;
+ text-indent: -9999px;
+}
+
+a.minibutton:hover, a.minibutton:focus, a.minibutton.selected {
+ color:#fff;
+ text-decoration:none;
+ text-shadow:-1px -1px 0 rgba(0,0,0,0.3);
+ background-position:0 -30px;
+}
+a.minibutton:hover>span, a.minibutton:focus>span, a.minibutton.selected>span {background-position:100% -30px;}
+
+a.minibutton.mousedown{background-position:0 -60px; }
+a.minibutton.mousedown>span{background-position:100% -60px; }
+
+/* icons */
+a.minibutton .icon {
+ float:left;
+ margin-left:-4px;
+ width:18px;
+ height:22px;
+ background:url(/static/art/minibutton_icons.png) 0 0 no-repeat;
+}
+
+a.btn-download .icon {background-position:-40px 0;}
+a.btn-download:hover .icon, a.btn-download:focus .icon {background-position:-40px -25px;}
+
+a.btn-left .icon {background-position:-161px 1px;}
+a.btn-left:hover .icon, a.btn-left:focus .icon {background-position:-161px -24px;}
+
+a.btn-right .icon {background-position:-178px 1px;}
+a.btn-right:hover .icon, a.btn-right:focus .icon {background-position:-178px -24px;}
+
+a.btn-source .icon {background-position:-211px 0px;}
+a.btn-source:hover .icon, a.btn-right:focus .icon {background-position:-211px -24px;}
View
64 static/css/shared.css
@@ -12,66 +12,4 @@ a {
color:#009;
}
-
-/* button basics from github */
-a.minibutton {
- outline: none;
- display:inline-block;
- height:23px;
- padding:0 0 0 3px;
- font-size:11px;
- font-weight:bold;
- color:#333;
- text-shadow:1px 1px 0 #fff;
- background:url(/static/art/minibutton_matrix.png) 0 0 no-repeat;
- white-space:nowrap;
- border:none;
- overflow:visible;
- cursor:pointer;
- text-decoration:none;
- vertical-align: middle;
-}
-
-a.minibutton>span {
- display:block;
- height:23px;
- padding:0 10px 0 8px;
- line-height:23px;
- background:url(/static/art/minibutton_matrix.png) 100% 0 no-repeat;
-}
-a.btn-no-txt>span {
- padding: 0 15px 0 8px;
- text-indent: -9999px;
-}
-
-a.minibutton:hover, a.minibutton:focus, a.minibutton.selected {
- color:#fff;
- text-decoration:none;
- text-shadow:-1px -1px 0 rgba(0,0,0,0.3);
- background-position:0 -30px;
-}
-a.minibutton:hover>span, a.minibutton:focus>span, a.minibutton.selected>span {background-position:100% -30px;}
-
-a.minibutton.mousedown{background-position:0 -60px; }
-a.minibutton.mousedown>span{background-position:100% -60px; }
-
-/* icons */
-a.minibutton .icon {
- float:left;
- margin-left:-4px;
- width:18px;
- height:22px;
- background:url(/static/art/minibutton_icons.png) 0 0 no-repeat;
-}
-
-a.btn-download .icon {background-position:-40px 0;}
-a.btn-download:hover .icon, a.btn-download:focus .icon {background-position:-40px -25px;}
-
-a.btn-left .icon {background-position:-161px 1px;}
-a.btn-left:hover .icon, a.btn-left:focus .icon {background-position:-161px -24px;}
-
-a.btn-right .icon {background-position:-178px 1px;}
-a.btn-right:hover .icon, a.btn-right:focus .icon {background-position:-178px -24px;}
-
-a.btn-source .icon {background-position:-211px 0px;}
-a.btn-source:hover .icon, a.btn-right:focus .icon {background-position:-211px -24px;}
+@import url("minibuttons.css");
View
1  static/css/tests.css
@@ -67,7 +67,6 @@ body.loaded #mt-loading {
height: 100px;
}
#mt-log {
- padding-left: 200px;
height: 100px;
overflow: auto;
}
View
162 static/js/test-helpers.js
@@ -1,81 +1,91 @@
- var makeActions = function(tests){
- try {
- if (!$('actions')) new Element('dt', {'id': 'actions'}).inject($('mt-content'), 'top');
- tests.each(function(test, i) {
- new Element('dt').adopt(
- new Element('a', {
- text: test.title,
- events: {
- click: test.fn
- },
- id: 'test-' + i
- })
- ).inject('actions');
- if (test.description) new Element('dd', { text: test.description }).inject('actions');
- });
- } catch(e) {
- alert('Could not create actions. Check console for details.');
- console.log('Ensure you have Core/Element.Event - plus its dependencies.', e);
- }
- };
- var log = function(msg) {
- var type = function(obj){
- if (obj == undefined) return false;
- if (obj.nodeName){
- switch (obj.nodeType){
- case 1: return 'element';
- case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
- }
- } else if (typeof obj.length == 'number'){
- if (obj.callee) return 'arguments';
- }
- return typeof obj;
- };
- var parse = function(){
- var str = '';
- for (var i = 0; i < arguments.length; i++) {
- var value = arguments[i];
- switch (type(value)) {
- case 'element':
- str += value.tagName.toLowerCase();
- if (value.id) str += '#' + value.id;
- if (value.className) str += value.className.split(' ').join('.');
- break;
+var makeActions = function(tests){
+ try {
+ if (!$('actions')) new Element('dt', {'id': 'actions'}).inject($('mt-content'), 'top');
+ tests.each(function(test, i) {
+ new Element('dt').adopt(
+ new Element('a', {
+ text: test.title,
+ events: {
+ click: test.fn
+ },
+ id: 'test-' + i
+ })
+ ).inject('actions');
+ if (test.description) new Element('dd', { text: test.description }).inject('actions');
+ });
+ } catch(e) {
+ alert('Could not create actions. Check console for details.');
+ console.log('Ensure you have Core/Element.Event - plus its dependencies.', e);
+ }
+ };
+var log = function(msg) {
+ if (!log.log_wrapper) {
+ log.log_wrapper = document.createElement('div');
+ log.log_wrapper.id = 'mt-log-wrapper';
+ log.log_element = document.createElement('div');
+ log.log_element.id = 'mt-log';
+ log.log_wrapper.appendChild(log.log_element);
+ document.body.appendChild(log.log_wrapper);
+ }
+
+
+ var type = function(obj){
+ if (obj == undefined) return false;
+ if (obj.nodeName){
+ switch (obj.nodeType){
+ case 1: return 'element';
+ case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
+ }
+ } else if (typeof obj.length == 'number'){
+ if (obj.callee) return 'arguments';
+ }
+ return typeof obj;
+ };
+ var parse = function(){
+ var str = '';
+ for (var i = 0; i < arguments.length; i++) {
+ var value = arguments[i];
+ switch (type(value)) {
+ case 'element':
+ str += value.tagName.toLowerCase();
+ if (value.id) str += '#' + value.id;
+ if (value.className) str += value.className.split(' ').join('.');
+ break;
- case 'array':
- str +='[';
- var results = [];
- for (var index = 0; index < value.length; index++) {
- results.push(parse(value[index]));
- }
- str += results.join(', ') + ']';
- break;
+ case 'array':
+ str +='[';
+ var results = [];
+ for (var index = 0; index < value.length; index++) {
+ results.push(parse(value[index]));
+ }
+ str += results.join(', ') + ']';
+ break;
- case 'object':
- var objs = [];
- for (name in value) {
- if (type(value[name]) != 'object') {
- objs.push(name + ': ' + parse(value[name]));
- } else {
- objs.push(name + ': (object)');
- }
- }
- str += '{' + objs.join(', ') + '}';
- break;
+ case 'object':
+ var objs = [];
+ for (name in value) {
+ if (type(value[name]) != 'object') {
+ objs.push(name + ': ' + parse(value[name]));
+ } else {
+ objs.push(name + ': (object)');
+ }
+ }
+ str += '{' + objs.join(', ') + '}';
+ break;
- case 'function':
- str += '(function)';
- break;
+ case 'function':
+ str += '(function)';
+ break;
- case 'boolean':
- str += String(value);
- break;
+ case 'boolean':
+ str += String(value);
+ break;
- default: str += value;
- }
- if (i != (arguments.length - 1)) str += ' ';
- }
- return str;
- };
- document.getElementById('mt-log').innerHTML += parse.apply(this, arguments) + '<br/>';
- };
+ default: str += value;
+ }
+ if (i != (arguments.length - 1)) str += ' ';
+ }
+ return str;
+ };
+ document.getElementById('mt-log').innerHTML += parse.apply(this, arguments) + '<br/>';
+};
View
6 test_runner/templates/blank.mako
@@ -1 +1,5 @@
-${test}
+${test}
+<link rel="stylesheet" href="/static/css/minibuttons.css" type="text/css" media="screen" title="no title" charset="utf-8">
+<%namespace name="components" file="test_components.mako" />
+${components.nav(current=current)}
+
View
1  test_runner/templates/test.mako
@@ -1,4 +1,5 @@
<%namespace name="components" file="test_components.mako" />
${components.header(title=title, projects=projects, current=current, next=next, previous=previous, excluded_tests=excluded_tests)}
${test}
+ ${components.nav(current=current)}
${components.footer()}
View
15 test_runner/templates/test_components.mako
@@ -8,6 +8,7 @@
<title>${title_prefix} - ${title}</title>
<link rel="stylesheet" href="/static/css/reset.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/static/css/tests.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <link rel="stylesheet" href="/static/css/minibuttons.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="/static/js/test-helpers.js"></script>
</head>
<div id="mt-content">
@@ -23,22 +24,12 @@
</html>
</%def>
-<%def name="nav(title, projects=None, current=None, previous=None, next=None, view='test', excluded_tests=None)">
- <div id="mt-content_header">
- <h2>${title}</h2>
- <div>
- % if previous:
- <a class="mt-prev minibutton btn-left" href="${previous}"><span><span class="icon"></span>previous (${prev_name})</span></a>
- % endif
- % if next:
- <a class="mt-next minibutton btn-right" href="${next}"><span><span class="icon"></span>next (${next_name})</span></a>
- % endif
+<%def name="nav(current=None, view='test')">
+ <div id="mt-test-buttons">
% if view == 'test' and test:
<a class="btn-source minibutton" href="/source/${current}"><span><span class="icon"></span>view source</span></a>
% elif view == 'source':
<a class="btn-left minibutton" href="${current}"><span><span class="icon"></span>back to test</span></a>
% endif
- </div>
</div>
- <div id="mt-log-wrapper"><div id="mt-log"></div></div>
</%def>
View
3  test_runner/templates/view_source.mako
@@ -6,10 +6,11 @@
<title>${title_prefix} - ${title}</title>
<link rel="stylesheet" href="/static/css/reset.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/static/css/tests.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <link rel="stylesheet" href="/static/css/minibuttons.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div class="view_source">
- ${components.nav(title=title + " source", current=current, view="source")}
+ ${components.nav(current=current, view="source")}
<div class="source">
<h3>Relevant sources</h3>
<a name="top"></a>
Please sign in to comment.
Something went wrong with that request. Please try again.