Create table/list and store it - what are my options? - listbox

I need something like this: http://listjs.com/examples/add-edit-remove
That means: a single page with a table and some fixed columns and users can add rows.
Since list.js is Javascript, it is not persistent across machines. But I am not very experienced in web technologies so I wonder what are my options here to store the informations?
Is a database needed? Seems like a bit overkill to me, I only need a table where some users can add a row in a dead simple way (like the example above).
Can I store the table into a file and render a HTML table from it?
Are there any prepackaged solutions which I can extend to my needs? PHP, Python, Ruby, Frameworks?
I was searching around for grocery-lists, to-do-lists and the like, I also considered installing a wiki but that is overkill to. This list should get deleted every day and would be used by maybe 5-6 people.

Seems like http://handsontable.com/ is exactly what I am looking for. There is a "load and save" example on their Github page which uses SQLite.

Related

How to pull all Wikipedia article titles as autocomplete tags for my site?

I think it would be good to incorporate tags/tokens with an autocomplete feature. I will use Wikipedia article titles to dynamically build the list of possible tokens (thus enabling autocomplete.) I am using Rails 4 and Ruby but any pointers would be great, I don't quite know where to begin with this.
The purpose is so that users do not just make up anything as tag (tagging themselves as expletives+nouns, for example.) And if it became possible to keep this master list updated (which is what I meant as "dynamically", it would be great. But even manually updated is ok.
I so far assume that part of it would include a web crawler that only searches :title fields on wikipedia. I am using Postgres as my DB.
Once I have a list, I can use something like the jquery token fields gem or chosen gem, as I learned from Railscasts. In those two examples, there was a list that enabled the autocomplete for tokens. I want that exact thing, but to get them from Wikipedia titles.
http://railscasts.com/episodes/258-token-fields-revised
This will be done in Rails 4 and I am using Postgres. I will probably be on Heroku as well.
You could use the API to fetch titles beginning with whatever the user typed so far like this: api.php?action=query&list=allpages&apfrom=Bav&aplimit=5 (assuming english Wikipedia here). Add &format=json or &format=xml.
Many of the suggestions, however, would be quite meaningless in other contexts than Wikipedia, e.g. titles with disambiguation suffixes: Bac. And most of the expletives and nouns you can think of will be there, so it won't do a good job at sorting them out, either.
If you plan to use the function on a heavily visited site, you should probably download and host the list of titles yourself, not to put extra load on the Wikimedia servers.

Web-based database/forms RAD tool

I'm searching for something of which I don't really know the name of.
From time to time, I have to develop a small tool for a small group of users which is basically a web frontend to one or two database tables. It's very basic and something which one could do in a spreadsheet (without the problem that only one user can have the file open at a time and something like Sharepoint is not available) or for what one would have chosen MS Access in the 90s. Google Docs would also be possible, but we'd like to keep our data in-house. (I for myself just use phpMyAdmin for that, but it's not suitable for not tech-savvy end-users.)
So I'm looking for a tool which generates/provides a forms-based Web interface for simple models or database schemes that I create. First, is there a common name for such a thing? And second, does anyone have recommendations (preferably open source and/or free)? The closest thing I've come to is the scaffold generator in Ruby on Rails, but it's very basic and not optimal since it's only designed for generating prototype could which one should edit later, and last time I have looked at it, it was not possible to differently updating your model, i. e. regenerate code for model changes but preserving the manual changes of your code.
Thank you.
You're looking for Web UI Framework. Look into http://agiletoolkit.org/

Web-based form-builder for users in Ruby/Rails

First time posting in Stack Overflow, hope I'm doing this right.
I'm writing an app with Ruby on Rails right now. Without disclosing too much, the premise is that we have organizations and normal users. Organizations have events, which require users to answer a questionnaire before participating.
I'm pretty sure about these models / relationships that I will be using (this isn't really that important/pertinent to my question i think, but just wanted to give background):
organization (one to many) events
event (one to one) quesitonnaire)
questionnaire (one to many) users
(specific) response (one to one) user
The part I have a question about is how to implement the questionnaire. I want to give the ability to Organizations to essentially write / build their own forms. I'd like to stay away from them using code if that's possible (ie any DSL and whatnot).
I suppose the easiest way to do this is to give them a set number of text-area responses, so that I can consistently store the data and don't have to hassle around with how to configure storing this data (for example, maybe each event can only have exactly 5 responses to be filled in by textfield response by the user).
My ideal would be for the organization to be able to dynamically generate the forms on their own - maybe one questionnaire will have 1 text input, followed by 3 multiple choices, and maybe 2 short answers at the end; another one may have 5 multiple choices, and 1 short answer; yet another questionnaire might only have 1 text input...you get the idea.
So I see two parts of this problem - the first is the user interface for the organization to create the questionnaire. i'm imagining this wouldn't be terribly hard - ask them how many of each response type (MC, short answer) they would like to put into the form, give them the ability to rearrange them, etc.
The second part of the problem (what I'm more concenred about) is how to store/access this data. I'm guessing there's no dynamic-attribute sort of deal in ruby - storing some field with an unspecified number of parts and whatnot. i suppose i could make them all individual models (ie a question_response model, with :question, :response_type, :response, etc), but I'm fairly certain that's probably inefficient.
My initial guess is probably to serialize the data / use json; I worked briefly with Drupal 6 and this seems to be the way they did it. I was wondering if anyone else had any experience / suggestions though? I'm pretty new to Ruby so I was wondering if there's a gem out there or something that would help with what I'm trying to do.
Thanks!
You might want to look at the Surveyor gem
http://vimeo.com/7051279
*slightly old how-to video
https://github.com/breakpointer/surveyor
Surveyor does come with it's own DSL which is relatively easy to use (although can be abit restrictive at times). The data is saved as a set of question - answer values, so there is no actual specific model (beyond Surveys -> Questions (question_groups) -> Answers).
Originally I did look at having people submit their own Surveyor DSL specs - which would then be used to generate the actual survey via a Rake command.
I think if you need to build a dynamic model (and save the data) it is possible, although I am not not sure if you'll be able to get the Rake tasks to run to build the actual tables in a dynamic way due to permission restrictions.
Have a look at http://ruby-metaprogramming.rubylearning.com/ and Metaprogramming Ruby: Program Like the Ruby Pros by Paolo Perrotta, for some starters.

How do you do sortable tables plugin for rails?

This seems like a classic rails situation: I want to have a my index action display a sortable table of the items. I've looked at (and hacked at) some plugins, notably thoughbot's sortable_table and Michael Kovacs's sortable (the latter I have forked and improved). However, now I'm finding that sortable is somewhat incompatible with inherited_resources and I'm getting frustrated with fixing code that's not really being maintained.
And yet ... everyone must hit this need in their app, right?
So, what's the best solution? Does everyone roll their own? Is there a plugin I haven't heard of yet? Do people not bother with sortable tables? Is there some javascript/ajaxy thing I should be using instead? I'd love to find a better solution.
Update: should note that my database table is too big to load all of the rows, that would absolutely kill performance.
I've been using the jQuery DataTables plugin recently and have really been loving it. Small downside is that it requires you to load all of your row at once since it relies on Javascript, but it can then do some pretty fast and fancy pagination, filtering, and lots of other cool things.
I always hated sorting tables in Rails, this made it a lot easier.
Edit: As stated in my comments below, check out http://datatables.net/examples/data_sources/server_side.html if you want to do server side pagination/sorting. Fairly easy and this works great with a PHP project I'm currently working on as well :-)
I use wice-grid, which is not only sortable, but can also be filtered, paginated, customised. I really like it ;)
I like the YUI Data table. Articles and Support community
It can do client-side or server-side sorting, depending on your preference and data set size.
Can also be used for editing the data.
There are rails plugins for use with YUI Data table -- Google for "yui datatable rails" -- but I haven't tried any of them yet.
it is not forcely needed to use a plugin
see http://railscasts.com/episodes/228-sortable-table-columns

