From 0f5181ccf4db2ba08ba90b71adafdd1a5704fd5b Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 29 Jan 2019 21:20:44 +0100 Subject: [PATCH] Introduces New Installation Page If there are no users signed up and no conferences we show a page informing people what they need to do. --- app/models/user.rb | 8 +++++--- app/views/conferences/_new_install.html.haml | 21 ++++++++++++++++++++ app/views/conferences/index.html.haml | 4 +++- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 app/views/conferences/_new_install.html.haml diff --git a/app/models/user.rb b/app/models/user.rb index 89fb97a9..12d58c54 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -265,12 +265,14 @@ class User < ApplicationRecord proposals(conference).count end + def self.empty? + User.count == 1 && User.first.email == 'deleted@localhost.osem' + end + private def setup_role - if User.count == 1 && User.first.email == 'deleted@localhost.osem' - self.is_admin = true - end + self.is_admin = true if User.empty? end def touch_events diff --git a/app/views/conferences/_new_install.html.haml b/app/views/conferences/_new_install.html.haml new file mode 100644 index 00000000..1ec2bd02 --- /dev/null +++ b/app/views/conferences/_new_install.html.haml @@ -0,0 +1,21 @@ +.row + .col-md-12 + .well + %h1 + Welcome to your new + = link_to('https://osem.io') do + Open Source Event Manager + installation! + %p + The first user to + - if ENV['OSEM_ICHAIN_ENABLED'] == 'true' + = link_to(new_ichain_registration_path('user')) do + sign up + - else + = link_to(new_registration_path('user')) do + sign up + 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 + contact us! diff --git a/app/views/conferences/index.html.haml b/app/views/conferences/index.html.haml index a3735478..5382989c 100644 --- a/app/views/conferences/index.html.haml +++ b/app/views/conferences/index.html.haml @@ -5,7 +5,7 @@ %h2 Upcoming Conferences - @current.each do |conference| = render '/conferences/conference_details', conference: conference - -if @antiquated and @antiquated.any? + - if @antiquated and @antiquated.any? .row .col-md-12 %p.text-right @@ -18,6 +18,8 @@ #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