Skip to content

Commit

Permalink
Merge pull request #766 from unepwcmc/EU-opinions
Browse files Browse the repository at this point in the history
Eu opinions
  • Loading branch information
lucacug committed Jun 10, 2020
2 parents 408ee66 + 6386bfe commit 5f580fd
Show file tree
Hide file tree
Showing 40 changed files with 1,464 additions and 190 deletions.
5 changes: 4 additions & 1 deletion app/assets/javascripts/admin/taxon_concept.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ $(document).ready ->
.focus(-> $(@).animate(height: "15em", 500))
.blur(-> $(@).animate(height: "4em", 500))

$('.select2').select2()
$('.select2').select2({
placeholder: "Choose an option",
allowClear: true
})

$(".datepicker").datepicker(
format: "dd/mm/yyyy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ Species.DownloadsForEuDecisionsController = Ember.Controller.extend
selectedTaxonConcepts: []
timeScope: 'current'
timeScopeIsCurrent: ( ->
@get('timeScope') == 'current'
current = @get('timeScope') == 'current'
if current
@set('selectedYears', [])
current
).property('timeScope')
years: [1975..new Date().getFullYear()]
selectedYears: []
positiveOpinions: true
negativeOpinions: true
noOpinions: true
srgReferral: true
suspensions: true
euDecisionFilter: 'Default'
euDecisionFilterIsDefault: ( ->
@get('euDecisionFilter') == 'Default'
).property('euDecisionFilter')

autoCompleteTaxonConcepts: ( ->
if @get('taxonConceptQuery') && @get('taxonConceptQuery').length > 0
Expand All @@ -37,7 +45,7 @@ Species.DownloadsForEuDecisionsController = Ember.Controller.extend
}
).filter((e) ->
e.taxonConcepts.length > 0
)
)
else
@get('higherTaxaController.contentByRank')
).property('higherTaxaController.contentByRank.@each', 'taxonConceptQuery')
Expand Down Expand Up @@ -71,27 +79,56 @@ Species.DownloadsForEuDecisionsController = Ember.Controller.extend
).property('selectedTaxonConcepts.@each')

