Skip to content

Commit 9b9860a

Browse files
committed
Merge branch 'release-0.9.0'
2 parents 8eb8231 + 9c00205 commit 9b9860a

File tree

260 files changed

+11807
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+11807
-247
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
### 0.9.0 (2014-12-16)
2+
**Species+ Admin:**
3+
* nomenclature management (temporarily disabled)
4+
* changes to user roles (adding API users)
5+
6+
**Species+:**
7+
* fixes to CITES Suspensions downloads and wording of sources
8+
19
### 0.8.11 (2014-11-25)
210
**Species+ Admin:**
311
* fix for phantom opinions

Gemfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ gem 'devise'
2222
gem 'cancan'
2323
gem 'ahoy_matey'
2424
gem 'gon'
25+
gem 'wicked'
2526

2627
gem 'sidekiq'
2728
gem 'sidekiq-status'
@@ -35,8 +36,8 @@ gem 'jquery-mousewheel-rails'
3536
gem 'jquery-cookie-rails'
3637
gem 'bootstrap-sass', '~> 2.3.1.0'
3738
gem 'kaminari'
38-
gem 'select2-rails'
39-
gem 'nested_form', '~> 0.3.1'
39+
gem 'select2-rails', '~> 3.5.7'
40+
gem 'nested_form', '~> 0.3.2'
4041
gem 'acts-as-taggable-on', '~> 2.3.1'
4142
gem 'carrierwave'
4243

@@ -107,13 +108,16 @@ group :test, :development do
107108
gem "json_spec"
108109
gem "database_cleaner", ">=1.2.0"
109110
gem "timecop"
111+
gem "launchy"
112+
gem 'byebug'
110113
end
111114

112115
group :test do
113116
gem "codeclimate-test-reporter", require: nil
114117
gem "factory_girl_rails", "~> 4.0"
115118
gem 'simplecov', :require => false
116119
gem 'coveralls', :require => false
120+
gem 'capybara'
117121
end
118122

119123
gem 'rake', '~> 10.0.3'

Gemfile.lock

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ GEM
8484
capistrano (>= 2.5)
8585
browser (0.6.0)
8686
builder (3.0.4)
87+
byebug (3.2.0)
88+
columnize (~> 0.8)
89+
debugger-linecache (~> 1.2)
8790
cancan (1.6.10)
8891
capistrano (2.15.4)
8992
highline
@@ -95,6 +98,12 @@ GEM
9598
capistrano (>= 1.0.0)
9699
capistrano-log_with_awesome (0.0.2)
97100
capistrano (>= 2.5.14)
101+
capybara (2.4.4)
102+
mime-types (>= 1.16)
103+
nokogiri (>= 1.3.3)
104+
rack (>= 1.0.0)
105+
rack-test (>= 0.5.4)
106+
xpath (~> 2.0)
98107
carrierwave (0.10.0)
99108
activemodel (>= 3.2.0)
100109
activesupport (>= 3.2.0)
@@ -119,6 +128,7 @@ GEM
119128
execjs
120129
coffee-script-source (1.4.0)
121130
colorize (0.5.8)
131+
columnize (0.8.9)
122132
compass (0.12.2)
123133
chunky_png (~> 1.2)
124134
fssm (>= 0.2.7)
@@ -136,6 +146,7 @@ GEM
136146
rails (>= 3.0.0)
137147
database_cleaner (1.2.0)
138148
debug_inspector (0.0.2)
149+
debugger-linecache (1.2.0)
139150
devise (3.2.4)
140151
bcrypt (~> 3.0)
141152
orm_adapter (~> 0.1)
@@ -224,6 +235,8 @@ GEM
224235
kaminari (0.14.1)
225236
actionpack (>= 3.0.0)
226237
activesupport (>= 3.0.0)
238+
launchy (2.4.3)
239+
addressable (~> 2.3)
227240
listen (0.7.2)
228241
lumberjack (1.0.2)
229242
mail (2.5.4)
@@ -240,18 +253,18 @@ GEM
240253
activerecord
241254
activerecord-postgres-hstore
242255
activesupport
243-
nested_form (0.3.1)
256+
nested_form (0.3.2)
244257
net-scp (1.1.1)
245258
net-ssh (>= 2.6.5)
246259
net-sftp (2.1.2)
247260
net-ssh (>= 2.6.5)
248261
net-ssh (2.6.7)
249262
net-ssh-gateway (1.2.0)
250263
net-ssh (>= 2.6.5)
251-
netrc (0.7.7)
252-
nokogiri (1.6.3.1)
253-
mini_portile (= 0.6.0)
254-
oj (2.1.4)
264+
netrc (0.7.9)
265+
nokogiri (1.6.5)
266+
mini_portile (~> 0.6.0)
267+
oj (2.11.1)
255268
orm_adapter (0.5.0)
256269
pg (0.17.1)
257270
pg-hstore (1.2.0)
@@ -330,7 +343,7 @@ GEM
330343
railties (~> 3.2.0)
331344
sass (>= 3.1.10)
332345
tilt (~> 1.3)
333-
select2-rails (3.2.1)
346+
select2-rails (3.5.7)
334347
thor (~> 0.14)
335348
sentient_user (0.3.3)
336349
railties (>= 3.1)
@@ -395,6 +408,10 @@ GEM
395408
whenever (0.8.4)
396409
activesupport (>= 2.3.4)
397410
chronic (>= 0.6.3)
411+
wicked (1.0.3)
412+
rails (>= 3.0.7)
413+
xpath (2.0.0)
414+
nokogiri (~> 1.3)
398415
yajl-ruby (1.1.0)
399416

