diff --git a/classes/Homepage.php b/classes/Homepage.php index 852e025b7d..ec1b9e6e6d 100644 --- a/classes/Homepage.php +++ b/classes/Homepage.php @@ -47,10 +47,27 @@ public function display() { $data['featured'] = $this->getEditorialContent(); $data['topics'] = $this->getFrontPageTopics(); $data['divisions'] = $this->getRecentDivisions(); + $data['search_box'] = $this->getSearchBox($data); return $data; } + protected function getSearchBox(array $data): Search\SearchBox{ + $search_box = new Search\SearchBox(); + $search_box->homepage_panel_class = "panel--homepage--overall"; + $search_box->homepage_subhead = ""; + $search_box->homepage_desc = "Understand who represents you, across the UK's Parliaments."; + $search_box->search_section = ""; + $search_box->quick_links = []; + if (count($data["mp_data"])) { + $search_box->add_quick_link('Find out more about your MP (' . $data["mp_data"]['name'] . ')', $data["mp_data"]['mp_url']); + } + $search_box->add_quick_link('Create and manage email alerts', '/alert/'); + $search_box->add_quick_link('Subscribe to our newsletter', 'https://www.mysociety.org/subscribe/'); + $search_box->add_quick_link('Donate to support our work', '/support-us/'); + return $search_box; + } + protected function getRegionalList() { return null; } diff --git a/classes/SPHomepage.php b/classes/SPHomepage.php index 527ec1fb58..d658297799 100644 --- a/classes/SPHomepage.php +++ b/classes/SPHomepage.php @@ -15,6 +15,23 @@ class SPHomepage extends Homepage { 'SPWRANSLIST' => array('recent_wrans', 'spwransfront', 'Written answers'), ); + protected function getSearchBox(array $data): Search\SearchBox{ + $search_box = new Search\SearchBox(); + $search_box->homepage_panel_class = "panel--homepage--scotland"; + $search_box->homepage_subhead = "Scottish Parliament"; + $search_box->homepage_desc = ""; + $search_box->search_section = "scotland"; + $search_box->quick_links = []; + if (count($data["mp_data"])) { + $regional_con = $data["regional"][0]["constituency"]; + $search_box->add_quick_link('Find out more about your MSPs for ' . $data["mp_data"]["constituency"] . '(' . $regional_con . ')', '/postcode/?pc=' . $data["mp_data"]['postcode'] ); + } + $search_box->add_quick_link('Create and manage email alerts', '/alert/'); + $search_box->add_quick_link('Subscribe to our newsletter', 'https://www.mysociety.org/subscribe/'); + $search_box->add_quick_link('Donate to support our work', '/support-us/'); + return $search_box; + } + protected function getEditorialContent() { $debatelist = new \SPLIST; $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none'); diff --git a/classes/Search/SearchBox.php b/classes/Search/SearchBox.php new file mode 100644 index 0000000000..ee7caaad36 --- /dev/null +++ b/classes/Search/SearchBox.php @@ -0,0 +1,34 @@ +homepage_panel_class = $homepage_panel_class; + $this->homepage_subhead = $homepage_subhead; + $this->homepage_desc = $homepage_desc; + $this->search_section = $search_section; + $this->quick_links = $quick_links; + } + + public function add_quick_link(string $title, string $url): void + { + $this->quick_links[] = ['title' => $title, 'url' => $url]; + } + +} + +?> \ No newline at end of file diff --git a/classes/SectionView/NiView.php b/classes/SectionView/NiView.php index 31720b3f19..a73598b9f5 100644 --- a/classes/SectionView/NiView.php +++ b/classes/SectionView/NiView.php @@ -88,10 +88,37 @@ protected function display_front_ni() { $data['debates'] = array( 'recent' => $recent); $data['regional'] = $this->getMLAList(); + $data['search_box'] = $this->getSearchBox($data); $data['template'] = 'ni/index'; return $data; } + + protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox{ + + global $THEUSER; + + if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { + $postcode = $THEUSER->postcode(); + } else { + $postcode = null; + } + + $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); + $search_box->homepage_panel_class = "panel--homepage--niassembly"; + $search_box->homepage_subhead = "Northern Ireland Assembly"; + $search_box->homepage_desc = ""; + $search_box->search_section = "ni"; + $search_box->quick_links = []; + if (count($data["regional"])) { + $constituency = $data["regional"][0]["constituency"]; + $search_box->add_quick_link('Find out more about your MLAs for ' . $constituency, '/postcode/?pc=' . $postcode); + } + $search_box->add_quick_link('Create and manage email alerts', '/alert/'); + $search_box->add_quick_link('Subscribe to our newsletter', 'https://www.mysociety.org/subscribe/'); + $search_box->add_quick_link('Donate to support our work', '/support-us/'); + return $search_box; + } protected function getMLAList() { global $THEUSER; diff --git a/classes/SectionView/SeneddView.php b/classes/SectionView/SeneddView.php index 6ccb7a15d3..0c9200299b 100644 --- a/classes/SectionView/SeneddView.php +++ b/classes/SectionView/SeneddView.php @@ -98,11 +98,42 @@ protected function display_front_senedd() { $data['debates'] = array( 'recent' => $recent); $data['regional'] = $this->getMSList(); + $data['search_box'] = $this->getSearchBox($data); $data['template'] = 'senedd/index'; return $data; } + protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox{ + $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); + $search_box->homepage_panel_class = "panel--homepage--senedd"; + if (LANGUAGE == 'cy') { + $search_box->homepage_subhead = "Senedd"; + } else { + $search_box->homepage_subhead = "Senedd / Welsh Parliament"; + } + $search_box->homepage_desc = ""; + $search_box->search_section = "senedd"; + $search_box->quick_links = []; + if (count($data["regional"])) { + // get all unique constituencies + $constituencies = array(); + foreach ($data["regional"] as $member) { + $constituencies[$member["constituency"]] = 1; + } + $constituencies = array_keys($constituencies); + if (LANGUAGE == 'cy'){ + $search_box->add_quick_link('Darganfod mwy am eich Aelodau Cynulliad dros ' . $constituencies[0] . ' a ' . $constituencies[1], '/postcode/?pc=' . $data["mp_data"]['postcode']); + } else { + $search_box->add_quick_link('Find out more about your MSs for ' . $constituencies[0] . ' and ' . $constituencies[1], '/postcode/?pc=' . $data["mp_data"]['postcode']); + } + } + $search_box->add_quick_link(gettext('Create and manage email alerts'), '/alert/'); + $search_box->add_quick_link(gettext('Subscribe to our newsletter'), 'https://www.mysociety.org/subscribe/'); + $search_box->add_quick_link(gettext('Donate to support our work'), '/support-us/'); + return $search_box; + } + protected function getMSList() { global $THEUSER; diff --git a/www/docs/style/img/mysoc-footer/logo-mysociety-white.svg b/www/docs/style/img/mysoc-footer/logo-mysociety-white.svg new file mode 100644 index 0000000000..d0348ac790 --- /dev/null +++ b/www/docs/style/img/mysoc-footer/logo-mysociety-white.svg @@ -0,0 +1 @@ +mysociety-logo-grey \ No newline at end of file diff --git a/www/docs/style/img/niassembly-photo.jpg b/www/docs/style/img/niassembly-photo.jpg new file mode 100644 index 0000000000..31113507e2 Binary files /dev/null and b/www/docs/style/img/niassembly-photo.jpg differ diff --git a/www/docs/style/img/parliament-photo.jpg b/www/docs/style/img/parliament-photo.jpg new file mode 100644 index 0000000000..50362f8188 Binary files /dev/null and b/www/docs/style/img/parliament-photo.jpg differ diff --git a/www/docs/style/img/scotland-photo.jpg b/www/docs/style/img/scotland-photo.jpg new file mode 100644 index 0000000000..3459fcce42 Binary files /dev/null and b/www/docs/style/img/scotland-photo.jpg differ diff --git a/www/docs/style/img/senedd-photo.jpg b/www/docs/style/img/senedd-photo.jpg new file mode 100644 index 0000000000..2c7bfb9d0f Binary files /dev/null and b/www/docs/style/img/senedd-photo.jpg differ diff --git a/www/docs/style/sass/app.scss b/www/docs/style/sass/app.scss index 3484e5c59f..1e2bcfc69d 100644 --- a/www/docs/style/sass/app.scss +++ b/www/docs/style/sass/app.scss @@ -59,7 +59,7 @@ @import "accessible-autocomplete"; @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,400italic&display=swap); - +@import url(https://fonts.googleapis.com/css2?family=Merriweather&display=swap); /* Foundation Icons v 3.0 MIT License */ @font-face { font-family: "foundation-icons"; diff --git a/www/docs/style/sass/layout/_header.scss b/www/docs/style/sass/layout/_header.scss index f372df667a..909bc0a035 100644 --- a/www/docs/style/sass/layout/_header.scss +++ b/www/docs/style/sass/layout/_header.scss @@ -87,6 +87,7 @@ $badge-horizontal-shadow-desktop: -8px; &:hover, &:focus { text-decoration: none; background-color: darken($primary-color, 5%); + color: #fff !important; } } } diff --git a/www/docs/style/sass/pages/_home.scss b/www/docs/style/sass/pages/_home.scss index 7fccaf7397..ddfc0dbb99 100644 --- a/www/docs/style/sass/pages/_home.scss +++ b/www/docs/style/sass/pages/_home.scss @@ -3,6 +3,27 @@ color: #000; } + +.site-home__logo { + font-family: "Merriweather", serif; + font-weight: 400; + font-style: normal; + } + +.mysoc__org__logo { + display: block; + margin-top: 0.5em; + height: 0; + overflow: hidden; + padding-top: 32px; + } + + .mysoc__org__logo--mysociety { + width: 152px; + background-size: 152px 32px; + background-image: url('#{$mysoc-footer-image-path}logo-mysociety-white.svg'), none; + } + .hero__mp-search { @include grid-column(12); background-image: url('../img/homepage-hero-background-large.jpg'); @@ -318,18 +339,25 @@ input.homepage-search__button { } .home__search-suggestions { - @include grid-column(12); - margin-top: 1em; - @media (min-width: $large-screen) { - margin-top: 0; - @include grid-column(4); - } + margin-top: 0; + h3 { font-size: emCalc(14); font-weight: normal; } } +.home__search-suggestions p, .home__search-suggestions ul { + display: inline-block; + margin: 0; + vertical-align: middle; +} + +.home__search-suggestions p { + margin-right: 10px; /* Add space between p and ul */ +} + + .search-suggestions__list { @include inline-list; font-size: emCalc(14); diff --git a/www/docs/style/sass/parts/_panels.scss b/www/docs/style/sass/parts/_panels.scss index b94ebeb84c..12ba4d31ee 100644 --- a/www/docs/style/sass/parts/_panels.scss +++ b/www/docs/style/sass/parts/_panels.scss @@ -39,12 +39,71 @@ } } +.panel--homepage--overall { + background: rgba(#000, 0.5) url('../img/parliament-photo.jpg') center/cover no-repeat; + background-blend-mode: overlay; /* Blends the color with the image */ + + .quick-links__item { + background-color: #444; + display: inline-block; + } +} + +.panel--homepage--senedd { + background: rgba(#000, 0.5) url('../img/senedd-photo.jpg') center/cover no-repeat; + background-blend-mode: overlay; + + .quick-links__item { + background-color: #444; + display: inline-block; + } +} + +.panel--homepage--scotland { + background: rgba(#000, 0.5) url('../img/scotland-photo.jpg') center/cover no-repeat; + background-blend-mode: overlay; + + .quick-links__item { + background-color: #444; + display: inline-block; + } +} + +.panel--homepage--niassembly { + background: rgba(#000, 0.5) url('../img/niassembly-photo.jpg') center/cover no-repeat; + background-blend-mode: overlay; + + .quick-links__item { + background-color: #444; + display: inline-block; + } +} + +.home__quick-links{ + padding-top:20px; + +} + .panel--primary { - background-color: $colour_primary; - color: #fff; + background-size: cover; + background-repeat: no-repeat; + color: $colour_off_white; + + h1 { + color: $colour_off_white; + margin-bottom: 5px; + } - a, h2, h3 { - color: inherit; + h2, label, li { + color: $colour_mid_grey; + } + + a { + color: #fff; + } + + h3 { + color: $colour_off_white } .button { diff --git a/www/includes/easyparliament/templates/html/homepage/search-box.php b/www/includes/easyparliament/templates/html/homepage/search-box.php new file mode 100644 index 0000000000..1c475cc974 --- /dev/null +++ b/www/includes/easyparliament/templates/html/homepage/search-box.php @@ -0,0 +1,59 @@ +
+
+ +
+
+ + +
+
+ +

Popular searches today

+ + +
+ +
+

Built by + +

+
+
\ No newline at end of file diff --git a/www/includes/easyparliament/templates/html/index.php b/www/includes/easyparliament/templates/html/index.php index aa48984822..6a04dcbf80 100644 --- a/www/includes/easyparliament/templates/html/index.php +++ b/www/includes/easyparliament/templates/html/index.php @@ -3,80 +3,11 @@ # include 'homepage/promo-banner.php'; ?> -
-
- -
-
-

Democracy: it’s for everyone

-

You shouldn’t have to be an expert to understand what goes on in Parliament.

-

TheyWorkForYou takes open data from the UK's Parliaments, and presents it in a way that’s easy to follow – for everyone.

- About TheyWorkForYou -
-
-
-
- - -
-
- -
- -

Popular searches today

-
    - $popular_search) { ?> -
  • - -
- -
-
-
+ +
diff --git a/www/includes/easyparliament/templates/html/ni/index.php b/www/includes/easyparliament/templates/html/ni/index.php index 03af667f24..ba4d7572a2 100644 --- a/www/includes/easyparliament/templates/html/ni/index.php +++ b/www/includes/easyparliament/templates/html/ni/index.php @@ -1,70 +1,6 @@ -
-
- -
-
-

Democracy: it’s for everyone

-

You shouldn’t have to be an expert to understand what goes on in the Northern Ireland Assembly.

-

TheyWorkForYou takes open data from the Northern Ireland Assembly, and presents it in a way that’s easy to follow – for everyone.

- Find out more about TheyWorkForYou -
-
-
-
-
-
- -
- -

Popular searches today

-
    - $popular_search) { ?> -
  • - -
- -
-
-
+