Skip to content

Commit

Permalink
add flashes icons, add layouts for inner and landing pages, add initi…
Browse files Browse the repository at this point in the history
…al autotest config for cuke
  • Loading branch information
Glenn Roberts committed Apr 23, 2010
1 parent a7ff418 commit 41ae0d1
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 17 deletions.
3 changes: 3 additions & 0 deletions 2.0_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Action Mailer + Exception Notification

db:seed task

latest Email-Spec


Cool shit
StringEx
acts_as_url :title
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ class HomeController < ApplicationController
PAGES = %w[about] #allowable (non-index) pages rendered by show action

def index
render :layout => 'landing_page'
end

#
def show
render :action => params[:page]
render :action => params[:page], :layout => 'inner_page'
end

end
6 changes: 6 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ def title(page_title)
content_for(:title) { page_title }
end

#http://m.onkey.org/2009/7/7/nested-layouts
def parent_layout(layout)
@content_for_layout = self.output_buffer
self.output_buffer = render(:file => "layouts/#{layout}")
end

end
36 changes: 36 additions & 0 deletions app/stylesheets/partials/flashes.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#Flash
.success
padding: 15px 10px 15px 50px
border-color: #9c9
color: #4F8A10
background: url(/images/alertsuccess_icon.png) #DFF2BF left no-repeat

.info
padding: 15px 10px 15px 50px
border-color: #9c9
color: #00529B
background: url(/images/alertinfo_icon.png) #BDE5F8 left no-repeat

.warning
padding: 15px 10px 15px 50px
border-color: #9c9
color: #9F6000
background: url(/images/alertwarning_icon.png) #FEEFB3 left no-repeat

.validation_error
padding: 15px 10px 15px 50px
border-color: #c99
color: #D63301
background: url(/images/alertvalidation_error_icon.png) #FFCCBA left no-repeat

.error
padding: 15px 10px 15px 50px
border-color: #c99
color: #D8000C
background: url(/images/alerterror_icon.png) #FFBABA left no-repeat

a
color: #fff

&:hover
background: #000
1 change: 1 addition & 0 deletions app/views/home/about.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%h2 About Us
17 changes: 1 addition & 16 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,12 @@
- title = yield(:title) || configatron.site_description
%title= configatron.site_name + " : " + title
<link rel="icon" href="/images/favicon.ico" type="image/x-icon" />

<meta name="google-site-verification" content=" YOUR TAG HERE " />
<meta name="description" content=" YOUR META TAGS" />

= stylesheet_link_tag 'compiled/grid.css', :media => 'screen, projection'
= stylesheet_link_tag 'compiled/text.css', :media => 'screen, projection'
= stylesheet_link_tag 'compiled/forms.css', :media => 'screen, projection'

= yield(:head)
%body
#container
= render :partial => 'layouts/header'

#content
%h2 Content
= render :partial => 'layouts/flashes'
= yield :layout

= render :partial => 'layouts/sidebar'

= render :partial => 'layouts/footer'


= yield() #we're using Pratiks nested layout method here with parent_layout()
= javascript_include_tag 'jquery-1.4.2.min', 'application', :cache => true
10 changes: 10 additions & 0 deletions app/views/layouts/inner_page.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#container
= render :partial => 'layouts/header'
#content
%h2 Inner Page Content
= render :partial => 'layouts/flashes'
= yield :layout
= render :partial => 'layouts/footer'

-# always on the last line
= parent_layout 'application'
12 changes: 12 additions & 0 deletions app/views/layouts/landing_page.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#container
= render :partial => 'layouts/header'
#content
%h2 Content
= render :partial => 'layouts/flashes'
= yield :layout

= render :partial => 'layouts/sidebar'
= render :partial => 'layouts/footer'

-# always on the last line
= parent_layout 'application'
19 changes: 19 additions & 0 deletions features/step_definitions/devise_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

Then /^I am redirected to "([^\"]*)"$/ do |url|
assert [301, 302].include?(@integration_session.status), "Expected status to be 301 or 302, got #{@integration_session.status}"
location = @integration_session.headers["Location"]
assert_equal url, location
visit location
end

Then /^I am not redirected to "([^\"]*)"$/ do |url|
assert ![301, 302].include?(@integration_session.status), "Expected status to be 301 or 302, got #{@integration_session.status}"
location = @integration_session.headers["Location"]
assert_not_equal url, location
end


Then /^I am redirected to the sign in page for privileged access$/ do
Then 'I am redirected to "/users/sign_in?unauthenticated=true"'
end

3 changes: 3 additions & 0 deletions features/support/auto_open_page_on_fail.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
After do |scenario|
save_and_open_page if scenario.status == :failed
end
Binary file added public/images/alerterror_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/alertinfo_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/alertsuccess_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/alertvalidation_error_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/alertwarning_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 41ae0d1

Please sign in to comment.