Improve create and start permission handling (#613)

This commit is contained in:
Kevin Papst
2019-03-06 10:24:27 +01:00
committed by GitHub
parent bce85b04d6
commit e260dd84ad
31 changed files with 258 additions and 86 deletions

View File

@@ -73,7 +73,6 @@
eventRender: function(eventObj, $el) {
if (eventObj.source.ajaxSettings.name !== 'kimaiUserTimeSource') {
return;
}
$el.popover({
title: eventObj.title,
@@ -98,17 +97,23 @@
});
},
eventClick: function(calEvent, jsEvent, view) {
{% if is_granted('edit_own_timesheet') %}
location.href = '{{ path('timesheet_edit', {id: '-XX-'}) }}?origin=calendar'.replace('-XX-', calEvent.id);
{% endif %}
},
dayClick: function(date, jsEvent, view) {
{% if is_granted('create_own_timesheet') %}
location.href = '{{ path('timesheet_create') }}' + '?origin=calendar&begin=' + date.format();
{% endif %}
},
selectable: true,
select: function( start, end, jsEvent, view) {
if(view.type === 'month') {
return;
}
{% if is_granted('create_own_timesheet') %}
location.href = '{{ path('timesheet_create') }}' + '?from=' + start.format() + '&to=' + end.format();
{% endif %}
}
})
})

View File

@@ -3,7 +3,7 @@
<h3 class="box-title">
{{ title }}
{% if form.vars.docu_chapter is defined and form.vars.docu_chapter is not empty %}
<a href="{{ path('help_chapter', {'chapter': form.vars.docu_chapter}) }}"><i class="{{ 'help'|icon }}"></i></a>
<a href="{{ form.vars.docu_chapter|docu_link }}" target="_blank"><i class="{{ 'help'|icon }}"></i></a>
{% endif %}
</h3>
</div>

View File

@@ -4,7 +4,7 @@
{% block modal_title %}
{{ title }}
{% if form.vars.docu_chapter is defined and form.vars.docu_chapter is not empty %}
<a href="{{ path('help_chapter', {'chapter': form.vars.docu_chapter}) }}"><i class="{{ 'help'|icon }}"></i></a>
<a href="{{ form.vars.docu_chapter|docu_link }}" target="_blank"><i class="{{ 'help'|icon }}"></i></a>
{% endif %}
{% endblock %}
{% block modal_body %}

View File

@@ -3,7 +3,7 @@
{# Adds the help icon, including a link to the documentation #}
{% block form_label %}
{% if form.vars.docu_chapter is defined and form.vars.docu_chapter is not empty %}
<a href="{{ path('help_chapter', {'chapter': form.vars.docu_chapter}) }}"><i class="{{ 'help'|icon }}"></i></a>
<a href="{{ form.vars.docu_chapter|docu_link }}" target="_blank"><i class="{{ 'help'|icon }}"></i></a>
{% endif %}
{{ parent() }}
{% endblock form_label %}

View File

@@ -32,10 +32,12 @@
</div>
{% endif %}
</li>
{% if is_granted('create_own_timesheet') %}
<li class="footer"><a href="{{ path('timesheet_create') }}">{{ 'timesheet.start'|trans }}</a></li>
{% endif %}
</ul>
</li>
{% else %}
{% elseif is_granted('create_own_timesheet') %}
<li class="messages-menu">
<a href="{{ path('timesheet_create') }}" class="ddt-large">
<i class="{{ 'start'|icon }} fa-2x"></i>

View File

@@ -1,4 +1,4 @@
{% if entries is defined and entries is not empty %}
{% if entries is defined and entries is not empty and is_granted('start_own_timesheet') %}
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle ddt-large" data-toggle="dropdown">
<i class="{{ 'activity'|icon }} fa-2x"></i>

View File

@@ -46,7 +46,7 @@
</li>
{% endif %}
<li>
<a href="{{ constant('App\\Constants::HOMEPAGE') }}/documentation/" target="_blank">
<a href="{{ ''|docu_link }}" target="_blank">
<div class="pull-left image">
<i class="{{ 'help'|icon }} text-gray"></i>
</div>