-
Notifications
You must be signed in to change notification settings - Fork 0
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 #213 from dof-dss/development
Merge dev to main for release
- Loading branch information
Showing
15 changed files
with
115 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
show_banner: false | ||
service_url: 'https://www.nidirect.gov.uk/services/operation-shamrock.json' |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
(function ($, Drupal) { | ||
(function ($, Drupal, drupalSettings) { | ||
Drupal.behaviors.operationShamrock = { | ||
attach: function attach (context) { | ||
$('body', context).once('shamrock').each(function () { | ||
$.getJSON('/services/operation-shamrock.json', function (data) { | ||
$.getJSON(drupalSettings.origins_shamrock.service_url, function (data) { | ||
if (data.enabled) { | ||
$('body').prepend(data.banner); | ||
$('head').append(data.styling); | ||
$('body').prepend(data.banner_html); | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
})(jQuery, Drupal); | ||
})(jQuery, Drupal, drupalSettings); | ||
|
1 change: 1 addition & 0 deletions
1
...hamrock/modules/origins_shamrock_admin/config/install/origins_shamrock.admin.settings.yml
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
title: | ||
body: | ||
url: | ||
styles: | ||
published: false | ||
modified: '' |
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
11 changes: 11 additions & 0 deletions
11
origins_shamrock/modules/origins_shamrock_admin/origins_shamrock_admin.install
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,11 @@ | ||
<?php | ||
|
||
/** | ||
* Add styles configuration. | ||
*/ | ||
function origins_shamrock_admin_update_8001() { | ||
$config_factory = \Drupal::configFactory(); | ||
$config = $config_factory->getEditable('origins_shamrock.admin.settings'); | ||
$config->set('styles', "<style type='text/css'>.opsh--banner { background: #000; padding: 1.5em 21px;}@media screen and (max-width: 979px) { .opsh--banner { padding: 1.5em 12px; }}.opsh__link { display: block; max-width: 940px; margin: 0 auto;}.opsh__link:link { display: block; max-width: 940px; margin: 0 auto; color: #fff; text-decoration: none;}.opsh__link:visited { color: #bfb1ba;}.opsh__link:hover { text-decoration: none;}.opsh__link:hover .opsh__read-more { background-color: #fff; color: #000; outline: 1px solid #fff; text-decoration: none;}.opsh__link:focus { outline: 3px solid #fff; outline-offset: .5em;}.opsh__title { display: block; font-size: 3.6rem; margin-bottom: .5em; font-weight: bold; line-height: 1.25;}.opsh__msg { display: block; font-size: 1.8rem; line-height: 2.7rem; margin: .6rem 0 0;}.opsh__read-more { display: inline-block; font-size: 1.6rem; line-height: 2.1rem; margin: .6rem 0; text-decoration: underline;}@media screen and (max-width: 599px) { .opsh__title { font-size: 2.8rem; margin-bottom: 1.6rem; line-height: 3.2rem; } .opsh__msg { font-size: 1.6rem; line-height: 2.4rem; } .opsh__read-more { font-size: 1.4rem; line-height: 2.1rem; margin: .3rem 0; }}@media screen and (max-width: 480px) { .opsh__title { font-size: 2.1rem; margin-bottom: 1.6rem; line-height: 2.4rem; }}</style>"); | ||
$config->save(TRUE); | ||
} |
6 changes: 3 additions & 3 deletions
6
origins_shamrock/modules/origins_shamrock_admin/origins_shamrock_admin.links.menu.yml
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
origins_shamrock.administration: | ||
title: 'Shamrock Administration' | ||
title: 'Administration' | ||
route_name: origins.shamrock.admin.admin_form | ||
description: 'Configure Operation Shamrock banner' | ||
parent: origins.admin_config | ||
weight: 10 | ||
parent: origins_shamrock.configuration | ||
weight: 2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/** | ||
* Add service_url configuration. | ||
*/ | ||
function origins_shamrock_update_8001() { | ||
$config_factory = \Drupal::configFactory(); | ||
$config = $config_factory->getEditable('origins_shamrock.settings'); | ||
$config->set('service_url', 'https://www.nidirect.gov.uk/services/operation-shamrock.json'); | ||
$config->save(TRUE); | ||
} |
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ shamrock_banner: | |
dependencies: | ||
- core/jquery | ||
- core/drupal | ||
- core/drupalSettings |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
origins_shamrock.settings: | ||
title: 'Shamrock Settings' | ||
origins_shamrock.configuration: | ||
title: 'Operation Shamrock' | ||
route_name: origins.shamrock.settings_form | ||
description: 'Configure Operation Shamrock settings' | ||
parent: origins.admin_config | ||
weight: 10 | ||
origins_shamrock.settings: | ||
title: 'Settings' | ||
route_name: origins.shamrock.settings_form | ||
description: 'Configure Operation Shamrock settings' | ||
parent: origins_shamrock.configuration | ||
weight: 1 |
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