Skip to content

Commit 7cfbdd9

Browse files
committed
space specific logos and footer configuration
1 parent 6cab544 commit 7cfbdd9

7 files changed

Lines changed: 24 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config/secrets.yml
1515
config/sunspot.yml
1616
config/tess.yml
1717
config/ingestion.yml
18+
config/initializers/hosts.rb
1819
tmp/
1920
solr/test/
2021
solr/pids/

app/assets/stylesheets/application.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,11 @@ input[type=checkbox].field-lock + label:before,
808808
margin: 15px;
809809
}
810810

811+
.masonry-brick .space-logo {
812+
padding: .5em;
813+
border-radius: 4px;
814+
}
815+
811816
.list-card {
812817
@include floating-card;
813818
border-radius: 8px;

app/views/about/us.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
<% if TeSS::Config.funders.present? %>
1919
<p>
2020
<% TeSS::Config.funders.each do |funder| %>
21-
<% unless funder[:only] && funder[:only] != 'about' %>
21+
<% expected_space = current_space.default? ? 'default' : current_space.host %>
22+
<% if (funder[:only].blank? || funder[:only] == 'about') && (funder[:space].blank? || funder[:space] == expected_space) %>
2223
<%= link_to(funder[:url], target: '_blank', rel: 'noopener') do -%>
2324
<%= image_tag(funder[:logo], class: 'funding-logo') -%>
2425
<% end %>

app/views/layouts/_footer.html.erb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
<% space_string_in_config = current_space.default? ? 'default' : current_space.host %>
2+
13
<footer class="footer">
24
<div class="container">
35
<div class="row">
46
<div class="col-sm-4 col-xs-6">
57
<div class="footer-logo footer-item">
6-
<%= image_tag(TeSS::Config.site['logo'], :alt => TeSS::Config.site['logo_alt']) %>
8+
<% if TeSS::Config.site.dig('footer', 'show_space_logo') && current_space.image? %>
9+
<%= image_tag(current_space.image.url, :alt => current_space.logo_alt) %>
10+
<% else %>
11+
<%= image_tag(TeSS::Config.site['logo'], :alt => TeSS::Config.site['logo_alt']) %>
12+
<% end %>
713
</div>
814

915
<div class="footer-item contact-link">
@@ -12,7 +18,7 @@
1218

1319
<% if TeSS::Config.site.dig('footer', 'additional_links') %>
1420
<% TeSS::Config.site.dig('footer', 'additional_links').each do |link| %>
15-
<% if link[:location] == 'left' %>
21+
<% if link[:location] == 'left' && (link[:space].blank? || link[:space] == space_string_in_config) %>
1622
<div class="footer-item">
1723
<%= link_to link[:title], link[:url] %>
1824
</div>
@@ -45,7 +51,7 @@
4551
<% end %>
4652
<% if TeSS::Config.site.dig('footer', 'additional_links') %>
4753
<% TeSS::Config.site.dig('footer', 'additional_links').each do |link| %>
48-
<% if link[:location] == 'center' || !link[:location] %>
54+
<% if (link[:location] == 'center' || !link[:location]) && (link[:space].blank? || link[:space] == space_string_in_config)%>
4955
<div class="footer-item">
5056
<%= link_to link[:title], link[:url] %>
5157
</div>
@@ -76,7 +82,7 @@
7682

7783
<% if TeSS::Config.site.dig('footer', 'additional_links') %>
7884
<% TeSS::Config.site.dig('footer', 'additional_links').each do |link| %>
79-
<% if link[:location] == 'right' %>
85+
<% if link[:location] == 'right' && (link[:space].blank? || link[:space] == space_string_in_config)%>
8086
<div class="footer-item">
8187
<%= link_to link[:title], link[:url] %>
8288
</div>

app/views/layouts/_supported_by.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<div class="col-xs-12">
22
<hr/>
33
<div class="supporters">
4+
<% expected_space = current_space.default? ? 'default' : current_space.host %>
45
<%- TeSS::Config&.funders&.reverse&.each do |funder| %>
5-
<% unless funder[:only] && funder[:only] != 'footer' %>
6+
<% if (funder[:only].blank? || funder[:only] == 'footer') && (funder[:space].blank? || funder[:space] == expected_space) %>
67
<%= link_to funder[:url], class: 'footer-logo', target: '_blank', rel: 'noopener' do %>
78
<%= image_tag(funder[:logo]) %>
89
<% end %>

app/views/spaces/_space.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<% cache(space, expires_in: 6.hours) do %>
33
<li class="masonry-brick media-item long">
44
<%= link_to space, class: 'link-overlay', style: (theme_colour ? "border-color: #{theme_colour}" : nil) do %>
5-
<%= image_tag get_image_url_for(space), class: "media-image listing_image pull-right" %>
5+
<%= image_tag get_image_url_for(space), class: "media-image listing_image pull-right space-logo", style: (theme_colour ? "background-color: #{theme_colour}" : nil) %>
66
<h4 class="mb-2 mt-3" style="<%= theme_colour ? "color: #{theme_colour}" : ''-%>">
77
<%= space.title %>
88
</h4>

config/tess.example.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ default: &default
123123
# - url: https://example.com/
124124
# title: Example
125125
# location: center # Display link on 'left', 'center' or 'right', defaults to 'center'
126+
# space: # e.g. myspace.tesshub.mydomain.com - if present, show link only in specified space ("default" for default space)
127+
show_space_logo: false # Show space logo instead of site logo in footer
126128
# The order in which the tabs appear (if feature enabled)
127129
tab_order: ['about', 'events', 'materials', 'elearning_materials', 'workflows', 'collections', 'trainers', 'content_providers', 'nodes']
128130
# The tabs that should be collapsed under the "Directory" tab. Can be left blank to hide it.
@@ -236,6 +238,7 @@ default: &default
236238
# - url: https://example.org/your-funders-website
237239
# logo: foo.png
238240
# only: # "footer" or "about" - if pressent, show funder only in specified location
241+
# space: # e.g. myspace.tesshub.mydomain.com - if present, show funder only in specified space
239242
priority_licences:
240243
- MIT
241244
- Apache-2.0

0 commit comments

Comments
 (0)