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

[2.7] Update Twig docs for asset features #5574

Merged
merged 2 commits into from
May 9, 2016

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Jul 28, 2015

Finishes #5171

Q A
Doc fix? yes
New docs? no
Applies to 2.7+
Fixed tickets #4982 (partially)

@@ -1027,46 +1027,12 @@ assets won't be cached when deployed. For example, ``/images/logo.png`` might
look like ``/images/logo.png?v2``. For more information, see the :ref:`ref-framework-assets-version`
configuration option.

.. _`book-templating-version-by-asset`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to add a warning that this is not supported? Otherwise, people who use old links might get lost as the anchor wouldn't match anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean adding an admonition about this in the docs? I don't like that, it'll put completely unrelated text in the documentation (also, anyone linking to this currently wouldn't read the warning anyways)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I cannot remember anymore what I had in mind back then.

@wouterj wouterj force-pushed the javiereguiluz-update_twig_templates branch 2 times, most recently from 2515ef9 to 7f38440 Compare July 29, 2015 12:00
@wouterj wouterj force-pushed the javiereguiluz-update_twig_templates branch from 7f38440 to b327da7 Compare December 19, 2015 11:17
@wouterj
Copy link
Member Author

wouterj commented Dec 19, 2015

Rebased, ready to merge imo

@xabbuh
Copy link
Member

xabbuh commented Dec 19, 2015

👍

Returns the absolute URL for the given absolute path. This is useful to convert
an existing path:
Returns the absolute URL from the passed relative path. Assume the following
code was used to render ``http://example.com/sub/list.html``:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing me a little bit. Are we saying basically "Assume your Symfony installation is at http://example.com/sub`? What I mean is: are we trying to show that if you don't include /, then you should pass paths relative to your document root (e.g. the web dir) and that absolute_url will figure out if your installation is under a sub-directory and correct? If so, this is exactly how asset() works now - I'm just verifying that I'm not missing something. I think the fact that it corrects the subdirectory is not that important: it's just something that it should do. What's important is that we recommend (first) that you don't use the /, and that the path you should use is relative to your document root (e.g. web/).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've re-read your code, and it makes sense now. I'd re-word the second sentence:

For example, assume you're on the following page in your app
``http://example.com/products/hover-board``

I think the .html in the URL confused me for some reason too :). Obviously, if you change to /products, the code below will need to change too

@xabbuh
Copy link
Member

xabbuh commented May 4, 2016

@wouterj What is the state here?


.. code-block:: jinja

{{ absolute_url(asset(path)) }}
{{ absolute_url('/human.txt') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also add the current URL here:

{# assume the current URL is http://example.com/products/hover-board #}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it twice seems a bit duplicated to me. I've not included it in the PR, but feel free to make this change during merging if you feel it makes things better.

@weaverryan
Copy link
Member

I clarified some comments. After we do those, I'll be 👍

@wouterj wouterj force-pushed the javiereguiluz-update_twig_templates branch from b327da7 to 0cd7e6c Compare May 5, 2016 21:04
@wouterj
Copy link
Member Author

wouterj commented May 5, 2016

Thanks @weaverryan for the review. I've rebased and updated this PR now.

@xabbuh
Copy link
Member

xabbuh commented May 9, 2016

Thank you Wouter.

@xabbuh xabbuh merged commit 0cd7e6c into symfony:2.7 May 9, 2016
xabbuh added a commit that referenced this pull request May 9, 2016
…z, WouterJ)

This PR was merged into the 2.7 branch.

Discussion
----------

[2.7] Update Twig docs for asset features

Finishes #5171

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.7+
| Fixed tickets | #4982 (partially)

Commits
-------

0cd7e6c Correctly document new twig functions
bc18ff1 Updated Twig template to take into account asset() function changes
@wouterj wouterj deleted the javiereguiluz-update_twig_templates branch May 9, 2016 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants