From 269ce7915ee65a494b00e2361de2e8b0d9b3b09b Mon Sep 17 00:00:00 2001 From: Zachary Chai Date: Thu, 24 Nov 2016 11:16:56 -0500 Subject: [PATCH] separate root page and meetings page --- app/assets/javascripts/landing.js | 8 ++++--- app/controllers/landing_controller.rb | 3 +++ app/controllers/sessions_controller.rb | 2 +- app/views/landing/index.html.erb | 33 ++++++++++++++++++++++++++ app/views/landing/meetings.html.erb | 8 +++++++ config/locales/en-us.yml | 1 + config/routes.rb | 2 +- 7 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 app/views/landing/index.html.erb diff --git a/app/assets/javascripts/landing.js b/app/assets/javascripts/landing.js index fad81029..cd4097e2 100644 --- a/app/assets/javascripts/landing.js +++ b/app/assets/javascripts/landing.js @@ -131,7 +131,7 @@ } }; - var initIndex = function() { + var initMeetings = function() { $('.generate-link').click (function (e) { e.preventDefault(); @@ -157,8 +157,10 @@ $(document).on("turbolinks:load", function() { if ($("body[data-controller=landing]").get(0)) { init(); - if ($("body[data-action=meetings]").get(0)) { - initIndex(); + if ($("body[data-action=index]").get(0)) { + initMeetings(); + } else if ($("body[data-action=meetings]").get(0)) { + initMeetings(); } else if ($("body[data-action=rooms]").get(0)) { initRooms(); } diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index ca336cdc..3f14be1b 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -2,6 +2,9 @@ class LandingController < ApplicationController include BbbApi def index + end + + def resource if params[:resource] == 'meetings' render_meeting elsif params[:resource] == 'rooms' diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 54a0f3b5..d5c6bd50 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -2,7 +2,7 @@ class SessionsController < ApplicationController def create @user = User.from_omniauth(request.env['omniauth.auth']) session[:user_id] = @user.id - redirect_to controller: 'landing', action: 'index', id: @user.encrypted_id, resource: 'rooms' + redirect_to @user.room_url rescue => e logger.error "Error authenticating via omniauth: #{e}" redirect_to root_path diff --git a/app/views/landing/index.html.erb b/app/views/landing/index.html.erb new file mode 100644 index 00000000..37cfdf13 --- /dev/null +++ b/app/views/landing/index.html.erb @@ -0,0 +1,33 @@ +<% content_for :title do %> +
+ <%= t('hi_all') %> +
+ + <%= t('session_url_explanation') %> + +<% end %> + +<% if !@meeting_id %> + <% content_for :footer do %> + + <% end %> +<% end %> + +
+
+ +
+ <%= render layout: 'shared/center_panel' do %> +
+ <%= render 'shared/meeting_url', hidden: false %> + <%= render 'shared/join_form' %> +
+ <% end %> +
+ +
+
diff --git a/app/views/landing/meetings.html.erb b/app/views/landing/meetings.html.erb index 37cfdf13..6763a45c 100644 --- a/app/views/landing/meetings.html.erb +++ b/app/views/landing/meetings.html.erb @@ -17,6 +17,14 @@ <% end %> <% end %> +<% content_for :footer do %> + +<% end %> +
diff --git a/config/locales/en-us.yml b/config/locales/en-us.yml index bed580f8..38c106bb 100644 --- a/config/locales/en-us.yml +++ b/config/locales/en-us.yml @@ -35,6 +35,7 @@ en-US: unpublish_recording: Hide recording copied: Copied copy_error: Use Ctrl-c to copy + create_your_session: Create your own session date_recorded: Date duration: Duration end: End diff --git a/config/routes.rb b/config/routes.rb index 16bef9a8..9da269c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,7 +11,7 @@ Rails.application.routes.draw do # There are two resources [meetings|rooms] # meetings offer a landing page for NON authenticated users to create and join session in BigBlueButton # rooms offer a customized landing page for authenticated users to create and join session in BigBlueButton - get '/:resource/:id', to: 'landing#index', as: :resource + get '/:resource/:id', to: 'landing#resource', as: :resource get '/:resource/:id/join', to: 'bbb#join', as: :bbb_join, defaults: {format: 'json'} get '/:resource/:id/wait', to: 'landing#wait_for_moderator' get '/:resource/:id/session_status_refresh', to: 'landing#session_status_refresh'