From 9400669cc98171f040eb12390f76a4f4801f5b6d Mon Sep 17 00:00:00 2001 From: sergio marrocoli Date: Tue, 4 Jul 2023 12:06:20 +0100 Subject: [PATCH 1/8] feat: allow EuOpinions to have neither start_event_id ot document_id --- app/models/eu_opinion.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/eu_opinion.rb b/app/models/eu_opinion.rb index c6ac41c1f..1808be801 100644 --- a/app/models/eu_opinion.rb +++ b/app/models/eu_opinion.rb @@ -35,7 +35,7 @@ class EuOpinion < EuDecision validate :event_or_document_presence def event_or_document_presence - return if start_event_id.nil? ^ document_id.nil? - errors.add(:base, "Select at least an Event or a Document, but not both") + return unless start_event_id.present? && document_id.present? + errors.add(:base, "Select at an Event, a Document or neither, but not both") end end From 7f6dfd468de6e08ef3afda3881042bd1abd33898 Mon Sep 17 00:00:00 2001 From: sergio marrocoli Date: Wed, 30 Aug 2023 11:08:38 +0100 Subject: [PATCH 2/8] feat: Use filename to generate document title before it is sanitized --- app/models/document_batch.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/document_batch.rb b/app/models/document_batch.rb index f7a8cd5e8..0b3459288 100644 --- a/app/models/document_batch.rb +++ b/app/models/document_batch.rb @@ -40,7 +40,8 @@ def initialize_documents(documents_attributes, files) for idx in 0..(files.length - 1) do document_params = { type: documents_attributes[idx.to_s][:type], - filename: files[idx] + filename: files[idx], + title: files[idx].original_filename.sub(/.\w+$/, '') } @documents.push(Document.new(common_attributes.merge(document_params))) end From 658b68b3693a27164b4a6f54baf076f154f67c4c Mon Sep 17 00:00:00 2001 From: sergio marrocoli Date: Wed, 30 Aug 2023 11:10:16 +0100 Subject: [PATCH 3/8] Revert "feat: Use filename to generate document title before it is sanitized" This reverts commit 7f6dfd468de6e08ef3afda3881042bd1abd33898. --- app/models/document_batch.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/document_batch.rb b/app/models/document_batch.rb index 0b3459288..f7a8cd5e8 100644 --- a/app/models/document_batch.rb +++ b/app/models/document_batch.rb @@ -40,8 +40,7 @@ def initialize_documents(documents_attributes, files) for idx in 0..(files.length - 1) do document_params = { type: documents_attributes[idx.to_s][:type], - filename: files[idx], - title: files[idx].original_filename.sub(/.\w+$/, '') + filename: files[idx] } @documents.push(Document.new(common_attributes.merge(document_params))) end From b5884850ad0bfc1182725e8505f3f6baf0b75dbd Mon Sep 17 00:00:00 2001 From: lucacug Date: Tue, 12 Sep 2023 15:42:47 +0100 Subject: [PATCH 4/8] fix: tag as intersessional decision even when no doc or event name attached --- .../templates/taxon_concept/_eu_decisions.handlebars | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars index 754da8b2d..82f377390 100644 --- a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars +++ b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars @@ -69,6 +69,10 @@ Intersessional decision + {{else}} + {{#unless decision.start_event.name }} + Intersessional decision + {{/unless}} {{/if}} {{#if decision.private_url}} @@ -164,6 +168,10 @@ Intersessional decision + {{else}} + {{#unless decision.start_event.name }} + Intersessional decision + {{/unless}} {{/if}} {{#if decision.private_url}} From 36c7e470a4e58ce37ac6fdb20c793bbac090c6c2 Mon Sep 17 00:00:00 2001 From: lucacug Date: Tue, 12 Sep 2023 15:44:19 +0100 Subject: [PATCH 5/8] temp: temporary change the doc link to point to staging for testing(make sure to revert before merging)) --- .../species/templates/taxon_concept/_eu_decisions.handlebars | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars index 82f377390..8fbfb4d94 100644 --- a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars +++ b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars @@ -66,7 +66,7 @@ {{#if isSignedIn }} {{#if decision.intersessional_decision_id}} - + Intersessional decision {{else}} @@ -165,7 +165,7 @@ {{#if isSignedIn }} {{#if decision.intersessional_decision_id}} - + Intersessional decision {{else}} @@ -173,6 +173,7 @@ Intersessional decision {{/unless}} {{/if}} + {{/if}} {{#if decision.private_url}} {{decision.start_event.name}} From c52500a829c3498d179ae676eeceaae5db890508 Mon Sep 17 00:00:00 2001 From: lucacug Date: Tue, 12 Sep 2023 15:57:57 +0100 Subject: [PATCH 6/8] fix: remove extra if clause --- .../species/templates/taxon_concept/_eu_decisions.handlebars | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars index 8fbfb4d94..e95b63366 100644 --- a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars +++ b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars @@ -173,7 +173,6 @@ Intersessional decision {{/unless}} {{/if}} - {{/if}} {{#if decision.private_url}} {{decision.start_event.name}} From 81db5a70e1f219a1ab8fa63b55d6d167db251006 Mon Sep 17 00:00:00 2001 From: sergio marrocoli Date: Thu, 14 Sep 2023 13:38:30 +0100 Subject: [PATCH 7/8] Revert "temp: temporary change the doc link to point to staging for testing(make sure to revert before merging))" This reverts commit 36c7e470a4e58ce37ac6fdb20c793bbac090c6c2. --- .../species/templates/taxon_concept/_eu_decisions.handlebars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars index e95b63366..82f377390 100644 --- a/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars +++ b/app/assets/javascripts/species/templates/taxon_concept/_eu_decisions.handlebars @@ -66,7 +66,7 @@ {{#if isSignedIn }} {{#if decision.intersessional_decision_id}} - + Intersessional decision {{else}} @@ -165,7 +165,7 @@ {{#if isSignedIn }} {{#if decision.intersessional_decision_id}} - + Intersessional decision {{else}} From 006186a1ef48447b371fda0315f1f213e194774c Mon Sep 17 00:00:00 2001 From: sergio marrocoli Date: Thu, 14 Sep 2023 13:43:35 +0100 Subject: [PATCH 8/8] chore: update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 247fff9f3..bc8c16513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 1.12.0 +* Allow intersessional decisions to be created without start events or documents + ### 1.11.0 * Adds accepted names to serializer to match documented end point * Adds diactric insensitive seraching to geo_entity_search