From b5d2f77955acc2eb52c10532c5d14dfad8722ea6 Mon Sep 17 00:00:00 2001 From: Matthias Bauer Date: Wed, 18 May 2011 00:57:10 +0200 Subject: [PATCH] Close signups --- app/controllers/home_controller.rb | 3 +++ app/views/home/index.html.erb | 43 +++++++----------------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 55b2270..858bcb8 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -9,6 +9,9 @@ def index end def rsvp + redirect_to '/', :alert => 'Das Event ist vorbei!' + return + unless current_user redirect_to '/signin', :alert => 'Bitte melde dich erst an!' return diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 9a8ebf0..0db51db 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -36,52 +36,29 @@
<%- if current_user %> - <%- if current_user.status == 1 %> -

Das klingt gut! Ich bin dabei!

- <%= form_for current_user, :as => :user, :url => {:action => :rsvp} do |f| %> - <%= f.text_field :comment, :placeholder => 'Kommentar' %> - <%= f.submit 'Leider doch nicht :(', :name => 'no', :id => 'bn' %> <%= f.submit 'Aber nur vielleicht', :name => 'maybe', :id => 'bm' %> - <% end %> - <% elsif current_user.status == 2 %> -

Ich weiß noch nicht, ob ich das schaffe.

- <%= form_for current_user, :as => :user, :url => {:action => :rsvp} do |f| %> - <%= f.text_field :comment, :placeholder => 'Kommentar' %> - <%= f.submit 'Ja, ich kann!', :name => 'yes', :id => 'by' %> <%= f.submit 'Leider nicht.', :name => 'no', :id => 'bn' %> - <% end %> + <% if current_user.status == 1 && current_user.arrived %> +

Du warst dabei! Danke!

+ <% elsif current_user.status == 1 && !current_user.arrived %> +

Wir haben Dich vermisst!

<% else %> -

Ich schaff's leider nicht :(

- <%= form_for current_user, :as => :user, :url => {:action => :rsvp} do |f| %> - <%= f.text_field :comment, :placeholder => 'Kommentar' %> - <%= f.submit 'Doch, ich schaffe es!', :name => 'yes', :id => 'by' %> <%= f.submit 'Vielleicht doch!', :name => 'maybe', :id => 'bm' %> - <% end %> +

Schade, dass Du nicht dabei warst!

<% end %> <% else %> -

Klingt das gut? Machst Du mit?

- <%= form_for current_user, :as => :user, :url => {:action => :rsvp} do |f| %> - <%= f.text_field :comment, :placeholder => 'Kommentar' %> - <%= f.submit 'Ja', :name => 'yes', :id => 'by' %> <%= f.submit 'Nein', :name => 'no', :id => 'bn' %> <%= f.submit 'Vielleicht', :name => 'maybe', :id => 'bm' %> - <% end %> +

Die Hamburg++ ist vorüber!

<% end %> +

<%= link_to 'Like uns auf Facebook', 'https://www.facebook.com/hamburgplusplus' %> oder <%= link_to 'folge uns auf Twitter', 'https://twitter.com/HH_PlusPlus' %>, um über das nächste Event informiert zu werden!

-

Wer kommt noch?

+

Wer war da?

-

Auf jeden Fall<%- if @users.include?(:yes) %> (<%= @users[:yes].size %>)<% end %> Vielleicht<%- if @users.include?(:maybe) %> (<%= @users[:maybe].size %>)<% end %>

+

Auf jeden Fall<%- if @users.include?(:yes) %> (<%= @users[:yes].select{|x| x.arrived}.size %>)<% end %>

    - <%- @users[:yes].each do |user| %> + <%- @users[:yes].select{|x| x.arrived}.each do |user| %>
  • <%= render :partial => 'user', :locals => { :user => user } %>
  • <%- end %>
-
-

Vielleicht<%- if @users.include?(:maybe) %> (<%= @users[:maybe].size %>)<% end %> Auf jeden Fall<%- if @users.include?(:yes) %> (<%= @users[:yes].size %>)<% end %>

-
    - <%- @users[:maybe].each do |user| %> -
  • <%= render :partial => 'user', :locals => { :user => user } %>
  • - <%- end %> - -