Skip to content
Snippets Groups Projects
Commit 9118bd79 authored by Tyler Lemburg's avatar Tyler Lemburg
Browse files

Space allocation, migration, and calendar page

parent e811354c
No related branches found
No related tags found
No related merge requests found
require 'sinatra'
require 'models/user'
require 'models/service_space'
use Rack::Session::Cookie, :key => 'rack.session',
:path => '/',
......@@ -34,9 +36,45 @@ before do
]
session[:init] = true
# check if the user is currently logged in
if session.has_key?(:user_id)
@user = (User.includes(:permissions).find(session[:user_id]) rescue nil)
else
@user = nil;
end
end
helpers do
def load_service_space
url_name = params[:service_space_url_name]
space = ServiceSpace.find_by(:url_name => url_name)
raise Sinatra::NotFound if space.nil?
@space = space
end
def require_login
if @user.nil?
flash(:alert, 'You Must Login', 'That page requires you to be logged in. If you don\'t have an account, please sign up for <a href="/new_members/">New&nbsp;Member&nbsp;Orientation</a>.')
redirect '/login/'
end
end
end
not_found do
@breadcrumbs << {:text => 'Not Found'}
erb 'That page was not found.', :layout => :fixed
end
error do
@breadcrumbs << {:text => 'Error'}
flash(:danger, 'Sorry! There was an error.', "We apologize. A really bad error occurred and it didn't work. We're fixing this as we speak.")
erb 'In the meantime, you can <a href="/">go back to the homepage</a>.', :layout => :fixed
end
get '/' do
@breadcrumbs << {:text => 'Home'}
'Home'
end
\ No newline at end of file
erb 'Home', :layout => :fixed
end
Dir.glob("#{ROOT}/routes/*.rb") { |file| require file }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment