diff --git a/app/assets/javascripts/landing.js b/app/assets/javascripts/landing.js index b3e24d18..9ede6b12 100644 --- a/app/assets/javascripts/landing.js +++ b/app/assets/javascripts/landing.js @@ -1,10 +1,12 @@ (function() { - var initIndex = function() { - $('#join_form_button').click (function (event) { + var init = function() { + + $('.meeting-join').click (function (event) { + var url = $('.meeting-url').val(); + var name = $('.meeting-user-name').val(); $.ajax({ - url : $(this).data ('url') + "?name=" + $('#join_form_name').val(), + url : url + "/join?name=" + name, dataType : "json", - async : true, type : 'GET', success : function(data) { $(location).attr("href", data.response.join_url); @@ -16,30 +18,50 @@ }); }); - $('#url_form_button').click (function (event) { - $.ajax({ - url : $(this).data ('url'), - dataType : "json", - async : true, - type : 'GET', - success : function(data) { - $('#meeting_url').html(data.response.meeting_url); - $('#text_meeting_url').attr("href", data.response.meeting_url); - $('#text_meeting_url').text(data.response.meeting_url); - }, - error : function(xhr, status, error) { - }, - complete : function(xhr, status) { - } - }); + $('.meeting-url-copy').click (function (e) { + meetingURL = $('.meeting-url'); + meetingURL.select(); + document.execCommand("copy"); + meetingURL.blur(); }); }; + var initIndex = function() { + + $('.generate-link').click (function (e) { + e.preventDefault(); + var link = window.location.protocol + + '//' + + window.location.hostname + + '/' + + 'meetings/' + + Math.trunc(Math.random() * 1000000000); + + $('.meeting-url').val(link); + }); + + + $('.meeting-url').val(''); + $('.generate-link').click(); + }; + + var initRooms = function() { + meetingURL = $('.meeting-url'); + var link = window.location.protocol + + '//' + + window.location.hostname + + meetingURL.data('path'); + meetingURL.val(link); + }; + $(document).on("turbolinks:load", function() { + init(); if ($("body[data-controller=landing]").get(0)) { - if ($("body[data-action=meeting]").get(0) || $("body[data-action=room]").get(0)) { + if ($("body[data-action=meetings]").get(0)) { initIndex(); + } else if ($("body[data-action=rooms]").get(0)) { + initRooms(); } } }); -}).call(this); \ No newline at end of file +}).call(this); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index a15c8c86..6f2b6eff 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -10,8 +10,8 @@ * files in this directory. Styles in this file should be added after the last require_* statement. * It is generally better to create a new file per style scope. * - *= require_tree . *= require jquery-ui *= require dataTables/jquery.dataTables + *= require_tree . *= require_self */ diff --git a/app/assets/stylesheets/landing.scss b/app/assets/stylesheets/landing.scss index 48ad3a1c..f33d6f8d 100644 --- a/app/assets/stylesheets/landing.scss +++ b/app/assets/stylesheets/landing.scss @@ -1,15 +1,3 @@ // Place all the styles related to the landing controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ - -// Bootstrap -@import "bootstrap-sprockets"; -@import "bootstrap"; -@import "bootstrap-social"; -@import "font-awesome"; - -.room { - .room-link { - margin: 0 auto; - } -} diff --git a/app/assets/stylesheets/narrow-jumbotron.css b/app/assets/stylesheets/narrow-jumbotron.css deleted file mode 100644 index a2dbf869..00000000 --- a/app/assets/stylesheets/narrow-jumbotron.css +++ /dev/null @@ -1,79 +0,0 @@ -/* Space out content a bit */ -body { - padding-top: 1.5rem; - padding-bottom: 1.5rem; -} - -/* Everything but the jumbotron gets side spacing for mobile first views */ -.header, -.marketing, -.footer { - padding-right: 1rem; - padding-left: 1rem; -} - -/* Custom page header */ -.header { - padding-bottom: 1rem; - border-bottom: .05rem solid #e5e5e5; -} -/* Make the masthead heading the same height as the navigation */ -.header h3 { - margin-top: 0; - margin-bottom: 0; - line-height: 3rem; -} - -/* Custom page footer */ -.footer { - padding-top: 1.5rem; - color: #777; - border-top: .05rem solid #e5e5e5; -} - -/* Customize container */ -@media (min-width: 48em) { - .container { - max-width: 72rem; - } -} -.container-narrow > hr { - margin: 2rem 0; -} - -/* Main marketing message and sign up button */ -.jumbotron { - text-align: center; - border-bottom: .05rem solid #e5e5e5; -} -.jumbotron .btn { - padding: .75rem 1.5rem; - font-size: 1.5rem; -} - -/* Supporting marketing content */ -.marketing { - margin: 3rem 0; -} -.marketing p + h4 { - margin-top: 1.5rem; -} - -/* Responsive: Portrait tablets and up */ -@media screen and (min-width: 48em) { - /* Remove the padding we set earlier */ - .header, - .marketing, - .footer { - padding-right: 0; - padding-left: 0; - } - /* Space out the masthead */ - .header { - margin-bottom: 2rem; - } - /* Remove the bottom border on the jumbotron for visual effect */ - .jumbotron { - border-bottom: 0; - } -} diff --git a/app/assets/stylesheets/shared.scss b/app/assets/stylesheets/shared.scss new file mode 100644 index 00000000..cea5f60a --- /dev/null +++ b/app/assets/stylesheets/shared.scss @@ -0,0 +1,51 @@ +@import "bootstrap-sprockets"; +@import "bootstrap"; +@import "bootstrap-social"; +@import "font-awesome"; + + +html, body { + width: 100%; + height: 100%; +} + +.header { + padding: 20px 40px; + + .logo { + max-width: 150px; + max-height: 50px; + } +} + +.footer { + padding: 20px; +} + +.page-header { + margin-top: 100px; + border: 0; +} + +.content-box { + .center-block { + float: none; + } + + .input-spacing { + margin-top: 15px; + } + + .panel-footer { + padding: 35px; + background-color: white; + } + + .panel-body { + padding-bottom: 40px; + } + + .title-wrapper { + margin-bottom: 30px; + } +} diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index e500e1a2..689080ef 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -10,18 +10,6 @@ class LandingController < ApplicationController end end - # GET /token.json - def new_meeting - respond_to do |format| - meeting_url = resource_url('meetings', helpers.new_meeting_token) - format.json { render :json => { :messageKey => "ok", :message => "New meeting URL created", :status => :ok, :response => { :meeting_url => meeting_url} }, :status => status } - end - end - - def meeting - render_meeting - end - def admin? @user == current_user end @@ -30,16 +18,13 @@ class LandingController < ApplicationController private def render_meeting - @resource = params[:resource] - @meeting_token = params[:id] || @meeting_token = helpers.new_meeting_token - @refreshable = (params[:resource] == 'meetings' && !params.has_key?(:id)) + params[:action] = 'meetings' render :action => 'meeting' end def render_room - @resource = params[:resource] - @meeting_token = params[:id] - @user = User.find_by(username: @meeting_token) + params[:action] = 'rooms' + @user = User.find_by(username: params[:id]) if @user.nil? redirect_to root_path return diff --git a/app/models/user.rb b/app/models/user.rb index 9cfb2add..0d9f7aa5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,6 +19,14 @@ class User < ApplicationRecord auth_hash['info']['nickname'] end + def ownership_name + if username.end_with? 's' + "#{username}'" + else + "#{username}'s" + end + end + def room_url "/rooms/#{username}" end diff --git a/app/views/landing/_footer_message.html.erb b/app/views/landing/_footer_message.html.erb deleted file mode 100644 index ed818a1e..00000000 --- a/app/views/landing/_footer_message.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
diff --git a/app/views/landing/_footer_oauth_append.html.erb b/app/views/landing/_footer_oauth_append.html.erb deleted file mode 100644 index 2c3f58c7..00000000 --- a/app/views/landing/_footer_oauth_append.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - diff --git a/app/views/landing/_join_form.html.erb b/app/views/landing/_join_form.html.erb deleted file mode 100644 index f3cf610f..00000000 --- a/app/views/landing/_join_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -