Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-1.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacug committed Jan 17, 2024
2 parents 1baddf0 + 7ab0d62 commit 5c92872
Show file tree
Hide file tree
Showing 45 changed files with 2,627 additions and 120 deletions.
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
### 1.13.0
**Species+**
* Fix security issue
* Remove .spp suffix from Hybrids
* Add CITES RST download from the public interface
* Add new Identification materials documents (csv and pdf)
* Fix GA missing functions on develop and staging envs
* Include non standard (EN, ES, FR) languages to autocomplete mview
* Fix commission notes documents loading
* Allow matches anywhere in trade permit number string, instead of just the start
* Add Chinese common names
* Add first draft of dockerizing the app

**Trade Monitoring Tool**
* Update csvs
* Fix downloads when no appendix is submitted

**Checklist**
* Include EU(Regions) to the geo entity types

### 1.12.0
* Allow intersessional decisions to be created without start events or documents

Expand Down
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Dockerfile
FROM ruby:2.3.1

# The ruby:2.3.1 image is ancient, based of debian jessie which no longer
# receives active security updates. Therefore we must declare the debian
# archive as a source instead.
RUN rm /etc/apt/sources.list && \
echo "deb http://archive.debian.org/debian-security jessie/updates main" \
>> /etc/apt/sources.list.d/jessie.list && \
echo "deb http://archive.debian.org/debian jessie main" \
>> /etc/apt/sources.list.d/jessie.list \
;

# Rails and SAPI has some additional dependencies, e.g. rake requires a JS
# runtime, so attempt to get these from apt, where possible
RUN apt-get update && apt-get install -y --force-yes \
libsodium-dev libgmp3-dev libssl-dev \
libpq-dev postgresql-client \
nodejs \
texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra \
;
# NB: Postgres client from Debian is 9.4 - not sure if this is acceptable

RUN mkdir /SAPI
WORKDIR /SAPI

COPY Gemfile /SAPI/Gemfile
COPY Gemfile.lock /SAPI/Gemfile.lock
RUN gem install bundler -v 1.17.3
RUN bundle install

COPY . /SAPI

EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ group :development do
gem 'jslint_on_rails'
gem 'git_pretty_accept'
gem 'rubocop', '~> 0.40.0', require: false
gem 'letter_opener'
gem 'rbnacl', '>= 3.2', '< 5.0'
gem 'rbnacl-libsodium'
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ GEM
activesupport (>= 3.0.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
launchy (~> 2.2)
listen (0.7.2)
lumberjack (1.0.2)
mail (2.5.5)
Expand Down Expand Up @@ -573,7 +571,6 @@ DEPENDENCIES
json_spec (= 1.1.5)
kaminari
launchy
letter_opener
memcache-client
nested-hstore
nested_form (~> 0.3.2)
Expand Down
15 changes: 6 additions & 9 deletions app/assets/javascripts/cites_trade/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,12 @@ $(document).ready(function(){
$.cookie('cites_trade.csv_separator', csv_separator)
query += '&filters[csv_separator]=' + csv_separator;

// google analytics function only defined on production
if (typeof(ga) === 'function') {
ga('send', {
hitType: 'event',
eventCategory: 'Downloads: ' + report_type,
eventAction: 'Format: CSV',
eventLabel: csv_separator
});
}
ga('send', {
hitType: 'event',
eventCategory: 'Downloads: ' + report_type,
eventAction: 'Format: CSV',
eventLabel: csv_separator
});
downloadResults( decodeURIComponent( query ) );
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Species.DownloadsController = Ember.Controller.extend Species.Spinner,
needs: [
'downloadsForCmsListings',
'downloadsForCitesListings', 'downloadsForCitesRestrictions',
'downloadsForCitesListings', 'downloadsForCitesRestrictions', 'downloadsForCitesProcesses',
'downloadsForEuListings', 'downloadsForEuDecisions'
]
downloadsPopupVisible: false
Expand All @@ -23,6 +23,9 @@ Species.DownloadsController = Ember.Controller.extend Species.Spinner,
legislationIsCitesRestrictions: ( ->
@get('citesLegislation') == 'restrictions'
).property('citesLegislation')
legislationIsCitesProcesses: ( ->
@get('citesLegislation') == 'processes'
).property('citesLegislation')
legislationIsEuListings: ( ->
@get('euLegislation') == 'listings'
).property('euLegislation')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Species.DownloadsForCitesListingsController = Ember.Controller.extend
}
).filter((e) ->
e.taxonConcepts.length > 0
)
)
else
@get('higherTaxaController.contentByRank')
).property('higherTaxaController.contentByRank.@each', 'taxonConceptQuery')
Expand Down Expand Up @@ -103,4 +103,4 @@ Species.DownloadsForCitesListingsController = Ember.Controller.extend
@set('selectedTaxonConcepts', [])

