Skip to content

Commit

Permalink
Merge branch 'master' of github.com:harmdewit/meetup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bramjetten committed Jan 6, 2011
2 parents fb0b0a6 + 2150ba4 commit d4aa847
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 27 deletions.
8 changes: 7 additions & 1 deletion .eprj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<string>public\stylesheets\admin\css3.css</string>
<key>.log</key>
<string>log\development.log</string>
<key>_par</key>
<string>app\views\participants\_participant.html.haml</string>
<key>_parti</key>
<string>app\views\participants\_participant.html.haml</string>
<key>appli</key>
Expand All @@ -27,9 +29,13 @@
<key>main.cs</key>
<string>public\stylesheets\main.css</string>
<key>mains</key>
<string>public\stylesheets\main.css</string>
<string>public\stylesheets\admin\main.css</string>
<key>notif</key>
<string>app\mailers\notifier.rb</string>
<key>participant</key>
<string>app\views\participants\_participant.html.haml</string>
<key>r</key>
<string>config\routes.rb</string>
<key>ro</key>
<string>config\routes.rb</string>
<key>rou</key>
Expand Down
26 changes: 20 additions & 6 deletions app/controllers/connections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ def create
if @connection1.save && @connection2.save
@meeting = @connected_participant.meeting
Notifier.request_received(@current_user, @connected_participant.user).deliver
redirect_to(meeting_participants_url(@meeting.id), :notice => "Je hebt nu een connectie met #{@connected_participant.user.first_name} #{@connected_participant.user.last_name}.")
else
flash[:error] = "Je hebt deze persoon al toevoegd jongen."
redirect_to @current_participant.meeting
redirect_to(meeting_participants_url(@current_participant.meeting.id), :notice => "Je hebt nu een connectie met #{@connected_participant.user.first_name} #{@connected_participant.user.last_name}.")
else
if Connection.find_by_participant_id_and_connected_participant_id(@current_participant.id, @connected_participant.id)
@connection1 = Connection.find_by_participant_id_and_connected_participant_id(@current_participant.id, @connected_participant.id)
@connection2 = Connection.find_by_connected_participant_id_and_participant_id(@current_participant.id, @connected_participant.id)
@connection1.status = 'Accepted'
@connection2.status = 'Accepted'
if @connection1.save && @connection2.save
Notifier.request_received(@current_user, @connected_participant.user).deliver
redirect_to(meeting_participants_url(@current_participant.meeting.id), :notice => "Je hebt nu een connectie met #{@connected_participant.user.first_name} #{@connected_participant.user.last_name}.")
else
flash[:error] = 'Friend not accepted!'
redirect_to meeting_participants_url(@current_participant.meeting.id)
end
else
flash[:error] = "Je hebt deze persoon al toevoegd jongen."
redirect_to meeting_participants_url(@current_participant.meeting.id)
end
end
end

Expand All @@ -40,8 +54,8 @@ def edit
def update
@user = User.find(@current_user)
@connected_user = User.find(params[:connected_user_id])
params[:connection1] = {:user_id => @user.id, :connected_user_id => @connected_user.id, :status => 'accepted'}
params[:connection2] = {:user_id => @connected_user.id, :connected_user_id => @user.id, :status => 'accepted'}
params[:connection1] = {:user_id => @user.id, :connected_user_id => @connected_user.id, :status => 'Accepted'}
params[:connection2] = {:user_id => @connected_user.id, :connected_user_id => @user.id, :status => 'Accepted'}
@connection1 = Connection.find_by_user_id_and_connected_user_id(@user.id, @connected_user.id)
@connection2 = Connection.find_by_user_id_and_connected_user_id(@connected_user.id, @user.id)
if @connection1.update_attributes(params[:connection1]) && @connection2.update_attributes(params[:connection2])
Expand Down
17 changes: 14 additions & 3 deletions app/controllers/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,24 @@ def show

