diff --git a/app/assets/stylesheets/pages/_contacts.scss b/app/assets/stylesheets/pages/_contacts.scss index a897fcf..ad0cd0b 100644 --- a/app/assets/stylesheets/pages/_contacts.scss +++ b/app/assets/stylesheets/pages/_contacts.scss @@ -6,7 +6,8 @@ a:hover { display: flex; justify-content: space-between; a { - align-self: flex-end; + align-self: center; + margin-top: 19px; } } @@ -145,6 +146,19 @@ a:hover { overflow: scroll; } +.close { + margin-right: 8px; + margin-top: -46px; + float: right; + font-size: 27px; + font-weight: bold; + line-height: 1; + color: #F55E4F; + text-shadow: 0 1px 0 #000; + opacity: 0.8; + filter: alpha(opacity=20); +} + diff --git a/app/controllers/connections_controller.rb b/app/controllers/connections_controller.rb index 0a8b48b..bf1c1be 100644 --- a/app/controllers/connections_controller.rb +++ b/app/controllers/connections_controller.rb @@ -15,4 +15,10 @@ class ConnectionsController < ApplicationController end end + + def destroy + connection = current_user.connections.find_by(contact_id: params[:id].to_i) + connection.destroy + redirect_to root_path + end end diff --git a/app/views/connections/new.html.erb b/app/views/connections/new.html.erb index 0543a78..081a36c 100644 --- a/app/views/connections/new.html.erb +++ b/app/views/connections/new.html.erb @@ -6,4 +6,3 @@ <%= f.submit %> <% end %> - diff --git a/app/views/pages/_contact.html.erb b/app/views/pages/_contact.html.erb index 6878932..724cb14 100644 --- a/app/views/pages/_contact.html.erb +++ b/app/views/pages/_contact.html.erb @@ -26,6 +26,10 @@ end <% end %> + <%= link_to connection_path(contact), method: :delete do %> + + <% end %> + diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index a9edc98..3b7a929 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb @@ -12,6 +12,8 @@ <%= render "pages/contact", contact: contact %> <% end %> + +