GithubHelp home page GithubHelp logo

datenanfragen / company-json-generator Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 5.0 1.55 MB

A very simple (quick-and-dirty) company JSON generator

Home Page: https://company-json.datenanfragen.de

License: Other

HTML 42.99% JavaScript 56.35% CSS 0.66%
gdpr company-database json privacy

company-json-generator's People

Contributors

baltpeter avatar dependabot[bot] avatar karansinghbisht avatar madhavshah avatar mal-tee avatar ozdemirburak avatar srijit2002 avatar tominkki avatar zner0l avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

company-json-generator's Issues

Support loading records

We should support loading an existing record into the generator from a file.

Since this feature is especially useful for validating and fixing community contributions, we should also support loading records from the URL (as a base64-encoded string or similar).

Allow loading record from arbitrary URL

The tool can already load records from a number of sources, including from the data repository (through the slug parameter) and from JSON (through the doc parameter):

if (fragmentArgs.slug) {
fetch(
'https://raw.githubusercontent.com/datenanfragen/data/master/companies/' + fragmentArgs.slug + '.json'
)
.then((e) => e.json())
.then((json) => {
initializeForm(json);
})
.catch((e) => {
console.error('Failed to retrieve or parse JSON doc.', e);
initializeForm(null);
alert('Failed to retrieve or parse JSON doc.');
});
} else {
let json = null;
if (fragmentArgs.doc) {
json = JSON.parse(fragmentArgs.doc);
} else if (Cookie.get('record_template')) {
json = JSON.parse(Cookie.get('record_template'));
}
initializeForm(json);
}

We should add the ability to load a record from an arbitrary URL through a new url parameter. As the implementation will be very similar to the one for the slug parameter, we should reuse that code.


The idea behind this is that we wouldn't need to encode the whole record in the URL in our backend anymore for suggest PR "Edit" links. Instead, we could just reference the raw file on GitHub (like: https://raw.githubusercontent.com/datenanfragen-community-edits/data/suggest_haspa_1631904031723/companies/haspa.json) and load that.
The added bonus of that is that this would allow the "Edit" link to continue working even after changes have already been made to the PR.

Clean up `app.js` and convert it to modern TypeScript

The source code for this tool uses an awful mix of old and new JS and has gotten quite messy over time.

We should refactor and clean up the source code and convert it to TypeScript, making use of modern JS and TS features.

As the code for the tool is quite short and not complex, this issue is well suited for people new to our project. But you need to be familiar with modern JS and TS already.

automatic changes of values aren't considered in record generation

issue description

  • When using the slug helper to generate a slug based on the URL, the generated slug is added to the slug textbox. However, when the JSON record is generated, it doesn't contain a slug.
    A similar thing happens with the email helper.
  • When using the phone/fax number formatter to reformat the phone/fax number, the new formatted number appears correctly in the textbox. But when generating the JSON record, it still contains the old format of the number.

-> While the website changes the values, the changes aren't considered when generating the JSON record.

expected result

The generator uses the displayed, formatted text to generate the JSON record.

steps to reproduce

  1. Add https://example.com as the website
  2. Press enter and confirm the dialog to generate the slug
  3. check that the slug textbox now contains example-com
  4. press the "Generate" button
    -> The JSON record view doesn't contain the slug.

Alternatively:

  1. Add 004987654321 as the phone/fax number
  2. press enter, add the ISO 3166-1 alpha-2 country code de, and confirm the dialog
  3. check the phone/fax number textbox. it should have changed to +49 8765 4321
  4. press the "Generate" button
    -> The JSON record has 004987654321 instead of +49 8765 4321 as the phone/fax number.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.