commit
103f00d55a
|
@ -20,3 +20,5 @@ body {
|
||||||
}
|
}
|
||||||
@import "devise/index";
|
@import "devise/index";
|
||||||
@import "users/index";
|
@import "users/index";
|
||||||
|
@import "connections/index";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
@import 'new';
|
|
@ -0,0 +1,11 @@
|
||||||
|
.align-center {
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
h2 {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.email {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,14 @@ a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contacts-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
a {
|
||||||
|
align-self: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
class ConnectionsController < ApplicationController
|
||||||
|
def new
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@connection = Connection.new
|
||||||
|
@connection.user = current_user
|
||||||
|
contact_user = User.find_by(email: params[:user][:email])
|
||||||
|
@connection.contact = contact_user
|
||||||
|
|
||||||
|
if @connection.save
|
||||||
|
redirect_to contacts_path
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -6,11 +6,15 @@ class PagesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@contact = Connection.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def home
|
def home
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cable_testing
|
def cable_testing
|
||||||
chatroom = 'chat_room_' + params[:chat_room_id]
|
chatroom = 'chat_room_' + params[:chat_room_id]
|
||||||
puts params
|
puts params
|
||||||
|
|
|
@ -31,6 +31,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_user
|
def find_user
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<div class="align-center">
|
||||||
|
<h2>Add a new contact:</h2>
|
||||||
|
<%= form_for User.new, url: connections_path do |f| %>
|
||||||
|
<%= f.label :email, class: "email" %>:
|
||||||
|
<%= f.text_field :email %>
|
||||||
|
|
||||||
|
<%= f.submit %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -6,7 +6,11 @@ end
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<img src="https://kitt.lewagon.com/placeholder/users/ssaunier" alt="" class="profile img-circle" width=65>
|
<% if contact.photo.url.nil? %>
|
||||||
|
<img src="https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png" class="avatar profile dropdown-toggle img-circle" width=65>
|
||||||
|
<% else %>
|
||||||
|
<%= cl_image_tag contact.photo, class: "profile avatar dropdown-toggle img-circle", width:65%>
|
||||||
|
<% end %>
|
||||||
<div class="text text-color">
|
<div class="text text-color">
|
||||||
<% if contact.nil? || contact.nil? %> <!-- REPLACE WITH FIRST NAME AND LAST NAME -->
|
<% if contact.nil? || contact.nil? %> <!-- REPLACE WITH FIRST NAME AND LAST NAME -->
|
||||||
<p><%= contact.email %></p>
|
<p><%= contact.email %></p>
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="contacts-container text-color">
|
<div class="contacts-container text-color">
|
||||||
<div class="contacts half">
|
<div class="contacts half">
|
||||||
<h2 class="contact">Contacts</h2>
|
<div class="contacts-header">
|
||||||
|
<h2>Contacts</h2>
|
||||||
|
|
||||||
|
<%= link_to new_connection_path do %>
|
||||||
|
<i class="fas fa-plus-square"></i>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<% current_user.contacts.each do |contact| %>
|
<% current_user.contacts.each do |contact| %>
|
||||||
<%= render "pages/contact", contact: contact %>
|
<%= render "pages/contact", contact: contact %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="video-feed half">
|
<div class="video-feed half">
|
||||||
<div class="video-content">
|
<div class="video-content">
|
||||||
|
|
|
@ -41,4 +41,7 @@ Rails.application.routes.draw do
|
||||||
get '/users/:id/edit', to: 'users#edit', as: :user_edit
|
get '/users/:id/edit', to: 'users#edit', as: :user_edit
|
||||||
patch '/users/:id', to: 'users#update'
|
patch '/users/:id', to: 'users#update'
|
||||||
delete '/users/:id', to: 'users#destroy'
|
delete '/users/:id', to: 'users#destroy'
|
||||||
|
|
||||||
|
resources :connections, only: [:create, :new]
|
||||||
|
#get '/add_contact', to: 'connections#create'
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,3 +5,5 @@
|
||||||
#
|
#
|
||||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
||||||
# Character.create(name: 'Luke', movie: movies.first)
|
# Character.create(name: 'Luke', movie: movies.first)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ConnectionsControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in New Issue