diff --git a/app/assets/stylesheets/partials/_layout.css.scss b/app/assets/stylesheets/partials/_layout.css.scss index a00394592..a9a843f23 100644 --- a/app/assets/stylesheets/partials/_layout.css.scss +++ b/app/assets/stylesheets/partials/_layout.css.scss @@ -16,6 +16,7 @@ nav .brand { footer { background-color: #a0a0a0; padding: 60px 0; + margin-top: 50px; a { color: #774f9f; diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index a665f5b27..24c19ef8e 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b7f7020dc..f8bd58dbc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 41a08e68b..fa0dc5590 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -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 diff --git a/app/models/course_invitation.rb b/app/models/course_invitation.rb index 91a533b36..47f91dd90 100644 --- a/app/models/course_invitation.rb +++ b/app/models/course_invitation.rb @@ -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 diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/show.html.haml index 235c07057..0dcfbac0d 100644 --- a/app/views/dashboard/show.html.haml +++ b/app/views/dashboard/show.html.haml @@ -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 @@ -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 diff --git a/app/views/invitations/_coach.html.haml b/app/views/invitations/_coach.html.haml index a49226dea..0726b18c0 100644 --- a/app/views/invitations/_coach.html.haml +++ b/app/views/invitations/_coach.html.haml @@ -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 diff --git a/app/views/invitations/_student.html.haml b/app/views/invitations/_student.html.haml index 8e93b7ba9..2ede5a0ed 100644 --- a/app/views/invitations/_student.html.haml +++ b/app/views/invitations/_student.html.haml @@ -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 @@ -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" diff --git a/app/views/invitations/index.html.haml b/app/views/invitations/index.html.haml index 5faa01aad..c4c35575e 100644 --- a/app/views/invitations/index.html.haml +++ b/app/views/invitations/index.html.haml @@ -9,7 +9,6 @@ %dd{ "data-magellan-arrival" => "coach" } =link_to "Coach", "#coach" - .row .large-12.columns - if current_member.is_student? and