These are chat archives for symfony2admingenerator/GeneratorBundle

2nd
Apr 2015
Stéphane
@sescandell
Apr 02 2015 05:31
Hi everone
@bobvandevijver simplier than creating a dedicated bundle and configuration, you can also override the default FieldGuesser by extending the admingen one and overwritting dedicated methods. It will works fine
@tobias-93 : for no, if you don't make the field as filterable, it will not be displayed even if you use it in the list builder under the filter param. But this is something changed here https://github.com/symfony2admingenerator/GeneratorBundle/pull/96/files#diff-9da10e225fd96c3984b51a7a3920f74aR54 in my current PR
Dražen Perić
@peric
Apr 02 2015 08:07
@loostro ok, just post the gist here when it's ready. thank you ;)
Stéphane
@sescandell
Apr 02 2015 08:43
@peric for "s2a_collection_upload" take a look to https://github.com/sescandell/CollectionUploadSample
You can see different sample with syc and async mode
Tobias Feijten
@tobias-93
Apr 02 2015 09:50
@sescandell I made the field filterable but it doesn't appear in the filters section. I think it's just not possible to filter on, so it isn't shown. I just want to know if that is predicted behavior or not
Tobias Feijten
@tobias-93
Apr 02 2015 10:10
@loostro I created the PR in the non-standard-dbtypes branch, if you could have a look at it?
ioleo
@ioleo
Apr 02 2015 10:29
hi tobias. ive seen the PR and it would probably work, but I really want to keep the values in the configuration class
this way we can validate the configuration
Tobias Feijten
@tobias-93
Apr 02 2015 10:36
I understand, but I couldn't find a way to add the defaults in the configuration
ioleo
@ioleo
Apr 02 2015 10:36
yeah its tricky
there is no documentation on how to use "defaults" and "prototype" at the same time
Tobias Feijten
@tobias-93
Apr 02 2015 10:36
exactly
ioleo
@ioleo
Apr 02 2015 10:37
im doing a bit of trial-and-error search for the solution now :)
Tobias Feijten
@tobias-93
Apr 02 2015 10:37
I see :)
ioleo
@ioleo
Apr 02 2015 11:11
such a pain in the ass
Stéphane
@sescandell
Apr 02 2015 11:22
@tobias-93 currently, if your field is defined as filterable, according to this line: https://github.com/symfony2admingenerator/GeneratorBundle/blob/master/Builder/Admin/ListBuilder.php#L56 it should be displayed... (but this is something that is going to change in PR#96)
Tobias Feijten
@tobias-93
Apr 02 2015 11:26
@sescandell I'll do some more debugging then
Dražen Perić
@peric
Apr 02 2015 11:31
@loostro so the configuration for old and new bundle should be the same? Because I've found some different things in the current documentation and in this sample you're referencing to.
ioleo
@ioleo
Apr 02 2015 11:39
which part?
most of old-stable configuration stayed the same... but some of it changed (eg. removed conditional actions)
Tobias Feijten
@tobias-93
Apr 02 2015 11:53
@loostro your last change seems to work in our environment :)
ioleo
@ioleo
Apr 02 2015 11:53
yeah it seems to be the correct way to do this
but undocumented...
Tobias Feijten
@tobias-93
Apr 02 2015 11:54
Maybe not many people need this and those who do know enough about it to use it properly
But I agree with you that some documentation on this part wouldn't be unneeded ;)
ioleo
@ioleo
Apr 02 2015 11:55
still getting an error
Tobias Feijten
@tobias-93
Apr 02 2015 11:55
interesting
hmm I checked my solution, which of course works... :(
Tobias Feijten
@tobias-93
Apr 02 2015 12:09
@loostro if you remove the addDefaultsIfNotSet() at each child node of form_types and filter_types, the default will still be loaded if there's nothing in the config.yml. Then, if something needs to be added all default types also need to be added as well to the config.yml.
If that is documented well, it could be helpful
And acceptable as a solution imho
ioleo
@ioleo
Apr 02 2015 12:10
ive just pushed a fix removeing that
Tobias Feijten
@tobias-93
Apr 02 2015 12:10
I saw
ioleo
@ioleo
Apr 02 2015 12:12
maybe we could also add a ->validate entry
Tobias Feijten
@tobias-93
Apr 02 2015 12:12
so that at least all default entries are there
ioleo
@ioleo
Apr 02 2015 12:13
and if the user gives a config like
admingenerator_generator:
    form_types:
        only_my_custom: text
the validator should add the missing default entries
in which case, we would only have to define the types we want to customize
not copy/paste all the defaults
Yay! All tests passed =) finally :)
Dražen Perić
@peric
Apr 02 2015 12:17
@loostro ok, will try to follow those examples one more time. btw: about my question from yesterday, single image upload works now, but I don't have an idea how to "preview" it in the view. How do I setup this?
Tobias Feijten
@tobias-93
Apr 02 2015 12:34
@loostro that would be ideal
Stéphane
@sescandell
Apr 02 2015 12:51
@peric in https://github.com/sescandell/CollectionUploadSample you also have a sample of single image upload into the Product Entity
Dražen Perić
@peric
Apr 02 2015 13:18
Ok, will take a look again. I've managed to make it work but image preview (for example in show view) didn't work so my question was how to setup this.
But will take a look.
ioleo
@ioleo
Apr 02 2015 14:29
@peric show your admingenerator_form_extensions configuration
especially the image_manipulator key
Dražen Perić
@peric
Apr 02 2015 14:33
    upload_manager:    vich_uploader
    image_manipulator: liip_imagine
    collection_upload:
        async_listener_enabled: true
        async_route_name:       admingenerator_async_upload
        file_storage:           admingenerator.form.file_storage.local
