diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 3962fa5..84d8e4f 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -1,5 +1,3 @@ //= require_tree . //= require_self //= require 'custom' -@import 'bootstrap-sprockets'; -@import 'bootstrap'; diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss index e2b26c5..af45d7d 100644 --- a/app/assets/stylesheets/custom.css.scss +++ b/app/assets/stylesheets/custom.css.scss @@ -1,3 +1,19 @@ +@import 'bootstrap-sprockets'; +@import 'bootstrap'; + body { padding-top: 70px; } + +#form-errors { + color: #f00; + ul { + list-style: none; + margin: 0 0 18px 0; + } +} + +.field_with_errors { + @extend .form-group; + @extend .has-error; +} diff --git a/app/views/application/_form_messages.html.erb b/app/views/application/_form_messages.html.erb new file mode 100644 index 0000000..8106272 --- /dev/null +++ b/app/views/application/_form_messages.html.erb @@ -0,0 +1,12 @@ +<% if object.errors.any? %> +
+
+ The form contains <%= pluralize(object.errors.count, 'error') %>. +
+ +
+<% end %> diff --git a/app/views/friendships/_form.html.erb b/app/views/friendships/_form.html.erb index c792b4b..1fd8c1d 100644 --- a/app/views/friendships/_form.html.erb +++ b/app/views/friendships/_form.html.erb @@ -1,17 +1,6 @@ -<%= form_for(@friendship) do |f| %> - <% if @friendship.errors.any? %> -
-

<%= pluralize(@friendship.errors.count, "error") %> prohibited this friendship from being saved:

- - -
- <% end %> - -
- <%= f.submit %> +<%= form_for @friendship, html: { role: 'form' } do |f| %> + <%= render 'form_messages', object: @friendship %> +
+ <%= f.submit class: 'btn btn-primary' %>
<% end %> diff --git a/app/views/friendships/index.html.erb b/app/views/friendships/index.html.erb index 6139261..be65d7e 100644 --- a/app/views/friendships/index.html.erb +++ b/app/views/friendships/index.html.erb @@ -11,7 +11,6 @@ <% @friendships.each do |friendship| %> <%= link_to 'Show', friendship %> - <%= link_to 'Edit', edit_friendship_path(friendship) %> <%= link_to 'Destroy', friendship, method: :delete, data: { confirm: 'Are you sure?' } %> <% end %> diff --git a/app/views/friendships/show.html.erb b/app/views/friendships/show.html.erb index 8a72d24..c780ccd 100644 --- a/app/views/friendships/show.html.erb +++ b/app/views/friendships/show.html.erb @@ -1,4 +1,3 @@

<%= notice %>

-<%= link_to 'Edit', edit_friendship_path(@friendship) %> | <%= link_to 'Back', friendships_path %>