From f2c278ca713ab6255e0ba57b2e46adfaca44569a Mon Sep 17 00:00:00 2001 From: Despo Pentara Date: Mon, 5 May 2014 13:44:06 +0100 Subject: [PATCH 1/4] only display notice when not logged in. --- app/controllers/application_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 From 8e0b804c11bbb4a3ca40c1ebaf5b1dc3880a3b29 Mon Sep 17 00:00:00 2001 From: Despo Pentara Date: Mon, 5 May 2014 13:55:58 +0100 Subject: [PATCH 2/4] redirect if not logged in member --- app/controllers/invitations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 41a08e68b..8502d4db3 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -1,5 +1,5 @@ class InvitationsController < ApplicationController - before_action :logged_in? + before_action :is_member? def index if current_member.is_student? From 58c70ee838340a0c2f8bd4aa12f29939090b606e Mon Sep 17 00:00:00 2001 From: Despo Pentara Date: Mon, 5 May 2014 14:55:22 +0100 Subject: [PATCH 3/4] add margin to footer, enough with line breaks --- app/assets/stylesheets/partials/_layout.css.scss | 1 + 1 file changed, 1 insertion(+) 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; From fb05b08e06f4d86514a92a1ae0152e0ed80e1dbc Mon Sep 17 00:00:00 2001 From: Despo Pentara Date: Mon, 5 May 2014 15:13:29 +0100 Subject: [PATCH 4/4] display course invitations in portal, link RSVP button to portal if member signed in --- app/controllers/admin/application_controller.rb | 1 - app/controllers/invitations_controller.rb | 3 +++ app/models/course_invitation.rb | 5 ++++- app/views/dashboard/show.html.haml | 7 +++++-- app/views/invitations/_coach.html.haml | 6 ++++-- app/views/invitations/_student.html.haml | 13 +++++++++---- app/views/invitations/index.html.haml | 1 - 7 files changed, 25 insertions(+), 11 deletions(-) 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/invitations_controller.rb b/app/controllers/invitations_controller.rb index 8502d4db3..fa0dc5590 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -2,8 +2,11 @@ class InvitationsController < ApplicationController 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