Skip to content

Commit

Permalink
back buttons in "view test results" pages #26
Browse files Browse the repository at this point in the history
  • Loading branch information
evlach committed Aug 12, 2014
1 parent 7a09c30 commit d293bf5
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ window.accessdb.appRouter.on('route:results-details', function (type, typeValue,
atVer : Utils.urlParam(atVer),
type: type,
typeValue : typeValue
}
};
accessdb.TestResultsDetails = new accessdb.Views.TestResultsDetails();
accessdb.TestResultsDetails.reload(params);
});
Expand Down
24 changes: 24 additions & 0 deletions js/testresult-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ accessdb.Views.TestResultsFullViewByTest = function (){
params: this.params
} );
this.$el.html( template );
var btnTechnique = $($("#" + accessdb.config.PAGE_ID_PREFIX + "results-test" + " .back-button").get(0));
var technique = Utils.stripTechniqueFromTestID(this.params.typeValue);
btnTechnique.attr("href","#/results-technique.html/"+technique);
$(btnTechnique.find("span").get(1)).html("Back to technique " + technique);
this.$el.find('.chart').peity("pie", {
fill: ["green", "#f98"]
});
Expand Down Expand Up @@ -287,6 +291,26 @@ accessdb.Views.TestResultsDetails = function (){
params: this.params}
);
this.$el.html( template );
var test = null;
var technique = null;
var btnTechnique = $($("#" + accessdb.config.PAGE_ID_PREFIX + "results-details" + " .back-button").get(0));
var btnTest = $($("#" + accessdb.config.PAGE_ID_PREFIX + "results-details" + " .back-button").get(1));
if(this.params.type==="Test"){
test = this.params.typeValue;
technique = Utils.stripTechniqueFromTestID(test);
}
else{
technique = this.params.typeValue;
}
btnTechnique.attr("href","#/results-technique.html/"+technique);
$(btnTechnique.find("span").get(1)).html("Back to technique " + technique);
if(test){
btnTest.attr("href","#/results-test.html/"+test);
$(btnTest.find("span").get(1)).html("Back to test " + Utils.stripTestID(test));
btnTest.show();
}
else
btnTest.hide();
Utils.UIRoleAdapt();
}
};
Expand Down
29 changes: 23 additions & 6 deletions js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,29 @@ Utils.sortResultsTable = function (table, targetTable) {
};

Utils.stripTestID = function (id){
if(id){
var newID = id.split('_');
var first = newID[0];
return first + "_" + newID[1].replace(/(^|,)0+/g, '$1');
try {
if(id){
var newID = id.split('_');
var first = newID[0];
return first + "_" + newID[1].replace(/(^|,)0+/g, '$1');
}
else
return "";
}
else
return "";
catch(e){

}
}
Utils.stripTechniqueFromTestID = function (id){
try {
if (id) {
var newID = id.split('_');
return newID[0];
}
else
return "";
}
catch(e){

}
}
3 changes: 3 additions & 0 deletions pages/results-details.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<article id="axsdb-page-results-details">
<nav class="navbar" role="navigation">
<a href="#" class="btn-small"><span class="icon-home"></span> Home</a>
<a role="button" href="#/results.html" class="btn-small back-button"><span class="icon-arrow-left"></span><span></span></a>
<a role="button" href="#/results.html" class="btn-small back-button"><span class="icon-arrow-left"></span><span></span></a>

<a href="#" class="btn-small login"><span class="icon-unlock-alt"></span> Log In</a>
</nav>
<div class="content">
Expand Down
1 change: 1 addition & 0 deletions pages/results-technique.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<article id="axsdb-page-results-technique">
<nav class="navbar" role="navigation">
<a href="#/home.html" class="btn-small"><span class="icon-home"></span> Home</a>
<a role="button" href="#/results.html" class="btn-small"><span class="icon-arrow-left"></span>Browse Test Results</a>
<a href="#/log-in.html" class="btn-small login"><span class="icon-unlock-alt"></span> <span class="login-info">Log In</span></a>
</nav>
<div class="content">
Expand Down
3 changes: 2 additions & 1 deletion pages/results-test.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<article id="axsdb-page-results-test">
<nav class="navbar" role="navigation">
<a href="#/home.html" class="btn-small"><span class="icon-home"></span> Home</a>
<a href="#/log-in.html" class="btn-small login"><span class="icon-unlock-alt"></span> <span class="login-info">Log In</span></a>
<a role="button" href="#/results.html" class="btn-small back-button"><span class="icon-arrow-left"></span><span>Back to technique</span></a>
<a href="#/log-in.html" class="btn-small login"><span class="icon-unlock-alt"></span> <span class="login-info">Log In</span></a>
</nav>
<div class="content">
<div class="grid">
Expand Down
12 changes: 10 additions & 2 deletions templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,15 @@ <h3>Test Results</h3>
</ul>
</script>
<script type="text/template" id="Results_template">
<h1>Test Results for <%=params.type%> <%=Utils.stripTestID(params.typeValue)%>, <%=params.ua%> <%=params.uaVer%> with <%=params.at%> <%=params.atVer%></h1>
<h1>Test Results for <%=params.type%> <%
if(params.type==="Test")
{
%>
<%= Utils.stripTestID(params.typeValue)%>
<% } else { %>
<%= params.typeValue%>
<% }
%>, <%=params.ua%> <%=params.uaVer%> with <%=params.at%> <%=params.atVer%></h1>
<div class="">
<div class="column-second">
<div id="Results"><!-- Template: Results_template --></div>
Expand Down Expand Up @@ -353,7 +361,7 @@ <h1>Test Results for <%=params.type%> <%=Utils.stripTestID(params.typeValue)%>,
</script>

<script type="text/template" id="TestResultsFullViewByTechnique_template">
<table class="result-details tablesorter" id="TestResultsFullViewByTechnique_table">
<table class="result-details" id="TestResultsFullViewByTechnique_table">
<caption>In the columns, you can find browser versions.<br>The rows show assistive technologies.</caption>
<% lresults = results.length
accessdb.p = {
Expand Down

0 comments on commit d293bf5

Please sign in to comment.