Skip to content

Commit

Permalink
Merge pull request #83 from TeenQuotes/feature/helpscout-contact-form
Browse files Browse the repository at this point in the history
feat(contact): show a contact form from Helpscout on the contact page
  • Loading branch information
AntoineAugusti committed Sep 27, 2015
2 parents 94b7ed5 + 4043514 commit ef4faba
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 25 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ SERVER_PRODUCTION_KEYPHRASE=dummy
SERVER_PRODUCTION_ROOT=dummy

# BUGSNAG
BUGSNAG_API_KEY=dummy
BUGSNAG_API_KEY=dummy

# HELPSCOUT
HELPSCOUT_CONTACT_FORM=dummy
22 changes: 12 additions & 10 deletions app/TeenQuotes/Pages/Controllers/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace TeenQuotes\Pages\Controllers;

use Auth;
use BaseController;
use Lang;
use LaraSetting;
Expand All @@ -21,16 +22,17 @@ class ContactController extends BaseController
public function index()
{
$data = [
'chooseYourWeapon' => Lang::get('contact.chooseYourWeapon'),
'contactTitle' => Lang::get('contact.contactTitle'),
'emailAddress' => Lang::get('contact.emailAddress'),
'pageDescription' => Lang::get('contact.pageDescription'),
'pageTitle' => Lang::get('contact.pageTitle'),
'stayInTouchContent' => Lang::get('contact.stayInTouchContent'),
'stayInTouchTitle' => Lang::get('contact.stayInTouchTitle'),
'teamMembers' => LaraSetting::get('team'),
'teamTitle' => Lang::get('contact.teamTitle'),
'twitterAccount' => Lang::get('layout.twitterUsername'),
'chooseYourWeapon' => Lang::get('contact.chooseYourWeapon'),
'contactTitle' => Lang::get('contact.contactTitle'),
'emailAddress' => Lang::get('contact.emailAddress'),
'pageDescription' => Lang::get('contact.pageDescription'),
'pageTitle' => Lang::get('contact.pageTitle'),
'stayInTouchContent' => Lang::get('contact.stayInTouchContent'),
'stayInTouchTitle' => Lang::get('contact.stayInTouchTitle'),
'teamMembers' => LaraSetting::get('team'),
'teamTitle' => Lang::get('contact.teamTitle'),
'twitterAccount' => Lang::get('layout.twitterUsername'),
'user' => Auth::user(),
];

// Add description for each team member
Expand Down
4 changes: 4 additions & 0 deletions app/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@
'apiKey' => getenv('PUSHBULLET_APIKEY'),
'deviceIden' => getenv('PUSHBULLET_DEVICE_IDEN'),
],

'helpscout' => [
'form_id' => getenv('HELPSCOUT_CONTACT_FORM'),
],
];
17 changes: 9 additions & 8 deletions app/lang/en/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
*/

