Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with js overrides in templates #84

Closed
johanjanssens opened this issue Apr 24, 2017 · 2 comments
Closed

Problem with js overrides in templates #84

johanjanssens opened this issue Apr 24, 2017 · 2 comments

Comments

@johanjanssens
Copy link
Member

See: https://support.joomlatools.com/forums/topic/7480
See: https://support.joomlatools.com/forums/topic/7255

Related to: https://github.com/joomlatools/textman/issues/282

@johanjanssens
Copy link
Member Author

@ercanozkaya Another similar issue came in.

From previous discussions here is how I would try to do this:

I would assume that 'koowa' template is the default, afterall we are in the koowa context. This means setting template is system in 'joomla' very early on.

The condition when we render inside Joomla template is defined by Joomla itself. If we hit the Joomla onBeforeRender event we know that we are still in Joomla context and we need to render in Joomla, in that case we need to set the template to the correct Joomla template. If we didn't hit onBeforeRender we have triggered send earlier on in the cylce ourselves.

There are different ways to let the response layer know we are rendering in Joomla, query variable is one, but it might be better to set state using a header and remove that header in the response. That way we are not polluting the URL and query.

We are going to need to work on this and get it fixed. It also helps us to get rid of the 'koowa' variable in the URL to help us solve: https://github.com/joomlatools/textman/issues/284

ercanozkaya added a commit that referenced this issue Apr 27, 2017
Setting the header will make sure the framework sends the request itself without passing it back to Joomla.
In this case it will also set Joomla template to ‘system’ so that core JavaScript files are not overridden
by the current Joomla template.
@ercanozkaya
Copy link
Member

@johanjanssens can you review please? Here is how the implementation would look like in Docman:


class ComDocmanDispatcherHttp extends ComKoowaDispatcherHttp
{
    protected function _setResponse(KDispatcherContextInterface $context)
    {
        $view   = $context->getRequest()->getQuery()->view;
        $layout = $context->getRequest()->getQuery()->layout;

        if (in_array($view, ['doclink', 'upload']) || ($view === 'files' && $layout === 'select')) {
            $context->getResponse()->getHeaders()->set('X-Response-Send', 1);
        }

        parent::_setResponse($context);
    }
}

@ercanozkaya ercanozkaya modified the milestones: 3.1, 3.0 Apr 27, 2017
ercanozkaya added a commit that referenced this issue Apr 27, 2017
ercanozkaya added a commit that referenced this issue May 19, 2017
* feature/84-response:
  #84: Set the X-Response-Send header for backwards compatibility
  #87: Use isSite method as isClient doesn't exist in Joomla 3.6
  #84: Formatting
  #84: Add support for X-Response-Send header
ercanozkaya added a commit that referenced this issue May 22, 2017
* feature/90-js:
  #90: Add docblocks
  #90: Use request header X-Flush-Response
  #90: Make sure scripts work without a global jQuery variable
  #90: Inject custom head scripts right before </head>
  #90: Remove accordion and tabs helpers
  #84: Set header instead of query variable
  #90: Make sure jQuery is always loaded right before admin.js, helps when wrapping components
  #90: Add helper to load Vue.js
  #90: Only add editor styles and scripts in JDocument to page if it is explicitly asked for
  #90: Cleanup
  #90: Use our own jQuery and Bootstrap files when we render the page
  #90: Add jQuery before admin.js
  #84: Set the X-Response-Send header for backwards compatibility
  #90: Add Joomla 3.7 options object to <head>
  #90: Use in-house keep alive script
  #87: Use isSite method as isClient doesn't exist in Joomla 3.6
  #84: Formatting
  #84: Add support for X-Response-Send header
@ercanozkaya ercanozkaya modified the milestones: v3.1.0-rc.1, 3.1 Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants