diff --git a/app/assets/stylesheets/config/_bootstrap_variables.scss b/app/assets/stylesheets/config/_bootstrap_variables.scss index 77cb850..a947346 100755 --- a/app/assets/stylesheets/config/_bootstrap_variables.scss +++ b/app/assets/stylesheets/config/_bootstrap_variables.scss @@ -14,7 +14,7 @@ $gray-base: $gray; $brand-primary: $primary; $brand-success: $green; $brand-info: $yellow; -$brand-danger: $red; +$brand-danger: $warn; $brand-warning: $orange; $brand-secondary: $secondary; @@ -52,3 +52,4 @@ $border-radius-small: 2px; } // Override other variables below! +$input-border-focus: $primary; diff --git a/app/assets/stylesheets/config/_colors.scss b/app/assets/stylesheets/config/_colors.scss index dfca064..f551eb7 100644 --- a/app/assets/stylesheets/config/_colors.scss +++ b/app/assets/stylesheets/config/_colors.scss @@ -8,6 +8,7 @@ $orange: #E67E22; $green: #32B796; $gray: #000000; $light-gray: #F4F4F4; +$warn: #3d63cc; $primary: #F55E4F; $secondary: #5ED17E; diff --git a/app/assets/stylesheets/pages/_settings.scss b/app/assets/stylesheets/pages/_settings.scss index 9e511d8..b7b0f6c 100644 --- a/app/assets/stylesheets/pages/_settings.scss +++ b/app/assets/stylesheets/pages/_settings.scss @@ -91,3 +91,22 @@ input:checked + .slider:before { .padding-right { padding-right: 10px; } + +.margin-right { + margin-right: 10px; +} + +.flex-inline { + display: flex; + flex-direction: row; + align-items: center; +} + +.center-screen { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + text-align: center; + min-height: 80vh; +} diff --git a/app/assets/stylesheets/users/_show.scss b/app/assets/stylesheets/users/_show.scss index e800dd4..90bc12d 100644 --- a/app/assets/stylesheets/users/_show.scss +++ b/app/assets/stylesheets/users/_show.scss @@ -4,6 +4,7 @@ display:flex; flex-direction: column; justify-content: center; + text-align: center; h2 { font-size: 1.5em; @@ -21,33 +22,38 @@ margin-right: .5em; } } - .profile-pic { - display: flex; - align-items: center; - margin-right: 3em; - img { - width: 10em; - } - } - - .profile-text { - display: flex; - flex-direction: column; - justify-content: center; - color: #f2321f; - h1 { - margin: 0 0 .5em 0 ; - } - h2 { - margin: 0; - } - .italics { - font-style: italic; - color: white; - } - } } +} +.profile-text { + display: flex; + flex-direction: column; + justify-content: center; + color: $primary; + h1 { + margin: 0 0 .5em 0 ; } + h2 { + margin: 0; + } + .italics { + font-style: italic; + color: white; + } +} +.vcenter { + display: inline-block; + vertical-align: middle; + float: none; +} +.vertical-padding { + padding-top: 5px; + padding-bottom: 5px; +} + +.vertical-margin { + margin-top: 5px; + margin-bottom: 5px; +} diff --git a/app/controllers/connections_controller.rb b/app/controllers/connections_controller.rb index 0a8b48b..f22135d 100644 --- a/app/controllers/connections_controller.rb +++ b/app/controllers/connections_controller.rb @@ -1,6 +1,5 @@ class ConnectionsController < ApplicationController def new - end def create @@ -10,9 +9,17 @@ class ConnectionsController < ApplicationController @connection.contact = contact_user if @connection.save - redirect_to contacts_path + contact_message = nil + if contact_user.first_name.nil? || contact_user.last_name.nil? + contact_message = "#{contact_user.email}" + else + contact_message = "#{contact_user.first_name} #{contact_user.last_name}" + end + flash[:notice] = "Added #{contact_message} to contacts" + redirect_to contacts_path else - + flash[:alert] = "Invalid email address!" + render 'new' end end end diff --git a/app/views/connections/new.html.erb b/app/views/connections/new.html.erb index 0543a78..e6db9ff 100644 --- a/app/views/connections/new.html.erb +++ b/app/views/connections/new.html.erb @@ -1,9 +1,23 @@ -
-

