Skip to content

Commit afc3bde

Browse files
committed
Sort spaces by amount of content
1 parent b708fda commit afc3bde

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

app/models/elixir_tess_space.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ def model_name
33
Space.model_name
44
end
55

6+
def to_partial_path
7+
'spaces/space'
8+
end
9+
610
def self.policy_class
711
SpacePolicy
812
end

app/views/spaces/_space.html.erb

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

app/views/spaces/index.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<% end %>
1212
</div>
1313

14+
<% @spaces = @spaces.map { |s| (s.host == 'tess.elixir-europe.org') ? s.becomes(ElixirTessSpace) : s }.sort_by { |s| -(s.materials.count + s.events.not_finished.count) } %>
1415
<%= render partial: 'common/masonry_grid', locals: { objects: @spaces } %>
1516
</div>
1617
</div>

0 commit comments

Comments
 (0)