-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #439 from Vizzuality/feat/company-doesnt-have-mq-b…
…eta-data feat: adding beta_mq_assessments? to company model
- Loading branch information
Showing
10 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.info-tooltip { | ||
position: relative; | ||
max-width: 200px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ReactTooltip from 'react-tooltip'; | ||
|
||
const InfoTooltip = ({ trigger, content, html }) => ( | ||
<span className="base-tooltip"> | ||
{html ? <div data-tip={content} dangerouslySetInnerHTML={{ __html: trigger }} /> : <div data-tip={content}>{trigger}</div>} | ||
<ReactTooltip className="info-tooltip" /> | ||
</span> | ||
); | ||
|
||
InfoTooltip.propTypes = { | ||
trigger: PropTypes.any, | ||
content: PropTypes.any.isRequired, | ||
html: PropTypes.bool | ||
}; | ||
|
||
InfoTooltip.defaultProps = { | ||
trigger: ( | ||
<span className="base-tooltip__default-trigger">?</span> | ||
), | ||
html: false | ||
}; | ||
|
||
export default InfoTooltip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
<% if ENV['MQ_BETA_ENABLED'].to_s == 'true' %> | ||
<% link_html = link_to(enable_beta_data_tpi_mq_assessments_path, | ||
class: class_names('button', 'is-primary', 'mq-beta-scores__beta-button', 'active': session[:enable_beta_mq_assessments], 'disabled': !has_data), | ||
style: "min-width: 0;") { "BETA (V5.0)" } %> | ||
|
||
<div class="mq-beta-scores__container"> | ||
<span class="mq-beta-scores__text">MQ Methodology</span> | ||
<%= link_to disable_beta_data_tpi_mq_assessments_path, | ||
class: class_names('button', 'is-primary', 'no-margin', 'weight-normal': session[:enable_beta_mq_assessments], 'active': !session[:enable_beta_mq_assessments]), | ||
style: "min-width: 0;" do %> | ||
Current (V4.0) | ||
<% end %> | ||
<%= link_to enable_beta_data_tpi_mq_assessments_path, | ||
class: class_names('button', 'is-primary', 'mq-beta-scores__beta-button', 'active': session[:enable_beta_mq_assessments]), | ||
style: "min-width: 0;" do %> | ||
BETA (V5.0) | ||
<% end %> | ||
<% if has_data %> | ||
<%= link_html %> | ||
<% else %> | ||
<%= react_component("InfoTooltip", { | ||
trigger: link_html, | ||
content: 'It is not currently possible to show Beta (V5.0) scores for this company. Scores for the current methodology (V4.0) are shown in their place.', | ||
html: true, | ||
}) %> | ||
<% end %> | ||
</div> | ||
<div class="mq-beta-scores__divider"></div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters