Cocoon Gem Add Item Programmatically - cocoon-gem

I'm trying to add an item with the Cocoon gem programmatically.
I used this:
$("a.add_fields").click();
And it does work. I'm wondering if there is a more elegant solution. This seems a bit like a hack.

No. At the moment that is the only way. The code would have to be refactored for this to work, and all configuration is in the link anyway (which association, which partial, how to build, ...), so I think it is not too bad at the moment.

Related

How to dynamically load models inside an installable hook in Sails.js

We are thinking of making one of our applications very modular, creating hooks for the different sections.
What would be needed to do for "injecting" a hook/models folder with its own models into the sails instance?
I tried to find if there is a sails-hook-utils or something like that that allows for late model/controller/service injection, on hooks, but found none. I'm about to create a module for it, https://github.com/luislobo/sails-hook-utils, but it would be great if anyone has some head starts on how to do it?
Well, right after digging more, I just found a module that does exactly what I need. I didn't test it yet, but will do it now.
https://github.com/leeroybrun/sails-util-mvcsloader

Handling multiple template files with playframework in complex application?

I recently found out that Scala is an absolutely interesting programming language.
Since I'm not a real desktop application developer but more a webdeveloper I wanted to try out the play framework and if it works well for my purposes.
So far, I really like it, it seems to be easy to use and the developers really think it through.
BUT
I wanted to create an application with different templates, like an "internal", "external" and "admin" area. I already figured out to try out the "modular application" thing which seems to work good but I can't see any possibility to create something like multiple "template" files..
After a few hours of googling, I thought I should just ask..
Has anybody of you done it yet? Any tips how to organise it the best way?
Thanks a lot!
You can have as many views as required and you can also organize them in packages (under the app.views package) in many levels. All you need is just to learn how to reference required view from the controller.
Take a look to this sample schema.
In other words the most importantis clear and comfortable for you order, which you will be able to work with after 3 years without additional notes.

any way to synchonise between Redmine(or other issue trackers) and a plain text todo list?

I would like to access a Redmine taskbase via a simple text based interface - wondering what the shortest path would be (minimum investment/development).
Right now, this boils down to 2 use cases/phases:
Import a batch of tasks into Redmine from simple, wiki-based, bulletted TODO list, ie. plain text content. This is more of a one-off task, so a quick and dirty solution would be fine.
Later, some smooth two-way synchrosation would be great.. E.g. edit loads of tasks via some friendly plain text (or XML) in an editor, or scripting where I could manipulate all of them with simple text processing; then synchronise with Redmine and commit them back.
Any ideas on the easiest way to achieve these?
I'd prefer an external solution (i.e not touching the server), especially for the one-off import case; something like a neat IDE/editor/client, or a standalone Ruby script (e.g using the RM API).
If an appropriate RM plugin would be available, I would not resist giving it a try (can get root access from our lovely IT support:)..
Current ideas:
Emacs/Org-mode, looks like a great combination of a cool task manager UI and full plain text power. It seems rich enough to capture tags, states as well. This artice looks promising Orgmode and Roundup: Bridging public bugtrackers and local tasklists, although not exactly a perfect match.
org-mode parser in Ruby, could be used in an script with redmine-api access, or - worst case(for me, right now)- in newly developed RM plugin.. This looks like a good start: org-ruby
export RM->XML, process file, import XML->RM... not sure if this is supported?
I guess it's always possible to talk to the DB directly, but I'd prefer to avoid that.
Actually, I'm also interested a similar solution for Bugzilla.
At the simplest level, you could write a RM/Rails plugin that parses an Org-Mode task list, updating corresponding issues in the RM Model.
Equally, you can build a view for Redmine (again as a Rails plugin) to generate an org list of the current (or subset of) issues.
For Bugzilla I think you would be best off using the XML-RPC interface to do your issue comparison/update sync, so you'd have to take a very different approach from Redmine.
If you have any specific questions, please update your question, it's quite broad at the moment.
Update
At the moment, there are a few plugins which will probably help you figure out your solution, for example Nick Boltons xml import and Martin Liu's Redmine CSV Import Plugin but neither of these are going to completely solve the problem for you, just give you some useful starting point.
On the other hand, If you write a script that interacts with Redmine's REST api, you don't need it to be in any specific lanugage, in fact you could do it in Emacs-lisp, if the target users of the script are all Emacs aware, then this might well be the best way to do the job. (it would certainly be the most appealing option to me.)
Maybe this can be useful: https://github.com/fukamachi/redmine-el

Versioned cloud-based social code snippet management

It seems a lot to ask, but I'm looking for a cloud-based solution to managing code snippets. I am looking for:
Tags
User accounts (I want to be able to see all of my snippets on a single page)
syntax highlighting
versioning - myself or others should be able to edit my snippets to improve them and have revisions save so that I can go back and use an older version if I prefer.
straightforward UI with minimal advertising if any
Does anyone know of a solution which meets these requirements? If not, would anyone be interested in something like this? As a software engineer, after step zero (does it already exist), I'm perfectly willing to go onto step 1 (would other people use it? If so, make it).
www.codebarrel.com
it has everything you asked for
Sounds like Gist.
http://gist.github.com/
Except for the tags part. But it might be workable anyway.
I'm working on a site for this. The very rough (as in: barely works, but not even functional yet) initial version is here: https://github.com/jasongrout/snippets

Want to share a MGTwitterEngine iPhone Xcode skeleton project?

Anyone want to share an Xcode project that has MGTwitterEngine in it? Mine won't compile. Are there certain project settings to set? I just made a stock tab bar app for iPhone and added the MGTwitterEngine files. Tons of compiler errors. What am I missing?
I had same problem. To get it to compile I added "$SDKROOT/usr/include/libxml2" to the Header Search Paths list. I also checked Recursive checkbox.
Make sure that you're adding "$SDKROOT/usr/include/libxml2" to header search paths in your Target settings and not just the Project.
I managed to get the library path right eventually. However, in the end, I got rid of the whole MGTwitterEngine thing and went with the TwitterHelper stuff that I noticed the folks from the Stanford iPhone class using. It uses the synchronous calls and it's not as full-featured. But it's lighter and I understand it better. I just use threading to counter the synchronicity. (Hey, wasn't that a song?!) Anyway, a little JSON code and it's all under control. Most of you are probably going to think I'm a noob but it just feels cleaner and easier to handle. I know there are plenty of good reasons to use MGTwitterEngine.
Bottom line is, even though I got it to work by getting the library path right, I don't even need to worry about any paths by adding the very small TwitterHelper stuff to my project. Seems more Mac-like than to have to go into too much tinkering (I can already hear the experts saying that setting paths is not too much but I absolutely detest the Project Settings dialog.)
You also need to add
libxml to Header Search Path ( should be something like /usr/library/libxml2 )
I just wanted to add something that tripped me up. You have to make sure the Target header search path is also set because it may override the default project search path headers. If you are unable to find some header files that the path is definitely pointing to correctly in your project search path headers, then this is probably the reason.
You're probably missing the libxml library. You need to add that to your linked frameworks. Here's a question that has a little more information, but that's the gist of it.
Best approach for XML parsing on the iPhone