Merge pull request #1904 from Dagolin/#1873-only-allow-admin-create-expense-category

Hide `New Expense Category` if user has no right to create
This commit is contained in:
Hillel Coren 2018-02-19 08:36:49 +02:00 committed by GitHub
commit 058e3bfd33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,12 +90,18 @@
['label' => trans('texts.new_recurring_expense'), 'url' => url('/recurring_expenses/create')], ['label' => trans('texts.new_recurring_expense'), 'url' => url('/recurring_expenses/create')],
] ]
)->split() !!} )->split() !!}
{!! DropdownButton::normal(trans('texts.categories')) @if (Auth::user()->can('create', ENTITY_EXPENSE_CATEGORY))
->withAttributes(['class'=>'categoriesDropdown']) {!! DropdownButton::normal(trans('texts.categories'))
->withContents([ ->withAttributes(['class'=>'categoriesDropdown'])
['label' => trans('texts.new_expense_category'), 'url' => url('/expense_categories/create')], ->withContents([
] ['label' => trans('texts.new_expense_category'), 'url' => url('/expense_categories/create')],
)->split() !!} ]
)->split() !!}
@else
{!! DropdownButton::normal(trans('texts.categories'))
->withAttributes(['class'=>'categoriesDropdown'])
->split() !!}
@endif
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('.recurringDropdown:not(.dropdown-toggle)').click(function(event) { $('.recurringDropdown:not(.dropdown-toggle)').click(function(event) {