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

Map types in info.json files to valid HTML types #570

Closed
harshkhandeparkar opened this issue Dec 30, 2018 · 26 comments
Closed

Map types in info.json files to valid HTML types #570

harshkhandeparkar opened this issue Dec 30, 2018 · 26 comments
Labels
enhancement has-pull-request Issues which have a PR open

Comments

@harshkhandeparkar
Copy link
Member

harshkhandeparkar commented Dec 30, 2018

Please describe the problem (or idea)

Input types in some module info.json files are not valid html input types. This makes typing number type values inconvenient and invalid values can be submitted. Types like integer and string should be replaced with number, range or string.

Possible Fixes

Add a new function in examples/lib which maps different types to valid HTML types

Thank you!

@gitmate gitmate bot added HTML module New Module idea labels Dec 30, 2018
@gitmate
Copy link

gitmate bot commented Dec 30, 2018

GitMate.io thinks the contributor most likely able to help you is @ccpandhare.

Possibly related issues are #408 (Typo in info.json), #27 (add fisheyegl module), #113 (Add a Brightness module), #157 (Add a Contrast module), and #158 (Add a Saturation Module).

1 similar comment
@gitmate
Copy link

gitmate bot commented Dec 30, 2018

GitMate.io thinks the contributor most likely able to help you is @ccpandhare.

Possibly related issues are #408 (Typo in info.json), #27 (add fisheyegl module), #113 (Add a Brightness module), #157 (Add a Contrast module), and #158 (Add a Saturation Module).

@vibhorgupta-gh
Copy link

@harshkhandeparkar what values would htmlType assume? Given that the type property would be float, integer etc

@harshkhandeparkar
Copy link
Member Author

htmlType can be generalised. integer, float can both use number or range. percentage, color etc. can be string.

@harshkhandeparkar harshkhandeparkar changed the title Add valid html types to module info.json files Add Valid HTML Types To Module info.json Files Dec 30, 2018
@harshkhandeparkar harshkhandeparkar changed the title Add Valid HTML Types To Module info.json Files Add Valid HTML Types To Module *info.json* Files Dec 30, 2018
@harshkhandeparkar harshkhandeparkar changed the title Add Valid HTML Types To Module *info.json* Files Add Valid HTML Types To Module **info.json** Files Dec 30, 2018
@harshkhandeparkar harshkhandeparkar changed the title Add Valid HTML Types To Module **info.json** Files Add Valid HTML Types To Module info.json Files Dec 30, 2018
@harshkhandeparkar
Copy link
Member Author

harshkhandeparkar commented Jan 4, 2019

@tech4GT @jywarren is this issue good? Is this being fixed in some other issue or PR?

@Mridul97
Copy link

Mridul97 commented Jan 4, 2019

If no one is working on this issue, can I take up this issue?

@harshkhandeparkar
Copy link
Member Author

Absolutely. That will be awesome!

@Mridul97
Copy link

Mridul97 commented Jan 5, 2019

@harshkhandeparkar we cannot keep htmltype to be Number for input type float because it will not allow us to enter values like 1.5. So what should we keep htmltype when input type is float?

@harshkhandeparkar
Copy link
Member Author

@Mridul97 range will be good for float type inputs

@harshkhandeparkar
Copy link
Member Author

@Mridul97 if you are taking up #628 then can I work on this?

@Mridul97
Copy link

Mridul97 commented Jan 8, 2019

@harshkhandeparkar Actually I am almost done with this one, opening a pr!

@harshkhandeparkar
Copy link
Member Author

harshkhandeparkar commented Jan 8, 2019 via email

@harshkhandeparkar
Copy link
Member Author

Tell me your branch name. We will compare our changes. I will open a pr to your branch. Lets merge our changes.

@Mridul97
Copy link

Mridul97 commented Jan 8, 2019

Branch name is htmltypes, I just opened a pr #633.

@harshkhandeparkar
Copy link
Member Author

Look at my branch htmlType-in-info-files I have done many more other changes.

@Mridul97
Copy link

Mridul97 commented Jan 8, 2019

There are multiple commits to see changes like this becomes a bit inefficient, you can see my changes here #633.

@harshkhandeparkar
Copy link
Member Author

I have opened a pr to your branch. Please check it out. Also please git merge upstream/main

@jywarren
Copy link
Member

Hi, I'd like to suggest a slightly different approach, i'm sorry I didn't earlier but the rate of contribution is making my inbox a bit wild, apologies!

What if we maintain a utility function which maps the type to an htmlType, so that we can be more specific than htmlType (for reasons you've outlined here!) while not further complicating the info.json files, and not making the process of adding a new module any more complex?

We could create /src/util/inputTypeConversion.js perhaps... with some internal mapping with an assoc. array, like:

types = {
  'string': 'input',
  'text': 'textarea',
  'range': ...
}

And the util module could provide a method like:

inputTypeConversion.typeToHtmlType('string');

What do you think of this?

@jywarren
Copy link
Member

I appreciate all your work on this! I think it's a great idea. Thanks for considering my suggestion.

@harshkhandeparkar
Copy link
Member Author

harshkhandeparkar commented Jan 15, 2019

@jywarren The idea you suggested is cool but same type of input can have more than one htmlType like e.g. 'integer' can have both 'range' and 'number' as input. What can we do in that case?

Update: opened a new pr

@harshkhandeparkar
Copy link
Member Author

harshkhandeparkar commented Jan 15, 2019

Update: opened a new pr
@jywarren I'll open a new PR

@harshkhandeparkar
Copy link
Member Author

New pr #674

@jywarren
Copy link
Member

jywarren commented Jan 17, 2019 via email

@harshkhandeparkar harshkhandeparkar removed the module New Module idea label Jan 18, 2019
@harshkhandeparkar harshkhandeparkar changed the title Add Valid HTML Types To Module info.json Files Map types in info.json files to valid HTML types Jan 20, 2019
@harshkhandeparkar
Copy link
Member Author

@jywarren I think your rebase caused some problem in the pr and no changes were made. Any thoughts? I will probably open a new pr by force pushing from local. I still have the changes there. Thanks

@jywarren
Copy link
Member

jywarren commented Feb 9, 2019 via email

@harshkhandeparkar
Copy link
Member Author

Ok will do in a few minutes

@harshkhandeparkar harshkhandeparkar added the has-pull-request Issues which have a PR open label Feb 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement has-pull-request Issues which have a PR open
Projects
None yet
Development

No branches or pull requests

4 participants