Skip to content

Commit

Permalink
Initial tidy of show Initiative page
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRust committed Jan 13, 2020
1 parent 440c4c8 commit a25c812
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 101 deletions.
95 changes: 57 additions & 38 deletions app/views/initiatives/_initiative_info.html.erb
Original file line number Diff line number Diff line change
@@ -1,62 +1,81 @@

<p>
Status: <%=initiative.status_name%><br />
<h2 class="u-mb">Description</h2>
<div class="u-mb">
<p>What: <%=initiative.description_what%></p>
<p>How: <%=initiative.description_how%></p>
<% if initiative.anticipated_carbon_saving.present? %>
Saving: <%=format_carbon_saving(initiative.anticipated_carbon_saving)%>
<p>Saving: <%=format_carbon_saving(initiative.anticipated_carbon_saving)%></p>
<% end %>
</p>
<p>Further Information: <%=initiative.description_further_information%></p>
</div>

<h2>Description</h2>
<p>What: <%=initiative.description_what%></p>
<p>How: <%=initiative.description_how%></p>
<p>Further Information: <%=initiative.description_further_information%></p>
<div class="Initiative-images_scroller">
<div class="Initiative-images">
<% initiative.images.each do |image|%>
<%= image_tag image.variant(resize_to_limit: [200, 200]) %>
<% end %>
</div>
</div>
<h2>Solutions</h2>
<% initiative.themes.each do |theme| %>
<p>Theme: <%=theme.name%></p>
<% end %>
<% initiative.solutions.each do |solution| %>
<p>Solution: <%=solution.name%></p>
<% end %>
<h2>Contacts</h2>
<p>Lead Group: <%=initiative.lead_group_name%></p>
<% if initiative.consent_to_share? %>
<p>Contact Name: <%=initiative.contact_name%></p>
<p>Contact Email: <%=initiative.contact_email%></p>
<p>Contact Phone: <%=initiative.contact_phone%></p>
<% end %>
<p>Partner Groups Role: <%=initiative.partner_groups_role%></p>
<% if initiative.related_initiatives? %>
<p>Related Initiatives: <%=initiative.related_initiatives%></p>
<% end %>
<h2>Websites</h2>
<% initiative.websites.each do |website| %>
<%=link_to website.website, website.website, target: '_blank' %>

<h2 class="u-mb">Solutions</h2>
<div class="u-mb">
<ul class="u-listBulleted">
<% initiative.themes.each do |theme| %>
<li>Theme: <%=theme.name%></li>
<% end %>
</ul>
<% if initiative.solutions.any? %>
<ul class="u-listBulleted">
<% initiative.solutions.each do |solution| %>
<li>Solution: <%=solution.name%></li>
<% end %>
</ul>
<% end %>
</div>

<h2 class="u-mb">Contacts</h2>
<div class="u-mb">
<p>Lead Group: <%=initiative.lead_group_name%></p>
<% if initiative.consent_to_share? %>
<p>Contact Name: <%=initiative.contact_name%></p>
<p>Contact Email: <%=initiative.contact_email%></p>
<p>Contact Phone: <%=initiative.contact_phone%></p>
<% end %>
<p>Partner Groups Role: <%=initiative.partner_groups_role%></p>
<% if initiative.related_initiatives? %>
<p>Related Initiatives: <%=initiative.related_initiatives%></p>
<% end %>
</div>

<% if initiative.websites.any? %>
<h2 class="u-mb">Websites</h2>
<div class="u-mb">
<ul class="u-listBulleted">
<% initiative.websites.each do |website| %>
<li><%=link_to website.website, website.website, target: '_blank' %></li>
<% end %>
</ul>
</div>
<% end %>

