helloflask/flask-dropzone

Writing standard style tag in html rather than using dropzone.style() method

yuxiaoy1 opened this issue · 5 comments

Compare the following two writing styles of customizing the style for dropzone area:

<style>
.dropzone {
    border: 2px dashed #0087F7;
    margin: 10%;
    min-height: 400px;
}
</style>
{{ dropzone.style('border: 2px dashed #0087F7; margin: 10%; min-height: 400px;') }}

The first one (standard style tag) has two pros:

  • more readable and maintainable, while the second one looks sort of ugly.
  • more flexible on customizing different styles for multiple dropzones on one page, just replacing .dropzone to #<dropzone-id>, while the second one cannot realize.

Thus, I think the dropzone.style() method is unnecessary, and I suggest writing the standard style tag for customizing the style.

What do you think?

This macro is just a shortcut for simple usage similar to load_js(). We can update the docs to encourage users to use manual <style> entry for more flexibility.

more flexible on customizing different styles for multiple dropzones on one page, just replacing .dropzone to #, while the second one cannot realize.

Maybe we can add an id parameter to this macro to make it consistent with create() and config() macro and support multiple dropzones.

OK I'll create a PR later.

The docs PR #52 has been submitted, I will submit another PR addressing the multiple dropzones support.

PR #53 created to address the multiple dropzones support.

Well done! I will review them tomorrow, thanks!