Enable non-admins to set notification preferences

This commit is contained in:
Hillel Coren 2017-01-08 17:43:56 +02:00
parent f5ce8c325a
commit 01439a0f43
4 changed files with 43 additions and 29 deletions

View File

@ -1220,6 +1220,13 @@ class AccountController extends BaseController
$user->email = trim(strtolower(Input::get('email'))); $user->email = trim(strtolower(Input::get('email')));
$user->phone = trim(Input::get('phone')); $user->phone = trim(Input::get('phone'));
if ( ! Auth::user()->is_admin) {
$user->notify_sent = Input::get('notify_sent');
$user->notify_viewed = Input::get('notify_viewed');
$user->notify_paid = Input::get('notify_paid');
$user->notify_approved = Input::get('notify_approved');
}
if (Utils::isNinja()) { if (Utils::isNinja()) {
if (Input::get('referral_code') && !$user->referral_code) { if (Input::get('referral_code') && !$user->referral_code) {
$user->referral_code = $this->accountRepo->getReferralCode(); $user->referral_code = $this->accountRepo->getReferralCode();

View File

@ -7,22 +7,8 @@
{!! Former::open()->addClass('warn-on-exit') !!} {!! Former::open()->addClass('warn-on-exit') !!}
{{ Former::populate($account) }} {{ Former::populate($account) }}
{{ Former::populateField('notify_sent', intval(Auth::user()->notify_sent)) }}
{{ Former::populateField('notify_viewed', intval(Auth::user()->notify_viewed)) }}
{{ Former::populateField('notify_paid', intval(Auth::user()->notify_paid)) }}
{{ Former::populateField('notify_approved', intval(Auth::user()->notify_approved)) }}
<div class="panel panel-default"> @include('accounts.partials.notifications')
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.email_notifications') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('notify_sent')->label('&nbsp;')->text(trans('texts.email_sent')) !!}
{!! Former::checkbox('notify_viewed')->label('&nbsp;')->text(trans('texts.email_viewed')) !!}
{!! Former::checkbox('notify_paid')->label('&nbsp;')->text(trans('texts.email_paid')) !!}
{!! Former::checkbox('notify_approved')->label('&nbsp;')->text(trans('texts.email_approved')) !!}
</div>
</div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">

View File

@ -0,0 +1,16 @@
{{ Former::populateField('notify_sent', intval(Auth::user()->notify_sent)) }}
{{ Former::populateField('notify_viewed', intval(Auth::user()->notify_viewed)) }}
{{ Former::populateField('notify_paid', intval(Auth::user()->notify_paid)) }}
{{ Former::populateField('notify_approved', intval(Auth::user()->notify_approved)) }}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.email_notifications') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('notify_sent')->label('&nbsp;')->text(trans('texts.email_sent')) !!}
{!! Former::checkbox('notify_viewed')->label('&nbsp;')->text(trans('texts.email_viewed')) !!}
{!! Former::checkbox('notify_paid')->label('&nbsp;')->text(trans('texts.email_paid')) !!}
{!! Former::checkbox('notify_approved')->label('&nbsp;')->text(trans('texts.email_approved')) !!}
</div>
</div>

View File

@ -74,6 +74,12 @@
</div> </div>
</div> </div>
</div>
@if ( ! Auth::user()->is_admin)
@include('accounts.partials.notifications')
@endif
<center> <center>
@if (Auth::user()->confirmed) @if (Auth::user()->confirmed)
{!! Button::primary(trans('texts.change_password')) {!! Button::primary(trans('texts.change_password'))
@ -88,7 +94,6 @@
->submit()->large() ->submit()->large()
->appendIcon(Icon::create('floppy-disk')) !!} ->appendIcon(Icon::create('floppy-disk')) !!}
</center> </center>
</div>
<div class="modal fade" id="passwordModal" tabindex="-1" role="dialog" aria-labelledby="passwordModalLabel" aria-hidden="true"> <div class="modal fade" id="passwordModal" tabindex="-1" role="dialog" aria-labelledby="passwordModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">