From db79ad3e0869fb1d9d087d93818a82ee46c25c17 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Tue, 13 May 2014 15:34:35 +0530 Subject: [PATCH] Refactoring home#index --- app/views/home/_conference_details.html.haml | 32 +++++++++++++++++++ app/views/home/index.html.haml | 33 +------------------- 2 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 app/views/home/_conference_details.html.haml diff --git a/app/views/home/_conference_details.html.haml b/app/views/home/_conference_details.html.haml new file mode 100644 index 00000000..1653b3d8 --- /dev/null +++ b/app/views/home/_conference_details.html.haml @@ -0,0 +1,32 @@ +.row + .col-md-12 + .well + .row + .col-md-4.text-center + = image_tag(conference.logo(:original), class: 'img-responsive') if conference.logo? + .col-md-6 + %h3 + = conference.title + %small + %b + = conference_date_string(conference) + - if conference.venue.name and conference.venue.website and conference.venue.address + %p + %small + = link_to conference.venue.name, conference.venue.website + , + \#{link_to conference.venue.address, "http://maps.google.com/maps?q=#{conference.venue.address}"} + - if conference.venue.description + = simple_format(conference.venue.description, class: 'lead') + .col-md-2 + .btn-group-vertical + - if conference.registration_open? + - if conference.user_registered?(current_user) + = link_to "Modify Registration", register_conference_path(conference.short_title), :class =>"btn btn-default" + - else + = link_to "Register", register_conference_path(conference.short_title), :class =>"btn btn-success" + = link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public + - if !current_user.nil? && current_user.person.proposal_count(conference) > 0 + = link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default" + - elsif conference.cfp_open? + = link_to "Submit Proposal", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default" \ No newline at end of file diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 73702c5f..f9b27f71 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -2,35 +2,4 @@ .col-md-12.page-header %h2.text-center Upcoming Conferences - @current.each do |conference| - .row - .col-md-12 - .well - .row - .col-md-4.text-center - = image_tag(conference.logo(:original), class: 'img-responsive') if conference.logo? - .col-md-6 - %h3 - = conference.title - %small - %b - = conference_date_string(conference) - - if conference.venue.name and conference.venue.website and conference.venue.address - %p - %small - = link_to conference.venue.name, conference.venue.website - , - \#{link_to conference.venue.address, "http://maps.google.com/maps?q=#{conference.venue.address}"} - - if conference.venue.description - = simple_format(conference.venue.description, class: 'lead') - .col-md-2 - .btn-group-vertical - - if conference.registration_open? - - if conference.user_registered?(current_user) - = link_to "Modify Registration", register_conference_path(conference.short_title), :class =>"btn btn-default" - - else - = link_to "Register", register_conference_path(conference.short_title), :class =>"btn btn-success" - = link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public - - if !current_user.nil? && current_user.person.proposal_count(conference) > 0 - = link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default" - - elsif conference.cfp_open? - = link_to "Submit Proposal", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default" \ No newline at end of file + = render :partial => "conference_details", :locals => {:conference => conference} \ No newline at end of file