toParams: ( ->
{
data_type: 'EuDecisions'
filters:
designation: @get('designation')
geo_entities_ids: @get('selectedGeoEntitiesIds')
taxon_concepts_ids: @get('selectedTaxonConceptsIds')
set: @get('timeScope')
years: @get('selectedYears')
decision_types:
{
positiveOpinions: @get('positiveOpinions')
# IF EU DECISION FILTER IS "IN CONSULTATION" - DON'T APPLY ALL FILTERS
if @get('euDecisionFilter').toUpperCase() == 'IN CONSULTATION'
{
data_type: 'EuDecisions'
filters: {
designation: @get('designation')
csv_separator: @get('controllers.downloads.csvSeparator')
eu_decision_filter: @get('euDecisionFilter')
}
}
else
{
data_type: 'EuDecisions'
filters: {
####################################################
########## DEFAULT EU DECISION FILTERS #############
####################################################
designation: @get('designation')
csv_separator: @get('controllers.downloads.csvSeparator')
eu_decision_filter: @get('euDecisionFilter')
####################################################
geo_entities_ids: @get('selectedGeoEntitiesIds')
set: @get('timeScope')
taxon_concepts_ids: @get('selectedTaxonConceptsIds')
years: @get('selectedYears')
decision_types: {
negativeOpinions: @get('negativeOpinions')
noOpinions: @get('noOpinions')
positiveOpinions: @get('positiveOpinions')
srgReferral: @get('srgReferral')
suspensions: @get('suspensions')
}
csv_separator: @get('controllers.downloads.csvSeparator')
}
####################################################
####################################################
####################################################
}
}

).property(
'selectedGeoEntitiesIds.@each', 'selectedTaxonConceptsIds.@each',
'timeScope', 'selectedYears.@each', 'positiveOpinions', 'negativeOpinions',
'noOpinions', 'suspensions', 'controllers.downloads.csvSeparator'
'controllers.downloads.csvSeparator',
'euDecisionFilter',
'negativeOpinions',
'noOpinions',
'positiveOpinions',
'selectedGeoEntitiesIds.@each',
'selectedTaxonConceptsIds.@each',
'selectedYears.@each',
'srgReferral',
'suspensions',
'timeScope'
)

downloadUrl: ( ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ Species.TaxonConceptController = Ember.ObjectController.extend Species.SearchCon
Species.SignedInStatus,
needs: ['search', 'taxonConceptDocuments']
searchContext: 'species'
legalHeadings: [
{ id: 'cites_listings', name: 'CITES Listing', class: 'first' },
{ id: 'cites_quotas', name: 'CITES Quotas' },
{ id: 'cites_suspensions', name: 'CITES Suspensions' },
{ id: 'eu_listings', name: 'EU Listing' },
{ id: 'eu_decisions', name: 'EU Decisions', class: 'last' }
]

actions: {
scrollIntoView: (id) ->
event.preventDefault()
document.getElementById(id).scrollIntoView({ behavior: 'smooth' })
}

isCms: ( ->
if @get('taxonomy') != undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Species.TaxonConceptLegalController = Ember.ArrayController.extend
citesQuotasExpanded: false
euDecisionsExpanded: false


actions:
expandList: (id, flag) ->
this.set(flag, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Species.TaxonConcept = DS.Model.extend
cmsInstruments: DS.attr("array")
euListings: DS.attr("array")
euDecisions: DS.attr("array")
srgHistory: DS.attr("array")
distributionReferences: DS.attr("array")
taxonomy: DS.attr("string")
nomenclatureNoteEn: DS.attr("string")
Expand Down
136 changes: 82 additions & 54 deletions app/assets/javascripts/species/templates/downloads_for_eu.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -77,82 +77,110 @@
isVisibleBinding="controller.legislationIsEuDecisions"
controllerBinding="controllers.downloadsForEuDecisions"
}}
<div class="doc-type">
<strong class="heading">DOCUMENT TYPE</strong>
<div class="typy-columns">
<div class="col">
<div class="row">



<div class="bs-container p-3">
<div class="bs-row mb-3">
<div class="bs-col-auto p-3">
<div class="sub-heading">
<label>
{{view Ember.Checkbox checkedBinding="negativeOpinions"}}
SRG Negative Opinions
{{view Ember.RadioButton name="in_consultation" selectionBinding="euDecisionFilter" value="Default"}}
EU Decision Types
</label>
</div>
<div class="row">
</div>
<div class="bs-col-auto p-3 bs-border-left">
<div class="sub-heading">
<label>
{{view Ember.Checkbox checkedBinding="noOpinions"}}
SRG No Opinions
{{view Ember.RadioButton name="in_consultation" selectionBinding="euDecisionFilter" value="In consultation"}}
In Consultation
</label>
</div>
</div>
<div class="col">
<div class="row">
</div>
{{#if euDecisionFilterIsDefault }}
<div class="mb-4">
<div>
<label>
{{view Ember.Checkbox checkedBinding="negativeOpinions"}}
SRG Negative Opinions
</label>
</div>
<div>
<label>
{{view Ember.Checkbox checkedBinding="positiveOpinions"}}
SRG Positive Opinions
</label>
</div>
<div class="row">
<div>
<label>
{{view Ember.Checkbox checkedBinding="srgReferral"}}
SRG Referral
</label>
</div>
<div>
<label>
{{view Ember.Checkbox checkedBinding="suspensions"}}
Suspensions
</label>
</div>
<div>
<label>
{{view Ember.Checkbox checkedBinding="noOpinions"}}
SRG Historic No Opinions
</label>
</div>
</div>
</div>
</div>
<div class="info-columns">
<div class="col">
<ul class="tab-link">
<li>
{{#view Species.ToggleButton option="current" valueBinding="controller.timeScope"}}
CURRENT
{{/view}}
</li>
<li class="last-child">
{{#view Species.ToggleButton option="all" valueBinding="controller.timeScope"}}
ALL
{{/view}}
</li>
</ul>
</div>
<div class="col">
{{#if timeScopeIsCurrent}}
Only current data has<br />been selected.
{{else}}
<div class="popup-area">
{{view Species.YearSearchButton selectedYearsBinding="controller.selectedYears"}}
{{view Species.YearSearchDropdown controllerBinding="controller"}}

<div class="info-columns">
<div class="col">
<ul class="tab-link">
<li>
{{#view Species.ToggleButton option="current" valueBinding="controller.timeScope"}}
CURRENT
{{/view}}
</li>
<li class="last-child">
{{#view Species.ToggleButton option="all" valueBinding="controller.timeScope"}}
ALL
{{/view}}
</li>
</ul>
</div>
<div class="col">
{{#if timeScopeIsCurrent}}
Only current data has<br />been selected.
{{else}}
<div class="popup-area">
{{view Species.YearSearchButton selectedYearsBinding="controller.selectedYears"}}
{{view Species.YearSearchDropdown controllerBinding="controller"}}
</div>
{{/if}}
</div>
{{/if}}
</div>
</div>
<div class="bottom-columns">
<div class="col">
<div class="popup-area">
{{view Species.HigherTaxaSearchButton controllerBinding="controller"}}
{{view Species.HigherTaxaSearchDropdown controllerBinding="controller"}}
</div>
</div>
<div class="col">
<div class="popup-area">
{{view Species.GeoEntitiesSearchButton
selectedGeoEntitiesBinding="controller.selectedGeoEntities"
loadedBinding="controller.loaded"
}}
{{view Species.GeoEntitiesSearchDropdown controllerBinding="controller"}}
<div class="bottom-columns">
<div class="col">
<div class="popup-area">
{{view Species.HigherTaxaSearchButton controllerBinding="controller"}}
{{view Species.HigherTaxaSearchDropdown controllerBinding="controller"}}
</div>
</div>
<div class="col">
<div class="popup-area">
{{view Species.GeoEntitiesSearchButton
selectedGeoEntitiesBinding="controller.selectedGeoEntities"
loadedBinding="controller.loaded"
}}
{{view Species.GeoEntitiesSearchDropdown controllerBinding="controller"}}
</div>
</div>
</div>
</div>
{{/if}}
</div>



<div class="btn-holder">
{{view Species.StartDownloadButton controllerBinding="controller"}}
<div class="message-area">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
<li>{{#linkTo 'taxonConcept.legal'}}LEGAL{{/linkTo}}
<ul>
{{#unless isCms }}
<li class="first"><a href="#cites_listings" class="scroll-to">CITES Listing</a></li>
<li><a href="#cites_quotas" class="scroll-to">CITES Quotas</a></li>
<li><a href="#cites_suspensions" class="scroll-to">CITES Suspensions</a></li>
<li><a href="#eu_listings" class="scroll-to">EU Listing</a></li>
<li class="last"><a href="#eu_decisions" class="scroll-to">EU Decisions</a></li>
{{#each heading in this.legalHeadings }}
<li {{bind-attr class="heading.class"}}>
<a href=#{{unbound heading.id}} class="scroll-to" {{action 'scrollIntoView' heading.id}}>
{{ heading.name }}
</a>
</li>
{{/each}}
{{/unless}}
</ul>
</li>
Expand Down
Loading

0 comments on commit 5f580fd

Please sign in to comment.