-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic coach-application, part of issue #110, missing:coach from signi…
…n, validations, success-view, emails, admin
- Loading branch information
1 parent
e9bef8e
commit e6295f0
Showing
14 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the CoachApplications controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class CoachApplicationsController < ApplicationController | ||
before_action :find_event | ||
|
||
def new | ||
@coach_application = CoachApplication.new | ||
@coach_application.coach = Coach.find_by_id(1) | ||
@coach_application.event = @event | ||
end | ||
|
||
def create | ||
@coach_application = CoachApplication.new(params.require(:coach_application).permit(:installationparty, :workshopday, :lightningtalk, :notes)) | ||
@coach_application.event = @event | ||
@coach_application.coach = Coach.find_by_id(1) | ||
if @coach_application.save | ||
render html: 'Success' | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
private | ||
def find_event | ||
@event = Event.find(params[:event_id]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module CoachApplicationsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
class Coach < ApplicationRecord | ||
belongs_to :user | ||
accepts_nested_attributes_for :user | ||
has_many :coach_applications | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class CoachApplication < ApplicationRecord | ||
belongs_to :coach | ||
belongs_to :event | ||
accepts_nested_attributes_for :coach | ||
accepts_nested_attributes_for :event | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<%= form_for [@event, @coach_application] do |f| %> | ||
<h2>I can help on the</h2> | ||
<p class="note">Please select one or both.</p> | ||
<p> | ||
<%= f.check_box :installationparty %> | ||
<%= f.label(:installationparty, "installation party") %> | ||
</p> | ||
<p> | ||
<%= f.check_box :workshopday %> | ||
<%= f.label(:workshopday, "workshop day") %> | ||
</p> | ||
<h2>Would you like to give a lightning talk? What topic do you have in mind?</h2> | ||
<p class="note">The talk should be understandable for beginners and no longer than 5 minutes.</p> | ||
<p> | ||
<%= f.text_field :lightningtalk %> | ||
</p> | ||
<h2>Notes</h2> | ||
<p class="note">including if you would like to help the organizers on the day or even become an organizer in the future</p> | ||
<p> | ||
<%= f.text_field :notes %> | ||
</p> | ||
<fieldset> | ||
<h2>Personal Information</h2> | ||
<%= f.fields_for :coach do |coaches_form| %> | ||
<%= coaches_form.fields_for :user do |users_form| %> | ||
<p><%= users_form.label(:email, "E-Mail Address") %><br> | ||
<%= users_form.text_field :email %> | ||
</p> | ||
<% end %> | ||
<p><%= coaches_form.label(:name, "Name") %></p><p class="note">No official name necessary, you can use the name you want to be called. Just be sure to remember what you picked. *</p> | ||
<p><%= coaches_form.text_field :name %></p> | ||
<p> | ||
<%= coaches_form.check_box :female %> | ||
<%= coaches_form.label(:female, "female/I have some female sex characteristics.") %> | ||
</p> | ||
</fieldset> | ||
<fieldset> | ||
<h2>Which language(s) can you teach in?</h2> | ||
<p class="note">Please select one or both.</p> | ||
<p> | ||
<%= coaches_form.check_box :language_de %> | ||
<%= coaches_form.label(:language_de, "German") %> | ||
</p> | ||
<p> | ||
<%= coaches_form.check_box :language_en %> | ||
<%= coaches_form.label(:language_en, "English") %> | ||
</p> | ||
</fieldset> | ||
<fieldset> | ||
<p> | ||
<%= coaches_form.check_box :notifications %> | ||
<%= coaches_form.label(:notifications, "Notifications about upcoming events") %> | ||
</p> | ||
<p class="note">It would be great to have you on board as a coach again.</p> | ||
</fieldset> | ||
<% end %> | ||
<div class='button'> | ||
<%= f.submit "Submit", class: 'commit', type: 'submit' %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CreateCoachApplications < ActiveRecord::Migration[5.1] | ||
def change | ||
create_table :coach_applications do |t| | ||
t.boolean :installationparty | ||
t.boolean :workshopday | ||
t.string :lightningtalk | ||
t.string :notes | ||
t.references :event, foreign_key: true | ||
t.references :coach, foreign_key: true | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class CoachApplicationsControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
FactoryGirl.define do | ||
factory :coach_application do | ||
|
||
end | ||
factory :coach do | ||
association :user | ||
name "Swenja" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class CoachApplicationTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |