Skip to content

Commit

Permalink
Merge pull request reliefsupports#153 from gayanhewa/add_disqus
Browse files Browse the repository at this point in the history
Allow a mechanism to discuss around requests and donations
  • Loading branch information
thinkholic authored May 31, 2017
2 parents 4b71154 + 07c72df commit 339642e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ INVISIBLE_RECAPTCHA_SECRETKEY=6LfdQSMUAAAAAAT5cKXa7lI3koiFy4c5BP7BX3m8

NOCAPTCHA_SECRET=6LfdQSMUAAAAAAT5cKXa7lI3koiFy4c5BP7BX3m8
NOCAPTCHA_SITEKEY=6LfdQSMUAAAAAOP31dkmdZJeNvDghlBfqJsHT5M-

DISQUS_KEY=
10 changes: 8 additions & 2 deletions app/Http/Controllers/EntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use App\Http\Controllers\NeedsController;
use App\Http\Controllers\DonationController;


use Illuminate\Support\Facades\View;

class EntryController extends Controller
{
private $need;
Expand All @@ -33,6 +36,9 @@ public function __construct(
$this->donation = $donationRepository;
$this->d = $donationController;
$this->n = $needsController;

// TODO: move to a view composer next time someone needs to use APP_URL
View::share('base_url', env('APP_URL'));
}

/**
Expand All @@ -56,8 +62,8 @@ public function view($type, $id)
'data' => [
'id' => $id,
'type' => $type,
'entry' => $entry
'entry' => $entry,
]
]);;
]);
}
}
26 changes: 23 additions & 3 deletions resources/views/frontend/entry/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@section('content')

<div class="container main-container">

<div class="row">
<div class="col-md-12">

Expand Down Expand Up @@ -63,13 +63,33 @@
</div>
</div>

<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ url("/entry/".$data['type']."/".$data['id']) }}';
this.page.identifier = '{{ md5("need".$data['type'].$data['id']) }}';
};
(function() {
var d = document, s = d.createElement('script');
s.src = '//{{ env('DISQUS_KEY') }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>

<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
<script type="text/javascript">
function share(elm) {
window.open(
elm.href,
elm.href,
'winname',
'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=350');
return false;
return false;
}
</script>
</div><!-- /.container -->
Expand Down

0 comments on commit 339642e

Please sign in to comment.