Merge branch 'master' into front-end

This commit is contained in:
Beatrice Olivera 2018-08-28 17:21:12 +01:00 committed by GitHub
commit e7b4b74c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 146 additions and 47 deletions

BIN
app/assets/images/phone.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@ -18,3 +18,4 @@
body { body {
background-color: $background; background-color: $background;
} }
@import "devise/index";

View File

@ -0,0 +1,24 @@
.banner {
color: white;
text-align: center;
height: 100vh;
/* if you have a 70px navbar => height: calc(100vh - 70px); */
background-size: cover !important;
display: flex;
align-items: center;
justify-content: center;
}
.banner h1 {
font-size: 60px;
font-weight: bold;
text-shadow: 0px 1px rgba(0, 0, 0, 0.2);
color: #F0FFFF;
}
.banner p {
font-size: 30px;
font-weight: lighter;
color: #F0FFFF;
opacity: 0.8;
margin-bottom: 20px;
}

View File

@ -1,3 +1,4 @@
// Import your components CSS files here. // Import your components CSS files here.
@import "alert"; @import "alert";
@import "navbar"; @import "navbar";
@import "banner";

View File

@ -0,0 +1 @@
@import 'login';

View File

@ -0,0 +1,40 @@
.login-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
position: absolute;
background-image:
linear-gradient(
-225deg,
rgba(5,25,55,0.3) 0%,
rgba(68,73,101,0.3),
rgba(128,129,149,0.3),
rgba(191,190,200,0.3),
rgba(255,255,255,0.3)
50%),
url('https://unsplash.com/photos/jay5BqVyf5A');
.login-content {
position: relative;
top: -10vh;
padding: 50px;
background-color: white;
width: 25vw;
border-radius: 3px;
box-shadow: 1px 1px 10px rgba(0,0,0, 0.21);
h2 {
color: $primary;
}
}
}
.login {
// color: $primary;
width:100%;
}

View File

@ -1,5 +1,5 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery with: :exception protect_from_forgery with: :exception
before_action :authenticate_user! # before_action :authenticate_user!
protect_from_forgery unless: -> { request.format.json? } # Only accept json protect_from_forgery unless: -> { request.format.json? } # Only accept json
end end

View File

@ -1,9 +1,12 @@
class PagesController < ApplicationController class PagesController < ApplicationController
skip_before_action :authenticate_user!, only: [:call] # skip_before_action :authenticate_user!, only: [:call]
def call def call
end end
def index def index
end end
def home
end
end end

View File

@ -1,25 +1,29 @@
<h2>Sign up</h2> <div class="login-container">
<div class="login-content">
<h2>Sign up</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.error_notification %> <%= f.error_notification %>
<div class="form-inputs"> <div class="form-inputs">
<%= f.input :email, <%= f.input :email,
required: true, required: true,
autofocus: true , autofocus: true ,
input_html: { autocomplete: "email" }%> input_html: { autocomplete: "email" }%>
<%= f.input :password, <%= f.input :password,
required: true, required: true,
hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length),
input_html: { autocomplete: "new-password" } %> input_html: { autocomplete: "new-password" } %>
<%= f.input :password_confirmation, <%= f.input :password_confirmation,
required: true, required: true,
input_html: { autocomplete: "new-password" } %> input_html: { autocomplete: "new-password" } %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up", class: "login btn btn-primary" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
</div> </div>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up" %>
</div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -1,20 +1,24 @@
<h2>Log in</h2> <div class="login-container">
<div class="login-content">
<h2>Log in</h2>
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-inputs"> <div class="form-inputs">
<%= f.input :email, <%= f.input :email,
required: false, required: false,
autofocus: true, autofocus: true,
input_html: { autocomplete: "email" } %> input_html: { autocomplete: "email" } %>
<%= f.input :password, <%= f.input :password,
required: false, required: false,
input_html: { autocomplete: "current-password" } %> input_html: { autocomplete: "current-password" } %>
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %> <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
</div>
<div class="form-actions">
<%= f.button :submit, "Log in", class: "login btn btn-primary" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
</div> </div>
</div>
<div class="form-actions">
<%= f.button :submit, "Log in" %>
</div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -3,7 +3,7 @@
<% end -%> <% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br /> <%#= link_to "Sign up", new_registration_path(resource_name) %><!-- <br /> -->
<% end -%> <% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>

View File

@ -3,14 +3,14 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>TODO</title> <title>Polyglot</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= action_cable_meta_tag %> <%= action_cable_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all' %> <%= stylesheet_link_tag 'application', media: 'all' %>
<%#= stylesheet_pack_tag 'application', media: 'all' %> <!-- Uncomment if you import CSS in app/javascript/packs/application.js --> <%#= stylesheet_pack_tag 'application', media: 'all' %> <!-- Uncomment if you import CSS in app/javascript/packs/application.js -->
</head> </head>
<body> <body>
<%= render 'shared/navbar' %> <%= render 'shared/navbar' unless params["action"] == "home"%>
<%= render 'shared/flashes' %> <%= render 'shared/flashes' %>
<%= yield %> <%= yield %>
<%= javascript_include_tag 'application' %> <%= javascript_include_tag 'application' %>

View File

@ -0,0 +1,17 @@
<div class="banner" style="background-image: linear-gradient(-225deg, rgba(5,25,55,0.3) 0%, rgba(68,73,101,0.3),rgba(128,129,149,0.3),rgba(191,190,200,0.3),rgba(255,255,255,0.3) 50%), url('<%= image_path 'phone.jpg' %>');">
<div class="banner-content">
<h1>Make a call</h1>
<p>Communicate in different languages</p>
<p>and receive real-time translated</p>
<p> subtitles in your native tongue.</p>
<p>
<span id="banner-typed-text"></span>
</p>
<%= link_to "Sign Up",new_user_registration_path, class: "btn btn-primary btn-lg" %>
<%= link_to "Login", new_user_session_path, class: "btn btn-primary btn-lg" %>
</div>
</div>
<% unless current_user.nil? %>
<% end %>

View File

@ -1,10 +1,14 @@
Rails.application.routes.draw do Rails.application.routes.draw do
get 'video_sessions/create' get 'video_sessions/create'
devise_for :users devise_for :users, path: '', path_names: { sign_out: 'logout'}
root to: 'pages#call' devise_scope :user do
get '/logout', to: 'devise/sessions#destroy'
end
root to: 'pages#home'
get '/contacts', to: 'pages#index' get '/contacts', to: 'pages#index'
post '/sessions', to: 'video_sessions#create' post '/sessions', to: 'video_sessions#create'
mount ActionCable.server, at: '/cable' mount ActionCable.server, at: '/cable'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get '/home', to: 'pages#home'
end end