Permalink
Browse files

recovering changes

  • Loading branch information...
2 parents 85f49da + 67c8ddd commit 7bfb16b51b64a514f368a41fd97cec891f564dc6 @florida committed Nov 16, 2012
View
19 app/controllers/sessions_controller.rb
@@ -0,0 +1,19 @@
+class SessionsController < ApplicationController
+ def new
+ end
+
+ def create
+ user = login(params[:email], params[:password], params[:remember_me])
+ if user
+ redirect_back_or_to root_url, :notice => "Logged in!"
+ end
+ flash.now.alert = "Email or Password was invalid"
+ render :new
+ end
+
+ def destroy
+ logout
+ redirect_to root_url, :notice => "Logged Out!"
+ end
+
+end
View
15 app/controllers/users_controller.rb
@@ -0,0 +1,15 @@
+class UsersController < ApplicationController
+ def new
+ @user = User.new
+ end
+
+ def create
+ @user = User.new(params[:user])
+ if @user.save
+ redirect_to root_url, :notice => "Signed Up"
+
+ else
+ render :new
+ end
+ end
+end
View
2 app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
View
20 app/views/layouts/application.html.erb
@@ -44,7 +44,27 @@
</footer>
+<<<<<<< HEAD
+=======
+<header>
+ <ul>
+ <li><%= link_to 'Orders', admin_orders_path %></li>
+ <li><%= link_to 'Products', admin_products_path %></li>
+ <li></li>
+ </ul>
+
+
+</header>
+>>>>>>> 67c8ddd50d72f6ef054cabcf9360d7e6eccf2705
+
+
+<section id="container">
+ <% flash.each do |name,msg| %>
+ <%= content_tag :section, msg, :id => "flash_#{name}" %>
+ <% end %>
+ <%= yield %>
+</section>
</body>
</html>
View
18 app/views/sessions/new.html.erb
@@ -0,0 +1,18 @@
+<%= form_tag sessions_path do %>
+ <section class="field">
+ <% label_tag :email %>
+ <% text_field_tag :email, params [:email] %>
+
+ </section>
+ <section class="field">
+ <%= label_tag :password %>
+ <%= password_field_tag :password %>
+ </section>
+ <section class="field">
+ <%= check_box_tag :remember_me, 1, params[:remember_me]%>
+ <%= label_tag :remember_me %>
+ </section>
+ <section class="actions">
+ <%= submit_tag "Log in" %>
+ </section>
+<% end %>
View
29 app/views/users/new.html.erb
@@ -0,0 +1,29 @@
+<%= form_for @user do |f| %>
+ <% if @user.errors.any? %>
+ <section class="error_messages">
+ <h2>Form is invalid </h2>
+ <ul>
+ <% for message in @user.errors.full_messages %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ </section>
+ <% end %>
+
+ <section class="field">
+ <%= f.label :email %>
+ <%= f.text_field :email%>
+ </section>
+ <section class="field">
+ <%= f.label :password %>
+ <%= f.password_field :password %>
+ </section>
+ <section class="field">
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
+ </section>
+
+ <section class="actions">
+ <%= f.submit %>
+ </section>
+<% end %>
View
12 config/routes.rb
@@ -1,4 +1,5 @@
Elmorfstore::Application.routes.draw do
+<<<<<<< HEAD
match 'store' => 'store#index', :as => 'store', :via => :get
match 'shoppingcart' => 'store#show_cart', :as => 'shoppingcart', :via => :get
match 'add_to_cart/:id' => 'store#add_to_cart', :as => 'add_to_cart'
@@ -8,10 +9,15 @@
root :to => 'store#index'
namespace :admin do
+=======
+ # root :to => "store#index"
+
+ namespace :admin do
+ resources :orders, :products
+ end
+
+>>>>>>> 67c8ddd50d72f6ef054cabcf9360d7e6eccf2705
resources :orders, :products
-end
-
-resources :orders, :products
# The priority is based upon order of creation:
# first created -> highest priority.

0 comments on commit 7bfb16b

Please sign in to comment.