Add additional social media fields to contacts

+ YouTube
+ Blog

Simplify logic in the view, and refactor the test #BetterPlace
This commit is contained in:
James Mason 2018-11-13 13:47:20 -08:00 committed by Henne Vogelsang
parent cd150aaf21
commit a3adf8318d
6 changed files with 51 additions and 35 deletions

View file

@ -24,7 +24,9 @@ module Admin
# Only allow a trusted parameter "white list" through.
def contact_params
params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :mastodon, :public, :sponsor_email)
params.require(:contact).permit(
:social_tag, :email, :facebook, :googleplus, :twitter, :instagram,
:mastodon, :public, :sponsor_email, :youtube, :blog)
end
end
end

View file

@ -12,9 +12,11 @@
= f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers'
= f.inputs name: 'Social Media' do
= f.input :social_tag, hint: "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
= f.input :facebook, hint: 'This will appear in the social media section as link to the Facebook page of your Conference'
= f.input :googleplus, label: 'Google+ Url', hint: 'This will appear in the social media section as the link to the Google+ Page of your Conference'
= f.input :twitter, hint: 'This will appear in the social media section as the link to the Twitter Page of your Conference'
= f.input :instagram, hint: 'This will appear in the social media section as the link to the Instagram Page of your Conference'
= f.input :mastodon, hint: 'This will appear in the social media section as the link to the Mastodon Page of your Conference'
= f.input :blog, hint: 'This will appear in the social media section as a link to your conference blog.'
= f.input :facebook, hint: 'This will appear in the social media section as a link to the Facebook page of your Conference'
= f.input :googleplus, label: 'Google+ Url', hint: 'This will appear in the social media section as a link to the Google+ Page of your Conference'
= f.input :twitter, hint: 'This will appear in the social media section as a link to the Twitter Page of your Conference'
= f.input :instagram, hint: 'This will appear in the social media section as a link to the Instagram Page of your Conference'
= f.input :mastodon, hint: 'This will appear in the social media section as a link to the Mastodon Page of your Conference'
= f.input :youtube, hint: 'This will appear in the social media section as a link to the YouTube channel for your conference.'
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -3,21 +3,27 @@
.container
.row
.col-md-12.text-center
- unless contact.facebook.blank?
- if contact.blog?
= link_to "#{ contact.blog }" do
%i.fa.fa-rss-square.fa-4x
- if contact.facebook?
= link_to "#{ contact.facebook }" do
%i.fa.fa-facebook-square.fa-4x
- unless contact.twitter.blank?
- if contact.twitter?
= link_to "#{ contact.twitter }" do
%i.fa.fa-twitter.fa-4x
- unless contact.instagram.blank?
- if contact.instagram?
= link_to "#{ contact.instagram }" do
%i.fa.fa-instagram.fa-4x
- unless contact.googleplus.blank?
- if contact.googleplus?
= link_to "#{ contact.googleplus }" do
%i.fa.fa-google-plus-square.fa-4x
- unless contact.mastodon.blank?
- if contact.mastodon?
= link_to "#{ contact.mastodon }" do
%i.fa.icon-mastodon.fa-4x
- unless contact.email.blank?
- if contact.youtube?
= link_to "#{ contact.youtube }" do
%i.fa.fa-youtube.fa-4x
- if contact.email?
= mail_to "#{ contact.email }" do
%i.fa.fa-envelope-o.fa-4x