Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1966 results frontend #2089

Merged
merged 5 commits into from
Apr 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions akvo/rsr/static/scripts-src/my-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,21 @@ function initReact() {
// This can be either a list of periods (when no period has been selected, but only an
// indicator), or a list of indicator updates (when a period has been selected).

if (this.props.selectedPeriod !== null) {
if (this.props.selectedResult !== null && this.props.selectedResult.indicators !== undefined && this.props.selectedResult.indicators.length === 0) {
var addIndicatorsLink;
if (isAdmin) {
var language = window.location.pathname.substring(0, 3);
addIndicatorsLink =
React.DOM.a( {href:language + "/myrsr/project_editor/" + projectIds.project_id + "/"}, i18nResults.add_indicators);
} else {
addIndicatorsLink = React.DOM.span(null );
}

return (
React.DOM.span(
{className:"noIndicators"}, i18nResults.no_indicators, " ", addIndicatorsLink)
);
} else if (this.props.selectedPeriod !== null) {
// Show a list of indicator updates.
return (
React.DOM.div( {className:"indicator-period-container"},
Expand Down Expand Up @@ -1730,7 +1744,7 @@ function initReact() {
)
);
} else {
// No indicator selected, leave main content empty.
// Nothing selected, leave main content empty.
return (
React.DOM.span(null )
);
Expand Down Expand Up @@ -2434,7 +2448,8 @@ function initReact() {
selectedPeriod: this.selectedPeriod(),
selectPeriod: this.selectPeriod,
findProjectOfResult: this.findProjectOfResult,
findResult: this.findResult
findResult: this.findResult,
selectedResult: this.selectedResult()
}
)
)
Expand Down
21 changes: 18 additions & 3 deletions akvo/rsr/static/scripts-src/my-results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,21 @@ function initReact() {
// This can be either a list of periods (when no period has been selected, but only an
// indicator), or a list of indicator updates (when a period has been selected).

if (this.props.selectedPeriod !== null) {
if (this.props.selectedResult !== null && this.props.selectedResult.indicators !== undefined && this.props.selectedResult.indicators.length === 0) {
var addIndicatorsLink;
if (isAdmin) {
var language = window.location.pathname.substring(0, 3);
addIndicatorsLink =
<a href={language + "/myrsr/project_editor/" + projectIds.project_id + "/"}>{i18nResults.add_indicators}</a>;
} else {
addIndicatorsLink = <span />;
}

return (
<span
className="noIndicators">{i18nResults.no_indicators} {addIndicatorsLink}</span>
);
} else if (this.props.selectedPeriod !== null) {
// Show a list of indicator updates.
return (
<div className="indicator-period-container">
Expand Down Expand Up @@ -1730,7 +1744,7 @@ function initReact() {
</div>
);
} else {
// No indicator selected, leave main content empty.
// Nothing selected, leave main content empty.
return (
<span />
);
Expand Down Expand Up @@ -2434,7 +2448,8 @@ function initReact() {
selectedPeriod: this.selectedPeriod(),
selectPeriod: this.selectPeriod,
findProjectOfResult: this.findProjectOfResult,
findResult: this.findResult
findResult: this.findResult,
selectedResult: this.selectedResult()
}
)}
</div>
Expand Down
15 changes: 14 additions & 1 deletion akvo/rsr/static/styles-src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,7 @@ article {
position: absolute;
background: white;
border: 1px solid rgba(153, 153, 153, 0.8);
left: 68px;
left: 50px;
top: -2px; }
.baseline .baseline-year .result-tooltip .tooltip-arrow:after,
.baseline .baseline-year .result-tooltip .tooltip-arrow:before,
Expand Down Expand Up @@ -2924,6 +2924,19 @@ article {
-webkit-flex: 1;
-ms-flex: 1;
flex: 1; }
.indicator-container .noIndicators {
text-align: center;
display: block;
margin-top: 50%;
width: 100%;
height: 100%;
color: rgba(153, 153, 153, 0.5);
text-shadow: 1px 1px 0 white;
font-size: 150%; }
.indicator-container .noIndicators a {
font-size: 60%;
display: block;
width: 100%; }
.indicator-container .indicator-title {
font-size: 1.3em;
margin-bottom: 25px; }
Expand Down
17 changes: 16 additions & 1 deletion akvo/rsr/static/styles-src/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3114,7 +3114,7 @@ article {
position: absolute;
background: rgba(white, 1);
border: 1px solid rgba($primary4, 0.8);
left: 68px;
left: 50px;
top: -2px;
&:after,
&:before {
Expand Down Expand Up @@ -3360,6 +3360,21 @@ article {
background-color: rgba($secondary8, 0.3);
border: 1px solid rgba($secondary8, 0.8);
@include flex(1);
.noIndicators {
text-align: center;
display: block;
margin-top: 50%;
width: 100%;
height: 100%;
color: rgba($primary4, 0.5);
text-shadow: 1px 1px 0 rgba(white, 1);
font-size: 150%;
a {
font-size: 60%;
display: block;
width: 100%;
}
}
.indicator-title {
font-size: 1.3em;
margin-bottom: 25px;
Expand Down
2 changes: 2 additions & 0 deletions akvo/templates/myrsr/my_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ <h4 class="resultProjectTitle">
"results": "{% trans 'Results' %}",
"indicator": "{% trans 'Indicator' %}",
"indicators": "{% trans 'Indicators' %}",
"no_indicators": "{% trans 'This result has no indicators yet' %}",
"add_indicators": "{% trans 'Add indicators' %}",
"indicator_period": "{% trans 'Indicator period' %}",
"indicator_periods": "{% trans 'Indicator period(s)' %}",
"output": "{% trans 'Output' %}",
Expand Down
2 changes: 2 additions & 0 deletions akvo/templates/project_main.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
"results": "{% trans 'Results' %}",
"indicator": "{% trans 'Indicator' %}",
"indicators": "{% trans 'Indicators' %}",
"no_indicators": "{% trans 'This result has no indicators yet' %}",
"add_indicators": "{% trans 'Add indicators' %}",
"indicator_period": "{% trans 'Indicator period' %}",
"indicator_periods": "{% trans 'Indicator periods' %}",
"output": "{% trans 'Output' %}",
Expand Down