Skip to content

Commit

Permalink
Merge branch 'release-0.9.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
agnessa committed Mar 10, 2015
2 parents dcf419f + abc00ff commit 46cb624
Show file tree
Hide file tree
Showing 126 changed files with 1,909 additions and 457 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.0.0-p481
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Species.DownloadsForCitesListingsController = Ember.Controller.extend

autoCompleteRegions: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.regions')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand All @@ -42,7 +42,7 @@ Species.DownloadsForCitesListingsController = Ember.Controller.extend

autoCompleteCountries: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Species.DownloadsForCitesRestrictionsController = Ember.Controller.extend

autoCompleteRegions: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.regions')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand All @@ -52,7 +52,7 @@ Species.DownloadsForCitesRestrictionsController = Ember.Controller.extend

autoCompleteCountries: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Species.DownloadsForCmsListingsController = Ember.Controller.extend

autoCompleteRegions: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.regions')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand All @@ -42,7 +42,7 @@ Species.DownloadsForCmsListingsController = Ember.Controller.extend

autoCompleteCountries: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Species.DownloadsForEuDecisionsController = Ember.Controller.extend

autoCompleteRegions: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.regions')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand All @@ -54,7 +54,7 @@ Species.DownloadsForEuDecisionsController = Ember.Controller.extend

autoCompleteCountries: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Species.DownloadsForEuListingsController = Ember.Controller.extend

autoCompleteRegions: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.regions')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand All @@ -43,7 +43,7 @@ Species.DownloadsForEuListingsController = Ember.Controller.extend

