diff --git a/2.0_todo.txt b/2.0_todo.txt index 81d3e04..5b0dcb5 100644 --- a/2.0_todo.txt +++ b/2.0_todo.txt @@ -12,6 +12,9 @@ Action Mailer + Exception Notification db:seed task +latest Email-Spec + + Cool shit StringEx acts_as_url :title diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 638de8d..e22d6a0 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ac7c69f..a2ed2ed 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/stylesheets/partials/flashes.sass b/app/stylesheets/partials/flashes.sass new file mode 100644 index 0000000..0859600 --- /dev/null +++ b/app/stylesheets/partials/flashes.sass @@ -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 \ No newline at end of file diff --git a/app/views/home/about.html.haml b/app/views/home/about.html.haml new file mode 100644 index 0000000..34d375b --- /dev/null +++ b/app/views/home/about.html.haml @@ -0,0 +1 @@ +%h2 About Us \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index da3a937..8636fd2 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -5,27 +5,12 @@ - title = yield(:title) || configatron.site_description %title= configatron.site_name + " : " + title - - = 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 diff --git a/app/views/layouts/inner_page.html.haml b/app/views/layouts/inner_page.html.haml new file mode 100644 index 0000000..563547d --- /dev/null +++ b/app/views/layouts/inner_page.html.haml @@ -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' \ No newline at end of file diff --git a/app/views/layouts/landing_page.html.haml b/app/views/layouts/landing_page.html.haml new file mode 100644 index 0000000..00b59b0 --- /dev/null +++ b/app/views/layouts/landing_page.html.haml @@ -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' \ No newline at end of file diff --git a/features/step_definitions/devise_steps.rb b/features/step_definitions/devise_steps.rb new file mode 100644 index 0000000..0888dde --- /dev/null +++ b/features/step_definitions/devise_steps.rb @@ -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 + diff --git a/features/support/auto_open_page_on_fail.rb b/features/support/auto_open_page_on_fail.rb new file mode 100644 index 0000000..b0b8b60 --- /dev/null +++ b/features/support/auto_open_page_on_fail.rb @@ -0,0 +1,3 @@ +After do |scenario| + save_and_open_page if scenario.status == :failed +end \ No newline at end of file diff --git a/public/images/alerterror_icon.png b/public/images/alerterror_icon.png new file mode 100644 index 0000000..296415e Binary files /dev/null and b/public/images/alerterror_icon.png differ diff --git a/public/images/alertinfo_icon.png b/public/images/alertinfo_icon.png new file mode 100644 index 0000000..83de654 Binary files /dev/null and b/public/images/alertinfo_icon.png differ diff --git a/public/images/alertsuccess_icon.png b/public/images/alertsuccess_icon.png new file mode 100644 index 0000000..743ef89 Binary files /dev/null and b/public/images/alertsuccess_icon.png differ diff --git a/public/images/alertvalidation_error_icon.png b/public/images/alertvalidation_error_icon.png new file mode 100644 index 0000000..0183509 Binary files /dev/null and b/public/images/alertvalidation_error_icon.png differ diff --git a/public/images/alertwarning_icon.png b/public/images/alertwarning_icon.png new file mode 100644 index 0000000..0183509 Binary files /dev/null and b/public/images/alertwarning_icon.png differ