Index: lams_central/web/css/_authoring_base.scss
===================================================================
diff -u -r7e4e5c5afea0404304cf2f15fbfa79488fd1e92d -reff4591166587e12af17581dc551a6104673cceb
--- lams_central/web/css/_authoring_base.scss (.../_authoring_base.scss) (revision 7e4e5c5afea0404304cf2f15fbfa79488fd1e92d)
+++ lams_central/web/css/_authoring_base.scss (.../_authoring_base.scss) (revision eff4591166587e12af17581dc551a6104673cceb)
@@ -109,17 +109,12 @@
padding: 5px;
}
-div.propertiesDialogContainer .dialogContents .propertyBinContainer {
- text-align: right;
+div.propertiesDialogContainer .propertyBinButton {
+ float: right;
+ margin-right: 2px;
+ cursor: pointer;
}
-div.propertiesDialogContainer .dialogContents .propertyBinButton {
- width: 30px;
- height: 30px;
- margin: 10px;
- cursor: pointer;
-}
-
input[name="propertiesContentFieldGroupDivide"] {
margin-right: 10px;
}
Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js
===================================================================
diff -u -r7e4e5c5afea0404304cf2f15fbfa79488fd1e92d -reff4591166587e12af17581dc551a6104673cceb
--- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 7e4e5c5afea0404304cf2f15fbfa79488fd1e92d)
+++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision eff4591166587e12af17581dc551a6104673cceb)
@@ -55,11 +55,7 @@
'iconPath' : 'images/svg/branchingEnd.svg'
},
'bin' : {
- 'iconPath' : 'images/svg/authoringBin.svg',
- 'propertyButton' : $('
').addClass('propertyBinContainer')
- .append($('
![]()
').attr('src', LAMS_URL + 'images/svg/authoringBin.svg')
- .attr('title', LABELS.REMOVE_BUTTON_TOOLTIP)
- .addClass('propertyBinButton'))
+ 'iconPath' : 'images/svg/authoringBin.svg'
}
},
Index: lams_central/web/includes/javascript/authoring/authoringProperty.js
===================================================================
diff -u -r7e4e5c5afea0404304cf2f15fbfa79488fd1e92d -reff4591166587e12af17581dc551a6104673cceb
--- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 7e4e5c5afea0404304cf2f15fbfa79488fd1e92d)
+++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision eff4591166587e12af17581dc551a6104673cceb)
@@ -42,9 +42,6 @@
if (!content) {
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentBranching').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(activity);
- }))
.show().data('parentObject', activity);
// extra buttons for group/input based branching
$('.propertiesContentFieldMatchGroups', content).button().click(function(){
@@ -174,9 +171,6 @@
if (!content) {
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentGate').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(activity);
- }))
.show().data('parentObject', activity);
$('.propertiesContentFieldTitle', content).val(activity.title);
if (activity.gateType == 'system') {
@@ -406,9 +400,6 @@
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentGrouping').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(activity);
- }))
.show().data('parentObject', activity);
// init widgets
@@ -452,9 +443,6 @@
if (!content) {
// first run, create the content
content = label.propertiesContent = $('#propertiesContentLabel').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(label);
- }))
.show().data('parentObject', label);
$('.propertiesContentFieldTitle', content).val(label.title);
var color = label.items.shape.attr('fill');
@@ -533,9 +521,6 @@
if (!content) {
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentOptionalActivity').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(activity);
- }))
.show().data('parentObject', activity);
$('.propertiesContentFieldTitle', content).val(activity.title);
@@ -607,9 +592,6 @@
if (!content) {
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentParallel').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(activity);
- }))
.show().data('parentObject', activity);
$('.propertiesContentFieldTitle', content).val(activity.title);
@@ -664,9 +646,6 @@
if (!content) {
// first run, create the content
content = region.propertiesContent = $('#propertiesContentRegion').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(region);
- }))
.show().data('parentObject', region);
$('.propertiesContentFieldTitle', content).val(region.title);
@@ -726,9 +705,6 @@
if (!content) {
// first run, create the content
content = activity.propertiesContent = $('#propertiesContentTool').clone().attr('id', null)
- .append(layout.toolMetadata.bin.propertyButton.clone().click(function(){
- ActivityLib.removeItemWithButton(activity);
- }))
.show().data('parentObject', activity);
$('.propertiesContentFieldTitle', content).val(activity.title);
if (activity.parentActivity && (activity.parentActivity instanceof ActivityDefs.ParallelActivity)) {
@@ -880,6 +856,17 @@
}
}, false);
$('.modal-body', propertiesDialog).empty();
+ $('
' +
+ '' +
+ '')
+ .appendTo($('.modal-title', propertiesDialog))
+ .click(function(){
+ let item = $('.dialogContents', propertiesDialog).data('parentObject');
+ if (item) {
+ ActivityLib.removeItemWithButton(item);
+ }
+ });
+
// for proximity detection throttling (see handlers)
propertiesDialog.data('lastRun', 0);
// remove close button, add dimming
@@ -1806,6 +1793,13 @@
modalBody.find('input, select, textarea').prop('disabled', true);
modalBody.find('.spinner').prop('disabled', true);
}
+
+ // hide trashcan button on properties dialog if read only or the item should not be deleted
+ $('.propertyBinButton', dialog).toggle(!object.readOnly
+ && !(object.parentActivity && object.parentActivity.readOnly)
+ && !(object.branchingActivity && object.branchingActivity.readOnly)
+ && !(object instanceof ActivityDefs.Transition));
+
modalBody.find('input').blur();
dialog.on('shown.bs.modal', function(){
if (dialog.data('dragged')){