<% if local_assigns[:show_map] && show_map %>
<h2>Location</h2>
<p>Postcode: <%=initiative.postcode%></p>
<p>Locality: <%=initiative.location%></p>
<div class="Explore">
<h2 class="u-mb">Location</h2>
<div class="u-mb">
<p>Postcode: <%=initiative.postcode%></p>
<p>Locality: <%=initiative.location%></p>
</div>
<div class="Explore u-mb">
<% content_for :page_javascript do %>
<script type="text/json" id="map_data_json"><%=@map_data.to_json.html_safe%></script>
<%= javascript_packs_with_chunks_tag 'initiative_map', 'data-turbolinks-track': 'reload' %>
<% content_for :page_head do %>
<meta name="turbolinks-visit-control" content="reload">
<% end %>

<% end %>
<div class="Explore-map" id="initiative_location"></div>
</div>
<% end %>

<h2>Timestamps</h2>
<p>Created: <%=time_tag initiative.created_at%></p>
<p>Updated: <%=time_tag initiative.updated_at%></p>
<div class="u-textRight u-textMuted">
<p>Initiative Created: <%=time_tag initiative.created_at%></p>
<p>Last Updated: <%=time_tag initiative.updated_at%></p>
</div>
3 changes: 2 additions & 1 deletion app/views/initiatives/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
@initiative.name
] %>

<div class="PageHeader">
<div class="PageHeader u-mbL">
<h1 class="PageHeader-heading"><%=@initiative.name%></h1>
<p>Status: <%=@initiative.status_name%></p>
</div>
<div class="Initiative">
Expand Down
8 changes: 4 additions & 4 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@
</header>

<% if notice || alert %>
<section class="Alerts">
<div class="Alerts">
<% if notice %>
<p class="Alert Alert--info"><%= notice %></p>
<% end %>
<% if alert %>
<p class="Alert Alert--danger"><%= alert %></p>
<% end %>
</section>
</div>
<% end %>

<% content_class = yield :content_class %>
Expand All @@ -96,12 +96,12 @@

<footer class="Footer">
<div class="Container">
<section class="sponsors">
<div class="sponsors">
<h2>Sponsors</h2>
<div class="sponsors-logos">
<a class="sponsors-logo" href="https://featurist.co.uk" target="_blank"><img src="<%=asset_pack_path("media/logos/featurist.svg")%>"></a>
</div>
</section>
</div>
<p class="Footer-copyright">&copy; Carbon Map <time datetime="<%= Date.current.year %>"><%= Date.current.year %></time></p>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion app/views/partials/_breadcrumb.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<nav class="Breadcrumb">
<nav class="Breadcrumb u-mbL">
<ol class="Breadcrumb-list">
<% items.each do |item| %>
<li class="Breadcrumb-listItem">
Expand Down
14 changes: 8 additions & 6 deletions frontend/styles/application.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

@import "normalize.css";
@import "leaflet.markercluster/dist/MarkerCluster.css";
@import "leaflet.markercluster/dist/MarkerCluster.Default.css";
@import "leaflet-gesture-handling/dist/leaflet-gesture-handling.css";
@import "sidebar-v2/css/leaflet-sidebar.css";
@import "suitcss-base";
@import "./base/variables";
@import "./base/base";
@import "./components/alert";
Expand All @@ -23,3 +18,10 @@
@import "./components/nav";
@import "./components/page_header";
@import "./components/sponsors";
@import "leaflet.markercluster/dist/MarkerCluster.css";
@import "leaflet.markercluster/dist/MarkerCluster.Default.css";
@import "leaflet-gesture-handling/dist/leaflet-gesture-handling.css";
@import "sidebar-v2/css/leaflet-sidebar.css";
@import "suitcss-utils-display";
@import "suitcss-utils-text";
@import "./base/utilities";
44 changes: 8 additions & 36 deletions frontend/styles/base/base.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/*
* Extends SUIT CSS base
* https://github.com/suitcss/base
*/

@font-face {
font-display: fallback;
font-family: "fira_sansregular";
font-style: normal;
font-weight: normal;
Expand All @@ -9,24 +15,16 @@
}

html {
box-sizing: border-box;
height: 100%;
}

*,
*::before,
*::after {
box-sizing: inherit;
}

