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

add switch, radio input and file upload support for settings form #6

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

dvitcompte
Copy link
Contributor

@dvitcompte dvitcompte commented Apr 12, 2017

add switch, radio input and file upload support for settings form.

I'm not sure if file upload process contains all needed verifications (file size fo example).
Tested on ps 1.6

settings.json updated in email-templates-sdk for example

@dvitcompte dvitcompte changed the title add switch and radio input support for settings form add switch, radio input and file upload support for settings form Apr 12, 2017
@Scritik
Copy link
Contributor

Scritik commented Apr 12, 2017

@dvitcompte Some parts of your code are indented with tabs and not spaces. You forgot the method's visibility. Can you make sure that all your code is PSR-2? Thanks.

@rGaillard Can you take a look? Seems ok to me but I want to be sure since we have some uploads possibility. Thx.

@dvitcompte
Copy link
Contributor Author

@Scritik

Hello!
My bad I forgot to launch the PSR-2 plugin. Now it's done.
I did not set the $max_file_size argument for the method ImageManager::validateUpload($file). I don't know if you want to set a limit and the value of this limit (500kB, 1Mb?).
The file upload could be usefull to change little image like socials network, or add a background image in the header (I'm developping a template using a background header image)

I also fixed the indent in the settings.json file here (826fe58)

Thanks for the feedback!

Regards,

@dvitcompte dvitcompte closed this Jun 1, 2017
@dvitcompte dvitcompte reopened this Jun 1, 2017
@dvitcompte
Copy link
Contributor Author

Hello, still no review for this pull request?
Thx

@Scritik
Copy link
Contributor

Scritik commented Sep 20, 2017

Hi @dvitcompte,

Sorry for the delay, I think it's time to get back to this module :)

I have a few questions/remarks:

  • The support for a switch is interesting but in PS1.5, it's not supported if I remember. You should add a condition to transform the the switch into a radio button on 1.5.
  • is_bool is a bool, so the default value should be a bool :)
  • Same for values, you should assign an empty array (just to keep the same type).

@rGaillard Can you take a look at uploadFiles()? thx.

Thanks.

@Scritik Scritik self-requested a review September 20, 2017 22:39
@dvitcompte
Copy link
Contributor Author

Hello @Scritik ,
happy to read you again :)
I added a condition for PS15 to display a radio button instead of a switch. I also added a "class" property with the value 't' which is used for PS15 to display properly the radio buttons.

I'm preparing commits to add support for select field, and tabs (only for PS16 & PS17)

Regards

@Scritik
Copy link
Contributor

Scritik commented Sep 21, 2017

Thank you! I will take a look at it asap.

While select can be interesting, please do not make tabs if they are not compatible 1.5. I don't think it is really useful by the way, yes the form can be long but the choices are generally quite simple.

Thanks!

@dvitcompte
Copy link
Contributor Author

Hello,

I was wondering the same about tabs, but as PS16 and 17 are the most used and more and more shops are updated to PS17 or PS16. And for example my Minimalist Pro template has 29 options : 12 only for all socials networks, 8 for colors. I thought that classifying them by theme would be a good idea.
I will use


instead in my settings form :)

settings.json has been updated with an example of select field in email-templates-sdk project.

Regards

@Scritik
Copy link
Contributor

Scritik commented Sep 23, 2017

Yes they are the most used but this module is compatible with the 1.5 for now.
Keep this idea when we will work on a 2.0, only compatible with 1.6+.

And by the way, 12 social networks? Don't you think it's a little bit too much for merchants? ;)

@dvitcompte
Copy link
Contributor Author

Hello,

there are "only" 8 socials networks ;), a multilang field to add a custom title, 2 fields to add a custom social network, the last is to select the position of this block in the email. This is the most advanced module and others are more simple.

@Scritik
Copy link
Contributor

Scritik commented Sep 27, 2017

8 seems more reasonable :)

@Scritik
Copy link
Contributor

Scritik commented Sep 27, 2017

I started to test your PR and I found an issue. If I have a file input in the form and I edit the template, the file is not saved, and I need to upload a file every time!

A solution is to save the value like the other values, and if no file is uploaded, you get the saved value and use it instead of the empty value.

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.

2 participants