govuk_content_models 25.0.0 → 26.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/app/models/local_transaction_edition.rb +9 -9
- data/app/models/place_edition.rb +8 -9
- data/app/models/transaction_edition.rb +9 -10
- data/lib/govuk_content_models/test_helpers/factories.rb +3 -4
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/workflow_test.rb +1 -3
- metadata +4 -6
- data/app/models/expectant.rb +0 -21
- data/app/models/expectation.rb +0 -12
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 26.0.0
|
2
|
+
|
3
|
+
- Removes `Expectation` model and introduces `need_to_know` `String` field on
|
4
|
+
Transaction, LocalTransaction and Place editions to store the expectations
|
5
|
+
as a govspeak field.
|
6
|
+
|
1
7
|
## 25.0.0
|
2
8
|
|
3
9
|
- Removes the `alternative_title` field from the `Edition` class.
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require "expectant"
|
2
1
|
require "local_service"
|
3
2
|
require "edition"
|
4
3
|
|
5
4
|
class LocalTransactionEdition < Edition
|
6
|
-
|
5
|
+
field :lgsl_code, type: Integer
|
6
|
+
field :lgil_override, type: Integer
|
7
|
+
field :introduction, type: String
|
8
|
+
field :more_information, type: String
|
9
|
+
field :need_to_know, type: String
|
10
|
+
field :minutes_to_complete, type: String
|
11
|
+
field :uses_government_gateway, type: Boolean
|
7
12
|
|
8
|
-
|
9
|
-
field :lgil_override, type: Integer
|
10
|
-
field :introduction, type: String
|
11
|
-
field :more_information, type: String
|
12
|
-
|
13
|
-
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:introduction, :more_information]
|
13
|
+
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:introduction, :more_information, :need_to_know]
|
14
14
|
|
15
15
|
@fields_to_clone = [
|
16
16
|
:lgsl_code, :introduction, :more_information,
|
17
|
-
:minutes_to_complete, :
|
17
|
+
:minutes_to_complete, :need_to_know
|
18
18
|
]
|
19
19
|
|
20
20
|
validate :valid_lgsl_code
|
data/app/models/place_edition.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
require "edition"
|
2
|
-
require "expectant"
|
3
2
|
|
4
3
|
class PlaceEdition < Edition
|
5
|
-
|
4
|
+
field :introduction, type: String
|
5
|
+
field :more_information, type: String
|
6
|
+
field :need_to_know, type: String
|
7
|
+
field :place_type, type: String
|
8
|
+
field :minutes_to_complete, type: String
|
9
|
+
field :uses_government_gateway, type: Boolean
|
6
10
|
|
7
|
-
|
8
|
-
field :more_information, type: String
|
9
|
-
field :place_type, type: String
|
11
|
+
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:introduction, :more_information, :need_to_know]
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
@fields_to_clone = [:introduction, :more_information, :place_type,
|
14
|
-
:expectation_ids]
|
13
|
+
@fields_to_clone = [:introduction, :more_information, :place_type, :need_to_know]
|
15
14
|
|
16
15
|
def whole_body
|
17
16
|
self.introduction
|
@@ -1,22 +1,21 @@
|
|
1
1
|
require "edition"
|
2
|
-
require "expectant"
|
3
2
|
|
4
3
|
class TransactionEdition < Edition
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
field :
|
9
|
-
field :
|
10
|
-
field :link, type: String
|
11
|
-
field :more_information, type: String
|
4
|
+
field :introduction, type: String
|
5
|
+
field :will_continue_on, type: String
|
6
|
+
field :link, type: String
|
7
|
+
field :more_information, type: String
|
8
|
+
field :need_to_know, type: String
|
12
9
|
field :alternate_methods, type: String
|
10
|
+
field :minutes_to_complete, type: String
|
11
|
+
field :uses_government_gateway, type: Boolean
|
13
12
|
|
14
|
-
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:introduction, :more_information, :alternate_methods]
|
13
|
+
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:introduction, :more_information, :alternate_methods, :need_to_know]
|
15
14
|
|
16
15
|
@fields_to_clone = [:introduction, :will_continue_on, :link,
|
17
16
|
:more_information, :alternate_methods,
|
18
17
|
:minutes_to_complete, :uses_government_gateway,
|
19
|
-
:
|
18
|
+
:need_to_know]
|
20
19
|
|
21
20
|
def indexable_content
|
22
21
|
"#{super} #{Govspeak::Document.new(introduction).to_text} #{Govspeak::Document.new(more_information).to_text}".strip
|
@@ -168,11 +168,13 @@ FactoryGirl.define do
|
|
168
168
|
sequence(:lgsl_code) { |nlgsl| nlgsl }
|
169
169
|
introduction { "Test introduction" }
|
170
170
|
more_information { "This is more information" }
|
171
|
+
need_to_know "This service is only available in England and Wales"
|
171
172
|
end
|
172
173
|
|
173
174
|
factory :transaction_edition, :parent => :edition, :class => "TransactionEdition" do
|
174
175
|
introduction { "Test introduction" }
|
175
176
|
more_information { "This is more information" }
|
177
|
+
need_to_know "This service is only available in England and Wales"
|
176
178
|
link "http://continue.com"
|
177
179
|
will_continue_on "To be continued..."
|
178
180
|
alternate_methods "Method A or Method B"
|
@@ -208,14 +210,11 @@ FactoryGirl.define do
|
|
208
210
|
lgil_code 0
|
209
211
|
end
|
210
212
|
|
211
|
-
factory :expectation do
|
212
|
-
sequence(:text) {|n| "You will need #{n} of these."}
|
213
|
-
end
|
214
|
-
|
215
213
|
factory :place_edition do
|
216
214
|
title "Far far away"
|
217
215
|
introduction "Test introduction"
|
218
216
|
more_information "More information"
|
217
|
+
need_to_know "This service is only available in England and Wales"
|
219
218
|
place_type "Location location location"
|
220
219
|
end
|
221
220
|
|
@@ -42,10 +42,8 @@ class WorkflowTest < ActiveSupport::TestCase
|
|
42
42
|
def template_user_and_published_transaction
|
43
43
|
user = User.create(name: "Ben")
|
44
44
|
other_user = User.create(name: "James")
|
45
|
-
expectation = Expectation.create text:"Credit card required"
|
46
45
|
|
47
|
-
transaction = user.create_edition(:transaction, title: "My title", slug: "my-title", panopticon_id: @artefact.id)
|
48
|
-
transaction.expectation_ids = [expectation.id]
|
46
|
+
transaction = user.create_edition(:transaction, title: "My title", slug: "my-title", panopticon_id: @artefact.id, need_to_know: "Credit card required")
|
49
47
|
transaction.save
|
50
48
|
|
51
49
|
request_review(user, transaction)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_content_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 26.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -348,8 +348,6 @@ files:
|
|
348
348
|
- app/models/completed_transaction_edition.rb
|
349
349
|
- app/models/curated_list.rb
|
350
350
|
- app/models/edition.rb
|
351
|
-
- app/models/expectant.rb
|
352
|
-
- app/models/expectation.rb
|
353
351
|
- app/models/guide_edition.rb
|
354
352
|
- app/models/help_page_edition.rb
|
355
353
|
- app/models/licence_edition.rb
|
@@ -476,7 +474,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
476
474
|
version: '0'
|
477
475
|
segments:
|
478
476
|
- 0
|
479
|
-
hash: -
|
477
|
+
hash: -3896108249963512199
|
480
478
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
481
479
|
none: false
|
482
480
|
requirements:
|
@@ -485,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
485
483
|
version: '0'
|
486
484
|
segments:
|
487
485
|
- 0
|
488
|
-
hash: -
|
486
|
+
hash: -3896108249963512199
|
489
487
|
requirements: []
|
490
488
|
rubyforge_project:
|
491
489
|
rubygems_version: 1.8.23
|
data/app/models/expectant.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Expectant
|
2
|
-
|
3
|
-
module ClassMethods
|
4
|
-
def expectation_choices
|
5
|
-
Hash[Expectation.all.order_by(text: :asc).map {|e| [e.text, e._id.to_s] }]
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
extend ActiveSupport::Concern
|
10
|
-
|
11
|
-
included do
|
12
|
-
field :expectation_ids, type: Array, default: []
|
13
|
-
field :minutes_to_complete, type: String
|
14
|
-
field :uses_government_gateway, type: Boolean
|
15
|
-
end
|
16
|
-
|
17
|
-
def expectations
|
18
|
-
Expectation.criteria.in(_id: self.expectation_ids)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|