From e7452a9d3186db067903d00577bfc3c66abe0f56 Mon Sep 17 00:00:00 2001 From: Espartaco Palma Date: Thu, 18 Jul 2019 02:24:25 -0700 Subject: [PATCH] Use New Install within their own template It used to be a partial inside #index, but having their own page yields some extra benefits: - Performance: Move logic from the view to the controller - Theres' no need to go extra steps inside the :index view - UI: Remove the extra 'Upcoming Conferences' when the system needs to start the flow of the creation of the first user --- app/controllers/conferences_controller.rb | 3 +++ app/views/conferences/index.html.haml | 2 -- .../{_new_install.html.haml => new_install.html.haml} | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) rename app/views/conferences/{_new_install.html.haml => new_install.html.haml} (92%) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 035ab366..3878481b 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -8,6 +8,9 @@ class ConferencesController < ApplicationController def index @current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc) @antiquated = Conference.where('end_date < ?', Date.current) + if @antiquated.empty? && @current.empty? && User.empty? + render :new_install + end end def show diff --git a/app/views/conferences/index.html.haml b/app/views/conferences/index.html.haml index 5382989c..7146b8fc 100644 --- a/app/views/conferences/index.html.haml +++ b/app/views/conferences/index.html.haml @@ -18,8 +18,6 @@ #antiquated.collapse - @antiquated.each do |conference| = render '/conferences/conference_details', conference: conference - - if @antiquated.empty? && @current.empty? && User.empty? - = render partial: 'new_install' -content_for :script_body do :javascript diff --git a/app/views/conferences/_new_install.html.haml b/app/views/conferences/new_install.html.haml similarity index 92% rename from app/views/conferences/_new_install.html.haml rename to app/views/conferences/new_install.html.haml index 1ec2bd02..d6cf8eef 100644 --- a/app/views/conferences/_new_install.html.haml +++ b/app/views/conferences/new_install.html.haml @@ -17,5 +17,5 @@ will the be administrator of it. %p We hope you enjoy using OSEM, if you have any question don't hesitate to - = link_to('http://osem.io/#contact') do + = link_to('https://osem.io/#contact') do contact us!