Skip to content

Commit

Permalink
[#1966] Final adjustments for the results framework
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Apr 5, 2016
1 parent 55fcb6e commit 928d1e4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 31 deletions.
34 changes: 18 additions & 16 deletions akvo/rsr/static/scripts-src/my-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -1355,9 +1355,13 @@ function initReact() {

renderActions: function() {
// Render the actions for this period.
if (isPublic || !isAdmin) {
// In the public view or in the 'MyRSR' view as a non-admin:
// Only display whether the period is locked or not.
if (isPublic) {
// In the public view, display nothing.
return (
React.DOM.span(null )
);
} else if (!isAdmin) {
// In the 'MyRSR' view as a non-admin, display whether the period is locked or not.
switch(this.props.period.locked) {
case false:
return (
Expand All @@ -1373,8 +1377,7 @@ function initReact() {
);
}
} else {
// In the 'MyRSR' view as an admin:
// Show the buttons to lock or unlock a period.
// In the 'MyRSR' view as an admin, show the buttons to lock or unlock a period.
if (this.state.lockingOrUnlocking) {
return (
React.DOM.td( {className:"actions-td"},
Expand Down Expand Up @@ -1575,12 +1578,13 @@ function initReact() {
React.DOM.tr(null,
React.DOM.td(null,
React.DOM.i( {className:"fa fa-spin fa-spinner"} ), " ", i18nResults.loading, " ", i18nResults.indicator_periods
),
React.DOM.td(null ),React.DOM.td(null ),React.DOM.td(null )
)
)
);
}

var actionCell = isPublic ? React.DOM.span(null ) : React.DOM.td( {className:"th-actions"} );

return (
React.DOM.div( {className:"indicator-period-list selfProject"},
React.DOM.h4( {className:"indicator-periods-title"}, i18nResults.indicator_periods),
Expand All @@ -1591,7 +1595,7 @@ function initReact() {
React.DOM.td( {className:"th-period"}, i18nResults.period),
React.DOM.td( {className:"th-target"}, i18nResults.target_value),
React.DOM.td( {className:"th-actual"}, i18nResults.actual_value),
React.DOM.td( {className:"th-actions"})
actionCell
)
),
periods
Expand Down Expand Up @@ -1694,8 +1698,10 @@ function initReact() {
}

return (
React.DOM.div(
{className:"noIndicators"}, i18nResults.no_indicators, " ", addIndicatorsLink)
React.DOM.div( {className:"noIndicators"},
i18nResults.no_indicators, " ", addIndicatorsLink,
React.DOM.a( {href:"https://akvorsr.supporthero.io/article/show/design-a-results-framework", target:"_blank"}, i18nResults.more_info)
)
);
} else if (this.props.selectedPeriod !== null) {
// Show a list of indicator updates.
Expand Down Expand Up @@ -1901,13 +1907,9 @@ function initReact() {
}

if (this.expanded()) {
// Show a different text when the result is selected (expanded).
// Do not show a text when the result is selected (expanded).
return (
React.DOM.span( {className:"result-indicator-count"},
React.DOM.i( {className:"fa fa-tachometer"} ),
React.DOM.span( {className:"indicator-count inlined"}, indicatorLength),
React.DOM.p(null, this.indicatorText(),":")
)
React.DOM.span(null )
);
} else {
// Show the number of indicators
Expand Down
32 changes: 17 additions & 15 deletions akvo/rsr/static/scripts-src/my-results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1355,9 +1355,13 @@ function initReact() {

renderActions: function() {
// Render the actions for this period.
if (isPublic || !isAdmin) {
// In the public view or in the 'MyRSR' view as a non-admin:
// Only display whether the period is locked or not.
if (isPublic) {
// In the public view, display nothing.
return (
<span />
);
} else if (!isAdmin) {
// In the 'MyRSR' view as a non-admin, display whether the period is locked or not.
switch(this.props.period.locked) {
case false:
return (
Expand All @@ -1373,8 +1377,7 @@ function initReact() {
);
}
} else {
// In the 'MyRSR' view as an admin:
// Show the buttons to lock or unlock a period.
// In the 'MyRSR' view as an admin, show the buttons to lock or unlock a period.
if (this.state.lockingOrUnlocking) {
return (
<td className="actions-td">
Expand Down Expand Up @@ -1576,11 +1579,12 @@ function initReact() {
<td>
<i className="fa fa-spin fa-spinner" /> {i18nResults.loading} {i18nResults.indicator_periods}
</td>
<td /><td /><td />
</tr>
</tbody>;
}

var actionCell = isPublic ? <span /> : <td className="th-actions" />;

return (
<div className="indicator-period-list selfProject">
<h4 className="indicator-periods-title">{i18nResults.indicator_periods}</h4>
Expand All @@ -1591,7 +1595,7 @@ function initReact() {
<td className="th-period">{i18nResults.period}</td>
<td className="th-target">{i18nResults.target_value}</td>
<td className="th-actual">{i18nResults.actual_value}</td>
<td className="th-actions"/>
{actionCell}
</tr>
</thead>
{periods}
Expand Down Expand Up @@ -1694,8 +1698,10 @@ function initReact() {
}

return (
<div
className="noIndicators">{i18nResults.no_indicators} {addIndicatorsLink}</div>
<div className="noIndicators">
{i18nResults.no_indicators} {addIndicatorsLink}
<a href="https://akvorsr.supporthero.io/article/show/design-a-results-framework" target="_blank">{i18nResults.more_info}</a>
</div>
);
} else if (this.props.selectedPeriod !== null) {
// Show a list of indicator updates.
Expand Down Expand Up @@ -1901,13 +1907,9 @@ function initReact() {
}

if (this.expanded()) {
// Show a different text when the result is selected (expanded).
// Do not show a text when the result is selected (expanded).
return (
<span className="result-indicator-count">
<i className="fa fa-tachometer" />
<span className="indicator-count inlined">{indicatorLength}</span>
<p>{this.indicatorText()}:</p>
</span>
<span />
);
} else {
// Show the number of indicators
Expand Down
1 change: 1 addition & 0 deletions akvo/templates/myrsr/my_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ <h4 class="resultProjectTitle">
"indicator": "{% trans 'Indicator' %}",
"indicators": "{% trans 'Indicators' %}",
"no_indicators": "{% trans 'This result has no indicators yet' %}",
"more_info": "{% trans 'Find out more about adding indicators to the results framework' %}",
"add_indicators": "{% trans 'Add indicators' %}",
"indicator_period": "{% trans 'Indicator period' %}",
"indicator_periods": "{% trans 'Indicator period(s)' %}",
Expand Down
1 change: 1 addition & 0 deletions akvo/templates/project_main.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"indicator": "{% trans 'Indicator' %}",
"indicators": "{% trans 'Indicators' %}",
"no_indicators": "{% trans 'This result has no indicators yet' %}",
"more_info": "{% trans 'Find out more about adding indicators to the results framework' %}",
"add_indicators": "{% trans 'Add indicators' %}",
"indicator_period": "{% trans 'Indicator period' %}",
"indicator_periods": "{% trans 'Indicator periods' %}",
Expand Down

0 comments on commit 928d1e4

Please sign in to comment.