Commit e91d9dd5d666238d2e3edb1c4a7676a72fc97f2f

Authored by totoro
1 parent 63b2c11b

fix dropzone helper

Showing 1 changed file with 38 additions and 22 deletions   Show diff stats
web/CXM_dropzone.anubis
@@ -3,34 +3,50 @@ @@ -3,34 +3,50 @@
3 TODO: 3 TODO:
4 Complete dropzone options and features binding 4 Complete dropzone options and features binding
5 5
6 - Author: Julien Verneuil (06/04/2016) 6 + Authors: Julien Verneuil (06/04/2016)
  7 + David René (2017/08/12)
7 8
8 read tools/basis.anubis 9 read tools/basis.anubis
9 - 10 +read system/string.anubis
10 read calexium_lib/web/CXM_making_a_web_site.anubis 11 read calexium_lib/web/CXM_making_a_web_site.anubis
  12 +read calexium_lib/web/CXM_jquery.anubis
11 13
12 public define HTML_Partial_Content 14 public define HTML_Partial_Content
13 dropzone 15 dropzone
14 ( 16 (
15 - String dropzone_form_name,  
16 - String dict_default_message,  
17 - String dict_file_too_big,  
18 - String param_name,  
19 - String submit_action_name 17 + String dropzone_form_name,
  18 + String dict_default_message,
  19 + String dict_file_too_big,
  20 + String param_name,
  21 + String init,
  22 + WEB_Action_Name submit_action,
  23 + List((String,String)) extra_ops,
20 ) = 24 ) =
21 - with dropzone_form_id = generate_random_string(15),  
22 - partial_content([], sequence([  
23 - literal("  
24 - <script type=\"text/javascript\">  
25 - $(document).ready(function () {  
26 - Dropzone.options." + dropzone_form_id + " = {  
27 - dictDefaultMessage : \"" + dict_default_message + "\",  
28 - dictFileTooBig : \"" + dict_file_too_big + "\",  
29 - paramName : \"" + param_name + "\" 25 + with dropzone_form_id = to_lower(dropzone_form_name+"_"+generate_random_string(15)),
  26 + partial_content(
  27 + [ js(js_file("js/dropzone.js")),
  28 + css(css_file("css/dropzone.css")),
  29 + js_script("
  30 +Dropzone.options." + to_Camel_case(dropzone_form_id) + " = {
  31 + dictDefaultMessage : \"" + dict_default_message + "\",
  32 + dictFileTooBig : \"" + dict_file_too_big + "\",
  33 + paramName : \"" + param_name + "\","+
  34 +(if init = "" then "" else "
  35 + init: "+init)+"
30 }; 36 };
31 - });  
32 - </script>"),  
33 - partial(partial_content(  
34 - [js(js_file("js/dropzone.js")), css(css_file("css/dropzone.css"))],  
35 - form(dropzone_form_id, [class("dropzone")], submit_action_name, [], empty)  
36 - ))])). 37 + $('#"+dropzone_form_id+"').dropzone(); ")],
  38 + form(dropzone_form_id, [class("dropzone")], submit_action, extra_ops, empty)
  39 + )
  40 +.
  41 +
  42 +public define HTML_Partial_Content
  43 + dropzone
  44 + (
  45 + String dropzone_form_name,
  46 + String dict_default_message,
  47 + String dict_file_too_big,
  48 + String param_name,
  49 + WEB_Action_Name submit_action
  50 + )=
  51 + dropzone(dropzone_form_name, dict_default_message, dict_file_too_big, param_name, "", submit_action, [])
  52 +.