Skip to content

Instantly share code, notes, and snippets.

View haslinger's full-sized avatar
🏠
Working from home

Stefan Haslinger haslinger

🏠
Working from home
View GitHub Profile

Hobo can even create an autocompletion for relations from the has_many side of a relation.

@haslinger
haslinger / 0004 Translation of Enum-Tags in Hobo.markdown
Last active December 31, 2015 00:39
EnumStings in Hobo can be translated easily.

EmumStrings are an awesome feature of Hobo for a set of constants for select-options, that should be localized (gender, titles, types,...).

I didn't understand how to translate Hobo EnumStrings (I believe I saw other things on Hobocentral).

My thanks go to Iox, who helped me figure it out.

The most tricky part for me is the key: contentelement/markups: in the .yml file

  • The Model class is named ContentElement (so neither ContentElement nor content_elements is right here)
@haslinger
haslinger / 0003 Migraton generator hack.markdown
Last active December 30, 2015 13:49
Tricking the migration generator when having two models with same table_namein Hobo

Two models / same table_name in Hobo

I had the following issue:

A hobo model like this:

class Category < ActiveRecord::Base
  hobo_model
  fields do
@haslinger
haslinger / 0002 Live CKEditor in Hobo.markdown
Last active September 22, 2016 17:48
Live CKEditor in Hobo

Live CKEditor in Hobo

This in a quite ugly hack ... but its working ...

It is actually quite easy to enable inline editing in Hobo using Clickeditor, which is awesome. It is also possible to use Ckeditor in Hobo, which is awesome as well.

There is even some integration between the two, so clicking on a cktext-attribute unhides the already embedded CkEditor. But unfortunately, you can't save, there isn't even a save button.

@haslinger
haslinger / 0001 Sortable tree structure for Hobo .markdown
Last active December 30, 2015 04:39
Sortable tree structure for Hobo

Sortable tree structure for Hobo

I like the ability to have draggable and sortable lists via acts-as-list in Hobo, but I needed more:

I had a hierarchical structure, like a category tree, that needed to be sortable. I wanted a drag and drop interface. Furthermore the updates should be immediate via Ajax. Because this can take a while for huge trees, the user should be informed clearly, but unobtrusively, when update started, when update suceeded and when it failed.

I found Hobo to be compatible with the Ancestry gem and it plays nicely with Nestable.js and Messenger.js and it doesn't break the Bootstrap look and feel too much.