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

Adding new 'cmf_media_file' form type #137

Merged
merged 1 commit into from
Jul 27, 2015

Conversation

eiannone
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #99, #136
License MIT
Doc PR symfony-cmf/symfony-cmf-docs#689

To do:

  • submit changes to the documentation

As discussed in #99, the MediaBundle seems to miss a 'cmf_media_file' form type, like the already defined 'cmf_media_image'.
This form type would be useful when a file must be embedded/attached to a container document, and maybe useful also for sonata admin.

@eiannone
Copy link
Contributor Author

One build is failing due to a Twig compiler problem (Twig v1.12.0-RC1). It generates a compiled template with a syntax error.
This is not related to my commit. Also master branch is affected.
It's a bug in Twig v1.12.0-RC1, which was fixed in v1.12.0 (missing 'array' string in https://github.com/twigphp/Twig/blob/v1.12.0-RC1/lib/Twig/Node/Expression/Call.php#L24). Don't know why travis is using that RC version instead of the stable one. Maybe because the '--prefer-lowest' flag in composer?

{% block cmf_media_image_widget_preview %}
{% if form.vars.data and form.vars.data.id is defined and form.vars.data.id %}
<img src="{{ cmf_media_display_url(form.vars.data, { imagine_filter : imagine_filter }) }}" alt="" {% if not imagine_filter %}width="100"{% endif %} />
{% endif %}
{% endblock %}
{{ form_widget(form) }}
Copy link
Member

Choose a reason for hiding this comment

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

i fear changing the order here is a BC break for users of the bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I will revert it to the original position to avoid breaking compatibility.
Anyway, to me it makes more sense having the preview of the uploaded image before the upload button (for replacing it). I could possibly propose this in a PR for a future version of the bundle.

@dbu
Copy link
Member

dbu commented Jul 24, 2015

hey, i like this one very much! the refactoring is great, and you even added tests for this!

the test failure is most likely unrelated. we do one build with --prefer-lowest exactly for the reason to see if things work or if we need to fix the minimum requirements in composer.json. i created #138 about that - we won't block this pull request because of it.

@eiannone
Copy link
Contributor Author

@dbu thank you for your review. I've addressed your points, and hope now the code is better documented.

@dbu
Copy link
Member

dbu commented Jul 24, 2015

great job, thanks a lot! i created the doc issue, please do a pull request for the documentation. it can be short, but at least the user should find a hint that this exists.

@lsmith77
Copy link
Member

please rebase on master to get the tests fixed.

@eiannone
Copy link
Contributor Author

Rebased (and squashed). All test are ok now.
I've also updated documentation, see symfony-cmf/symfony-cmf-docs#689

dbu added a commit that referenced this pull request Jul 27, 2015
Adding new 'cmf_media_file' form type
@dbu dbu merged commit e19d0f8 into symfony-cmf:master Jul 27, 2015
@lsmith77 lsmith77 removed the review label Jul 27, 2015
@dbu
Copy link
Member

dbu commented Jul 27, 2015

good job, thanks!

@eiannone eiannone deleted the file-form-type branch July 28, 2015 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants