Add context parameter to actions JS data methods.

Review Request #13107 — Created June 14, 2023 and submitted

david
Review Board
release-6.x
reviewboard

It turns out that it will be useful to allow the get_js_*_data for
actions to have access to the rendering context. This change does that
by introducing some new template tags that call the methods with the
context.

This also allows improving the implementation of the menu view a bit,
removing non-rendering actions from the data sent to the JS model,
preventing some warnings about unknown IDs from popping up in the case
that an extension has hidden a menu-item action.

  • Implemented a custom action that used the context parameter.
  • Used HideActionHook to hide a menu item action and saw that I was no
    longer getting warnings in the JS console.
  • Ran js-tests.
Summary
Add context parameter to actions JS data methods.
Description From Last Updated

I think the description is meant to say get_js_*_data instead of get_*_model_data.

maubinmaubin

line break before binary operator Column: 9 Error code: W503

reviewbotreviewbot

Expected a string and instead saw %. Column: 2 Error code: W095

reviewbotreviewbot

Expected ':' and instead saw 'load'. Column: 4 Error code: E021

reviewbotreviewbot

Expected a JSON value. Column: 9 Error code: E003

reviewbotreviewbot

Expected '}' and instead saw 'actions'. Column: 9 Error code: E021

reviewbotreviewbot

Unrecoverable syntax error. (10% scanned). Column: 9 Error code: E041

reviewbotreviewbot

Should say "Render ths JS view data for an action"

maubinmaubin

Expected ':' and instead saw 'load'. Column: 4 Error code: E021

reviewbotreviewbot

Expected a JSON value. Column: 9 Error code: E003

reviewbotreviewbot

Expected a string and instead saw %. Column: 2 Error code: W095

reviewbotreviewbot

Expected '}' and instead saw 'actions'. Column: 9 Error code: E021

reviewbotreviewbot

Unrecoverable syntax error. (10% scanned). Column: 9 Error code: E041

reviewbotreviewbot

blank line at end of file Column: 1 Error code: W391

reviewbotreviewbot

Expected a string and instead saw %. Column: 2 Error code: W095

reviewbotreviewbot

Expected ':' and instead saw 'load'. Column: 4 Error code: E021

reviewbotreviewbot

Expected a JSON value. Column: 9 Error code: E003

reviewbotreviewbot

Expected '}' and instead saw 'actions'. Column: 9 Error code: E021

reviewbotreviewbot

Unrecoverable syntax error. (10% scanned). Column: 9 Error code: E041

reviewbotreviewbot
Checks run (2 failed)
flake8 failed.
JSHint failed.

flake8

JSHint

david
Review request changed

Commits:

Summary
-
Add context parameter to actions JS data methods.
+
Add context parameter to actions JS data methods.

Diff:

Revision 2 (+180 -18)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 passed.
JSHint failed.

JSHint

maubin
  1. 
      
  2. I think the description is meant to say get_js_*_data instead of get_*_model_data.

  3. Should say "Render ths JS view data for an action"

  4. 
      
david
Review request changed

Description:

~  

It turns out that it will be useful to allow the get_*_model_data for

  ~

It turns out that it will be useful to allow the get_js_*_data for

    actions to have access to the rendering context. This change does that
    by introducing some new template tags that call the methods with the
    context.

   
   

This also allows improving the implementation of the menu view a bit,

    removing non-rendering actions from the data sent to the JS model,
    preventing some warnings about unknown IDs from popping up in the case
    that an extension has hidden a menu-item action.

Commits:

Summary
-
Add context parameter to actions JS data methods.
+
Add context parameter to actions JS data methods.

Diff:

Revision 3 (+188 -18)

Show changes

Checks run (2 failed)

flake8 failed.
JSHint failed.

flake8

JSHint

maubin
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-6.x (4280e6b)
Loading...