Skip to content

Commit

Permalink
Hide the events to the guest users
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmyn5600 committed May 4, 2021
1 parent bfb0c0a commit 6b29da9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.3'
ruby '2.7.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/events_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ def show_event_list(events)
out = ''
events.each do |event|
out += "<div class=\"box\">"
if user_signed_in?
out += "<ul><li>#{link_to event.title, event_url(event), class: 'event-title'}</li>"
elsif
out += "<ul><li>#{link_to event.title, new_event_path, class: 'event-title'}</li>"
end
out += "<li><b>Description:</b> #{event.description}</li>"
out += "<li><b>Date:</b> #{event.date}</li>"
out += "<li><b>Location:</b> #{event.location}</li></ul>"
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Rails.application.routes.draw do
devise_for :users, :controllers => { registrations: 'registrations' }
root "events#index"
resources :events
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root "events#index"
resources :event_attendees, only: [:create, :destroy]
end

0 comments on commit 6b29da9

Please sign in to comment.