But I have to do it anyway one more time and see if I've missed something.
ioleo
@ioleo
Apr 02 2015 14:33
show me your liip image bundle configuration then
Dražen Perić
@peric
Apr 02 2015 14:34
liip_imagine:
    driver:               gd
    cache:                default
    data_loader:          default
    controller:
        filter_action:         liip_imagine.controller:filterAction
        filter_runtime_action: liip_imagine.controller:filterRuntimeAction
    resolvers:
        default:
            web_path:
              web_root:     "%kernel.root_dir%../web"
              cache_prefix: /media/cache
    loaders:
        default:
            filesystem:
                data_root:  "%upload_dir%"
    filter_sets:
        single_upload:
            filters:
                strip:      ~
                thumbnail:  { size: [90, 90], mode: outbound }
ioleo
@ioleo
Apr 02 2015 14:37
OK so you can overwrite your show template
in your Acme/DemoBundle/Resources/views/EntityShow/index.html.twig
and add there
{% block show_column_yourcolumnname %}
Dražen Perić
@peric
Apr 02 2015 14:39
Ok. So there is no "out of the box" support for that, but I can easily extend it, per column?
ioleo
@ioleo
Apr 02 2015 14:39
and in this block you can add <img src="{{ Entity.yourcolumnname| imagine_filter('single_upload') }}" />
by default, the show builder does not generate image previews
becouse.. as you may have noticed, liip imagine bundle is OPTIONAL
for s2a_single_upload FORM type, there is no preview, only an icon is displayed
for s2a_collection_upload FORM type, there is an option to generate a preview thumb useing liip/avalanche filters
or with a direct link to the image, but embeded in <img src="here link" width="x" height="y"> where x and y are fixed values (so they dont break the layout)
Tobias Feijten
@tobias-93
Apr 02 2015 15:05
@loostro see my new PR :)
ioleo
@ioleo
Apr 02 2015 15:21
@tobias-93 nice, i've added some comments, when you fix them its ready to merge
Tobias Feijten
@tobias-93
Apr 02 2015 15:21
@loostro I saw, already busy :)
Tobias Feijten
@tobias-93
Apr 02 2015 15:28
@loostro see my new commit :)
ioleo
@ioleo
Apr 02 2015 15:29
i just learned how to set a topic lol :P
ioleo
@ioleo
Apr 02 2015 15:52
hmm
do you know any bundle with a GoogleMaps form (to get longitute/latitude) ?
I'm looking at this https://github.com/ollietb/OhGoogleMapFormTypeBundle but It has not been updated for a long time and I see some dead code in it
is there something else?
ioleo
@ioleo
Apr 02 2015 16:03
hmm ill probably have to fork and fix it a bit..
Bob van de Vijver
@bobvandevijver
Apr 02 2015 16:26
I've build something myself to get the longtitude/latitude using the Google Maps API
ioleo
@ioleo
Apr 02 2015 16:32
open source?
Bob van de Vijver
@bobvandevijver
Apr 02 2015 16:38
Nope, it is in a private repository and the page is protected with an login
But, it is based on this API, which is relatively simple: Google MAPS API
And it is also not in a form type
ioleo
@ioleo
Apr 02 2015 17:06
ive decided to refactor OhGoogleMap and add it to FormExtensions
Bob van de Vijver
@bobvandevijver
Apr 02 2015 17:08
Okay, nice
I do not need it, but it is nice to have
ioleo
@ioleo
Apr 02 2015 17:10
it will work like other formextension types - automatic rendering of init javascript etc
ioleo
@ioleo
Apr 02 2015 18:42
Owkay! Let's see if it blows up :P
i hope not to spend all night on this..
ioleo
@ioleo
Apr 02 2015 19:11
ready for the drumroll....
BOOM! Errored :D
ioleo
@ioleo
Apr 02 2015 19:24
oh come on packagist, update already -.-
Bob van de Vijver
@bobvandevijver
Apr 02 2015 19:25
You haven't configured the callback correctly maybe?
ioleo
@ioleo
Apr 02 2015 19:25
i have, but sometimes packagist has 'lag'
Bob van de Vijver
@bobvandevijver
Apr 02 2015 19:25
Yeah, that's true
ioleo
@ioleo
Apr 02 2015 19:25
i mean, on packagist page the commit hash is OK
but when i do composer show "repo name"
it returns dev-master with older (3 commits before) hash
and i did composer clear-cache to make sure its not my fault
Bob van de Vijver
@bobvandevijver
Apr 02 2015 19:26
That might also be your local composer cache?
ioleo
@ioleo
Apr 02 2015 19:30
i'll rebuild the whole virtual machine 8)
see if that helps ;P
Bob van de Vijver
@bobvandevijver
Apr 02 2015 19:30
You can also remove your .composer directory ;)
ioleo
@ioleo
Apr 02 2015 19:30
i did
im pretty sure it's packagist cacheing something
i did 4-5 edits on github page
that triggered 4-5 hook updates to packagist
in short time
Bob van de Vijver
@bobvandevijver
Apr 02 2015 19:31
A, that might cause it
ioleo
@ioleo
Apr 02 2015 19:32
but, since i must wait anyways.. rebuilding the box wont hurt ;)
ioleo
@ioleo
Apr 02 2015 20:15
ahh what a bs problem :/
ioleo
@ioleo
Apr 02 2015 22:38
uhh finally