jkuchar / MultipleFileUpload

Upload more files at once using Nette Forms. More front-end interfaces available. (fallback between them is available)
http://addons.nette.org/cs/multiplefileupload
BSD 3-Clause "New" or "Revised" License
10 stars 11 forks source link

Refactor initJS.js files to initJS.latte #2

Closed TomPastyrik closed 10 years ago

TomPastyrik commented 11 years ago

Hi,

thanks for this plugin in a first place! :) I would recommend refactor initJS.js files to initJS.latte since there are inputs for latte variables and IDE parsers cannot handle it with .js filename. So there are unnecessary errors of static code analysis.

jkuchar commented 11 years ago

Great idea! :-) But actually I'm abroad and don't have notebook with IDE. Please, could you send a fork? (I think is really easy fix, just changing few lines) If you are going to do that please do your changes into master. Not into nette09 branch. Thanks!

Ciki commented 10 years ago

not sure about this. it's true about the errors but if renamed to .latte we'll lose colored js markup

jkuchar commented 10 years ago

There are two options. Both annoing: A) to have .latte - no syntax highliting (or wrong one because it will be considered as a HTML file) B) to have .js file - and there will be parse errors in IDE because of latte macros -> than there is red exclamation mark in project and in IDE it looks that project is broken.

In some .latte looks better for me because it contents latte template, not a js file

Ciki commented 10 years ago

Actually it's a js file/contents with some variables&helpers. Or as you say a latte template but with js content inside. Just a point of view.. The simplest solution I can think of is to rename it to have .latte extension and wrap the file content in <script> tags which would have to be removed in Controller::renderInitJavaScript() method or https://github.com/jkuchar/MultipleFileUpload/blob/master/MultipleFileUpload/MultipleFileUpload.php#L293. What do you think?

jkuchar commented 10 years ago

I'm not OK with this solution. Probably best one should be if code will export needed variables as local JavaScript properties that will be used in template. (so they won't be declared in .latte file, but in controller)