return [
'pageTitle' => 'Contact | '.Lang::get('layout.nameWebsite'),
'pageDescription' => 'Contact the team. Say hi, report a bug or propose a feature!',
'chooseYourWeapon' => 'Choose your weapon',
'contactTitle' => 'Contact us',
'teamTitle' => 'Our team',
'stayInTouchTitle' => 'Stay in touch',
'stayInTouchContent' => 'We are very concerned by you, our visitors. You are our top priority and this is the reason why we will be very happy to hear from you!<br/><br/>You have an idea? A suggestion? Something seems to be broken on the website? You want to show us your love? You want to drink a beer with us?<br/><br/>We will be very happy to answer to your message. Here are a few informations if you wish to contact us, by hook or by crook (but we do not accept carrier pigeons).',
'emailAddress' => 'support@'.Config::get('app.domain'),
'chooseYourWeapon' => 'Choose your weapon',
'teamDescriptionClara' => 'Clara is in charge of the Twitter account. She loves life. Since 2009 she tweets everyday to inspire us! Thanks to her we have build the '.Lang::get('layout.nameWebsite').' web suite.',
'helpscoutInfo' => 'We will get back to you shortly!',
'pageDescription' => 'Contact the team. Say hi, report a bug or propose a feature!',
'pageTitle' => 'Contact | '.Lang::get('layout.nameWebsite'),
'stayInTouchContent' => 'We are very concerned by you, our visitors. You are our top priority and this is the reason why we will be very happy to hear from you!<br/><br/>You have an idea? A suggestion? Something seems to be broken on the website? You want to show us your love? You want to drink a beer with us?<br/><br/>We will be very happy to answer to your message. Here are a few informations if you wish to contact us, by hook or by crook (but we do not accept carrier pigeons).',
'stayInTouchTitle' => 'Stay in touch',
'teamDescriptionAntoine' => 'Antoine is the lead developer. He likes when servers respond fast and when everything work as expected. He is always happy to have an impact on your life. He works hard to make things easy for you.',
'teamDescriptionMaxime' => 'Maxime is the iOS developer. Thanks to him you have '.Lang::get('layout.nameWebsite').' in your pocket, one tap away! He hates Antoine because he designs difficult-to-understand systems.',
'teamDescriptionClara' => 'Clara is in charge of the Twitter account. She loves life. Since 2009 she tweets everyday to inspire us! Thanks to her we have build the '.Lang::get('layout.nameWebsite').' web suite.',
'teamDescriptionJonathan' => 'Jonathan is the designer. Usually, Antoine designs something ugly and Jonathan makes it pretty. If you like the design then you will love Jonathan. And everybody loves Jonathan!',
'teamDescriptionMaxime' => 'Maxime is the iOS developer. Thanks to him you have '.Lang::get('layout.nameWebsite').' in your pocket, one tap away! He hates Antoine because he designs difficult-to-understand systems.',
'teamDescriptionMichel' => 'Michel is the tester. If something is not working or could be improved, he will find it for sure. A lot of software work thanks to him!',
'teamTitle' => 'Our team',
];
16 changes: 10 additions & 6 deletions ressources/views/contact/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<div id="contact-page">
<!-- CONTACT -->
<h1 class="animated fadeInDown">{{ $contactTitle }}</h1>
<div id="first-col" class="col-sm-6 animated fadeInDown">

<div id="first-col" class="col-sm-6 animated fadeInDown">
<div id="stay-in-touch">
<h2>{{ $stayInTouchTitle }}</h2>
{{ $stayInTouchContent }}
</div>
</div>
<div id="second-col" class="col-sm-6 animated fadeInDown">

<div id="second-col" class="col-sm-6 animated fadeInDown">
<div id="contact-info">
<h2>{{ $chooseYourWeapon }}</h2>
<ul>
Expand All @@ -30,7 +30,7 @@

<!-- TEAM LIST -->
<h1 id="team-title" class="animated fadeInUp">{{ $teamTitle }}</h1>

<div id="team-container" class="row animated fadeInUp">
@foreach ($teamMembers as $teamMember)
<?php
Expand All @@ -51,4 +51,8 @@
</div>

</div>
@stop
@stop

@section('add-js')
@include('js.helpscout', compact('user'))
@stop
25 changes: 25 additions & 0 deletions ressources/views/js/helpscout.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script>
!function(e,o,n){window.HSCW=o,window.HS=n,n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={},t.readyQueue=[],t.config=function(e){this.userConfig=e},t.ready=function(e){this.readyQueue.push(e)},o.config={docs:{enabled:!1,baseUrl:""},contact:{enabled:!0,formId:"{{ Config::get('services.helpscout.form_id') }}"}};var r=e.getElementsByTagName("script")[0],c=e.createElement("script");c.type="text/javascript",c.async=!0,c.src="https://djtflbt20bdde.cloudfront.net/",r.parentNode.insertBefore(c,r)}(document,window.HSCW||{},window.HS||{});
// http://developer.helpscout.net/beacons/
HS.beacon.config({
poweredBy: false,
color: '#2980B9',
icon: 'message',
instructions: "{{ trans('contact.helpscoutInfo') }}"
});
</script>

{{-- Current user details if available --}}
@if (!is_null($user))
<script>
// http://developer.helpscout.net/beacons/
HS.beacon.ready(function() {
HS.beacon.identify({
name: '{{ $user->login }}',
email: '{{ $user->email }}',
id: {{ $user->id }}
});
});
</script>
@endif

0 comments on commit ef4faba

Please sign in to comment.