Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gem 'dotenv-rails'
gem 'jquery-rails'
# gem 'less-rails-semantic_ui', '~> 2.3.1'
gem 'autoprefixer-rails', '8.6.5'
gem 'therubyracer'
#gem 'therubyracer'

gem 'carrierwave', '~> 1.0'

Expand Down
19 changes: 11 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ GEM
ruby2_keywords (>= 0.0.4)
faraday-net_http (2.0.1)
ffi (1.15.5)
ffi (1.15.5-x64-mingw32)
globalid (1.0.0)
activesupport (>= 5.0)
hashie (5.0.0)
Expand All @@ -141,7 +142,6 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jwt (2.3.0)
libv8 (3.16.14.19)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand All @@ -160,7 +160,7 @@ GEM
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.15.0)
msgpack (1.4.5)
msgpack (1.5.1)
multi_json (1.15.0)
multi_xml (0.6.0)
net-imap (0.2.3)
Expand All @@ -182,6 +182,8 @@ GEM
nokogiri (1.13.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.3-x64-mingw32)
racc (~> 1.4)
oauth2 (1.4.9)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
Expand All @@ -200,6 +202,7 @@ GEM
omniauth (~> 2.0)
orm_adapter (0.5.0)
pg (1.3.4)
pg (1.3.4-x64-mingw32)
public_suffix (4.0.6)
puma (4.3.11)
nio4r (~> 2.0)
Expand Down Expand Up @@ -239,7 +242,6 @@ GEM
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
ref (2.0.0)
regexp_parser (2.2.1)
responders (3.0.1)
actionpack (>= 5.0)
Expand All @@ -249,6 +251,8 @@ GEM
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
sassc (2.4.0-x64-mingw32)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
Expand Down Expand Up @@ -277,9 +281,6 @@ GEM
sprockets (>= 3.0.0)
ssrf_filter (1.0.7)
strscan (3.0.1)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (1.2.1)
tilt (2.0.10)
timeout (0.2.0)
Expand All @@ -290,6 +291,8 @@ GEM
turbolinks-source (5.2.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2022.1)
tzinfo (>= 1.0.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
warden (1.2.9)
Expand All @@ -308,6 +311,7 @@ GEM

PLATFORMS
ruby
x64-mingw32

DEPENDENCIES
autoprefixer-rails (= 8.6.5)
Expand Down Expand Up @@ -335,7 +339,6 @@ DEPENDENCIES
shrine
spring
spring-watcher-listen (~> 2.0.0)
therubyracer
trix-rails
turbolinks (~> 5)
tzinfo-data
Expand All @@ -346,4 +349,4 @@ RUBY VERSION
ruby 3.0.3p157

BUNDLED WITH
2.3.4
2.3.10
1 change: 1 addition & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def index

def show
@entry = Entry.new
@teams = Team.where(id:@event.entry.map(&:team_id))
end

def new
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/teams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class TeamsController < ApplicationController

def index
@page = Page.find_by(name: 'teams')
@teams = Team.order(score: :desc).reject { |team| team.number_of_memberships.zero? }
@teams = Team.order(score: :desc)
end

def show
Expand Down
6 changes: 6 additions & 0 deletions app/models/team.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
class Team < ApplicationRecord

default_scope { ids = Membership.select("team_id, count(*) as member_count").group("team_id").having("count(*) > 0").map(&:team_id)
Team.where(id:ids)}
has_many :memberships

mount_uploader :image, ImageUploader
Expand Down Expand Up @@ -43,4 +46,7 @@ def delete_memberships!
membership.decline!
end
end
def entry_for(event)
Entry.find_by(team:self, event: event)
end
end
12 changes: 6 additions & 6 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
<div class="event-applied-teams">
<h3 class="applied-teams-title">Nevezett csapatok</h3>
<div class="ui centered cards">
<% @event.entry.each do |entry| %>

<% @teams.each do |team| %>
<%entry = team.entry_for(@event) %>
<div class="ui card">
<div class="image">
<% if entry.team.image? %>
<%= image_tag(entry.team.image.url(:square_thumb), alt: 'Image') %>
<% if team.image? %>
<%= image_tag(team.image.url(:square_thumb), alt: 'Image') %>
<% else %>
<%= image_tag('team-placeholder.png', alt: 'Image') %>
<% end %>
</div>
<div class="content">
<div class="header">
<%= link_to entry.team.name, team_path(entry.team), class: 'item team-name-item' %>
<%= link_to team.name, team_path(team), class: 'item team-name-item' %>
</div>
<% if admin? %>
<div class="description">
<%= entry.comment %>

</div>
<% end %>
<% if @event.can_entry? && entry.revocable_by?(current_user) %>
Expand Down
4 changes: 2 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ default: &default
development:
<<: *default
database: schorpong_development
username: schorpong
password: schorpong
username: postgres
password: Yxcvbnm13xy
host: localhost
port: 5432

Expand Down