400417
PLATFORMS
@@ -410,10 +427,12 @@ DEPENDENCIES
410427
binding_of_caller (>= 0.7.2)
411428
bootstrap-sass (~> 2.3.1.0)
412429
brightbox (>= 2.3.9)
430+
byebug
413431
cancan
414432
capistrano
415433
capistrano-ext
416434
capistrano-slack!
435+
capybara
417436
carrierwave
418437
clerk
419438
codeclimate-test-reporter
@@ -443,9 +462,10 @@ DEPENDENCIES
443462
jslint_on_rails
444463
json_spec
445464
kaminari
465+
launchy
446466
memcache-client
447467
nested-hstore
448-
nested_form (~> 0.3.1)
468+
nested_form (~> 0.3.2)
449469
nokogiri
450470
oj
451471
pg
@@ -461,7 +481,7 @@ DEPENDENCIES
461481
rspec-rails
462482
rvm-capistrano
463483
sass-rails (~> 3.2.3)
464-
select2-rails
484+
select2-rails (~> 3.5.7)
465485
sextant
466486
sidekiq
467487
sidekiq-status
@@ -477,4 +497,5 @@ DEPENDENCIES
477497
underscore-rails
478498
webrick (= 1.3.1)
479499
whenever
500+
wicked
480501
yajl-ruby
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
$(document).ready ->
2+
defaultTaxonSelect2Options = {
3+
placeholder: 'Start typing scientific name'
4+
width: '300px'
5+
minimumInputLength: 3
6+
quietMillis: 500
7+
allowClear: true
8+
initSelection: (element, callback) =>
9+
id = $(element).val()
10+
if (id != null && id != '')
11+
callback({id: id, text: $(element).attr('data-name') + ' ' + $(element).attr('data-name-status')})
12+
13+
ajax:
14+
url: '/admin/taxon_concepts/autocomplete'
15+
dataType: 'json'
16+
data: (query, page) ->
17+
search_params:
18+
scientific_name: query
19+
name_status: this.data('name-status-filter')
20+
taxonomy:
21+
id: this.data('taxonomy-id')
22+
per_page: 25
23+
page: 1
24+
results: (data, page) => # parse the results into the format expected by Select2.
25+
formatted_taxon_concepts = data.map (tc) =>
26+
id: tc.id
27+
text: tc.full_name + ' ' + tc.name_status
28+
results: formatted_taxon_concepts
29+
}
30+
$('.taxon-concept').select2(defaultTaxonSelect2Options)
31+
$('.taxon-concept').on('change', (event) ->
32+
return false unless event.val
33+
$.when($.ajax( '/admin/taxon_concepts/' + event.val + '.json' ) ).then(( data, textStatus, jqXHR ) =>
34+
$(this).attr('data-name', data.full_name)
35+
$(this).attr('data-name-status', data.name_status)
36+
if $(this).hasClass('status-change')
37+
# reload the name status dropdown based on selection
38+
statusDropdown = $(this).closest('.fields').find('select')
39+
statusFrom = data.name_status
40+
$(statusDropdown).find('option').attr('disabled', true)
41+
statusMap =
42+
'A': ['S']
43+
'N': ['A', 'S']
44+
'S': ['A']
45+
'T': ['A', 'S']
46+
$(statusDropdown).find('option[value=' + statusFrom + ']').removeAttr('selected')
47+
defaultStatus = statusMap[statusFrom][0]
48+
$(statusDropdown).find('option[value=' + defaultStatus + ']').attr('selected', true)
49+
$.each(statusMap[statusFrom], (i, status) ->
50+
$(statusDropdown).find('option[value=' + status + ']').removeAttr('disabled')
51+
)
52+
)
53+
if $(this).hasClass('clear-others')
54+
# reset selection in other taxon concept select2 instances
55+
$('input.taxon-concept').not($(this)).each((i, ac) ->
56+
$(ac).select2('val', '')
57+
$(ac).removeAttr('data-name')
58+
$(ac).removeAttr('data-name-status')
59+
)
60+
)
61+
62+
$(document).on('nested:fieldAdded', (event) ->
63+
# this field was just inserted into your form
64+
field = event.field
65+
# it's a jQuery object already
66+
taxonField = field.find('.taxon-concept')
67+
# and activate select2
68+
taxonField.select2(defaultTaxonSelect2Options)
69+
)
70+
71+
simpleTaxonSelect2Options = {
72+
placeholder: 'Start typing scientific name'
73+
width: '200px'
74+
}
75+
$('.simple-taxon-concept').select2(simpleTaxonSelect2Options)
76+
.on('select2-removed', (event) ->
77+
$(this).closest('.controls').find('.select-all-checkbox').prop('checked', false)
78+
79+
$('.species-checkbox:contains('+event.choice.text+')')
80+
.find('.select-partial-checkbox').prop('checked', false)
81+
)
82+
83+
$('.select-all-checkbox').click (e) ->
84+
checkboxElement = $(e.target)
85+
selectElement = checkboxElement.parent().find('select')
86+
if checkboxElement.is(':checked')
87+
selectElement.find('option').prop("selected","selected")
88+
else
89+
selectElement.find('option').removeAttr("selected")
90+
selectElement.trigger("change")
91+
92+
$('.select-partial-checkbox').click (e) ->
93+
checkboxElement = $(e.target)
94+
species = $(checkboxElement).parent().find('span').text()
95+
selectElement = checkboxElement.parent().parent().find('select')
96+
if checkboxElement.is(':checked')
97+
selectElement.find('option:contains('+species+')').prop("selected","selected")
98+
else
99+
selectElement.find('option:contains('+species+')').removeAttr("selected")
100+
selectElement.trigger("change")
101+
102+
$('form').on('click', '.output-radio', (e) ->
103+
value = $(this).val()
104+
switch value
105+
when "New taxon"
106+
NewTaxonForm(this)
107+
when "Existing taxon"
108+
ExistingTaxonForm(this)
109+
when "Existing subspecies"
110+
UpgradedTaxonForm(this)
111+
)
112+
113+
HideInputTaxon = (obj) ->
114+
input_taxon = $(obj).closest('.fields').find('.input-taxon')
115+
input_taxon.select2('data',null)
116+
input_taxon.hide()
117+
input_taxon.closest('.control-group').find('label').hide()
118+
119+
ShowInputTaxon = (obj) ->
120+
input_taxon = $(obj).closest('.fields').find('.input-taxon')
121+
input_taxon.show()
122+
input_taxon.closest('.control-group').find('label').show()
123+
124+
HideUpgradeInfo = (obj) ->
125+
upgrade_info = $(obj).closest('.fields').find('.upgrade-info')
126+
upgrade_info.first().hide()
127+
upgrade_info.find('input').prop("value", '')
128+
$(obj).closest('.fields').find('.parent-taxon').select2('data',null)
129+
130+
NewTaxonForm = (obj) ->
131+
HideInputTaxon(obj)
132+
$(obj).closest('.fields').find('.upgrade-info').first().show()
133+
134+
ExistingTaxonForm = (obj) ->
135+
ShowInputTaxon(obj)
136+
HideUpgradeInfo(obj)
137+
138+
UpgradedTaxonForm = (obj) ->
139+
ShowInputTaxon(obj)
140+
$(obj).closest('.fields').find('.upgrade-info').first().show()
141+
142+
DefaultExistingTaxon = (obj) ->
143+
$(obj).find('.output-radio[value="Existing taxon"]').attr("checked","checked")
144+
ExistingTaxonForm(obj)
145+
146+
OutputsDefaultConfiguration = ->
147+
$('.fields').each (index) ->
148+
taxon_concept = $(this).find('input.input-taxon')
149+
parent = $(this).find('input.parent-taxon')
150+
151+
if typeof taxon_concept.attr("data-name") == 'undefined'
152+
$(this).find('.output-radio[value="New taxon"]').attr("checked","checked")
153+
NewTaxonForm(this)
154+
else if typeof parent.attr("data-name") == 'undefined'
155+
$(this).find('.output-radio[value="Existing taxon"]').attr("checked","checked")
156+
ExistingTaxonForm(this)
157+
else
158+
$(this).find('.output-radio[value="Existing subspecies"]').attr("checked","checked")
159+
UpgradedTaxonForm(this)
160+
161+
OutputsDefaultConfiguration()

app/assets/javascripts/admin/tag.js.coffee

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/assets/javascripts/application.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
//= require bootstrap-dropdown
1717
//= require bootstrap-button
1818
//= require select2
19-
//= require_tree ./application

app/assets/javascripts/application/exports.js.coffee

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{{#if decision.subspecies_info}}
3636
{{{decision.subspecies_info}}}<br />
3737
{{/if}}
38-
{{decision.term.name}} {{decision.source.name}} <br />
38+
{{decision.term.name}} {{#if decision.source.code}}{{decision.source.code}} - {{decision.source.name}}{{/if}} <br />
3939
{{{decision.notes}}}
4040
</td>
4141
<td class="last">
@@ -86,7 +86,7 @@
8686
{{#if decision.subspecies_info}}
8787
{{{decision.subspecies_info}}}<br />
8888
{{/if}}
89-
{{decision.term.name}} {{decision.source.name}} <br />
89+
{{decision.term.name}} {{#if decision.source.code}}{{decision.source.code}} - {{decision.source.name}}{{/if}} <br />
9090
{{{decision.notes}}}
9191
</td>
9292
<td class="last">

0 commit comments

Comments
 (0)