Add a new contact:

- <%= form_for User.new, url: connections_path do |f| %> - <%= f.label :email, class: "email_label_color" %>: - <%= f.text_field :email %> +<% params["action"] = "Add contact" %> - <%= f.submit %> - <% end %> +
+
+
+
+
+

Enter an email address:

+
+ <%= simple_form_for User.new, url: connections_path, class: "input-group" do |f| %> +
+
+ <%= f.input_field :email, class: "form-control margin-right" %> +
+ <%= f.button :submit, value: "Add Contact" , class: "btn btn-primary" %> +
+
+
+ <% end %> +
+
+
diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index 4fca728..b7c7c93 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb @@ -8,7 +8,7 @@

Contacts

- <%= link_to new_connection_path do %> + <%= link_to add_contact_path do %> <% end %>
diff --git a/app/views/users/setting.html.erb b/app/views/users/setting.html.erb index b6ec6e7..9aa6733 100644 --- a/app/views/users/setting.html.erb +++ b/app/views/users/setting.html.erb @@ -60,15 +60,15 @@
<%= t.label :language, class:'padding-right no-margin font-weight-normal' %> - <%= t.input_field :language, collection: languages.sort, class:'input-field-text-black input-dropdown' %> + <%= t.input_field :language, collection: languages.sort, class:'input-field-text-black input-dropdown form-control' %>
<%= t.label :caption_font, class:'padding-right no-margin font-weight-normal' %> - <%= t.input_field :caption_font, collection: fonts.sort, class:'input-field-text-black input-dropdown' %> + <%= t.input_field :caption_font, collection: fonts.sort, class:'input-field-text-black input-dropdown form-control' %>
<%= t.label :caption_font_size, class:'padding-right no-margin font-weight-normal' %> - <%= t.input_field :caption_font_size, class:'input-field-text-black' %> + <%= t.input_field :caption_font_size, class:'input-field-text-black input-dropdown form-control' %>
<%= t.label :enable_transcript, class:'padding-right no-margin font-weight-normal' %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fcd054c..020cacb 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,27 +1,28 @@ - - -
-
-
- <% if @user.photo.url.nil? %> - <%= image_tag "https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png", class: "img-circle"%> - <% else %> - <%= cl_image_tag @user.photo, class: "img-circle"%> - <% end %> - +
+
+
+ <% if @user.photo.url.nil? %> + <%= image_tag "https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png", class: "img-circle"%> + <% else %> + <%= cl_image_tag @user.photo, class: "img-circle"%> + <% end %> +
-
-

<%= @user.first_name %> <%= @user.last_name %>

-

<%= @user.email %>

+
+
+

<%= @user.first_name %> <%= @user.last_name %>

+

<%= @user.email %>

+
- -
- <%= link_to "Edit Information", user_edit_path(@user), class: "btn btn-primary" %> - <%= link_to "Delete Account", user_path(@user), class: "btn btn-danger", method: :delete, data: { +
+
+ <%= link_to "Edit Information", user_edit_path(@user), class: "btn btn-primary vertical-margin" %> + <%= link_to "Delete Account", user_path(@user), class: "btn btn-danger vertical-margin", method: :delete, data: { confirm: "Are you sure?" } %>
+
-
+
diff --git a/config/routes.rb b/config/routes.rb index 60e89c4..08df58e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -36,12 +36,11 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get '/home', to: 'pages#home' - get '/users/:id', to: 'users#show', as: :user get '/users/:id/edit', to: 'users#edit', as: :user_edit patch '/users/:id', to: 'users#update' delete '/users/:id', to: 'users#destroy' - resources :connections, only: [:create, :new] - #get '/add_contact', to: 'connections#create' + resources :connections, only: [:create] + get '/add_contact', to: 'connections#new', as: :add_contact end