autoCompleteCountries: ( ->
if @get('geoEntityQuery') && @get('geoEntityQuery').length > 0
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")
@get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
re.test item.get('name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Species.SearchController = Ember.Controller.extend Species.Spinner,
).property('taxonConceptQuery')

geoEntityQueryObserver: ( ->
re = new RegExp("^"+@get('geoEntityQuery'),"i")
re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i")

@set 'autoCompleteCountries', @get('controllers.geoEntities.countries')
.filter (item, index, enumerable) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
<th class="col2">COUNTRY</th>
<th class="col2">EU DECISIONS</th>
<th class="col3">NOTES</th>
<th class="col3">DOCUMENT</th>
<th class="col3">DOCUMENT</th>
</tr>
</thead>
<tbody {{bindAttr class="controller.euDecisionsExpanded:historic_expanded"}}>
{{#each decision in currentEuDecisions}}
<tr class="current">
<td>{{decision.start_date}}</td>
<td>{{decision.start_date}}
{{#if decision.original_start_date}}
<br>(valid since {{decision.original_start_date}})
{{/if}}
</td>
<td>{{decision.geo_entity.name}}</td>
<td>
{{#if decision.eu_decision_type.description}}
Expand Down Expand Up @@ -43,9 +47,11 @@
{{{decision.nomenclature_note_en}}}
</td>
<td class="last">
<a class="legal-links" href="{{unbound decision.start_event.url}}">
{{decision.start_event.name}}
</a>
{{#if decision.start_event.url}}
<a class="legal-links" href="{{unbound decision.start_event.url}}">
{{decision.start_event.name}}
</a>
{{/if}}
</td>
</tr>
{{else}}
Expand Down Expand Up @@ -98,9 +104,11 @@
{{{decision.nomenclature_note_en}}}
</td>
<td class="last">
<a class="legal-links" href="{{unbound decision.start_event.url}}">
{{decision.start_event.name}}
</a>
{{#if decision.start_event.url}}
<a class="legal-links" href="{{unbound decision.start_event.url}}">
{{decision.start_event.name}}
</a>
{{/if}}
</td>
</tr>
{{/each}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Trade.SandboxShipmentsController = Ember.ArrayController.extend Trade.ShipmentPa
@get('store').commit()
@clearModifiedFlags()
@transitionToParentController()
location.reload()

cancelChanges: () ->
@get('store').get('currentTransaction').rollback()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ Trade.SearchController = Ember.Controller.extend Trade.QueryParams, Trade.Flash,

autoCompleteObjects: (collectionName, columnName, query) ->
return @get(collectionName) unless query
re = new RegExp("^" + query, "i")
if collectionName != 'controllers.geoEntities'
query = "^" + query
else
query = "(^|\\(| )" + query
re = new RegExp(query, "i")
@get(collectionName).filter (element) ->
re.test(element.get(columnName))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,17 @@ Trade.SearchResultsController = Ember.ArrayController.extend Trade.QueryParams,
)

updateBatch: ->
updates = @get('batchUpdateParams').export()
if Object.keys(updates).length == 0
alert("No changes detected.")
return false
if confirm("This will update " + @get('total') + " shipments. Are you sure?")
$.ajax(
url: '/trade/shipments/update_batch'
type: 'POST'
data:
filters: @get('controllers.search.searchParams')
updates: @get('batchUpdateParams').export()
updates: updates
)
.done( (data) =>
@flashSuccess(message: 'Successfully updated ' + data.rows + ' shipments.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,63 @@ Trade.ShipmentBatchUpdate = Ember.Object.extend
exporter: null
countryOfOrigin: null
reporterType: null
importPermitNumber: null
exportPermitNumber: null
originPermitNumber: null
countryOfOriginBlank: false
unitBlank: false
sourceBlank: false
purposeBlank: false
importPermitNumberBlank: false
exportPermitNumberBlank: false
originPermitNumberBlank: false

columns: (->
[
'taxonConceptId', 'reportedTaxonConceptId', 'appendix', 'year',
'term', 'unit', 'purpose', 'source',
'importer', 'exporter', 'countryOfOrigin', 'reporterType'
'importer', 'exporter', 'countryOfOrigin', 'reporterType',
'importPermitNumber', 'exportPermitNumber', 'originPermitNumber'
]
).property()

nullableColumns: (->
[
'countryOfOrigin', 'unit', 'source', 'purpose',
'importPermitNumber', 'exportPermitNumber', 'originPermitNumber'
]
).property()

columnsToExportAsIds: (->
[
'term', 'unit', 'purpose', 'source',
'importer', 'exporter', 'countryOfOrigin'
]
).property()

reset: ->
@get('columns').forEach( (c) =>
@set(c, null)
if @get('nullableColumns').contains(c)
blankPropertyName = c + 'Blank'
@set(blankPropertyName, false)
)

export: ->
result = {}
@get('columns').forEach( (c) =>
property_value = @get(c)
if property_value
property_name = c.decamelize()
if typeof property_value == 'object'
result[property_name + '_id'] = property_value.get('id')
else
result[property_name] = property_value
propertyValue = @get(c)
propertyNameForBackend = c.decamelize()
if @get('columnsToExportAsIds').contains(c)
propertyNameForBackend += '_id'
if propertyValue
if @get('columnsToExportAsIds').contains(c)
propertyValue = propertyValue.get('id')
result[propertyNameForBackend] = propertyValue
if @get('nullableColumns').contains(c)
blankPropertyName = c + 'Blank'
if @get(blankPropertyName)
result[propertyNameForBackend] = null
)
result

Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@
<label>
Year<br><input type="text" name="year">
</label>
<label class="blank-checkbox">
<input type="checkbox" name="year">set blank
</label>
</div>
<div class="attribute-area clearfix">
<label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<form action="#">
<fieldset>
<div class="heading">
Name, Appendix and Year
Name, Appendix & Year
</div>
<div class="inner">
<div class="attribute-area left taxon-name">
Expand Down Expand Up @@ -43,14 +43,14 @@
</div>

<div class="heading">
Trade Codes
Trade Codes & Quantity
</div>
<div class="inner">
<div class="attribute-area left">
<p>Term Code</p>
<p class="small">Current value: <span class="blue">{{currentShipment.termCode}}</p>
{{view Trade.Select2
prompt="Please select term code value"
prompt="Select"
contentBinding="controllers.terms"
optionValuePath="content.code"
optionLabelPath="content.code"
Expand All @@ -61,7 +61,7 @@
<p>Unit Code</p>
<p class="small">Current value: <span class="blue">{{currentShipment.unitCode}}</p>
{{view Trade.Select2
prompt="Please select unit code value"
prompt="Select"
contentBinding="controllers.units"
optionValuePath="content.code"
optionLabelPath="content.code"
Expand All @@ -72,7 +72,7 @@
<p>Purpose Code</p>
<p class="small">Current value: <span class="blue">{{currentShipment.purposeCode}}</p>
{{view Trade.Select2
prompt="Please select purpose code value"
prompt="Select"
contentBinding="controllers.purposes"
optionValuePath="content.code"
optionLabelPath="content.code"
Expand All @@ -83,13 +83,21 @@
<p>Source Code</p>
<p class="small">Current value: <span class="blue">{{currentShipment.sourceCode}}</p>
{{view Trade.Select2
prompt="Please select source code value"
prompt="Select"
contentBinding="controllers.sources"
optionValuePath="content.code"
optionLabelPath="content.code"
valueBinding="currentShipment.sourceCode"
}}
</div>
<div class="attribute-area left">
<p>Quantity</p>
<p class="small">Current value: <span class="blue">{{currentShipment.quantity}}</span></p>
{{view Ember.TextField
prompt="Please type quantity value"
valueBinding="currentShipment.quantity"
}}
</div>
</div>

<div class="heading">
Expand Down Expand Up @@ -121,7 +129,7 @@
</div>

<div class="heading">
Permit & Quantity
Permit
</div>
<div class="inner">
<div class="attribute-area left">
Expand All @@ -148,14 +156,6 @@
valueBinding="currentShipment.originPermit"
}}
</div>
<div class="attribute-area left">
<p>Quantity</p>
<p class="small">Current value: <span class="blue">{{currentShipment.quantity}}</span></p>
{{view Ember.TextField
prompt="Please type quantity value"
valueBinding="currentShipment.quantity"
}}
</div>
</div>

</fieldset>
Expand All @@ -164,7 +164,7 @@
<div class="modal-footer">
{{confirm-button title="Update" action="updateShipment" shipmentBinding="currentShipment"
}}
<button {{action 'cancelShipmentEdit' currentShipment }} class="pull-right btn btn-primary">
<button {{action 'cancelShipmentEdit' currentShipment }} class="pull-right btn">
Cancel
</button>
</div>
Loading

0 comments on commit 46cb624

Please sign in to comment.