GithubHelp home page GithubHelp logo

jgrid builder about jsgrid HOT 38 CLOSED

openpsa avatar openpsa commented on August 23, 2024
jgrid builder

from jsgrid.

Comments (38)

smartcorestudio avatar smartcorestudio commented on August 23, 2024

+1
Ideally, it would be very nice if we'll have something like we had in old jgGrid: http://www.trirand.com/blog/?page_id=6, or something like Bootstrap Customizer (without LESS vars of course) http://getbootstrap.com/customize/
But maybe it will be too difficult to implement and maintain

from jsgrid.

flack avatar flack commented on August 23, 2024

Yes, that is something I would like to have as well. The thing is, if we use gh-pages for hosting, we're pretty much limited to javascript for implementing a download builder. I've researched a bit, and it is possible (at least with modern browsers). When I have a little time, I'll try to build a prototype

from jsgrid.

bouks avatar bouks commented on August 23, 2024

@flack if you think gh-pages can't do the builder, we can host ourselves the builder.

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

I don't know exactly, but I think that Bootstrap Customizer is integrated into GitHub. It has an interesting feature of saving current download settings on GitHub after clicking "Compile and Download" button on this page http://getbootstrap.com/customize/ you'll get a link on GitHub

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

Here is example of the message: "Success! Your configuration has been saved to https://gist.github.com/6cc533221cfee66e7587 and can be revisited here at http://getbootstrap.com/customize/?id=6cc533221cfee66e7587 for further customization."

from jsgrid.

flack avatar flack commented on August 23, 2024

@bouks Sure, we could do that. But if possible, I would like to keep everything in the same system for better maintainability, so I'll give the gh-pages idea a try first. If it doesn't work out, we can whip up a PHP script pretty quickly and host it somewhere

from jsgrid.

bouks avatar bouks commented on August 23, 2024

Do you think the builder (for "official download") should propose "nightly builds" and/or official versions build ?

from jsgrid.

bouks avatar bouks commented on August 23, 2024

And also old releases ?

from jsgrid.

flack avatar flack commented on August 23, 2024

@bouks: For a start, I would make it pull the source files from HEAD, and then later on from the newest tag (i.e. latest release). We can decide about older versions when have them and see if there is demand for it

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

As for me, I think that the latest official version will be the best option. So, maybe it's better to start with it (if it's possible). Other options are also useful, but I think they can be added later

from jsgrid.

flack avatar flack commented on August 23, 2024

@smartcorestudio The gist part of the download builder is only there for convenience, i.e. for editing the same config later on. It is not directly part of the download builder. We could write something like that, too, but we would need to register for the Github developer program to gain API access.

Meanwhile, the main download builder is written is Javascript, the same way I was planning to do it. I didn't find the uncompressed sources, but the centerpiece is http://stuk.github.io/jszip/. We could easily write a frontend with checkboxes, then load all the checked files as strings, concatenate them in memory, and then compress them with JSZip for download.

from jsgrid.

flack avatar flack commented on August 23, 2024

to borrow from the JSZip example:

var zip = new JSZip();
zip.file("grid.min.js", load_and_concatenate_all_selected_js_files());
var i18n = zip.folder("i18n");
add_all_locale_files_files(i18n);
var content = zip.generate({type:"blob"});
// see FileSaver.js
saveAs(content, "grid.js-custom.zip");

from jsgrid.

flack avatar flack commented on August 23, 2024

I've added and deployed a small proof of concept implementation now. It is still incomplete (it doesn't create a zip yet with all the locale files & js), but it builds a minified js file based on the user's selection.

There is still a lot to do, but I don't have the time right now. I'll try to continue later this week, but I'll gladly accept patches in the meantime :-)

from jsgrid.

flack avatar flack commented on August 23, 2024

http://openpsa.github.io/grid.js/download/index.html

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

Thank you for your work! How do you think is it a good idea or not: to include choosing of locales into future versions of Download Builder?

from jsgrid.

bouks avatar bouks commented on August 23, 2024

@smartcorestudio Sure. Good idea.

from jsgrid.

flack avatar flack commented on August 23, 2024

@smartcorestudio: Do you mean including locales directly into grid.min.js or just into the zip in general?

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

@flack I think both variants are acceptable. AFAIK in the original jqGrid we include locales as a separate files. But if we'll have an ability to combine everything we need in one minified file via Download builder - why not...? The question is: if someone will create a new language file, you'll have to add it manually to the options of Download builder?

from jsgrid.

flack avatar flack commented on August 23, 2024

