Commit 78fb4175 authored by Jen Zajac's avatar Jen Zajac
Browse files

Fix some issues with viewacl templating BUG1465107

  also fixes a bug whereby removing or blanking out
  rows throws a db error

  behatnotneeded

Change-Id: If14c511e0992890c40df398a4e23a78308fdaf78
parent 395afc5f
......@@ -152,7 +152,7 @@ $string['Added'] = 'Added';
$string['share'] = 'Share';
$string['sharedbyme'] = 'Shared by me';
$string['sharewith'] = 'Share with';
$string['whosharewith?'] = 'Who do you want to share with?';
$string['whosharewith'] = 'Who do you want to share with?';
$string['accesslist'] = 'Access list';
$string['defaultaccesslistmessage'] = 'Nobody besides you can view your selected pages / collections. Add people to give them access.';
$string['sharewithmygroups'] = 'Share with my groups';
......
......@@ -36,8 +36,8 @@
<script type="text/x-tmpl" id="row-template">
<tr id="row-{%=o.id%}" data-id="{%=o.id%}">
<td class="text-center pr0 ptl tiny">
<a class="pts {% if (o.presets.locked || o.presets.empty) { %}icon-placeholder{% } %} text-block" data-bind="remove-share" href="#" id="remove-share{%=o.id%}">
<span class="text-danger icon icon-lg icon-minus"></span>
<a class="{% if (o.presets.locked || o.presets.empty) { %}icon-placeholder{% } %} text-block" data-bind="remove-share" href="#" id="remove-share{%=o.id%}">
<span class="text-danger icon icon-lg icon-trash"></span>
<span class="sr-only">{%={{jstr tag=remove section=view}}%}</span>
</a>
</td>
......@@ -99,10 +99,10 @@
</td>
{% if (o.viewtype !== "profile") { %}
<td class="text-center tiny">
<input value="1" name="accesslist[{%=o.id%}][allowcomments]" class="mtm allow-comments-checkbox" type="checkbox" {% if (o.presets.allowcomments == "0") { %}{% } else { %}checked{% } %} {% if (o.presets.locked) { %}disabled{% } %}>
<input value="1" name="accesslist[{%=o.id%}][allowcomments]" class="mtm allow-comments-checkbox js-hide-empty {% if (o.presets.empty) { %}hidden{% } %}" type="checkbox" {% if (o.presets.allowcomments == "0") { %}{% } else { %}checked{% } %} {% if (o.presets.locked) { %}disabled{% } %}>
</td>
<td class="text-center tiny">
<input value="1" name="accesslist[{%=o.id%}][approvecomments]" class="mtm moderate-comments-checkbox" type="checkbox" {% if (o.presets.approvecomments) { %}checked{% } %} {% if (o.presets.locked) { %}disabled{% } %}>
<input value="1" name="accesslist[{%=o.id%}][approvecomments]" class="mtm moderate-comments-checkbox js-hide-empty {% if (o.presets.empty) { %}hidden{% } %}" type="checkbox" {% if (o.presets.approvecomments) { %}checked{% } %} {% if (o.presets.locked) { %}disabled{% } %}>
</td>
{% } %}
......@@ -259,7 +259,7 @@ jQuery(function($) {
}
// render empty row
addNewRow(shareoptions);
addNewRow(shareoptions, {empty: true});
}
function addNewRow(shareoptions, presets) {
......@@ -520,10 +520,6 @@ jQuery(function($) {
renderAccessList(shareoptions);
setDatePicker($( ".js-date-picker > input" ));
for(i = 0; i < select2.length; i = i + 1) {
attachSelect2Search($(select2[i]));
}
$('#editaccess_allowcomments').on('change', function() {
$('.allow-comments-checkbox').prop('checked', true);
});
......
......@@ -450,7 +450,7 @@ function editaccess_submit(Pieform $form, $values) {
if ($values['accesslist']) {
$dateformat = get_string('strftimedatetimeshort');
for ($i = 0; $i < count($values['accesslist']); $i++) {
foreach ($values['accesslist'] as $i => $value) {
if (empty($values['accesslist'][$i]['type'])) {
unset($values['accesslist'][$i]);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment