-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4579 from alphagov/add-local-transaction-model
Add local transaction model
- Loading branch information
Showing
15 changed files
with
211 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
class LocalTransaction < ContentItem | ||
attr_reader :country_name, :introduction, | ||
:lgil_code, :lgil_override, :lgsl_code, | ||
:more_information, :need_to_know | ||
|
||
def initialize(content_store_response) | ||
super(content_store_response) | ||
|
||
@introduction = content_store_response.dig("details", "introduction") | ||
@lgil_code = content_store_response.dig("details", "lgil_code") | ||
@lgil_override = content_store_response.dig("details", "lgil_override") | ||
@lgsl_code = content_store_response.dig("details", "lgsl_code") | ||
@more_information = content_store_response.dig("details", "more_information") | ||
@need_to_know = content_store_response.dig("details", "need_to_know") | ||
end | ||
|
||
def unavailable? | ||
country_name_availability_for("type") == "unavailable" | ||
end | ||
|
||
def devolved_administration_service? | ||
country_name_availability_for("type") == "devolved_administration_service" | ||
end | ||
|
||
def devolved_administration_service_alternative_url | ||
return unless devolved_administration_service? | ||
|
||
country_name_availability_for("alternative_url") | ||
end | ||
|
||
def set_country(country_name) | ||
@country_name = country_name.downcase.gsub(" ", "_") | ||
end | ||
|
||
def slug | ||
URI.parse(base_path).path.sub(%r{\A/}, "") | ||
end | ||
|
||
private | ||
|
||
def country_name_availability_for(key) | ||
content_store_response.dig("details", country_name_availability, key) | ||
end | ||
|
||
def country_name_availability | ||
"#{country_name}_availability" | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
app/views/local_transaction/devolved_administration_service.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.