-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inscription #14
base: master
Are you sure you want to change the base?
Inscription #14
Changes from all commits
d654266
e41a663
adaf922
e4f74f4
75377e1
b36d866
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class SubjectParticipantController < ApplicationController | ||
before_action :authenticate_participant! | ||
|
||
def show | ||
end | ||
|
||
def create | ||
@subject_participant = SubjectParticipant.new(subject_participant_params) | ||
|
||
if @subject_participant.save | ||
redirect_to subjects_path, notice: 'Votre participation a été enregistré' | ||
else | ||
redirect_to subjects_path | ||
end | ||
end | ||
|
||
def show | ||
end | ||
|
||
def destroy | ||
@subject_participant = SubjectParticipant.find(params[:id]) | ||
@subject_participant.destroy | ||
flash[:alert] = "Participation annulée" | ||
redirect_to subjects_path | ||
end | ||
|
||
def subject_participant_params | ||
params.permit(:interested_id, :subject_id) | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
class SubjectParticipant < ActiveRecord::Base | ||
validates_presence_of :interested_id, :subject_id | ||
validates :interested_id, presence: true | ||
validates :subject_id, presence: true, uniqueness: { scope: :interested_id} | ||
belongs_to :interested, :class_name => "Participant" #interested | ||
belongs_to :subject | ||
belongs_to :subject | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create.html.haml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
destroy.html.haml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Si tu t'en sers aussi peu, je préfère ne même pas avoir de fichier ;) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
show.html.haml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Si tu t'en sers aussi peu, je préfère ne même pas avoir de fichier ;) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
- if participant_signed_in? | ||
- if subject.participation(current_participant).nil? | ||
= link_to "Ca m'intéresse !", subject_participant_index_path(:interested_id => current_participant.id, :subject_id => subject.id), :method => :post, class:"btn btn-primary" | ||
|
||
- else | ||
= link_to "Ca ne m'intéresse plus !", subject_participant_path(subject.participation(current_participant).id), :method => :delete, class:"btn btn-primary" | ||
- else | ||
= link_to "Connectez-vous", new_participant_session_path |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
%h1.text-center Subjects | ||
.container | ||
.row | ||
%table | ||
%thead | ||
%tr | ||
%th.col-sm-offset-1.col-sm-2 Title | ||
%th.col-sm-2 Description | ||
%th.col-sm-2 Questioner | ||
%th.col-sm-2 Conférence | ||
%th{:colspan => "3"} | ||
%tbody | ||
- @subjects.each do |subject| | ||
%tr | ||
%td.col-sm-offset-1.col-sm-2= subject.title | ||
%td.col-sm-2= subject.description | ||
%td.col-sm-2= subject.questioner.try(:name) | ||
%td.col-sm-2= subject.conference.title | ||
%td.col-sm-1 | ||
%td.col-sm-2.text-center | ||
= link_to 'Show', subject | ||
| #{link_to 'Edit', edit_subject_path(subject)} | #{link_to 'Destroy', subject, method: :delete, data: { confirm: 'Are you sure?' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiens, le message de warning est en Anglais... pourtant j'aurai juré que les inscriptions aux sujets sont des boutons en Français... j'ai pas suivi un truc ? (parle-moi en avant de tout changer !) |
||
|
||
= render partial: 'inscription_button', locals: {subject: subject} | ||
|
||
%br/ | ||
.text-center | ||
%td | ||
= link_to 'New Subject', new_subject_path | ||
| | ||
%td= link_to 'Home', root_path |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.text-center | ||
%h1 | ||
%strong= @subject.title | ||
%p | ||
%strong Description: | ||
= @subject.description | ||
%p | ||
%strong Rapporteur: | ||
= @subject.questioner.try(:name) | ||
%p | ||
%strong Conference: | ||
= @subject.conference.title | ||
%p | ||
%strong Participant: | ||
%ul | ||
- @interesteds.each do |interested| | ||
%li | ||
= interested.email | ||
|
||
= link_to 'Edit', edit_subject_path(@subject) | ||
| | ||
\#{link_to 'Back', subjects_path} | | ||
\#{link_to 'Home', root_path} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
resources :subjects | ||
resources :participants | ||
resources :conferences | ||
resources :subject_participant | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. J'hésite un peu à t'en parler mais bon: est-ce que tu es sure de vouloir exposer ces nouvelles routes ? |
||
root 'welcome#index' | ||
|
||
# The priority is based upon order of creation: first created -> highest priority. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stp, pense à fixer tes EOL (il t'en manque pas mal)... ou install un plugin Sublime pour ces aspects là (trailling ws too...)