← Back to team overview

mahara-contributors team mailing list archive

[Bug 1521315] [NEW] issue editing page, quirk removing artefacts

 

Public bug reported:

Mahara 15.10.0, Php 5.6.12, Postgres 9.3.5

Problem removing artefact DOM element(s) when editing page (after page
has been displayed)

reproducible on Mac OS X 10.9.5
    Chrome 46.0.2490.86 (64bit)
    Safari 9.0.1 99637.86.2.7.2)
    Firefox 42.0


To reproduce
Create a portfolio page
add a journal artefact to the page (or any other artefact)
add another artefact (doesn't matter what kind)

Display page  (this is crucial, everything works as expected in edit
mode)

Go back and edit the page
delete one of your artefacts and it gets removed from the DOM as expected
try to delete another artefact and it will appear to work but DOM will NOT be updated unless you reload page

problem found in 
js/views.js

lines 538  button.on('click' ....)
the variable blockinstanceID is a global so far is the onclick function is concerned so the first time through the routine it is undefined, then on lines 546 - 548 it is set properly to the data-id attribute of the artefact you are trying to delete 

When you try to delete another artefact from the page blockinstanceId
retains the value from the previous call and is NOT set to the current
artefacts data-id. (i.e. assignment on line 547 is skipped)

a potential fix (though I don't particularly like it)
after line 559 where the DOM element is removed add
blockinstanceId= undefined;

The only place where rewriteDeleteButton is called and blockinstanceId
is 'defined' is on line 1099 setting up for the removecancel button on
click function. Another fix might be to have that routine call it's own
rewriteDeleteButton (maybe refactor rewriteDeleteButton ) and have
onClick use it's own local blockinstanceId which is always assumed to be
null.

** Affects: mahara
     Importance: Undecided
         Status: New


** Tags: dom javascript

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1521315

Title:
  issue editing page, quirk removing artefacts

Status in Mahara:
  New

Bug description:
  Mahara 15.10.0, Php 5.6.12, Postgres 9.3.5

  Problem removing artefact DOM element(s) when editing page (after page
  has been displayed)

  reproducible on Mac OS X 10.9.5
      Chrome 46.0.2490.86 (64bit)
      Safari 9.0.1 99637.86.2.7.2)
      Firefox 42.0

  
  To reproduce
  Create a portfolio page
  add a journal artefact to the page (or any other artefact)
  add another artefact (doesn't matter what kind)

  Display page  (this is crucial, everything works as expected in edit
  mode)

  Go back and edit the page
  delete one of your artefacts and it gets removed from the DOM as expected
  try to delete another artefact and it will appear to work but DOM will NOT be updated unless you reload page

  problem found in 
  js/views.js

  lines 538  button.on('click' ....)
  the variable blockinstanceID is a global so far is the onclick function is concerned so the first time through the routine it is undefined, then on lines 546 - 548 it is set properly to the data-id attribute of the artefact you are trying to delete 

  When you try to delete another artefact from the page blockinstanceId
  retains the value from the previous call and is NOT set to the current
  artefacts data-id. (i.e. assignment on line 547 is skipped)

  a potential fix (though I don't particularly like it)
  after line 559 where the DOM element is removed add
  blockinstanceId= undefined;

  The only place where rewriteDeleteButton is called and blockinstanceId
  is 'defined' is on line 1099 setting up for the removecancel button on
  click function. Another fix might be to have that routine call it's
  own rewriteDeleteButton (maybe refactor rewriteDeleteButton ) and have
  onClick use it's own local blockinstanceId which is always assumed to
  be null.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1521315/+subscriptions


Follow ups