From af0799990cb019772ae2c9264a3e16de772dc805 Mon Sep 17 00:00:00 2001 From: Rahul Date: Mon, 5 Aug 2019 00:35:56 +0530 Subject: [PATCH] show invited users in invite field --- app/controllers/admin/booths_controller.rb | 1 + app/controllers/booths_controller.rb | 1 + app/models/booth.rb | 4 ++++ app/views/admin/booths/edit.html.haml | 2 +- app/views/admin/booths/new.html.haml | 2 +- app/views/booths/_form.html.haml | 2 +- app/views/booths/edit.html.haml | 2 +- app/views/booths/new.html.haml | 2 +- 8 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/booths_controller.rb b/app/controllers/admin/booths_controller.rb index 0a8027ca..d36277ab 100644 --- a/app/controllers/admin/booths_controller.rb +++ b/app/controllers/admin/booths_controller.rb @@ -50,6 +50,7 @@ module Admin def edit @url = admin_conference_booth_path(@conference.short_title, @booth.id) + @invitation_pending_emails = @booth.invited_responsibles.pluck(:email).join(',') end def update diff --git a/app/controllers/booths_controller.rb b/app/controllers/booths_controller.rb index 9cd6f475..d51ae0a7 100644 --- a/app/controllers/booths_controller.rb +++ b/app/controllers/booths_controller.rb @@ -34,6 +34,7 @@ class BoothsController < ApplicationController def edit @url = conference_booth_path(@conference.short_title, @booth.id) + @invitation_pending_emails = @booth.invited_responsibles.pluck(:email).join(',') end def update diff --git a/app/models/booth.rb b/app/models/booth.rb index 71ab6e98..ce03ca19 100644 --- a/app/models/booth.rb +++ b/app/models/booth.rb @@ -84,4 +84,8 @@ class Booth < ApplicationRecord end alert end + + def invited_responsibles + responsibles.where(last_sign_in_at: nil) + end end diff --git a/app/views/admin/booths/edit.html.haml b/app/views/admin/booths/edit.html.haml index 0cac17e7..b23d2e06 100644 --- a/app/views/admin/booths/edit.html.haml +++ b/app/views/admin/booths/edit.html.haml @@ -2,4 +2,4 @@ Editing = @booth.title -= render 'booths/form' += render 'booths/form', invitation_pending_emails: @invitation_pending_emails diff --git a/app/views/admin/booths/new.html.haml b/app/views/admin/booths/new.html.haml index 0cf6adb5..4b0c1f63 100644 --- a/app/views/admin/booths/new.html.haml +++ b/app/views/admin/booths/new.html.haml @@ -1,3 +1,3 @@ %h1 New #{t'booth'} -= render 'booths/form' += render 'booths/form', invitation_pending_emails: '' diff --git a/app/views/booths/_form.html.haml b/app/views/booths/_form.html.haml index b9a0e511..221a66fa 100644 --- a/app/views/booths/_form.html.haml +++ b/app/views/booths/_form.html.haml @@ -12,7 +12,7 @@ hint: 'e.g. employee, comunity manager, etc' = f.input :website_url = responsibles_selector_input f - = f.input :invite_responsible, + = f.input :invite_responsible, input_html: { value: invitation_pending_emails }, hint: "This field is to invite unregistered users using their email to become #{(t'booth_responsible').pluralize}." = image_tag f.object.picture.thumb.url if f.object.picture? = f.input :picture diff --git a/app/views/booths/edit.html.haml b/app/views/booths/edit.html.haml index 9f60196d..6cbee3d2 100644 --- a/app/views/booths/edit.html.haml +++ b/app/views/booths/edit.html.haml @@ -3,4 +3,4 @@ Editing = @booth.title - = render 'form' + = render 'form', invitation_pending_emails: @invitation_pending_emails diff --git a/app/views/booths/new.html.haml b/app/views/booths/new.html.haml index 6713d312..188e92b9 100644 --- a/app/views/booths/new.html.haml +++ b/app/views/booths/new.html.haml @@ -1,4 +1,4 @@ .container %h1 Request a #{t'booth'} - = render 'form' + = render 'form', invitation_pending_emails: ''