@smartcorestudio: Yes, currently, each file will have to be added manually. We could automate this partially (e.g. by writing the filenames of all locale files into some JSON file with grunt), but I think manual is actually the better solution here, because then we can control the sort order, and we can give each file a human-readable label, e.g.

<div class="checkbox">
<label>
<input type="checkbox" value="i18n/grid.locale-pt-BR.js">
Brazilian Portuguese
</label>
</div>

I guess language name resolution from ISO code could also be automated, if one finds a javascript lib that contains all the language names, but for a first version, I think the manual approach should be sufficient

from jsgrid.

meh-uk avatar meh-uk commented on August 23, 2024

See http://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/4900304#4900304

from jsgrid.

flack avatar flack commented on August 23, 2024

this only contains two-letter codes, so it wouldn't work for grid.locale-pt-BR.js and the like

from jsgrid.

flack avatar flack commented on August 23, 2024

we could of course add those manually as needed, but it kind of defeats the purpose of automating it :-)

from jsgrid.

meh-uk avatar meh-uk commented on August 23, 2024

I've asked about the licence for that.

from jsgrid.

flack avatar flack commented on August 23, 2024

Hm, maybe I'm missing something, but this only contains country names, doesn't it?

{"AF":{"languages":["ps","uz","tk"],"name":"Afghanistan"}}

What we would need would be something like

{"AF":{"languages":{"ps": "Pashtu","uz": "Uzbekian","tk": "Turkemian"},"name":"Afghanistan"}}

from jsgrid.

flack avatar flack commented on August 23, 2024

Maybe this could work:

https://www.npmjs.com/package/country-language

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

@flack Another variant in JSON format: http://smartcore.ru/locales.json

from jsgrid.

flack avatar flack commented on August 23, 2024

@smartcorestudio Looks good!

from jsgrid.

flack avatar flack commented on August 23, 2024

I think the encoding is slightly broken (for example if you look at the Cyrillic strings), but we would only need code and fullname for now, so this shouldn't be a problem

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

Hmm... It don't see problems with Cyrillic in this file. For example I see:

  {
    "code":"ru",
    "fullname":"Russian",
    "shortname":"Russian",
    "nativename":"русский"
  },
  {
    "code":"ru-RU",
    "fullname":"Russian (Russia)",
    "shortname":"Russian",
    "nativename":"русский (Россия)"
  },

Which is correct. But I opened it in text editor, not in browser

from jsgrid.

flack avatar flack commented on August 23, 2024

ok, then it must be the charset of the web server or that of my browser. I'll try downloading with wget and see if it is displayed correctly in the editor afterwards

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

Sometimes I get this error after clicking "Download" button. Firefox 34, Opera.
2015-01-17 16_19_05-grid js - download

from jsgrid.

flack avatar flack commented on August 23, 2024

Should be fixed now. It only happened when one deselected grid.base.js. The question is: Is that a valid configuration? I was thinking about removing the checkbox for grid.base.js (or making it read-only) for simplicity, because I can't think of a use case for only downloading some addon modules without the base lib

from jsgrid.

meh-uk avatar meh-uk commented on August 23, 2024

I think the base should be a requirement.

from jsgrid.

flack avatar flack commented on August 23, 2024

just a small update: locales are now auto-added to the download page, with human-readable names provided by @smartcorestudio's JSON file (thanks for that, BTW).

As you can see on http://openpsa.github.io/grid.js/download/index.html, we still have three filenames with incorrect language codes. The dk one is probably a duplicate of the Danish translation and could be removed. The other two will have to be renamed I guess

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

@flack:

  1. Yes, "dk" is duplicate of Danish. Maybe we should just delete this file in favor of "da"
  2. Cat is Catalanian, it's correct 2-letter code is "ca". File should be renamed
  3. Mne is Montenegrin. I can't find ISO language code for this language. http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes and http://en.wikipedia.org/wiki/Montenegrin_language

from jsgrid.

flack avatar flack commented on August 23, 2024

Just a small note to self: Currently, we bundle the minified CSS file from the dist folder. Instead, we should generate the CSS on the fly, taking into account only the relevant less files (i.e. if someone doesn't select the subgrid module, subgrid.less should be skipped as well)

from jsgrid.

smartcorestudio avatar smartcorestudio commented on August 23, 2024

@flack Yes. Of course CSS file is rather small compared to JS, but this can be another small "+1" for using less.

from jsgrid.

flack avatar flack commented on August 23, 2024

Yeah, you probably won't really notice the difference in size. But when we have on the fly compilation in place, we can later make the stylesheet configurable (like in the bootstrap customize page)

from jsgrid.

Related Issues (20)

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.