Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: gbataille/kenfaire
base: f35c0c240e
...
head fork: gbataille/kenfaire
compare: 0540637a8b
  • 5 commits
  • 16 files changed
  • 0 commit comments
  • 1 contributor
View
2  README.rdoc
@@ -1 +1 @@
-Kenfaire app
+Kenfaire Rails Application
View
BIN  app/assets/images/recyclage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/recyclage_120.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/recyclage_250.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3  app/assets/javascripts/sessions.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
View
98 app/assets/stylesheets/application.css.sass
@@ -1,12 +1,8 @@
@import 'bootstrap'
-$image-size: 100px
-$content-height: 600px
-$footer-height: 50px
+$image-size: 120px
$color-brownish: #F9C498
-
$padding-menu: 4px
-$padding-content: 10px
@mixin menutheme
background-color: $color-brownish
@@ -15,13 +11,33 @@ $padding-content: 10px
body.body
background: url('recyclage.png')
background-repeat: repeat
- background-color: white
+ background-color: $color-brownish
+
+ margin-top: 30px
+ margin-bottom: 30px
span.errors
background-color: red
+.scroll
+ overflow: scroll
+
+.toprow
+ height: $image-size
+
+.middlerow
+ height: 500px
+
+.footrow
+ height: 30px
+
+.logo
+ background: url('recyclage_120.png')
+ background-size: contain
+ background-repeat: no-repeat
+
.pagecontent
- margin: 50px 50px 20px 20px
+ background-color: white
-moz-border-radius: 30px
-webkit-border-radius: 30px
@@ -31,78 +47,14 @@ span.errors
-webkit-box-shadow: 5px 5px 15px 3px rgba(0, 0, 0, .6)
box-shadow: 5px 5px 15px 3px rgba(0, 0, 0, .6)
-.ulcorner
- background: url('recyclage.png')
- background-size: cover
-
- @include menutheme
-
- -moz-border-radius: 30px 0 0 0
- -webkit-border-radius: 30px 0 0 0
- border-radius: 30px 0 0 0
-
- width: $image-size
- height: $image-size
-
- float: left
-
-.topcenter
- @include menutheme
-
- height: $image-size
-
- overflow: hidden
-
.titlebar
- @include menutheme
-
height: 70%
.menubar
- @include menutheme
-
height: 30%
-.topright
- @include menutheme
-
- height: $image-size
- width: $image-size
-
- -moz-border-radius: 0 30px 0 0
- -webkit-border-radius: 0 30px 0 0
- border-radius: 0 30px 0 0
-
- float: right
-.leftmenu
- @include menutheme
- width: $image-size
- height: $content-height - (2 * $padding-menu)
-
- float: left
-
-.content
-
- background-color: white
- height: $content-height - (2 * $padding-content)
-
- padding: 10px
- overflow: scroll
-
- text-align: center
-
- h1
- margin-bottom: 15px
-
-.footer
- @include menutheme
- height: $footer-height
-
- -moz-border-radius: 0 0 30px 30px
- -webkit-border-radius: 0 0 30px 30px
- border-radius: 0 0 30px 30px
-
- clear: both
+.debug
+ margin: 30px
.debug_dump
-moz-box-sizing: border-box
View
3  app/assets/stylesheets/sessions.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
2  app/controllers/application_controller.rb
@@ -1,4 +1,4 @@
class ApplicationController < ActionController::Base
protect_from_forgery
-
+ include SessionsHelper
end
View
20 app/controllers/sessions_controller.rb
@@ -0,0 +1,20 @@
+class SessionsController < ApplicationController
+ def new
+
+ end
+
+ def create
+ user = User.find_by_email(params[:session][:email])
+ if user && user.authenticate(params[:session][:password])
+ sign_in user
+ redirect_to user
+ else
+ flash.now[:error] = 'Invalid email/password combination'
+ render 'new'
+ end
+ end
+
+ def destroy
+
+ end
+end
View
2  app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
View
42 app/views/layouts/application.html.haml
@@ -8,24 +8,26 @@
= csrf_meta_tags
%body.body
- .pagecontent
- .ulcorner
- .topright
- =render :file => 'layouts/user_panel'
- .topcenter
- .titlebar
- %h2
- KenFaire?
- .menubar
- =render :file => 'layouts/top_menu_bar'
+ .container.pagecontent
+ .row
+ .span2.logo.toprow
+ .span8.toprow
+ .titlebar
+ %h2
+ KenFaire?
+ .menubar
+ =render :file => 'layouts/top_menu_bar'
+ .span2.toprow
+ =render :file => 'layouts/user_panel'
+ .row
+ .span2.middlerow
+ =render :file => 'layouts/left_navigation'
+ .span10.middlerow.scroll
+ =render :file => 'layouts/notice'
+ = yield
+ .row
+ .span12.footrow
+ =render :file => 'layouts/footer'
- .leftmenu
- =render :file => 'layouts/left_navigation'
- .content
- =render :file => 'layouts/notice'
- = yield
-
- .footer
- =render :file => 'layouts/footer'
-
- = debug(params) if Rails.env.development?
+ .debug
+ = debug(params) if Rails.env.development?
View
2  app/views/layouts/user_panel.html.haml
@@ -1 +1 @@
-=link_to 'Sign Up', 'signup'
+=link_to 'Sign Up', '/signup'
View
17 app/views/sessions/new.html.haml
@@ -0,0 +1,17 @@
+%h1 Sign In
+
+.row
+ .span6.offset4
+ = form_for(:session, url: sessions_path) do |f|
+
+ = f.label :email
+ = f.text_field :email
+
+ = f.label :password
+ = f.password_field :password
+
+ = f.submit "Sign in", class: "btn btn-large btn-primary"
+
+ %p
+ New user?
+ = link_to "Sign up now!", signup_path
View
1  config/application.rb
@@ -59,7 +59,6 @@ class Application < Rails::Application
#Use Sass extension to generate CSS path/names
#Use HAML for view files
config.generators do |g|
- g.template_engine :haml
g.stylesheet_engine = :sass
end
end
View
7 config/routes.rb
@@ -1,9 +1,10 @@
Kenfaire::Application.routes.draw do
resources :users
-
+ resources :sessions, only: [:new, :create, :destroy]
+
match 'signup' => 'users#new', :as => :signup
- match 'login' => 'users#new', :as => :login
- match 'logout' => 'users#new', :as => :logout
+ match '/signin', to: 'sessions#new'
+ match '/signout', to: 'sessions#destroy', via: :delete
get "home/index"
View
32 spec/requests/authentication_pages_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe "Authentication" do
+
+ subject { page }
+
+ describe "signin page" do
+ before { visit signin_path }
+
+ it { should have_content('Sign In') }
+
+ describe "with invalid information" do
+ before { click_button "Sign in" }
+
+ it { should have_content('Sign In') }
+ #it { should have_selector('div.alert.alert-error', text: 'Invalid') }
+ end
+
+ #describe "with valid information" do
+ # let(:user) { FactoryGirl.create(:user) }
+ # before do
+ # fill_in "Email", with: user.email
+ # fill_in "Password", with: user.pwd
+ # click_button "Sign in"
+ # end
+
+ # it { current_path.should == user_path(user) }
+ #end
+
+ end
+
+end

No commit comments for this range

Something went wrong with that request. Please try again.