Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/stylesheets/partials/_layout.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ nav .brand {
footer {
background-color: #a0a0a0;
padding: 60px 0;
margin-top: 50px;

a {
color: #774f9f;
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ class Admin::ApplicationController < ApplicationController
def is_admin?
redirect_to root_path unless logged_in? and current_member.is_admin?
end

end
6 changes: 4 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def is_verified_coach_or_admin?
helper_method :is_verified_coach_or_admin?

def is_member?
flash[:notice] = "Only authorised members can access that link. If you are a member please sign in"
redirect_to root_path unless logged_in?
unless logged_in?
flash[:notice] = "Only authorised members can access that link. If you are a member please sign in"
redirect_to root_path
end
end
end
5 changes: 4 additions & 1 deletion app/controllers/invitations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
class InvitationsController < ApplicationController
before_action :logged_in?
before_action :is_member?

def index
@upcoming_session = Sessions.next

if current_member.is_student?
@upcoming_student = SessionInvitation.to_students.where(member: current_member).joins(:sessions).where("date_and_time >= ?", DateTime.now)
@upcoming_student += CourseInvitation.where(member: current_member).joins(:course).where("date_and_time >= ?", DateTime.now)
@attended = SessionInvitation.to_students.where(member: current_member).attended
end

Expand Down
5 changes: 4 additions & 1 deletion app/models/course_invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ class CourseInvitation < ActiveRecord::Base
validates :course, :member, presence: true
validates :member_id, uniqueness: { scope: [:course ] }

def parent
course
end

private

def email
CourseInvitationMailer.invite_student(self.course, self.member, self).deliver
end

end
7 changes: 5 additions & 2 deletions app/views/dashboard/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
=talk.title
%br
%li.cta-button
=link_to "RSVP", @meeting, class: "button round tiny"
=link_to "View details", @meeting, class: "button round tiny"

- if @next_session.present?
.large-4.medium-6.columns
Expand All @@ -42,7 +42,10 @@
%br
= AddressDecorator.decorate(@next_session.host.address).to_html
%li.cta-button
= link_to "RSVP", "/auth/github", class: "button round tiny"
- if logged_in?
= link_to "RSVP", invitations_path, class: "button round tiny"
- else
= link_to "RSVP", "/auth/github", class: "button round tiny"

- if @next_course.present?
.large-4.medium-6.columns
Expand Down
6 changes: 4 additions & 2 deletions app/views/invitations/_coach.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
.panel
%p
%h4
= link_to invitation.parent.to_s, invitation_path(invitation)
= invitation.parent.to_s
.date= "on #{l(invitation.parent.date_and_time, format: :website_format)}"
%br

=link_to attendance_status(invitation), invitation_path(invitation), class: "button round expand"
- elsif @upcoming_session
%em You have no invitations. If you just signed up you should receive one soon.
- else
%em There are no upcoming events
%em There are no upcoming events.

- if @coached.any?
%p
Expand Down
13 changes: 9 additions & 4 deletions app/views/invitations/_student.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
.panel
%p
%h4
= link_to invitation.parent.to_s, invitation_path(invitation)
= invitation.parent.to_s
.date #{l(invitation.parent.date_and_time, format: :website_format)}
%br
=link_to attendance_status(invitation), invitation_path(invitation), class: "button round expand"
- if invitation.is_a? SessionInvitation
=link_to attendance_status(invitation), invitation_path(invitation), class: "button round expand"
- elsif invitation.is_a? CourseInvitation
=link_to attendance_status(invitation), course_invitation_path(invitation), class: "button round expand"
- elsif @upcoming_session
%em You have no invitations. If you just signed up you should receive one soon.
- else
%em There are no upcoming events
%em There are no upcoming events.

- if @attended.any?
%h5 Attended
Expand All @@ -25,7 +30,7 @@
.panel
%p
%h4
= link_to invitation.parent.to_s, invitation_path(invitation)
= invitation.parent.to_s
.date= "#{l(invitation.parent.date_and_time, format: :website_format)}"
%br
=link_to "View", invitation_path(invitation), class: "button round expand"
1 change: 0 additions & 1 deletion app/views/invitations/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
%dd{ "data-magellan-arrival" => "coach" }
=link_to "Coach", "#coach"


.row
.large-12.columns
- if current_member.is_student? and
Expand Down