-
Notifications
You must be signed in to change notification settings - Fork 11
NGSTACK-921 enhanced link download support #262
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
44709c1
7074d06
dd4ee2b
a77e69a
30358e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,26 @@ system: | |
| match_all: | ||
| template: "@ibexadesign/content/views/link_embed.html.twig" | ||
| match: ~ | ||
| download_inline: | ||
| ezbinaryfile_common: | ||
| template: "@ibexadesign/content/views/download_inline/ezbinaryfile_common.html.twig" | ||
| match: | ||
| Identifier\ContentType: | ||
| - ng_video | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we want downloadable
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't come up with a specific use case, but I added ng_video because both file and ng_video content types have field of type ezbinaryfile.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pspanja WDYT? |
||
| - file | ||
| match_all: | ||
| template: "@ibexadesign/content/views/download_inline.html.twig" | ||
| match: ~ | ||
| download_link: | ||
| ezbinaryfile_common: | ||
| template: "@ibexadesign/content/views/download_link/ezbinaryfile_common.html.twig" | ||
| match: | ||
| Identifier\ContentType: | ||
| - ng_video | ||
| - file | ||
| match_all: | ||
| template: "@ibexadesign/content/views/download_link.html.twig" | ||
| match: ~ | ||
| modal: | ||
| form_common: | ||
| template: "@ibexadesign/content/views/modal/form_common.html.twig" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| {# content \Netgen\IbexaSiteApi\API\Values\Content #} | ||
| {# content \Ibexa\Contracts\Core\Repository\Values\Content\Content #} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure this change is correct? We don't work with Ibexa Content.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 30358e1 |
||
|
|
||
| {% extends '@IbexaCore/content_fields.html.twig' %} | ||
|
|
||
|
|
@@ -35,6 +35,32 @@ | |
| } | ||
| }) | ||
| }} | ||
| {% elseif field.value.isTargetDownloadLink %} | ||
| {{ ng_view_content_embedded( | ||
| 'download_link', | ||
| { | ||
| 'contentId': field.value.reference, | ||
| 'params': { | ||
| 'label': label, | ||
| 'suffix': suffix, | ||
| 'refererLocationId': app.request.attributes.get('locationId'), | ||
| 'css_class': css_class | ||
| } | ||
| }) | ||
| }} | ||
| {% elseif field.value.isTargetDownloadInline %} | ||
| {{ ng_view_content_embedded( | ||
| 'download_inline', | ||
| { | ||
| 'contentId': field.value.reference, | ||
| 'params': { | ||
| 'label': label, | ||
| 'suffix': suffix, | ||
| 'refererLocationId': app.request.attributes.get('locationId'), | ||
| 'css_class': css_class | ||
| } | ||
| }) | ||
| }} | ||
| {% else %} | ||
| {% if ng_enhancedlink_has_location(field.value.reference) %} | ||
| {% set href = path('ibexa.url.alias', { 'contentId': field.value.reference }) ~ suffix %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {# content \Netgen\IbexaSiteApi\API\Values\Content #} | ||
| {# location \Netgen\IbexaSiteApi\API\Values\Location #} | ||
|
|
||
| {% set ezBinaryFileField = null %} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Twig variables should be
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dd4ee2b |
||
| {% for field in content.fields %} | ||
| {% if field.fieldTypeIdentifier == 'ezbinaryfile' %} | ||
| {% set ezBinaryFileField = field %} | ||
| {% set break = true %} | ||
| {% endif %} | ||
| {% if break is defined %} | ||
| {% set break = loop.last %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% if location is defined and ezBinaryFileField is not null %} | ||
| <a href="{{ path('ngsite_download', { 'contentId': content.id, 'fieldId': ezBinaryFileField.id, 'isInline': 1 }) }}" class="{{ css_class }}"> | ||
| {{ content.name }} | ||
| </a> | ||
| {% else %} | ||
| <p>{{ content.name }}</p> | ||
| {% endif %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {# content \Netgen\IbexaSiteApi\API\Values\Content #} | ||
| {# location \Netgen\IbexaSiteApi\API\Values\Location #} | ||
|
|
||
| {% set ezBinaryFileField = null %} | ||
| {% for field in content.fields %} | ||
| {% if field.fieldTypeIdentifier == 'ezbinaryfile' %} | ||
| {% set ezBinaryFileField = field %} | ||
| {% set break = true %} | ||
| {% endif %} | ||
| {% if break is defined %} | ||
| {% set break = loop.last %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% if location is defined and ezBinaryFileField is not null %} | ||
| <a href="{{ path('ngsite_download', { 'contentId': content.id, 'fieldId': ezBinaryFileField.id, 'isInline': 1 }) }}" class="{{ css_class }}"> | ||
| {{ content.name }} | ||
| </a> | ||
| {% else %} | ||
| <p>{{ content.name }}</p> | ||
| {% endif %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {# content \Netgen\IbexaSiteApi\API\Values\Content #} | ||
| {# location \Netgen\IbexaSiteApi\API\Values\Location #} | ||
|
|
||
| {% set ezBinaryFileField = null %} | ||
| {% for field in content.fields %} | ||
| {% if field.fieldTypeIdentifier == 'ezbinaryfile' %} | ||
| {% set ezBinaryFileField = field %} | ||
| {% set break = true %} | ||
| {% endif %} | ||
| {% if break is defined %} | ||
| {% set break = loop.last %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% if location is defined and ezBinaryFileField is not null %} | ||
| <a href="{{ path('ngsite_download', { 'contentId': content.id, 'fieldId': ezBinaryFileField.id, 'isInline': 0 }) }}" class="{{ css_class }}"> | ||
| {{ content.name }} | ||
| </a> | ||
| {% else %} | ||
| <p>{{ content.name }}</p> | ||
| {% endif %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {# content \Netgen\IbexaSiteApi\API\Values\Content #} | ||
| {# location \Netgen\IbexaSiteApi\API\Values\Location #} | ||
|
|
||
| {% set ezBinaryFileField = null %} | ||
| {% for field in content.fields %} | ||
| {% if field.fieldTypeIdentifier == 'ezbinaryfile' %} | ||
| {% set ezBinaryFileField = field %} | ||
| {% set break = true %} | ||
| {% endif %} | ||
| {% if break is defined %} | ||
| {% set break = loop.last %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% if location is defined and ezBinaryFileField is not null %} | ||
| <a href="{{ path('ngsite_download', { 'contentId': content.id, 'fieldId': ezBinaryFileField.id, 'isInline': 0 }) }}" class="{{ css_class }}"> | ||
| {{ content.name }} | ||
| </a> | ||
| {% else %} | ||
| <p>{{ content.name }}</p> | ||
| {% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just name this
common. No need forezbinaryfile_prefix. Same goes for template file names.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a77e69a
Renamed
ezbinaryfile_common.html.twigtemplates to just becommon.html.twig. Updated thecontent_view.yamlfile to reflect this change as well