Skip to content

Commit

Permalink
Tickets sold, progress monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciaan committed Sep 7, 2017
1 parent a661fdb commit 89c2c20
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
3 changes: 1 addition & 2 deletions app/controllers/events_controller.rb
Expand Up @@ -3,7 +3,7 @@
class EventsController < ApplicationController

# order is important here, we need to be authenticated before we can check permission
before_filter :authenticate_user!, except: [:show, :index]
before_filter :authenticate_user!, except: [:show, :index, :club_stats]
load_and_authorize_resource only: [:new, :show, :update, :edit, :destroy]

respond_to :html, :js, :ics
Expand Down Expand Up @@ -88,7 +88,6 @@ def statistics

def club_stats
@event = Event.find params.require(:id)
authorize! :view_stats, @event

if not @event.registrations.empty?
@stats = @event.registrations.paid.group(:club_id).count.sort_by{|k, v| v}.reverse
Expand Down
35 changes: 22 additions & 13 deletions app/views/events/club_stats.html.erb
@@ -1,20 +1,29 @@
<%= render partial: "events/tabs" %>
<h2>Club stats</h2>
<%= render partial: 'flash' %>

<table class="table table-striped table-hover">
<tbody>
<tr>
<th>Club</th>
<th>Tickets sold</th>
</tr>
<% @stats.each do |s| %>
<div class="row">
<div class="col-sm-12">
<h2><%= t('events.club_stats.title')%></h2>

<table class="table table-striped table-hover">
<tbody>
<tr>
<td><%= Club.find_by_id(s.first).try :name %></td>
<td><%= s.last %></td>
<th><%= t('events.club_stats.club')%></th>
<th><%= t('events.club_stats.tickets_sold')%></th>
</tr>
<% end %>
</tbody>
</table>
<% @stats.each do |s| %>
<% if !s.first.nil? and not [2,3].include? s.first %>
<tr>
<td><%= Club.find_by_id(s.first).name %></td>
<td><%= s.last %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<small>Als jouw vereniging er nog niet bij staat, heeft deze nog geen tickets verkocht.</small>
</div>
</div>

7 changes: 6 additions & 1 deletion config/locales/en.yml
Expand Up @@ -48,9 +48,14 @@ en:
register: Register
registration:
club:
info: The foundation ball (Stichtingsbal) is an initiative by en through the student associations. You donate €1 per ticket to the selected association.
info: The foundation ball (Stichtingsbal) is an initiative from the student associations. You donate €1 per ticket to the selected association.
start_date: Start date
website: Website
events:
club_stats:
club: Club
tickets_sold: Tickets sold
title: Tickets sold ranking
flash:
mollie: Registration is being processed, check your mailbox for the current status.
succes: Registration successful. Please check your mailbox for your ticket.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/nl.yml
Expand Up @@ -53,6 +53,11 @@ nl:
club:
info: Het Stichtingsbal is een initiatief voor en door studentenverenigingen. U schenkt €1 per ticket aan de vereniging die u hieronder selecteert. Heeft u geen vereniging van uw voorkeur kiest u gewoon ‘Universiteit Gent’.
payments: Betalingen kunnen via bank overschrijvingen alsook bankkaarten gebeuren.
events:
club_stats:
title: Tussenstand tickets
club: Vereniging
tickets_sold: Verkochte tickets
flash:
succes: Registratie succesvol. Uw ticket zou nu in uw mailbox toegekomen moeten zijn.
mollie: Uw registratie is verwerkt, controleer uw mailbox voor de status.
Expand Down

0 comments on commit 89c2c20

Please sign in to comment.