Searching sub-models with Ferret

I have a rails app in which I am trying to do some full text searching on. Ferret seems to be the most popular choice. However, I have an issue.
I have a 'thing' which contains an id which determines if a user can see it (and therefore search it), but I want to search sub-models of this 'thing' which are related to my 'thing' but don't directly contain any references back to the user.
Therefore, how do I implement it? Is there a clever way of implementing this, or do I need to dirty my models with a link to the domain identifier?
I think it would be very wrong to assume that Ferret is the most popular choice for this. Most people I know have ditched Ferret and replaced it with Sphinx. And the people who can't use Sphinx for some reason have opted for Xapian.
That said, the answer to your question is likely to be largely the same regardless of the indexing system you choose:
When you're dealing with permissions and indexing, you can't effectively index anything related to the permissions system because it's going to be user-specific. All your permissions stuff needs to live in your models/controllers somewhere. I'm fond of putting all my permissions stuff in a module and then including it in my model, so that I can easily share it between models.
Pagination can be a real pain for this kind of thing because you request 10 items from your search engine, and then your permissions code rejects 5 of those items, which means you have to keep running searches until you have your first ten items to display. And now when you want page two, well, things turn into a real mess then. Heaven forbid they decide to skip straight to page ten, because now you can't do tricks like giving a start ID instead of a page number. Really, it's not something you want to do at all if you can help it.
There really are no "clever" ways of getting around the mismatch between permissions and full-text indexing. At least, none that I know of. It's just a pain.
I suggested to my boss when we first started out that the only sane solution was an egalitarian permissions system: If we gave you a username and password, then you have access. He wasn't a fan.

Resources