Project

General

Profile

« Previous | Next » 

Revision c1a8ccf1

Added by Daniel Lobato Garcia over 8 years ago

Fixes #10929 - Add removed widgets to dashboard

This commit allows users to re-add widgets. At this point it's only
possible to recover removed widgets by clicking on "Reset to default".

To do this I populate the 'Add widgets' list by getting a diff
between the current widgets and the available ones. The code calls any
available widget 'default_widget', so keep that in mind.

After removing a widget, we reload the page, which is fairly fast thanks
to turbolinks. This is so that we populate the 'Add widgets' list.

Clicking on the widget to add will trigger a POST call that will add the
widget to User.current.widgets and reload the page. The reason why I
need to reload the page is to get the data in the new widget, otherwise
we would load an empty widget. It's not optimal but turbolinks makes it
fast.

(cherry picked from commit 24fc15c59e0acb589ef46a8f60e8ce76e72fd8d2)

  • added
  • modified
  • copied
  • renamed
  • deleted