From 1c152c87ab2cebf66dddc8a3d4a3c13cca91c635 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Wed, 14 May 2014 13:16:08 +0530 Subject: [PATCH 01/10] Create Splash Page using existing routes as Conference#Show --- app/controllers/conference_controller.rb | 5 + app/views/conference/show.html.haml | 16 +++ app/views/home/_conference_details.html.haml | 2 + app/views/layouts/_navigation.html.haml | 102 +++++++++--------- config/routes.rb | 2 +- .../controllers/conference_controller_spec.rb | 12 +++ 6 files changed, 90 insertions(+), 49 deletions(-) create mode 100644 app/controllers/conference_controller.rb create mode 100644 app/views/conference/show.html.haml create mode 100644 spec/controllers/conference_controller_spec.rb diff --git a/app/controllers/conference_controller.rb b/app/controllers/conference_controller.rb new file mode 100644 index 00000000..7a872c26 --- /dev/null +++ b/app/controllers/conference_controller.rb @@ -0,0 +1,5 @@ +class ConferenceController < ApplicationController + def show + @conference = Conference.find_by_short_title(params[:id]) + end +end diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml new file mode 100644 index 00000000..9c1880ab --- /dev/null +++ b/app/views/conference/show.html.haml @@ -0,0 +1,16 @@ += content_for :splash_header do + %ul.nav.navbar-nav + %li + %a{ href: "#" } Program + %li + %a{ href: "#" } Location + %li + %a{ href: "#" } Registration + %li + %a{ href: "#" } CfP + %li + %a{ href: "#" } Sponsors + %li + %a{ href: "#" } Press + += render :partial => "home/conference_details", :locals => {:conference => @conference} \ No newline at end of file diff --git a/app/views/home/_conference_details.html.haml b/app/views/home/_conference_details.html.haml index 1653b3d8..36f4ad09 100644 --- a/app/views/home/_conference_details.html.haml +++ b/app/views/home/_conference_details.html.haml @@ -20,6 +20,8 @@ = simple_format(conference.venue.description, class: 'lead') .col-md-2 .btn-group-vertical + - if controller.class.name != "ConferenceController" + = link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default" - if conference.registration_open? - if conference.user_registered?(current_user) = link_to "Modify Registration", register_conference_path(conference.short_title), :class =>"btn btn-default" diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index cedea71f..25a32a24 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -7,53 +7,59 @@ %span.icon-bar %span.icon-bar %span.icon-bar - = link_to CONFIG['name'], root_path, :class => 'navbar-brand', :title => "Open Source Event Manager" - .collapse.navbar-collapse - - if @conference && !@conference.short_title.nil? - %p.navbar-text - = @conference.short_title - - if user_signed_in? - - if has_role?(current_user, "admin") || has_role?(current_user, "organizer") - - if controller.class.name.split("::").first=="Admin" - - if @conference and not @conference.short_title.nil? - = render 'layouts/admin_menu' - %ul.nav.navbar-nav.navbar-right - %li.dropdown - %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} - - if not current_user.person.public_name.empty? - #{current_user.person.public_name} - -else - #{current_user.email} - = image_tag(current_user.person.gravatar_url(:size => "18"), :title => "Yo #{current_user.person.public_name}!") - %b.caret - %ul.dropdown-menu - = render 'layouts/user_menu' + - if controller.class.name == "ConferenceController" + = link_to @conference.title, "#", :class => 'navbar-brand' - else - %ul.nav.navbar-nav.navbar-right - - if current_page?(new_registration_path('user')) - %li.active - = link_to(new_registration_path('user')) do - %span.glyphicon.glyphicon-heart - Sign Up - - else - %li - = link_to(new_registration_path('user')) do - %span.glyphicon.glyphicon-heart - Sign Up - %li.dropdown.visible-desktop + = link_to CONFIG['name'], root_path, :class => 'navbar-brand', :title => "Open Source Event Manager" + .collapse.navbar-collapse + - if @conference && controller.class.name == "ConferenceController" + = yield(:splash_header) + - else + - if @conference && !@conference.short_title.nil? + %p.navbar-text + = @conference.short_title + - if user_signed_in? + - if has_role?(current_user, "admin") || has_role?(current_user, "organizer") + - if controller.class.name.split("::").first=="Admin" + - if @conference and not @conference.short_title.nil? + = render 'layouts/admin_menu' + %ul.nav.navbar-nav.navbar-right + %li.dropdown %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} - %span.glyphicon.glyphicon-user - Sign In - %span.caret - .dropdown-menu{:style => "padding: 17px;"} - = form_tag user_session_path do - = text_field_tag 'user[email]', nil, id: 'user_email_dd' - = password_field_tag 'user[password]', nil, id: 'user_password_dd' - %label.checkbox - = check_box_tag 'user[remember_me]' - Remember me - %button.btn.btn-block Sign in - %br - = link_to "Forgot your password?", new_password_path('user') - %li.hidden-lg - = link_to('Sign In', new_user_session_path) \ No newline at end of file + - if not current_user.person.public_name.empty? + #{current_user.person.public_name} + -else + #{current_user.email} + = image_tag(current_user.person.gravatar_url(:size => "18"), :title => "Yo #{current_user.person.public_name}!") + %b.caret + %ul.dropdown-menu + = render 'layouts/user_menu' + - else + %ul.nav.navbar-nav.navbar-right + - if current_page?(new_registration_path('user')) + %li.active + = link_to(new_registration_path('user')) do + %span.glyphicon.glyphicon-heart + Sign Up + - else + %li + = link_to(new_registration_path('user')) do + %span.glyphicon.glyphicon-heart + Sign Up + %li.dropdown.visible-desktop + %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} + %span.glyphicon.glyphicon-user + Sign In + %span.caret + .dropdown-menu{:style => "padding: 17px;"} + = form_tag user_session_path do + = text_field_tag 'user[email]', nil, id: 'user_email_dd' + = password_field_tag 'user[password]', nil, id: 'user_password_dd' + %label.checkbox + = check_box_tag 'user[remember_me]' + Remember me + %button.btn.btn-block Sign in + %br + = link_to "Forgot your password?", new_password_path('user') + %li.hidden-lg + = link_to('Sign In', new_user_session_path) \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 1fdcc96f..9e6633e8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,7 +51,7 @@ Osem::Application.routes.draw do end end - resources :conference, :only => [] do + resources :conference, :only => [:show] do resources :proposal do resources :event_attachment, :controller => "event_attachments" patch "/confirm" => "proposal#confirm" diff --git a/spec/controllers/conference_controller_spec.rb b/spec/controllers/conference_controller_spec.rb new file mode 100644 index 00000000..f9131880 --- /dev/null +++ b/spec/controllers/conference_controller_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe ConferenceController do + + describe "GET 'show'" do + it "returns http success" do + get :show, id: "sample" + expect(response).to be_success + end + end + +end From 94078f844ba8bdc35b6c9bd6e63bbc626cec201b Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Wed, 14 May 2014 13:29:13 +0530 Subject: [PATCH 02/10] Fixes by houndci --- spec/controllers/conference_controller_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/controllers/conference_controller_spec.rb b/spec/controllers/conference_controller_spec.rb index f9131880..b5b373d1 100644 --- a/spec/controllers/conference_controller_spec.rb +++ b/spec/controllers/conference_controller_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe ConferenceController do - describe "GET 'show'" do - it "returns http success" do - get :show, id: "sample" + describe 'GET #show' do + it 'returns http success' do + get :show, id: 'sample' expect(response).to be_success end end From 4778564e3e0eb4bd151cafcd1b4dc5eb077e995b Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Thu, 15 May 2014 11:03:28 +0530 Subject: [PATCH 03/10] fixes done as suggested --- app/views/home/_conference_details.html.haml | 2 +- app/views/layouts/_navigation.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/home/_conference_details.html.haml b/app/views/home/_conference_details.html.haml index 36f4ad09..ec1683d1 100644 --- a/app/views/home/_conference_details.html.haml +++ b/app/views/home/_conference_details.html.haml @@ -20,7 +20,7 @@ = simple_format(conference.venue.description, class: 'lead') .col-md-2 .btn-group-vertical - - if controller.class.name != "ConferenceController" + - if @conference && controller.class.name != "ConferenceController" = link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default" - if conference.registration_open? - if conference.user_registered?(current_user) diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 25a32a24..1f8a92e0 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -7,12 +7,12 @@ %span.icon-bar %span.icon-bar %span.icon-bar - - if controller.class.name == "ConferenceController" + - if @conference && controller.class.name == "ConferenceController" = link_to @conference.title, "#", :class => 'navbar-brand' - else = link_to CONFIG['name'], root_path, :class => 'navbar-brand', :title => "Open Source Event Manager" .collapse.navbar-collapse - - if @conference && controller.class.name == "ConferenceController" + - if content_for?(:splash_header) = yield(:splash_header) - else - if @conference && !@conference.short_title.nil? From d498178513b16c25e7626605168f5579e458ddb0 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Thu, 15 May 2014 11:05:18 +0530 Subject: [PATCH 04/10] fixes by hound ci --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 9e6633e8..6259c95c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,7 +51,7 @@ Osem::Application.routes.draw do end end - resources :conference, :only => [:show] do + resources :conference, only: [:show] do resources :proposal do resources :event_attachment, :controller => "event_attachments" patch "/confirm" => "proposal#confirm" From 2d01bcad17c639c70bcb0785de49678db04c1095 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 16 May 2014 21:01:03 +0530 Subject: [PATCH 05/10] fixes done --- app/views/home/_conference_details.html.haml | 2 +- app/views/layouts/_navigation.html.haml | 98 ++++++++++---------- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/app/views/home/_conference_details.html.haml b/app/views/home/_conference_details.html.haml index ec1683d1..335b25ed 100644 --- a/app/views/home/_conference_details.html.haml +++ b/app/views/home/_conference_details.html.haml @@ -20,7 +20,7 @@ = simple_format(conference.venue.description, class: 'lead') .col-md-2 .btn-group-vertical - - if @conference && controller.class.name != "ConferenceController" + - if !@conference || @conference != conference = link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default" - if conference.registration_open? - if conference.user_registered?(current_user) diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 1f8a92e0..b2d38de7 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -7,59 +7,57 @@ %span.icon-bar %span.icon-bar %span.icon-bar - - if @conference && controller.class.name == "ConferenceController" + - if @conference = link_to @conference.title, "#", :class => 'navbar-brand' - else = link_to CONFIG['name'], root_path, :class => 'navbar-brand', :title => "Open Source Event Manager" .collapse.navbar-collapse - - if content_for?(:splash_header) - = yield(:splash_header) + = yield(:splash_header) + - if @conference && !@conference.short_title.nil? + %p.navbar-text + = @conference.short_title + - if user_signed_in? + - if has_role?(current_user, "admin") || has_role?(current_user, "organizer") + - if controller.class.name.split("::").first=="Admin" + - if @conference and not @conference.short_title.nil? + = render 'layouts/admin_menu' + %ul.nav.navbar-nav.navbar-right + %li.dropdown + %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} + - if not current_user.person.public_name.empty? + #{current_user.person.public_name} + -else + #{current_user.email} + = image_tag(current_user.person.gravatar_url(:size => "18"), :title => "Yo #{current_user.person.public_name}!") + %b.caret + %ul.dropdown-menu + = render 'layouts/user_menu' - else - - if @conference && !@conference.short_title.nil? - %p.navbar-text - = @conference.short_title - - if user_signed_in? - - if has_role?(current_user, "admin") || has_role?(current_user, "organizer") - - if controller.class.name.split("::").first=="Admin" - - if @conference and not @conference.short_title.nil? - = render 'layouts/admin_menu' - %ul.nav.navbar-nav.navbar-right - %li.dropdown + %ul.nav.navbar-nav.navbar-right + - if current_page?(new_registration_path('user')) + %li.active + = link_to(new_registration_path('user')) do + %span.glyphicon.glyphicon-heart + Sign Up + - else + %li + = link_to(new_registration_path('user')) do + %span.glyphicon.glyphicon-heart + Sign Up + %li.dropdown.visible-desktop %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} - - if not current_user.person.public_name.empty? - #{current_user.person.public_name} - -else - #{current_user.email} - = image_tag(current_user.person.gravatar_url(:size => "18"), :title => "Yo #{current_user.person.public_name}!") - %b.caret - %ul.dropdown-menu - = render 'layouts/user_menu' - - else - %ul.nav.navbar-nav.navbar-right - - if current_page?(new_registration_path('user')) - %li.active - = link_to(new_registration_path('user')) do - %span.glyphicon.glyphicon-heart - Sign Up - - else - %li - = link_to(new_registration_path('user')) do - %span.glyphicon.glyphicon-heart - Sign Up - %li.dropdown.visible-desktop - %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} - %span.glyphicon.glyphicon-user - Sign In - %span.caret - .dropdown-menu{:style => "padding: 17px;"} - = form_tag user_session_path do - = text_field_tag 'user[email]', nil, id: 'user_email_dd' - = password_field_tag 'user[password]', nil, id: 'user_password_dd' - %label.checkbox - = check_box_tag 'user[remember_me]' - Remember me - %button.btn.btn-block Sign in - %br - = link_to "Forgot your password?", new_password_path('user') - %li.hidden-lg - = link_to('Sign In', new_user_session_path) \ No newline at end of file + %span.glyphicon.glyphicon-user + Sign In + %span.caret + .dropdown-menu{:style => "padding: 17px;"} + = form_tag user_session_path do + = text_field_tag 'user[email]', nil, id: 'user_email_dd' + = password_field_tag 'user[password]', nil, id: 'user_password_dd' + %label.checkbox + = check_box_tag 'user[remember_me]' + Remember me + %button.btn.btn-block Sign in + %br + = link_to "Forgot your password?", new_password_path('user') + %li.hidden-lg + = link_to('Sign In', new_user_session_path) \ No newline at end of file From 443ee19760a31b96dd51bada4176b91d8677af8c Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Sat, 17 May 2014 08:29:33 +0530 Subject: [PATCH 06/10] Added ids to links in conference#show --- app/views/conference/show.html.haml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 9c1880ab..ad614e75 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,16 +1,16 @@ = content_for :splash_header do %ul.nav.navbar-nav %li - %a{ href: "#" } Program + %a{ href: "#program" } Program %li - %a{ href: "#" } Location + %a{ href: "#location" } Location %li - %a{ href: "#" } Registration + %a{ href: "#registration" } Registration %li - %a{ href: "#" } CfP + %a{ href: "#call-for-papers" } CfP %li - %a{ href: "#" } Sponsors + %a{ href: "#sponsors" } Sponsors %li - %a{ href: "#" } Press + %a{ href: "#press" } Press -= render :partial => "home/conference_details", :locals => {:conference => @conference} \ No newline at end of file += render :partial => "home/conference_details", :locals => {:conference => @conference} From de3701fce7ef8cb11cb29e02acf411eb6b379e02 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Sat, 17 May 2014 08:30:56 +0530 Subject: [PATCH 07/10] single quotes --- app/views/conference/show.html.haml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index ad614e75..ce95e21d 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,16 +1,16 @@ = content_for :splash_header do %ul.nav.navbar-nav %li - %a{ href: "#program" } Program + %a{ href: '#program' } Program %li - %a{ href: "#location" } Location + %a{ href: '#locatio' } Location %li - %a{ href: "#registration" } Registration + %a{ href: '#registration' } Registration %li - %a{ href: "#call-for-papers" } CfP + %a{ href: '#call-for-papers' } CfP %li - %a{ href: "#sponsors" } Sponsors + %a{ href: '#sponsors' } Sponsors %li - %a{ href: "#press" } Press + %a{ href: '#press' } Press = render :partial => "home/conference_details", :locals => {:conference => @conference} From aa539b2cf0e78c1260a7014671afab5778784529 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Sat, 17 May 2014 08:31:07 +0530 Subject: [PATCH 08/10] single quotes --- app/views/conference/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index ce95e21d..48b3c6c8 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -3,7 +3,7 @@ %li %a{ href: '#program' } Program %li - %a{ href: '#locatio' } Location + %a{ href: '#location' } Location %li %a{ href: '#registration' } Registration %li From 894ca542c070c9be839bbe51c62c84c68e18bff0 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Mon, 19 May 2014 20:33:02 +0530 Subject: [PATCH 09/10] Removed header links --- app/views/conference/show.html.haml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 48b3c6c8..a2cfcfff 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,16 +1,3 @@ -= content_for :splash_header do - %ul.nav.navbar-nav - %li - %a{ href: '#program' } Program - %li - %a{ href: '#location' } Location - %li - %a{ href: '#registration' } Registration - %li - %a{ href: '#call-for-papers' } CfP - %li - %a{ href: '#sponsors' } Sponsors - %li - %a{ href: '#press' } Press + = render :partial => "home/conference_details", :locals => {:conference => @conference} From e49906f342a6acbd6b72329166da8a513800af44 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Mon, 19 May 2014 20:33:33 +0530 Subject: [PATCH 10/10] Removed header links from conference#show --- app/views/conference/show.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index a2cfcfff..6decc148 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,3 +1 @@ - - = render :partial => "home/conference_details", :locals => {:conference => @conference}