body {
background-color: #fff;
color: #4c4c4c;
font-family: "fira_sansregular";
font-family: "fira_sansregular", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 1em;
height: 100%;
line-height: 1.5;
margin: 0;
padding: 0;
}

h1 {
Expand All @@ -45,32 +43,6 @@ h4 {
font-size: 0.75em;
}

section {
margin-bottom: 10px;
padding: 5px;
}

a {
color: inherit;
text-decoration: underline;
}

p {
margin: 0;
}

.u-hidden {
display: none;
}

ul {
padding-left: 10px;
}

li {
list-style-type: none;
}

input[type=text],
input[type=url],
input[type=email],
Expand Down
22 changes: 22 additions & 0 deletions frontend/styles/base/utilities.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Extends SUIT CSS utilities: display, text
* https://github.com/suitcss/utils-display
* https://github.com/suitcss/utils-text
*/

.u-mb {
margin-bottom: $space-base !important;
}

.u-mbL {
margin-bottom: $space-large !important;
}

.u-textMuted {
color: #76767a !important;
}

.u-listBulleted {
list-style: disc !important;
padding-left: 20px !important;
}
3 changes: 3 additions & 0 deletions frontend/styles/base/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ $bp-tablet-width: 756px;
$bp-tablet-landscape-width: 1024px;
$bp-desktop-width: 1260px;

$space-base: 15px;
$space-large: 30px;

@custom-media --bp-mobile (min-width: $bp-mobile-width);
@custom-media --bp-tablet (min-width: $bp-tablet-width);
@custom-media --bp-tablet-landscape (min-width: $bp-tablet-landscape-width);
Expand Down
5 changes: 1 addition & 4 deletions frontend/styles/components/container.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
.Container {
margin-left: auto;
margin-right: auto;
}

@media (--bp-tablet-landscape) {

.Container {
@media (--bp-tablet-landscape) {
max-width: 1180px;
}
}
6 changes: 1 addition & 5 deletions frontend/styles/components/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@
border: 1px solid lightgray;
margin-bottom: 30px;
margin-top: 30px;
padding: 20px;
}

.Content p {
margin-bottom: 15px;
padding: 20px 30px;
}
4 changes: 0 additions & 4 deletions frontend/styles/components/initiative.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
margin-top: 20px;
padding: 20px;
}

.Initiative p {
margin: 0;
}
1 change: 1 addition & 0 deletions frontend/styles/components/nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
}

.Nav a {
color: #fff;
font-size: 1.1em;
font-weight: 600;
line-height: 1.8em;
Expand Down
5 changes: 5 additions & 0 deletions frontend/styles/components/page_header.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.PageHeader {
align-items: center;
border-bottom: 3px solid #ff9700;
display: flex;
justify-content: space-between;
}

.PageHeader-heading {
padding-bottom: 10px;
}

.PageHeader-action {
background: linear-gradient(to bottom, #74ad5a 5%, #68a54b 100%);
background-color: #74ad5a;
Expand Down
4 changes: 4 additions & 0 deletions frontend/styles/components/sponsors.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.sponsors {
padding-top: 20px;
}

.sponsors-logos {
display: flex;
justify-content: space-evenly;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"leaflet": "^1.5.1",
"leaflet-gesture-handling": "^1.1.8",
"leaflet.markercluster": "^1.4.1",
"normalize.css": "^8.0.1",
"postcss-custom-media": "^7.0.8",
"postcss-inherit": "^4.1.0",
"postcss-nested": "^4.1.2",
Expand Down
2 changes: 2 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
plugins: [
require("postcss-import"),
require("postcss-nested"),
require("postcss-size"),
require("postcss-simple-vars"),
require("postcss-custom-media"),
require("postcss-flexbugs-fixes"),
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5959,7 +5959,7 @@ normalize-url@^3.0.0:
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559"
integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==

normalize.css@^8.0.0, normalize.css@^8.0.1:
normalize.css@^8.0.0:
version "8.0.1"
resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3"
integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==
Expand Down

0 comments on commit a25c812

Please sign in to comment.