def show_participants
@meeting = Meeting.find(params[:id])
@current_participant = Participant.find_by_user_id_and_meeting_id!(@current_user, @meeting)
@participants = Participant.find_all_by_meeting_id(@meeting.id)
@current_participant = Participant.find_by_user_id_and_meeting_id!(@current_user.id, @meeting.id)
@current_connected_participants = Array.new
@current_connected_participants_connections = Array.new
@suggested_participants = Array.new
@current_participant.connections.each do |c|
@current_connected_participants.push c.connected_participant
@current_connected_participants_connections.push c
@participants.unshift(@participants.delete(c.connected_participant))
end
@current_participant.connections.each do |c|
if c.status == 'Aanbevolen'
@participants.unshift(@participants.delete(c.connected_participant))
@suggested_participants.push c.connected_participant
else
@current_connected_participants.push c.connected_participant
@current_connected_participants_connections.push c
end
end
@participants.unshift(@participants.delete(@current_participant))
end

def last_meeting
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/participants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create
@participant.user_id = @current_user.id
@participant.meeting_id = params[:meeting_id]
if @participant.save
redirect_to(meeting_participants_url(@meeting), :notice => 'Je hebt je aangemeld voor de meeting.')
redirect_to(meeting_participants_url(@meeting), :notice => 'Je hebt je aangemeld voor de meeting. Je kunt nu afspraken maken met andere deelnemers om ze te ontmoeten op de meeting.')
else
render :action => 'new'
end
Expand Down
18 changes: 13 additions & 5 deletions app/views/connections/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
%strong
= @participant.user.first_name + " " + @participant.user.last_name
toevoegen
%p
Als je deze persoon toevoegt krijgt wordt hij hiervan op de hoogte gebracht.
%br/
Weet je het zeker?

= form_for [@participant, @connection] do |p|
%p If you add the user the person will be notified by email. Are you sure you want to add the user?
.actions
= p.submit 'Ok'
%button.hide_overlay Cancel

.buttons
= p.submit 'Ja, voeg toe'
%a{:href => "#", :class => "hide_overlay"}
%span.icon d
Nee, annuleren.
2 changes: 1 addition & 1 deletion app/views/meetings/show_participants.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@

#main_content
- @array = ""
= render @meeting.participants
= render @participants
32 changes: 23 additions & 9 deletions app/views/participants/_participant.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,46 @@
= link_to edit_participant_connection_url(participant, @current_connected_participants_connections[@current_connected_participants.index(participant)]), :remote => true do
.delete_connection
.card.front
%a= participant.connections.count
- unless participant == @current_participant
- unless @suggested_participants.include? participant
%a= participant.connections.count
- else
%a= participant.connections.count - 1
- else
%a= participant.connections.count - @suggested_participants.count
.card_inside
%h2= participant.user.first_name + " " + participant.user.last_name
%small
%p= participant.motivation
- if @suggested_participants.include? participant
= image_tag("suggestion_ribbon.png", :class => 'suggestion_ribbon')

.card.back
%a= participant.connections.count
- unless participant == @current_participant
- unless @suggested_participants.include? participant
%a= participant.connections.count
- else
%a= participant.connections.count - 1
- else
%a= participant.connections.count - @suggested_participants.count
- unless participant == @current_participant
- unless @current_connected_participants.include? participant
.img_add_connection
- else
.img_delete_connection

.card_inside
%img{:alt => "picture"}
%img.linkedin_img{:alt => "picture"}
%h2= participant.user.first_name + " " + participant.user.last_name
%small
.linkedin_url
%a{:href => '#'} LinkedIn Profiel
.connections

- participant.connections.each do |connection|
- unless connection.status == 'Aanbevolen'

.card
.card_inside
%h2= connection.connected_participant.user.first_name + " " + connection.connected_participant.user.last_name
%p= connection.connected_participant.motivation
- if connection.status == 'Aanbevolen'
= image_tag("suggestion_ribbon.png", :class => 'suggestion_ribbon')
.card
.card_inside
%h2= connection.connected_participant.user.first_name + " " + connection.connected_participant.user.last_name
%p= connection.connected_participant.motivation
2 changes: 1 addition & 1 deletion public/javascripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function displayCard(profiles) {
$('.linkedin').each(function() {
if($(this).attr("data-linkedin") == members[member].id) {
$(this).find("small").html(members[member].headline);
$(this).find("img").attr("src", members[member].pictureUrl);
$(this).find("img.linkedin_img").attr("src", members[member].pictureUrl);
$(this).find(".linkedin_url a").attr("href", members[member].siteStandardProfileRequest.url)
}
});
Expand Down

0 comments on commit d4aa847

Please sign in to comment.