Skip to content

Commit

Permalink
Add isAdmin js attribute and only show edit when admin
Browse files Browse the repository at this point in the history
Fixes #311
  • Loading branch information
bochoven committed Aug 15, 2016
1 parent 3ff8a81 commit 1b2f46d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/helpers/site_helper.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Munkireport version (last number is number of commits)
$GLOBALS['version'] = '2.9.0.2045';
$GLOBALS['version'] = '2.9.0.2046';

// Return version without commit count
function get_version()
Expand Down
1 change: 1 addition & 0 deletions app/views/partials/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
var baseUrl = "<?php echo conf('subdirectory'); ?>",
appUrl = baseUrl + 'index.php?',
businessUnitsEnabled = <?php echo conf('enable_business_units') ? 'true' : 'false'; ?>;
isAdmin = <?php echo $_SESSION['role'] == 'admin' ? 'true' : 'false'; ?>;
</script>

<script src="<?php echo conf('subdirectory'); ?>assets/js/jquery.js"></script>
Expand Down
4 changes: 3 additions & 1 deletion assets/js/clients/client_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ $(document).on('appReady', function(e, lang) {
mr.dt.buttonDom = "<'row'<'col-xs-6 col-md-8'lB r><'col-xs-6 col-md-4'f>>t<'row'<'col-sm-6'i><'col-sm-6'p>>";
mr.dt.buttons = {
buttons: [
'edit',
'copyHtml5',
'excelHtml5',
'csvHtml5',
'print'
]
};
if( isAdmin){
mr.dt.buttons.buttons.unshift('edit');
}

// Datatables defaults
$.extend( true, $.fn.dataTable.defaults, {
Expand Down

0 comments on commit 1b2f46d

Please sign in to comment.