summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/custom.css.scss20
-rw-r--r--app/views/common/_signout.html.erb5
-rw-r--r--app/views/layouts/application.html.erb9
-rw-r--r--config/routes.rb8
4 files changed, 18 insertions, 24 deletions
diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss
index faecdce..0599a93 100644
--- a/app/assets/stylesheets/custom.css.scss
+++ b/app/assets/stylesheets/custom.css.scss
@@ -7,17 +7,13 @@ header > nav {
#log-buttons {
margin-top: 8px;
- }
- .signup {
- @extend .btn;
- @extend .btn-success;
- }
- .signin {
+ form { display: inline; }
+ a, input[type="submit"] {
@extend .btn;
- @extend .btn-info;
+ &.user { @extend .btn-info; }
+ &.signup { @extend .btn-success; }
+ &.signin { @extend .btn-info; }
+ &.signout { @extend .btn-danger; }
}
- .signout {
- @extend .btn;
- @extend .btn-danger;
- }
- } \ No newline at end of file
+ }
+}
diff --git a/app/views/common/_signout.html.erb b/app/views/common/_signout.html.erb
new file mode 100644
index 0000000..2bdda0c
--- /dev/null
+++ b/app/views/common/_signout.html.erb
@@ -0,0 +1,5 @@
+<%=
+form_tag(sessions_path+"/current", method: "delete") do
+ submit_tag("Sign out", :class => "signout")
+end
+%>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 9cc30bc..39d73dd 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -19,12 +19,11 @@
<div id="log-buttons">
<% if signed_in? %>
- <%= current_user.user_name.upcase %>
- <%= link_to "Sign out", "/signout", method: "delete", :class => "signout", :role => "button" %>
+ <%= link_to current_user.user_name, current_user, :class => "user" %>
+ <%= render "common/signout" %>
<% else %>
- <%= link_to "Log in", new_session_path, :class => "signin", :role => "button" %>
- <%= link_to "Sign up", new_user_path, :class => "signup", :role => "button"
- %>
+ <%= link_to "Log in", new_session_path, :class => "signin" %>
+ <%= link_to "Sign up", new_user_path, :class => "signup" %>
<% end %>
</div>
</nav></header>
diff --git a/config/routes.rb b/config/routes.rb
index 90abea4..022ce42 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,13 +1,7 @@
Leaguer::Application.routes.draw do
- resources :sessions, only: [:new, :create, :destroy]
-
-
#creates sessions as a resource but limits it to these actions
- match '/signup', to: 'users#new', via: 'get'
- match '/signin', to: 'sessions#new', via: 'get'
- match '/signout', to: 'sessions#destroy', via: 'get'
-
+ resources :sessions, only: [:new, :create, :destroy]
resources :users