deleteGeoEntitySelection: (context) ->
@get('selectedGeoEntities').removeObject(context)
@get('selectedGeoEntities').removeObject(context)
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
Species.DownloadsForCitesProcessesController = Ember.Controller.extend
designation: 'cites'

needs: ['geoEntities','higherTaxaCitesEu', 'downloads']

higherTaxaController: ( ->
@get('controllers.higherTaxaCitesEu')
).property()

geoEntityQuery: null
taxonConceptQuery: null
selectedGeoEntities: []
selectedTaxonConcepts: []
timeScope: 'current'
timeScopeIsCurrent: ( ->
@get('timeScope') == 'current'
).property('timeScope')
years: [1975..new Date().getFullYear()]
selectedYears: []
processType: 'Both'
documentTypeIsCitesSuspensions: ( ->
@get('documentType') == 'CitesSuspensions'
).property('documentType')

autoCompleteTaxonConcepts: ( ->
if @get('taxonConceptQuery') && @get('taxonConceptQuery').length > 0
re = new RegExp("^"+@get('taxonConceptQuery'),"i")
@get('higherTaxaController.contentByRank')
.map((e) =>
{
rankName: e.rankName
taxonConcepts: e.taxonConcepts.filter((item) =>
re.test item.get('fullName')
)
}
).filter((e) ->
e.taxonConcepts.length > 0
)
else
@get('higherTaxaController.contentByRank')
).property('higherTaxaController.contentByRank.@each', 'taxonConceptQuery')

autoCompleteRegions: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.regions')
.filter (item, index, enumerable) =>
re.test item.get('name')
else
@get('controllers.geoEntities.regions')
).property('controllers.geoEntities.regions.@each', 'geoEntityQuery')

autoCompleteCountries: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
re.test item.get('name')
else
@get('controllers.geoEntities.countries')
).property('controllers.geoEntities.countries.@each', 'geoEntityQuery')

selectedGeoEntitiesIds: ( ->
@get('selectedGeoEntities').mapProperty('id')
).property('selectedGeoEntities.@each')

selectedTaxonConceptsIds: ( ->
@get('selectedTaxonConcepts').mapProperty('id')
).property('selectedTaxonConcepts.@each')

toParams: ( ->
{
data_type: 'Processes'
filters:
process_type: @get('processType')
designation: @get('designation')
geo_entities_ids: @get('selectedGeoEntitiesIds')
taxon_concepts_ids: @get('selectedTaxonConceptsIds')
set: @get('timeScope')
years: @get('selectedYears')
csv_separator: @get('controllers.downloads.csvSeparator')
}
).property(
'selectedGeoEntitiesIds.@each', 'selectedTaxonConceptsIds.@each',
'timeScope', 'selectedYears.@each', 'processType', 'controllers.downloads.csvSeparator'
)

downloadUrl: ( ->
'/species/exports/download?' + $.param(@get('toParams'))
).property('toParams')

actions:
startDownload: () ->
@set('downloadInProgress', true)
@set('downloadMessage', 'Downloading...')
$.ajax({
type: 'GET'
dataType: 'json'
url: @get('downloadUrl')
}).done((data) =>
@set('downloadInProgress', false)
if data.total > 0
@set('downloadMessage', null)
ga('send', {
hitType: 'event',
eventCategory: 'Downloads: ' + @get('processType'),
eventAction: 'Format: CSV',
eventLabel: @get('controllers.downloads.csvSeparator')
})
window.location = @get('downloadUrl')
return
else
@set('downloadMessage', 'No results')
)

deleteTaxonConceptSelection: (context) ->
@set('selectedTaxonConcepts', [])

deleteGeoEntitySelection: (context) ->
@get('selectedGeoEntities').removeObject(context)

deleteYearSelection: (context) ->
@get('selectedYears').removeObject(Number(context))
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ Species.ElibrarySearchController = Ember.Controller.extend Species.Spinner,
allDocumentTypes = @get('controllers.events.documentTypes')
.concat @get('controllers.events.interSessionalDocumentTypes')
.concat @get('controllers.events.identificationDocumentTypes')

if @get('isSignedIn')
allDocumentTypes = allDocumentTypes.concat(@get('controllers.events.interSessionalNonPublicDocumentTypes'))
@set('selectedDocumentType', allDocumentTypes.findBy('id', filtersHash.document_type))

general_subtype_type = @get_general_subtype_type(filtersHash)
Expand Down Expand Up @@ -71,10 +72,10 @@ Species.ElibrarySearchController = Ember.Controller.extend Species.Spinner,
general_subtype: isGeneralSubType
}

getDocTypeParam: ->
getDocTypeParam: ->
id = @get('selectedDocumentType.id')

if id != '__all__' then id else null
if id != '__all__' then id else null

filteredDocumentTypes: ( ->
if @get('selectedEventType')
Expand Down
Loading

0 comments on commit 5c92872

Please sign in to comment.