Comments (38)
+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.
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.
@flack if you think gh-pages can't do the builder, we can host ourselves the builder.
from jsgrid.
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.
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.
@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.
Do you think the builder (for "official download") should propose "nightly builds" and/or official versions build ?
from jsgrid.
And also old releases ?
from jsgrid.
@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.
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.
@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.
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.
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.
http://openpsa.github.io/grid.js/download/index.html
from jsgrid.
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.
@smartcorestudio Sure. Good idea.
from jsgrid.
@smartcorestudio: Do you mean including locales directly into grid.min.js
or just into the zip in general?
from jsgrid.
@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.
@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.
See http://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/4900304#4900304
from jsgrid.
this only contains two-letter codes, so it wouldn't work for grid.locale-pt-BR.js
and the like
from jsgrid.
we could of course add those manually as needed, but it kind of defeats the purpose of automating it :-)
from jsgrid.
I've asked about the licence for that.
from jsgrid.
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.
Maybe this could work:
https://www.npmjs.com/package/country-language
from jsgrid.
@flack Another variant in JSON format: http://smartcore.ru/locales.json
from jsgrid.
@smartcorestudio Looks good!
from jsgrid.
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.
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.
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.
Sometimes I get this error after clicking "Download" button. Firefox 34, Opera.
from jsgrid.
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.
I think the base should be a requirement.
from jsgrid.
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.
- Yes, "dk" is duplicate of Danish. Maybe we should just delete this file in favor of "da"
- Cat is Catalanian, it's correct 2-letter code is "ca". File should be renamed
- 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.
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.
@flack Yes. Of course CSS file is rather small compared to JS, but this can be another small "+1" for using less.
from jsgrid.
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)
- multiselect checkboxes not working properly HOT 1
- clicking form edit submit button does nothing when editurl and url are the same value
- form width in pager edit option not working HOT 14
- Edit option closeAfterEdit not functioning HOT 22
- Builder logs HOT 5
- grid not updating when editing HOT 39
- downloaded files naming in builder HOT 1
- Base in builder HOT 6
- use of grouping and loadonce:true causes subGrids to not work HOT 3
- New less organization HOT 29
- minifying css after (instead of) less HOT 2
- use JSDoc 3 for API documentation? HOT 1
- column alignment off when using group headers HOT 10
- Form Edit repopulate the entire table HOT 2
- What Is The Difference To free-jqgrid HOT 3
- one more jsgrid exist on GitHub HOT 2
- How to submit new row as JSON? HOT 3
- user definable footer summaries via drop down HOT 1
- setting the height property causes the horizontal scroll to unnecessarily appear HOT 3
- Clicking inline editing buttons should not remove selection HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsgrid.