Skip to content

Commit b708fda

Browse files
committed
Hack to allow an ELIXIR TeSS space to show up in the listing, but behave as a default space still
1 parent c103b84 commit b708fda

4 files changed

Lines changed: 39 additions & 1 deletion

File tree

app/controllers/application_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ def user_not_authorized(exception)
115115
end
116116

117117
def set_current_space
118-
Space.current_space = TeSS::Config.feature['spaces'] ? Space.find_by_host(request.host) : Space.default
118+
host = request.host
119+
return Space.default if host == 'tess.elixir-europe.org'
120+
Space.current_space = TeSS::Config.feature['spaces'] ? Space.find_by_host(host) : Space.default
119121
end
120122

121123
def current_space

app/models/elixir_tess_space.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
class ElixirTessSpace < Space
2+
def model_name
3+
Space.model_name
4+
end
5+
6+
def self.policy_class
7+
SpacePolicy
8+
end
9+
10+
def materials
11+
Material.where(space_id: nil)
12+
end
13+
14+
def events
15+
Event.where(space_id: nil)
16+
end
17+
18+
def workflows
19+
Workflow.where(space_id: nil)
20+
end
21+
22+
def collections
23+
Collection.where(space_id: nil)
24+
end
25+
26+
def learning_paths
27+
LearningPath.where(space_id: nil)
28+
end
29+
30+
def learning_path_topics
31+
LearningPathTopic.where(space_id: nil)
32+
end
33+
end

app/views/spaces/_space.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<% theme_colour = TeSS::Config.themes[space.theme]&.dig('primary') %>
2+
<% space = space.becomes(ElixirTessSpace) if space.host == 'tess.elixir-europe.org' %>
23
<% cache(space, expires_in: 6.hours) do %>
34
<li class="masonry-brick media-item long">
45
<%= link_to space, class: 'link-overlay', style: (theme_colour ? "border-color: #{theme_colour}" : nil) do %>

app/views/spaces/show.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<% @space = @space.becomes(ElixirTessSpace) if @space.host == 'tess.elixir-europe.org' %>
2+
13
<div class="wrapper collapsing-wrapper">
24
<%# SIDEBAR %>
35
<div class="collapsing-sidebar" id="sidebar">

0 commit comments

Comments
 (0)