== Hobo 0.7.4 ===
Switching to a new style for the changelog. Now that we're using git
the commit logs are a lot better, so this file is just going to
contain edited highlights of the commit log.
Rapid: making <view> make more use of the to_html API from
HoboFields
Reworked REXML extensions. Now compatible with REXML 3.7.1.1
through 3.7.1.3
ModelController -- fix to chosing whether or not to paginate
Various IE Javascript fixes
Rapid, <select-many>: Additional params, and IE fix
Moving the part-contexts javascripts from the very end of the
output, to the end of <body>
The script tag must now be output by the <page>, instead of
being appended automatically by DRYML. This is done in
<simple-layout/>
Rapid -- removing <view for='percentage'>
DRYML -- improved error reporting
Hobo::Model: fix -- we were breaking inheritence of validations
Model generators -- adding some helpful comments
Rapid: Fix to permission check for adding to primary collection on
<show-page>
Rapid: removing empty message from <index-page>
Rapid: Fix to enum-string editor
Rapid: Fix to auto-label in <count>
User model generator -- change create permission to allow admin to
create another admin
New lowpro version
New automatic css class 'with-owner' on default <card/>
Hobo::ModelController -- fix to automatic inclusion of reorder
action for models that act as list
Improvements to default <card>
Rapid javascript: try to automatically bring back the
empty-message on removing the last item from a collection
Scopes: fix to apply_scopes
Fix to <name-for-collection>
Rapid tags: Support for the empty-message on a collection
re-appearing automatically if all the items are removed by the
user
DRYML: scoped variables -- assigning to a variable now modifies
it's value in a parent scope if it's present in one
<delete-button> fix -- was incorrectly guessing 'in-place' during
ajax update
New tag <name-for-collection>
Fix to <view for='text'/>
Improvements to <table-plus>
Ability to sort by name of 'this' when 'this' is one of the
fields
Keep table headings in when the table is empty
Don't include page nav if the collection doesn't support it
Improvements to rapid pages
Allowing has_many associations in forms
Allowing the primary collection on a show page to be provided by
an instance variable (so that filtering/searching/pagination are
supported)
Tidy of <show-page>
<index-page> -- improved wording
Fixes to <index-page>
<account-nav> make 'logged in as bob' a link to current_user
Factored out default <collection> into <base-collection>, and
fixes to <collection-preview>
<base-card> -- add 'edit' link
<base-card> change 'title' param to 'heading' and make it easier
to provide your own
<creation-details> use a div rather than a span
Fix to <select-many>
Fix to <select-menu>
Fix to <input for='datetime'>
Rapid forms: switching to <select-one> and <select-many> naming
<form> -- don't include auth token on GET forms
Rapid: <belongs-to-menu-editor> -- don't show 'View' link if the
thing is not linkable
Rapid: adding sort attribute to <belongs-to-menu-editor>
Rapid: default 'no-filter' option for filter-menu
Rapid: Fix to extraneous whitespace in <you>
Rapid: better guess of label on <count>
Rapid: Use association name rather than class name in css classes
on <a> tags (when available)
Rapid: Fix to use of <else> with <a>
Removed 'all' method from ScopedProxy - delegates to the model
class instead
Fix to origin_attribute on scoped associations
Fix to with_abc automatic scopes
New automatic scopes 'include' and 'search', and improvements to
order_by scope
Scopes: fix to parameterised scopes on associations
Scopes: new apply_scopes method for models and has_many
associations
Pass a hash of scope-name => scope-arguments (single valur or
array), the result will be scoped accordingly, but only if the
first argument to the scope is not blank. It's designed to be
used from controllers: if a param (e.g. a search or filter) is
not included in the request, the scope is not applied
Hobo::ModelController -- fix to permission denied response for
ajax actions
Hobo::ModelController -- Fix to flash message after update
Hobo::ModelController -- fix to redirection after submitting a
form
Hobo::ModelController -- cleaning up sorting and filtering
Hobo::ModelController -- make reorder one of the automatic
:write_only actions if the model has the position_column method
<with-fields> better error reporting
Hobo::ModelController -- adding automatic reorder action
Works with acts_as_list and scriptaculous drag and drop
re-ordering
Hobo::Model adding :managed => true option to has_many
Only valid with the :through option. Records of the joining
model will be created and destroyed as required when this record
is saved, in order to honour the contents of the association at
save time.
Hobo::Model -- adding .user_update
Hobo::Model -- fix to user_find
Hobo::HoboHelper -- #map_this (used by repeat) will set this_key
when iterating over a hash
DRYML: made this_field_reflection do a better job of figuring out
the current reflection
DRYML: adding this_key -- gives you the current key when
<repeat>ing on a hash
DRYML: Error message for invalid attributes on parameter tags,
e.g. <foo: if-'...'>
Hobo module - fix to permission checks on unexpected objects
Hobo module -- always return false for can_create? on has_many
associations that are not 'simple'
(i.e. they have conditions)
DRYML: Fix for replacing an overridden tag parameter
Rapid pages: new submit label on show page (add to collection)
Rapid pages: Add param to <show-page>
Rapid pages: by default, append app-name to every title, override
with full-title attribute (<base-page>)
Rapid pages: <show-page> -- update primary collection count when
an item is deleted
Rapid pages: fix on <show-page>
Rapid pages: make edit link on show-page check if the edit action
is linkable
Rapid forms: adding inputs (just textareas) for textile and
markdown
front_controller generator -- use <collection-preview> in
index.dryml
Rapid generics: adding support for <collection with='&MyModel'/>
Rapid tags: switching to <main-nav> tag, called from simple-layout
hobo_model_resource generator -- removing creating of (rails
style) resource route
Improvements to rapid pages
Allowing has_many associations in forms
Allowing the primary collection on a show page to be provided by
an instance variable (so that filtering/searching/pagination are
supported)
Rapid: Fix to use of <else> with <a>
Removed 'all' method from ScopedProxy - delegates to the model
class instead
Fix to origin_attribute on scoped associations
Rapid tags: disabled <belongs-to-view>, new <view
for='ActiveRecord::Base'> is used now
Hobo::Model -- fix to reverse_refelction
Rapid tags: Adding <head:> and <foot:> params to <ul>
Rapid tags: Adding params to <select-many>
Rapid tags: adding support for <ul empty> (force the <ul> to
appear even if empty)
Fix: automatic scopes not_ and "association name" were not being
created
Rapid forms: Renaming <name-array-input> to <select-many> (and
improvements)
Hobo::Model -- adding assigment by arrays of names to has_many
associations
Hobo::Model -- adding Model.manage_join_records
Routing: fix -- don't try to load assemble.rb if
ApplicationController not defined
Rapid pages: Fix to body class on <new-page>
Rapid pages: fix to show page
Rapid pages -- fixing pluralisation of <index-page> title
Adding support for 'this' psuedo-field to <with-fields> and
<with-fields-names>
In particular, this makes it possible to include the object
itself in a table plus column
Adding a general <view> for ActiveRecord objects (just <a/>)
Allowing lookup of polymorphic tags to include ActiveRecord::Base
or Object as a catch-all
Rapid generics: make collection preview hide the show-all link if
there are none
<page-nav> now uses will_paginate's helper to provide much better
page navigation than before.
=== Release 0.7.3 ===
hobo command -- options are now:
--user-model <model-name-or-false>
--svn # Use 'svn co' to checkout Hobo
--create-dbs # Run rake db:create:all
--hobo-src <path to hobo src>
-d | --database <database> # e.g. mysql, sqlite
Core extentions
Extracted from Hobo into new project: HoboSupport
Some notable changes:
#every has gone: users.every(:name) is now users.*.name
hobo generator
application.dryml now has a generated <app-name> tag
hobo_front_controller generator
Generated "search" route is now called "site_search"
Removed unused --no-user option
hobo_migration_generator
Removed from Hobo - now part of the HoboFields spinn-off project
New generator hobo_model_resource creates a model + controller pair
Rapid Javascripts
Default ajax message changed to "Saving..."
Hobo.ajaxRequest now takes the message as an option (was the second argument)
Fix to showing the ajax spinner in the right place in IE
Hobo.addUrlParams now has an option to remove specified parameters
Fixes to HasManyThroughInput behaviour
New behaviour supporting filtering (e.g. on index pages) using <select> tags
Rich data types
These are all part of the HoboFields project now
Booleans are now represented by the type Hobo::Boolean which is still part of Hobo
Active record extensions
Monkey-patch to make AR complain less about missing classes for
polymorphic associations
The block-based "composable query mechanism" is gone. Named scopes are much better.
Hobo's original implementation of what later became "Sexy Migrations" is gone.
Hobo module utility methods
Hobo.field_types and Hobo.symbolic_type_name are gone - now part of
HoboFields
Fixes to can_edit?
Site-search:
Now automatically skips searching of non-linkable models.
Can now be passed an array of models (including scoped finders) to search
Now renders <search-card> instead of <card>
New feature: Hobo::DevController
A controller that adds developer support features (not in production
mode). For now it just adds a method that can be used to change the current_user:
/dev/set_current_user?name=Fred+Bloggs
Very useful
Hobo Routing
Hobo::ModelRouter.linkable? can now be used with all the routes
created by Hobo.
Hobo helpers
object_url now always returns nil if the URL requested is not a
route known to Hobo routing
object_url never includes _method= in the query string
dom_id is now moved to DRYML's TemplateEnvironment
can_view? now utilises some simple cacheing
signup_url now defaults to the
linkable? no longer accepts an array as parameter
Rapid helpers
ajax_updater(url_or_form, message, update, options) is now
ajax_updater(url_or_form, update, options) (message has become an
option)
DRYML
DRYML integration changes -- this is a start to the work of
extracting DRYML from Hobo.
The fallback from a template file to a tag, e.g. from index.dryml
to <index-page/> is now handled by DRYML, not by Hobo's model
controller. You can customise the chosed tag by calling
dryml_fallback_tag("my-tag") from your controller action
The default DRYML context is now the value returned by
#dryml_context (was previously the value of @this). #dryml_context
returns @this by default but can be overridden.
<include src="mytags" bundle="foo">
includes a taglib from the plugin that the 'foo' bundle came from,
and puts into effect any class renames from that bundle (for
polymorphic tags).
Fix - tags with capitalised names now work
<my-param:></my-param:> can now be used to clear the contents of a
parameter. It's not the same as <my-param:/> (which does nothing)
New psuedo parameters for insterting content in and around
parameters. e.g. for a param 'title':
<before-title:> and <after-title:> for insterting content
immediately before and after the parameter.
<append-content:> and <prepend-content:> for inserting content at
the begining and end of the default content.
Note these are all just syntactic sugar for things you can do
already with <param-content/> and <title: replace> /
<title: restore/>
When changing the context with the ':' shorthand, now use dashes,
not underscores (the idea being that underscores are soley for use
in Ruby code
e.g. <with:my-field>
Control attributes <my-tag if> is equivalent to <my-tag if="&this"/>
(remember these test for blank? / not blank?, not Ruby trueness)
this_type now never returns AssociationReflections,
this_field_reflection does
this_type now returns Hobo::Boolean for boolean types.
this_field_dom_id is now just dom_id -- pass an object and an
attriubte, or nothing to default to this and this_field
Can now do merge-params="param1, param2" to merge just the named
params
Fix: <foo:foo> (i.e. field name same as tag name)
Fix: using alias-of with a reserved word was broken
Hobo models
New method Model.named to find things by name,
e.g. Category.named("Cars"), also aliased as Category["Cars"]
Various new methods to support permission. This moves much of the
logic into the model (from Hobo::ModelController). These methods are
all passed, as the first argument, the user performing the action. A
Hobo::Model::PermissionDeniedError is raised if the permission check
fails.
Class methods:
user_find -- find with view-permission check
user_new -- new with create-permission check
user_create -- create with create-permission check
user_can_create? -- test to see if a user is allowed to create the model.
Instace methods:
user_can_create?
user_save_changes
user_view
user_destroy
Models now get a new_foo method for each has_one :foo
The old id_name system is gone. Will be coming back in various
guises (e.g. see .named above)
def_scope implementation factored out into separate modules
New metod #get_creator returns the value of the creator attribute
(if there is one)
Various features exrtacted and now part of HoboFields
Scopes
Note: Hobo will probably switch to has_finder which provides
(nearly) all the functionality of Hobo's scopes and has a superior
implementation. We'll extend has_finder to add the bits that it is
missing.
The implementation of scopes has been factored out into separate models.
Large new set of automatically defined scopes. These are defined
automatically when you call them for the first time, much like the
magic finders in ActiveRecord (e.g. find_by_name_and_address):
For every has_many relationship (e.g. tags)
with_tag(t) -- find records that have tag c
with_tags(a, b, c) -- find records that have all these tags
without_tag(t)
without_tags(a, b, c)
For every belongs_to and has_one (e.g. manager)
manager_is(m)
manager_is_not(m)
For every regular field (e.g. name)
name_is(x)
name_is_not(x)
For textual fields
name_contains(x)
name_does_not_contain(x)
name_starts(x)
name_does_not_start(x)
name_ends(x)
name_does_not_end(x)
For boolean fields (e.g. published)
published
not_published
For the various date/time columns (these must end _at, e.g. pulished_at)
published_before(x)
published_after(x)
published_between(x, y)
And finally
order_by(field_name) -- add an ORDER BY clause
limit(n) -- add a LIMIT clause
recent(n) -- orders by created_at and limits to n records
Hobo model controller
Permission and not-found errors are now handled centrally using the
new rescue_from declaration in Rails. No need to worry about these
in individual actions.
All the hobo actions (hobo_show, hobo_new etc) are greatly
simplified. Much of the logic has been moved elsewhere, so it's now
a lot easier to avoid using those actions at all and still get the
usual features such as permission checks, fallback on page tags etc.
hobo_index now takes a "finder" (model class or scoped model
class) as the first argument. If you want to retrieve the
collection yourself, there's no reason to call hobo_index at all -
just write a regular Rails style action.
The hobo_actions don't set any extra instance variables any more
beyond @this. e.g. hobo_show_collection doesn't set @owner,
because you can now use this.origin
As part of the previous change, #not_allowed? is gone.
Some work on autocomplete - might be working now :-)
auto_actions -- can now say
auto_actions :write_only # just gives you create, update and destroy
auto_actions :read_only # gives you all except the above three
Support for scopes on declarative index actions:
index_action :scope => :my_scope
New method filter_by for easily adding filtering to index actions, e.g.
# assuming category and price_range are scopes defined on the current model
def index
finder = filter_by(:category => params[:category], price_range => [params[:min_price], params[:max_price])
hobo_index finder
end
The old data_filters stuff is gone. This was based on the
"composable query" thing which is gone too (see above).
Dependency on classic_pagination is gone. Now uses will_paginate
User model
Hobo::UserController.user_models is now Hobo::User.user_models
New method Hobo::User.default_user_model returns the user model used
in various places if no model is specified.
Now requires the current password to be provided when changing the
password (at the model level and in the related rapid-pages)
User.login_attr renamed to User.login_attribute
User controller
Now includes the rapid_user_pages taglib (these have been separated
from the main rapid-pages taglib)
New helper: logout_current_user
Bundles
Support for multiple bundles per plugin -- bundles can now be
selective about which models and controllers they include.
Adding support for: belongs_to :foo, :polymorphic => :optional
Magic option names are now available inside the model and controller *instances*
Bundle options with defaults now work with nested option hashes
belongs_to in a bundle model can now be given an :alias option - an
alias of the (parameterised) belongs_to is created so that the model
has a known API
Core DRYML tags
<wrap> can be given a parameter="..." attribute to wrap the content
in a template using the given parameter name.
<repeat> can now be used with <else> (i.e. the collection was empty)
Rapid tags: general
New standardised API for getting metadata from collections
#association_name returns th, er, name of the association. If
called on a named scope it returns the original association name,
not the scope name
#member_class returns the (expected) class of items in the array
#origin returns the object from which the collection was obtained
#origin_attribute returns the name of the attribute from which the
collection was obtained
So, unless something has changed:
collection.origin.send(collection.origin_attribute) == collection
This API is made available on all association proxies, regular
arrays and will_paginate collections.
New taglib - rapid_generics - provides various tags used by the
default pages. These tags are designed to work generically with your
models, but can also be customised of course.
<table> -- the "Edit" link now goes to action="edit" (was linking to
the show page)
<count> is now better at guessing the label to use, also now
supports <count lowercase/> to downcase the label.
<clearer> is gone - hooray for overflow: hidden
Added do to <you> as in: <you do/>
New tag <filter-menu/> creates a form with a <select>. Used for
adding menu-based filters to index pages.
New tag <comma-list>
Rapid tags: editing
<editor> now merges params and attributes (e.g. you can add your own css classes)
Most ajax controls now just give "Saving..." as the default ajax
message.
Rapid tags: forms
<form> (without an action attribute) now renders nothing if the
calculated action is not linkable
If you provide action="..." to <form> (i.e. a manual form) the
automatic css classes are not added.
<delete-button> now renders nothing if the destory action is not linkable
<delete-button> now automatically switche to non-in-place delete if
the thing being deleted is the top-level context if the page.
New tag <select-menu>
<remote-method-button> now switches to in-place mode if you give any
ajax attribute (e.g. success="...")
<after-submit> -- can now do
<after-submit go-back> (requires session[:previous_uri])
and
<after-submit stay-here>
Rapid tags: navigation
Now assumes will_paginate style pagination instead of classic_pagination
<account-nav> now proivides a link to the account page by default
<account-nav> now provides a complete set of parameters for customisation
Rapid tags: pages
login, signup and account-disabled pages have been moved out to
rapid-user-pages
simple-layout -- the main-nav parameter is now on a wrapper around
<magic-nav> rather than actually on <magic-nav>, so this now works
as you'd expect:
<main-nav:> --- your nav here --- </main-nav:>
aside-layout -- the aside now appears in the output even if it's
empty
<show-page> -- various improvements and new parameters
<permission-denied-page> now sets a body class, and the message can
be changed with an attribute.
<app-name> is gone -- this is now automatically generated in your
application.dryml (you may need to manually add this to existing
apps)
Rapid tags: plus
New tag <change-password-form>
=== Release 0.7.2 ===
Migration generator
Fixed "no such method table_name" bug
Fixed various problems with specific column types, in particular
decimal colums were problematic.
Model and controller generators:
Brought test related files up to date with latest Rails
Model controller
Fix: now correctly renders pages with validation errors for tag
pages (pages with no dryml file)
index_action and show_action can now be passed options for Hobo's
default actions rather than giving a block. e.g.
index_action :foo
hobo_index :page_size => 10
end
Can now be written
index_action :foo, :page_size => 10
Hobo user model generator
Added :default => false to administrator field
DRYML
Polymorphic tags -- looking up the polymorphic tag for an array will
now use the 'member_class' of the array if available.
Rapid
New generic tag <collection>. Used to create type-specific
renderings of collections. E.g. you can
<def tag="collection" for="Comment">
To customise how an array of comments are displayed. This will get
picked up by the default pages.
Rapid pages
Removed <default-layout/> -- dryml has built in facilities for
setting and overriding defaults so this was not needed.
Login and signup pages now specify "simple" layout, so e.g. if you
redefine <page> to use "aside" layout, then login and signup will
still use the simple layout.
Various improvements to the default pages
<index-page> new params
Plugins
Changing from hobo_* naming convention to rapid_*
Clean theme
Many small style improvements
Support for aside layout
=== Release 0.7.1 ===
Hobo 0.7 is tested against Rails 2.0.1
Adding docs to the repo in /doc, including the beginings of a Hobo
tutorial
Front controller generator -- improvements to index page (app home
page)
Migration generator -- fix for situations where a table is being
renamed and modified in the same migration.
Hobo user controller generator -- no index page for users by default.
Hobo models
New style for declarting extra metadata on fields /
associations. Now part of the field / assoication declaration
instead of requiring an additional declaration:
set_creator_attr :foo
is now:
belongs_to :foo, :creator => true
Note that :creator => true can now be set on either a belongs_to
or a string field. In the latter case the string is set to the
login name of the current user.
set_login_attr :username
is now:
username :string, :login => true
(within the "fields do" block)
Can also write
username :string, :login => true, :validate => false
to disable the automatic login validations (see hobo/lib/hobo/user.rb)
Plus two new ones for fields: :name => true and :description => true.
All hobo models have a "recent" scope by default.
Added reflection helpers to find which collections are dependent.
The permission system can now be used to check for edit permission
on the object (rather than individual field) level. If the model
defined #can_edit?, that will be used, otherwise #can_update? is
called with a nil 'new object'.
#same_fields? and #only_changed_fields? now return true without
testing anything if the record passed is nil. This is more
compatible with the new ability to test for general edit
permission on an object.
#to_s now uses the declated name field (:name => true) if there is
one
Hobo user model
New class-level declaration set_admin_on_forst_user. Does what it
says on the tin. Only use it if your user model defines a boolean
field 'administrator'
Active Record extensions -- removed dubious #include? optimisation
from has_many associations.
New plugin feature -- Bundles
Bundles are Hobo's equivalent to "appable plugins" or "engines". A
plugin provides a bundle, and the app *instantiates* the bundle,
possibly more than once in file app/assemble.rb. This is the wrong
place to start documenting them but there are some examples in
/plugins
Hobo controllers
Options given to the include_plugin declaration have changed. They
are now exactly the same as the attributes taken by DRYML's
<include>
Hobo model controllers
Removed cruft left over from view-layer permissions experiment.
Simplified template lookup mechanism and removed inheritence aware
search for partials.
Added a cache for file-system tests to locate the correct
template. This avoids the need to stat files in production mode.
Better smarts for where to redirect to after a model is created.
Better support for model controllers that handle more than one
model. (this is a bit of a strange thing to do but a need for it
cropped up in an app than has a single place for users of different
types to log in)
Hobo user controller
"Account not available" is now a separate page
(<account-disabled-page>) instead of just a flash message.
Fixed occasional missing template bug
DRYML
DRYML now supports bundle class renaming when defining polymorphic
tags
Changes to <include> for plugins:
<include src="plugin/foo/taglibs/baa"/>
becomes
<include src="baa" plugin="foo"/>
You can also say <include src="foo" bundle="abc"/> which includes a
taglib from the bundle's plugin, as well as handling class renames
for polymorphic definitions.
Fix to allow calling tags with upper-case letters in their names.
DRYML core tags
<call-tag> now dasherises the tag name passed
<partial> is now just a trivial wrapper around render :partial
Hobo helpers
can_edit? can now be given nil as the field parameter to test for
general ability to edit this record (e.g. to decide wether to render
an "Edit" link). Also, parameters now default to #this and nil.
Renamed create_model to new_for_current_user. Pass a class or
association, defaults to #this.
New helper #font_models. Returns a list of models that are
candidates to appear on the default front page and main nav.
Changes to linkable? Subsite is now a named option (:subsite =>
"admin"), the target of the links defaults to #this and the action
defaults to :index for model targets and :show for records.
Hobo routing
Now automatically updates routes without restarting the server in
dev mode (yay!)
Site search -- don't search for records that are not linkable
Hobo Rapid
Clean theme is now the default theme
CSS -- small tweaks
JavaScript -- Ajax spinner now appears for a minimum time, and has a
fade effect.
Clean theme -- many improvements
Added an ajax option -- :spinner_next_to. Pass the dom id of a node
and the spinner will appear near that node.
Rapid tag library
<field-list> now defaults to <view> not <edit> as the tag for the
fields. Also, if the tag is <input>, non-editable fields are skipped
(used keep them in but to drop back to views).
<card> displays nothing if the object is not viewable. Default card
has various improvements.
New attribute <type-name dasherize/>
Fix: merge-attrs was missing on the belongs_to view
<boolean-checkbox-editor> now supports a custom ajax message and
configures the ajax spinner to appear near the checkbox.
Fix: incorrect use of <ul> in <error-messages>
<magic-nav> -- removed serach item, extended to maximum of 6 models
Many, many improvements to the default pages
<with-fields associations="has_many"> iterates of all has_many
relationships
Removed require of ruby-debug from fixdryml.task
New plugins featuring bundles: rapid_blog, rapid_comments,
rapid_images and rapid_tagging. All are work-in-progress.
=== Release 0.7 ===
Hobo 0.7 is tested against Rails 1.99.1 (aka Rais 2.0 RC2)
DRYML
Switched to dashes instead of underscores for tag and attributes
names. These are converted to underscores in the underlying ruby
code.
Unification of tempalte tags and non-template tags. There is now
only one type of tag and two different ways to call a tag:
<my-tag>content directly inside the tag</my-tag>
<my-tag>
<a-parameter:>Content inside a named parameter (note the colon)</a-parameter>
<another-parameter:>Some more content</another-parameter>
</my-tag>
Note that these styles cannot be mixed. If there is a parameter
inside a tag call, there must be only parameters (and whitespace,
which is not output)
In the first style, the call is implicitly equivalent to:
<my-tag>
<default:>content directly inside the tag</default>
</my-tag>
And by the same token, <tagbody/> is now written:
<do param="default"/>
The tagbody local variable is gone too. "if tagbody" is now
"if all_parameters.default?" and "tagbody.call" is now
"all_parameters.default"
A rake task hobo:fixdryml has been added which does a pretty good
job of converting Hobo 0.6 DRYML source-code to the new style. It
will change every file in app/views/**/*.dryml, and keeps a backup
copy of app/views in app_views_before_fixdryml. If you pass it CLASS=y
and ID=y it will 'dasherize' css classes and IDs too, which is the
new Hobo convention. You can also pass DIR=... if you want to point
it somewhere other than app/views. It won't fix anything in erb
scriptlets, e.g. use of the tagbody local variable. Expect to do
some manual fixes after running the task (good job you've got that
thorough test suite eh?)
The add_classes helper now automatically dasherizes all class names.
New helper 'element'. Use in place of Rails' tag and content_tag
helper. It dasherizes attributes given as symbols.
Migration generator
Better support for STI. It no longer wants to generate tables for
the subclasses. Still needed: a way of integrating fields declared in
the subclasses -- they are currently ignored by the generator.
Hobo Rapid
In place editing (and Ajax in general) will now provide the form
authentication token (CSRF protection) if available. No need to
disable protect_from_forgery any more.
Stylesheets:
Removed list-style: none from hobo_abse.css
Javascript:
Dasherized all css classes and dom IDs used.
Upgraded to latest low_pro.js
New theme 'Clean'
New helper 'linkable?' can be given a record or class, and tells you
if Hobo has a route for it. Only works for 'show' and 'index'
actions so far.
Tag library
\\'/;p <a> now automatically knows not to generate (broken) links to
things that are not 'linkable?'. Outputs just the link content
instead.
We used to have <FieldList> and <field_list>. We now have
<field-list> and <labelled-item-list>
<UL> is now <ul>, and only has the iteration behaviour if you give
a <li:> parameter. Otherwise it's just like a static tag.
<Table> is now <table> and only has the special behaviour if you
give a 'fields' attribute or '<tr:>' parameter. Otherwise it's
just like a static tag.
<view> for dates and times no longer break when the context is
nil.
<count> - unless-none attribute is gone. user if-any
<theme-stylesheet> now takes a 'name' attribute
<delete-button> takes a 'subsite' attribute
Rake tasks
New task hobo:fixdryml (see DRYML section above)
dump_fixtures is now hobo:fixtures:dump
Hobo models
Automatically declares the field 'position :integer' if the model
acts_as_list.
never_show declarations are now inherited
Fix: def_scope was broken when the scope name ended '?'
Fix: Hobo broke the 'guard_protected_attributes' optional parameter
to attributes=. (this was breaking attachment_fu)
Fix: assigning Date and Time objects in mass-assignment was broken.
User model
Newly generated user models (hobo_user_model generator) now give
create permission to all by default (to enable signup).
logins_count renamed to login_count (Hobo manages this field for you
if it exists).
Core extensions
Module#alias_tag_chain, which never should have been there is
gone. (It's not needed now that camel-case tags have gone).
=== Release 0.6.4 ===
Fix: In-place-editors were not working with the new version of
Scriptaculous
The default fade effect on in-place-editors is now disabled
<ShowPage> now has a title
=== Release 0.6.3 ===
New feature: subsites, i.e. namespaced routes, plus support in the
controller and view layers. Subsites are created automatically for any
directories found in app/controllers. Links default to the current
subsite unless you give a subite="..." attribute. The taglib
app/views/<subsite>/<subsite-name>.dryml is automatically included in
every page in the subsite.
The out-of-box app is not in great shape in this release, mostly due
to problems with the theme. We haven't fixed it because the theme
system going to change radically in Hobo 0.7
New version of lowpro, compatible with Prototype 1.6 (rev 267)
Change to hobo command:
hobo [...options...] app-name
instead of
hobo app-name [...options...]
Migration generator
Automatically ignores non-Hobo models (and associated tables)
Hobo::Migrations.ignore_models is now deprecated.
Use Hobo::Migrations.ignore to list models that should be
ignored. The associated tables are ignored too (rarely needed, as
these are probably not Hobo models anyway)
Hobo::Migrations.ignore_tables is still supported
Fix: problems with going back to a nil default from a non-nil
default.
Hobo model generator
In line with Rails 2.0, the timestamps declaration is now included
by default (it's generally something every model should have).
hobo_base.css
Removed over-zealous styling of too many elements.
hobo_rapid.css
Change of class names for validation errors.
hobo_rapid.js
Now silently ignores update to non-existent part. This is convenient
when parts are being added dynamically, but may prove to be a
mistake :-)
Global variable controllerNames is gone. Now use calls to
Hobo.pluralise. (Gee I guess we should really standardise on
American spellings)
The 'fade' parameter to removeButton is now an option. Confirmation
is now optional too.
Hobo.partFor returns the part containing a given element. Used in
the new update="self" feature.
LowPro behaviour HasManyThroughInput. This is badly named and will
change.
Core extensions
alias_tag_chain is like alias_method_chain but for DRYML tags
SafeNil
Now more efficient (thanks to "steve d" --
http://coderrr.wordpress.com)
Fix when used with DelegateClass
New method #implies on booleans. Borrowed from Eiffel. Useful in
permission methods.
true.implies false #=> false
true.implies true #=> true
false.implies x #=> true
Hash#map_hash. The block is passed only the value if the arity is 1.
DRYML
The ability to define tags in Ruby is now removed
Tag extension: <def tag="Page" extend_with="navigation">
This encapsulates the alias_method_chain pattern. The tag can make
a call to <PageWithoutNavigation> to get the old behaviour.
alias_current_as is gone -- replaced by extend_with
Fix: some DRYML attributes were leaking through to the output HTML
part_locals can now be passed instance variable names,
e.g. part_locals="@user". Note that inside the part this creates a
local variable "user". Don't user @user inside the part. It's just a
convenience to avoid the need to do <set user="&@user"/>
Fix: failure to accumulate CSS class names when merging attributes.
DRYML now gives the type returned by #field_type (when available)
over this.class
Fix: when overriding a parameter, the <default_tagbody/> of the new
parameter would incorrectly provide the old tagbody which should
have been overridden.
hoboParts variable is now set by <hobo_rapid_javascripts> rather
than being hard wired in the output from the DRYML compiler.
Fix: caching problems with tags imported by the include_tablib
directive.
AJAX Parts
Calls to parts, along with the part-state variables are now logged.
Can now say part="self" when a tag wants to update the part it is
contained in (useful for re-usable tags).
Rich data types
All rich data types now register themselves with Hobo, e.g.
class Hobo::EmailAddress < String
COLUMN_TYPE = :string
...
end
Hobo.field_types[:email_address] = Hobo::EmailAddress
New type builder - enum_string. e.g.
fields do
gender enum_string(:male, :female)
end
You can then do, e.g. if current_user.gender.male?
(You also automatically get select menu's in your views)
Hobo models
In fields declaration:
Got rid of weird thing where providing :length meant the type
defaulted to :string
Can now give classes as well as symbolic names for column types.
Mass attribute assignment extended to support some features that
were in the model controller. e.g. Dates can be represented as
Hashes of month, day etc. Chronic will be used to parse dates if
available. Object references (e.g. belongs_to relationships) can be
set with "@<typed-id>" as before.
"fields do" can optionally be used with a parameter if you don't
like the instance_eval hackery:
fields do |f|
f.name :string
end
belongs_to can be given :null => false, which is passed through to
the migration generator.
New method #column returns the meta-data for the named column.
#find now returns arrays with a #member_class method
def_scope
Chained scopes on a class didn't work at all -- now fixed,
e.g. Posts.recent.by_author.find(:all)
Fix: def_scope with sql parameter interpolation was broken.
#changed_fields, which was next to useless, replaced with
#only_changed_fields, which is used to assert that only the given
fields have changed.
Hobo user model
The module is renamed from Hobo::AuthenticatedUser to just
Hobo::User
It is no longer possible to set the login attribute by passing a
symbol to hobo_user_model. Go back to using set_login_attr. Didn't
work out. It happens sometimes.
Helpers
#subsite returns the name of the current subsite.
#object_url can now be passed the siubsite, e.g. :subsite => "admin"
#object_url can only be passed a single hash of options now (could
be passed any ammount before)
#dom_id now returns "" when a dom_id cannot be generated (used to
raise an error)
#map_this now works with ranges (used by DRYML's repeat)
#current_page_url returns request.request_uri without the query string
#query_params now returns a HashWithIndifferentAccess
Hobo.dom_id now works better with non-hobo models
Permission System
Fix: view permission was causing errors with non-hobo models. Now
defaults to viewable.
Hobo Controller
include_tablib accepts symbols as well as strings
#redirect_to now forwards all params to object_url when not given a
String, Symbol or Hash
#hobo_ajax_response no longer need be passed a dryml this
Model controller
Multiple model creates / updates are gone from the controller
layer. Hobo now uses good ol' Rails mass attribute
assignment. Coping with multiple object updates should be handled in
the model layer. Some features from the model controller have been
moved to the model layer, and more will be added in the future.
Attempts to automatically re-render the correct page after a
validation error on create / update using a form parameter
"page_path", which the <form> tag provides in a hidden
field. Previously assumed the form came from the new / edit action.
Automatic pagination is now only applied to appropriate
mime-types. Add mime-types to Hobo::ModelController.PAGINATE_FORMATS
to have them paginated.
New declaration 'auto_actions' allows you to select which actions
Hobo provides for you automatically.
# White list
auto_actions :show, :index
or
# Black list
auto_action :all, :except => [ :new_comment ]
You can use :collections to add/remove all collection actions in
either the black or white list.
New declaration 'index_action' declares a new index-like action
(similar to show_action)
index_action, show_action and web_method can now all be given
blocks, rather than defining a method of the same name:
show_action :summary do
hobo_show Post.find(params[:id], :include => :comments)
end
Web methods now automatically respond with hobo_ajax_response if the
method does not respond.
#search
Now less magic (i.e. doesn't operate by side-effecting). It now
returns a condition string suitable to be passed to :conditions.
Can be given a model as the first argument to search on a
different model (e.g. for show-collection actions).
Fix: :paginate => false was broken
#create, #update and #destroy now set flash messages by default
(only on "wants.html" requests)
<PermissionDeniedPage> used as the default permission denied
response.
<NotFoundPage> used as the default 404 response.
User controller
Added various customisation options to login and signup
On login, redirect to #home_page -- you can override this on your
controllers.
The actual name of the login attribute (e.g. "email", "username") is
now used in flash messages.
hobo_logout can now be given a block to customise the response.
Fixes for validation errors on signup.
Routing
Routes for non-existent actions are not generated.
Tag library: Core tags
<wrap> will wrap its content in ther tag specified by tag="..." if
when="..." is true.
Fix: <unless> -- was behaving like <if>
Tag library: Rapid
<FieldList> now has params <label> and <view> that wrap every label
and view. Also <foo_tag> where "foo" is a field-name, is the actual
tag that renders the field (e.g. <view> or <edit>)
<nil_view> can be overridden to customise the way Hobo renders nil
values.
<Table> new attribute 'empty' -- when given the table is rendered
even when there are items in the collection.
<name> now respects view permission properly
<view> now does a #strip to the output
<count> -- new attribute if_any - set to true to output nothing if
the count is zero.
Tag library: Rapid documents
The 'document' tags like <section>, <aside> output nothing when the
content is blank. Now they can ge given the 'empty' attribute
causing the tag to be output even if the content is blank.
New tag <sub_heading>
Tag library: Rapid forms
<hidden_fields> will now not output hidden fields for attributes
on new records that are in their default state.
<form> now has a default ajax message for creating new objects.
<form> now supports forgery protection
<input> -- better handling of the 'field with errors' wrapper
<input> for passwords now accepts extra html attributes
New <input> for enum-strings - a select menu.
New <input> for big decimals
<remote_method_button> now supports non ajax remote method calls
(when no update="..." is given)
css classes on buttons renamed from "button_input" to "button"
<update_button> now supports confirm="&false"
<belongs_to_menu_input>
none_message attribute renamed to blank_message
Conditions on belongs_to are now observed (only eligible records
are in the menu)
New <ErrorMessages> template tag - like the error_messages_for
helper with added Hobo goodness.
Tag library: Rapid navigation
<page_nav> now hides without errors if there is no @pages object
<nav_item> now ignores nested tags when selecting the current nav
item.
Tag library: Rapid pages
Significant re-factoring of all page tags -- see source :-)
<javascript name="a, b, c"> tag - like helper javascript_include_tag
New pages <NotFoundPage> and <PermissionDeinedPage>
Tag library: Rapid support
<TablePlus> various new params
=== Release 0.6.2 ===
Specs
Moved out of the plugin source into a separate directory in the
hierarchy. If you check out hobo/trunk you'll get two directories:
hobo and hobo_spec. You can run "rake" from the hobo directory and
it should work as long as hobo_spec is along side. Note the
hobo_spec tree contains an svn external to edge rails.
New rake task dump_fixtures (which really should be nicely
namespaced). This will dump the current database into test
fixtures. The nice part is that it won't overwrite symbolic names
you've given to rows in your fixtures, so you can round-trip with it:
rake db:fixtures:load, run up the app and create some new data, rake
dump_fixtures.
Migration generator
Fixed indentation bug in generated code.
Now prompts for the name of the generated migration after the
generated code is displayed.
Better error message for invalid field types declared in models.
Tabla theme
Fixed reference to non-existent human_type helper.
Hobo users
Various fixes to the new (in 0.6.1) multiple user model support.
If the model name is "User", the routes generated are simply:
/login
/logout
/signup
(as opposed to /user_login etc.)
The filter "login_required" can now be passed a user model (class),
e.g.
before_filter {|controller| controller.login_required(Administrator) }
The named routes "login", "logout" and "signup" are no longer
defined. Instead there are helpers login_url, signup_url and
logout_url, all of which are passed a user model (class) as
parameter.
New declaration 'hobo_user_model' can be used in place of hobo_model
and removes the need to include Hobo::AuthenticatedUser. Can be
passed the name of the login field, which removes the need to call
set_login_attr. Can also be passed a block in which to do
validations of the login attr (just as you can with set_login_attr).
User models now have a class method login_attr that returns the name
of the login attribute, e.g. :username
Guest model should now extend Hobo::Guest, which provides #guest
(true!) and #super_user (false)
User models now inherit #guest? (returns false). No need to define
it yourself.
Hobo models
Optimisation. Where possible we've replaced calls to #respond_to?
(which is slow on AR records) with the new class method
#has_hobo_method? which is an alias for
#respond_to_without_attributes?
"fields do" now supports shorthands for common validations
validates_uniqueness_of and validates_presence_of, e.g.:
fields do
name :string, :required, :unique
end
If you need to change the validation method, just go back to the
old way.
The creator attribute mechanism is updated to cope with multiple
user models. Hobo will not try to set the creator attribute if the
expected type is not the same as the type of the logged in user.
Various enhancements to composable query blocks
MyModel.has_creator? replaced with MyModel.creator_type which
returns the expected user class or nil if there is no creator
attribute.
Fix: def_scope was broken with has_many :through associations.
Integration test helpers
#logs_in_as updated to cope with multiple user types.
Core extensions
New method Object._? can be used to avoid an extra test for nil, e.g.
string_or_nil._?.length
is equivalent to
string_or_nil && string_or_nil.length
Hobo extensions to HashWithIndifferentAccess fixed to always return
indifferent hashes.
Hobo controller
Fix to #render_tags (problem with part contexts javascript)
Fix to include_taglib declaration (was not working in production
mode).
Hobo model controller
Largely re-written handling of http PUT and POST (update &
create). The new mechanism is more secure, more featureful and is
transactional. If your put/post affects multiple database rows, they
will either all happen or none will. See the model_controller_spec
for some good examples of what is allowed / possible.
def_data_filter is gone. Instead you can declare data filters from
within the action methods:
def index
data_filter :search do |query|
name_contains(query) | address_contains(query)
end
hobo_index
end
Declare data filters for autocompleters in the same way by giving
a block to autocomplete_for
#index now supports a "sort" parameter. The value should be
<field-name> or <model>.<field-name>. Precede with a '-' to sort in
descending order. e.g.
http://host/users?sort=-username
Provide the :order parameter to hobo_index to disable.
The mechanism to call a tag <ShowPage> if there is no show.dryml is
extended to work with any action name. So e.g. you can define
<FooPage> as an application wide page for any action "foo".
Hobo user controller
Options can now be given as procs, in which case they are called
only when needed and hence have access to things like current_user
(e.g. the redirect destination for a logged in user can take into
account who the user is)
#hobo_login can be given a block -- a place to check if the users
account is available. Return false to prevent the user from loggin
in.
Hobo module
#can_view? can now be given dotted field paths. E.g:
Hobo.can_view(current_user, post, "author.name")
Hobo Rapid
Adding low_pro.js (from the UJS project). First step towards
complete adoption of unobstrusive JavaScript.
Fix to client side of new ajax mechanism. Had problems with not URL
encoding part state.
New taglib rapid_plus, home of tags with an extra level of
functionality. First and only tag: <TablePlus> a table with
automatic support for sorting by clicking on column headings, and
filtering rows via a search field.
<Table> now supports tempalte parameters for each cell when given a
'fields' attribute, e.g. <name_view> <address_view> (<name_cell>
might seem like a better name, but we wanted to be compatible with
<FieldList> so it's easy to flip back and forth).
<name> tag now respects view permission.
<a action="new"> now only renders the link if the current user has
the required create permission.
<view> now supports attribute 'truncate'
<view for_type="Date"> now supports a 'format' attribute - a
strftime style format string.
New tag <restricted_page>. Sometimes permissions are a view layer
concern - you actually want to say "these colors, this logo,
etc. are only to be seen by the administrator".
<restricted_page login_required="Administrator"/>
New tag <you_have>. An easy way to say either "You have 3 posts in
this thread" or "Fred Blogs has 3 posts in this thread", depending
on whether Fred Blogs is the current user.
Fixes to the tags in rapid_documents to avoid evaling tagbody twice.
<hidden_fields> fixed (was outputing hidden fields even when the
field existed in the form). Also now support "for_query_string"
attribute, to output hidden fields for the name/value pairs in the
current query string.
<form> now sets a scoped variable "in_form" so tags can behave
differently when they are inside a form (FieldList does this).
<input> for datetime and date now supports the same attributes as
the equivalent rails helpers. e.g. you can change the order of the
fields.
<belongs_to_menu_input> can now be passed an array of records in the
"options" attribute (instead of retrieving the entire target table
from the DB).
Fixes to page navigation
<account_nav> upgraded to cope with multiple user models.
Rapid pages:
Various new template params made available, including many on
login and signup pages.
<Page> updated for multiple user models
<IndexPage> fix to ajax updating of record count
New css classes added to <NewPage> and <EditPage>
<error_messages> added to <EditPage>
Fix to new link in <ShowCollectionPage>
<image> tag removed from default ajax progress.
Dryml
Important change ommitted from 0.6 changelog - attributes passed to
the tag that are not in the tags declared attributes are available
in a local variable "attributes" (used to be called "options").
<set> can now assign to dotted named (object attributes) as well as
locals, and can have controll attributes on it (e.g. if)
Fix to replacing template parameters that are themselves templates.
When a boolean is in context, this_type is now always TrueClass
(never FalseClass even if the value is false). TrueClass is the Hobo
boolean type.
#render_tag on a page renderer object (Dryml internals) now returns
false. This alows Hobo's controller to say "call this tag if it
exists, otherwise..."
Rich types
Registered rich types can now provide there own validations that get
added to the model automatically. E.g. Hobo::EmailAddress
automatically validates the content as a valid email address.
Hobo helpers
New helper query_params returns a hash of parameters extracted from
the query string only (#params returns route-based parameters
too). Only works with simple name=value parameters.
=== Release 0.6.1 ===
Multiple user models
Hobo now supports multiple user models, with independent sign-up /
log-in/out for each.
The controller needs to declare hobo_user_controller instead of
hobo_model_controller (it still has all the hobo_model_controller
features). e.g.
class AdminsController; hobo_user_controller; end
Hobo routing will automatically give you
/admin_login
/admin_logout
/admin_signup
Note this controller will now filter logging of passwords.
The model needs to include Hobo::AuthenticatedUser and declare a
login attribute with, e.g.
set_login_attr :email
The hobo_front_controller generator no longer generates anything
related to users - it's now just the fron page and search page.
There is a new hobo_user_model generator to create these
controllers.
The global value Hobo.user_model is gone
Rapid now has <LoginPage> and <SignupPage> templates. They're not so
customisable just now but you can of course replace them completely
with your own views.
Misc fixes
Search was broken
The 'hobo' command tried to connect to the DB, which was a problem
as you'd had no chance to configure database.yml
Rapid
Fix: reset_form and refocus form options
<Table> now supports @fields, allowing you to give a bunch of field
names and automatically have a table with a column for each of those
fields. There's also a <controls> param that can be used to have a
delete button and edit link on each row. As usual there's a ton of
customisation options - see the source.
<human_type> is now <type_name> and takes flags @plural and @lowercase
<editor> and <input> have better automatic css classes
Restored old behaviour where <page_nav/> would display nothing when
there's only one page.
Finally created <EditPage>
Small cleanups in the rapid pages
New tag <with_field_names/> used in <Table> to iterate over the
column headings.
<view> for Time objects now supports @format - a strftime style
format string.
Migration generator
Fix: Edge Rails now dumps out in sexy format, which was freaking the
migration generator.
You can now configure the generator to completely ignore specified
tables and models. In environment.rb do
Hobo::Migrations.ignore = %w(red_fish blue_fish)
That will ignore the models RedFish and BlueFish, and the tables
red_fishes and blue_fishes
To ignore just tables, assign an array of their names to
Hobo::Migrations.ignore_tables
To ignore just models, assign an array of the class names to
Hobo::Migrations.ignore_models
New secure ajax parts mechanism
The new mechanism stores the part state in a base 64 encoded string,
complete with an SHA1 (by default) digest, so malicious tampering
with the part state is prevented.
Parts can now capture the state of local variables along with the
DRYML context. Give a list of locals you wish to capture in the
'part_locals' attribute. e.g.
<div part="my_part" part_locals="a, b"> ... </div>
(the inability to do this was a serious limitation of the previous
mechanism)
Core extensions
Added Methodphitamine and removed omap, oselect, ofind, oany oall.
See http://jicksta.com/articles/2007/08/04/the-methodphitamine
DRYML
merge_attrs fixed to not complain about nils
Fix: css classes were not accumulated in some template parameter
situations
Hobo module
#type_name renamed to #type_id
#object_from_dom_id will now return classes when the id has no, er, id. As in
Hobo.object_from_dom_id("blog_post") #=> BlogPost
Similarly, #dom_id generates those kind of ID for classes
=== Release 0.6 ===
DRYML
Local tags are gone. We finally gave up on this feature as too
complex.
New feature - <set_scoped> allows a variable assignment that exists
only for the lifetime of the tag-body of <set_scoped/>. At the end
of the block, the previous value of the variable, if there will be
restored. This feature gives a lot of the power of local tags in a
less pure but far simpler mechanism.
New feature - polymorphic tags. A tag can have many definitions for
different types of object. Define with e.g.
<def tag="card" for="User"/>...</def>
<def tag="card" for="BlogPost">...</def>
call with <card for_type/>
The actual tag called will be selected according to the type of
the current context.
Core tags moved from lib/hobo/core.rb to tags/core.dryml. This
follows on from the deprecating of def_tag
Fix: attrs_for now works with tags imported from a taglib
Gone: template parameter modifiers (e.g. <my_param.append>). The
only one left is 'replace' which is now written as '<my_param
replace>' and 'replace' is now a reserved attribute name. Two new
features - default tagbodies and restoring parameters - give the
same functionality but are more powerful because you can now _wrap_
a parameter in your own tag.
New feature - default tagbodies. Tags can provide a default tagbody
like this:
<def tag="foo">...<tagbody>this is the default</tagbody>...</def>
Callers can keep the default: <foo/>
replace it <foo>my tagbody</foo>
or wrap it in new content: <foo>“<default_tagbody/>”</foo>
You can give restore the default tagbody of an element further up
the hierarchy using the 'for' attribute. e.g:
<foo><baa>“<default_tagbody for="foo"/>”</baa></foo>
New feature: restoring replaced template parameters. For example -
wrapping a template param in an extra div:
<MyTemplate>
<my_param replace><div><my_param restore/></div></my_param>
</MyTemplate>
def@alias_current renamed to 'alias_current_as'
@if and @unless controll attributes always test for non-blank rather
than true. This is more convenient in DRYML where we generally want
to skip stuff if a collection is empty (empty enumerables are blank,
but not false)
An attribute that starts with an XML entity reference is *not*
considered a code attribute, even though it does start '&'
e.g. label="» Next"
#merge_attrs now always accumultates rather than
replaces css classes.
form, input and a have been removed from static_tags - these are now
defined tags.
Many core tags moved to Rapid. There are very ferw core tags now - just
the basic control tags (if, unless etc.)
Hobo Models
The display_name method is not used anymore. Instead use the new
polymorphic tags.
<def tag="name" for="MyModel">...</def>
The <name> tag eventually falls back on to_s, so as an alternative
you can rename your display_name methods to to_s.
New semantics for #new and #build.
#new now does what new_without_appending used to do. That is, it
instantiates a new object exactly as if it was in the collection,
but it does not modify the collection itself.
#build is extended so that it sets the belongs_to association that
is the counterpart to the has_many.
For existing apps, just change any calls to #new_without_appending
to #new
Refactored the rich type mechanism to make it easier to add new
types. To add a new type, e.g.:
class Isbn < String; COLUMN_TYPE = :string; end
Hobo.field_types[:isbn] = Isbn
You can then use :isbn as a field type in 'fields do', and
register a view with <def tag="view" for="isbn">
New rich type Hobo::EmailAddress < String
Doesn't have any special behaviour as yet, but we could do nifty
things with it in the future like auto anti-spam cloaking,
validations...
New method #nillable_field? tests if the underlying collumn can be
null.
New methods #created_date and #modified_date return
[created|modified]_at.to_date
Default to_s for all hobo_models
Model controller
Boolean fields now get a false value when the param is either '0' or
'false'.
Front controller
All the templates are updated to use the new DRYML
Migration generator
Now gives an option to generate and run the migration immediately
Will create the "foo_type" column for belongs_to associations marked
as polymorphic.
Hobo Rapid
lib/hobo/rapid.rb is gone. The tags are now in tags/rapid.dryml and
the helpers are in lib/hobo/rapid_helper.rb
Now includes two CSS stylesheets. hobo_base.css provides some handy
reset rules to reduce cross-browser headaches, and hobo_rapid.css
provides default styling for some of the Rapid components.
Rapid split up into more separate dryml files: rapid,
rapid_document_tags, rapid_forms, rapid_pages, rapid_editing,
rapid_navigation, rapid_support
There are a great many changes to the Rapid tags, too much to
describe individually here. The most important changes are:
<show> becomes <view>. <view> is a polymorphic tag, so you can
<def tag="view" for="MyClass">
<edit> is gone. Use <editor> if you want a tag that gives an
in-place (ajax) editor, and degrades to <view> if the user does
not have edit permission. <editor> is a polymorphic tag, so you
can <def tag="editor" for="MyClass">
<form_field> is now <input>. If you give a type attribute, you
get a regular html input tag, if you don't you get a smart Hobo
form field appropriate for the type of the context. <input> is a
polymorphic tag, so you can <def tag="input" for="MyClass">
All the special form-field tags tags that ended _field now end
_input
<table_for> becomes <Table>
<ul_for> becomes <UL>
<object_form> and <remote_method_form> are now both handled by
<form>
<object_link> and <new_object_link> are now both handled by <a>
<object_table> becomes <FieldList>
<display_name> becomes <name>
Various small changes to the navigation tags - please see
rapid_navigation.dryml
Hobo Rapid Javascript
Fix: problems with the save button in TinyMCE fighting with the
save-on-blur behaviour.
Tabla theme
Tweaks to application.dryml and the stylesheet for new DRYML
Hobo user model generator
Doesn't declare the authentication fields anymore, as these have
been moved to Hobo::Authenticated user. This is part of the move to
supporting multiple user models.
Hobo controller & helpers
ControllerHelpers are now HoboHelper, and there's a change to the
way this is included in both the controller and the view.
#render_tags extended to support polymorphic tags
#site_search now renders the polymorphic <card> tag for each search
result.
Hobo module
New method Hobo.symbolic_type_name returns a symbol abbreviation for
a rich type. e.g. Hobo.symbolic_type_name(Hobo::Text) #=> :text
New method Hobo.type_name
Hobo.type_name(MyModule::MyClass) #=> "my_module__my_class"
Note the double underscore
Core Extensions
ActiveSupport's HashWithIndifferentAccess is extended to keep it's
indifferent access semantics with Hobo's extensions to Hash.
=== Release 0.6-pre1 ===
*NOTE* We are now using Edge Rails for all our tests. YMMV with other
Rails releases. If you do upgrade tp Edge Rails, you'll need to
install classic_pagination too (this dependency will probably go away
at some point)
hobolib directory (app/views/hobolib) renamed to 'taglibs'
DRYML
Hobo::DefineTags and def_tag are deprecated - they'll be phased out.
Code attributes changed from foo="#baa" to foo="&baa"
Changing the context:
obj="..." renamed to with="..."
attr="..." renamed to field="..."
Shorthand syntax <show:authtor.name/> equivalent to <show field="author.name"/>
Note that the ':' and field name(s) are optional on the close tag, e.g.:
<repeat:comments> ... </repeat>
(Be aware that your DRYML is no longer valid XML if you go for this option)
<taglib> renamed to <include>
part_id="..." renamed to part="..."
#{...} is now supported in attributes of static tags (i.e. plain HTML tags)
<include> (formerly <taglib>) now supports the 'as' attribute for
putting tags in namespaces.
<include src="my_taglib"/>, then... <my_tag/>
<include src="my_taglib" as="foo"/>, then... <foo.my_tag/>
(note that <foo.my_tag/> compiles to simple "foo.my_tag()", i.e. a
method call on an object, so you can do other stuff with this if
the mood takes you)
xattrs="..." renamed to merge_attrs="..."
New feature: template tags
Parameter tags (<:foo>...</:foo>) are gone. Replaced by template
parameters.
content_option and replace_option are gone. The 'param' attribute is
the new equivalent (part of template tags)
<else> can now be used in many places. e.g. after <repeat>, the else
content will be used if the repeated collection is empty.
Attributes can now have no RHS, e.g.
<logo small/> is equivalent to <logo small="&true"/>
(note your DRYML is not valid XML if you use this shorthand)
#attrs_for can be called for any tag and return the declared
attributes on the tag. e.g.
attrs_for(:foo) #=> [:a, :b] -- assuming <def tag="foo" attrs="a, b">
New feature: local tags, e.g.
<def tag="a">
<def tag="panel">...</def>
... Any call to panel in here, or in the tagbody of the call to
<a> will get the local definition. Note that local tags are full
closures and have access to state from the containing tag...
</def>
<set a="&1" b="&2"/> equivalent to <% a = 1; b = 2 %>
New feature: polymorphic tag calls. e.g. if the current context is a
User <card for_type/> will try to call <user_card/>, falling back on
just <card/> if no such tag exists.
New feature: control attributes
<p if="..."/> as a shorthand for <if q="..."><p/></if>
<p unless="..."/> as a shorthand for <unless q="..."><p/></unless>
<p repeat="..."/> as a shorthand for <repeat with="..."><p/></repeat>
Think of these as the dryml equivalent of the suffix 'if' and 'unless' in Ruby.
If you give the attributes a string, it is treated test for a
non-blank field, e.g. if="address" is like
<if q="&!this.address.blank?">
You can use <else> after tags with these attributes on them.
Fix: calling @view methods with a block now works
The list of tags considered 'static' (i.e. plain HTML tags) can now
be customised by putting your own list (one tag per line) in
config/dryml_static_tags.txt
Hobo Controllers
New directive "include_taglib" allows a specific DRYML taglib to be
included in every action on this controller.
render_tag now supports custom render options, e.g.
render_tag :error_message, { :message => "uh oh" }, { :status => 500 }
Options passed to #hobo_index are now also forwarded to
#paginated_find, making it easier to change the page size etc.
#paginated_find now takes an :association parameter to provide a
custom association
Fix: :order option to paginated_find ignored in some situations.
Hobo controller actions now perform a #hobo_render if you give a
response block but the blog does not do a render or a redirect. So
e.g. if you just want to update the session you can leave hobo to
handle the response
Fix: hobo_create now checks for create permission if you pass a
custom :this parameter
POSTing and PUTing now support boolean values
Hobo Models
#created_by renamed to #set_creator. This should help avoid name
clashes with column names etc.
Added field declarations on models. This replaces set_field_type and
also supports the migration generator.
fields do
name :string
body :html
end
Added return_type declaration for setting rich types on model
methods, e.g.
return_type :html
def my_method
...
end
This allows DRYML to render the correct widget even when the
method is returning nil
Fix: def_scope was pretty much completely broken
RSpec support and a test Rails app (in spec/rails-root) added to the
repository.
DRYML Core Tags
<dynamic_tag/> renamed to <call_tag/>
<display_name/> displays "(not available)" if the context is nil
show@no_span renamed to show@no_wrapper, and for content such as
:html it now generates a div instead of a span.
count@unless_none -- nothing output when count is zero (can be
followed by an <else>)
<join> now uses <display_name> if no tagbody is given.
join@with renamed to join@separator
DRYML Helpers
#param_name_for will strip a trailing '?' if there is one.
Hobo Rapid Tags
<boolean_field> now also generates a hidden tag with the same name
and value '0' like the rails helper. This fixes HTMLs broken idea of
how to handle checkboxes (you get a 0 value if the checkbox is not
checked, instead of no parameter at all)
<object_form> no longer generates hidden fields for created_at and updated_at
Hobo::TextileString now includes a monkey-patch to RedCloth
Users & Authentication
Added: Hobo maintains a login_count attribute if one exists on your user model.
Hobo Rapid Javascript
Ajax forms now default to not resseting and not refocussing after submission.
Fix: ajax behaviour (Hobo.applyEvents) now applied to the result of searches.
Fix: Ajax now using encodeURIComponent instead of escape. Fixes
problems with foreign characters.
Tabla theme
Removed <application_logo/>
Added missing image plus.png
Generators
New: hobo_migration generator. Creates fully implemented migrations
for you based on field declarations in your models
hobo_model and hobo_user_model generators updated accordingly --
they don't generate migrations any more.
Routes
Routes with ';' have been changed to use '/' as per edge Rails.
Permission System
Hobo.can_edit? can now handle feild names that end in '?'
Hobo Module
Hobo.models now skips files whos names don't look like models
(e.g. editor backup files)
Core Extensions:
Add: Enumerable#build_hash
(1..3).build_hash {|i| ["#{i} Xs", "X" * i]}
=> {"1 Xs"=>"X", "3 Xs"=>"XXX", "2 Xs"=>"XX"}
Add: Enumerable#map_hash
(1..5).map_hash { |x| x**2 }
=> {5=>25, 1=>1, 2=>4, 3=>9, 4=>16}
Add: Hash#-
{:a => 1, :b => 2} - [:a] #=> {:b = 2}
Add: Hash#&
{:a => 1, :b => 2} & [:a] #=> {:a = 2}
Documentation
Added contributed rdoc to Hobo::AuthenticatedUser (thanks!)
=== Release 0.5.3 ===
Core tags
Fix: <show> tag was broken - it wasn't displaying the surrounding
<span> or any associations
<show> now handles all kinds of Numeric types
DRYML
DRYML Build cache: reloading unchanged DRYML files in dev mode is
now *much* faster.
Model extensions
Fixes to the id_name feature
Hobo model controller
Fix: :permission_denied_response was not supported on several
actions
Hobo Rapid
Hobo::Rapid::TYPE_NAMES added - a hash that maps classes to names
(symbols) that are used when looking for an editor / form field for
a given type. Allows you to extend the <edit> tag to support your
own types.
=== Release 0.5.2 ===
Misuse of classify changed throughout to camelize. Bugs related to
certain model names fixed as a result.
Added Hobo::LazyHash. If a value is a proc, the proc is called on the
first access of that key, and the result of the proc becomes the
value. These are used in the new controller customisation mechanism.
Hobo Rapid
New ajax options reset_form and refocus_form for ajax forms. Default
is true
toggle: new function like Element.toggle in prototype (Hobo uses the
css class 'hidden' instead of an inline 'style' attribute.
In place editing: various fixes related to HTML/URL encoding.
New option 'fade' to delete button. Pass fade="#false" to supress
the fade effect.
<hobo_rapid_javascripts> now takes an attribute tiny_mce. Set to
true to enable TinyMCE support for html editors.
<hobo_rapid_javascripts> within the <page> tag now available as
inner-tag 'rapid_javascripts'. e.g. you can do
<page rapid_javascripts.tiny_mce="#true">
to enable TinyMCE support.
Removed helper current_user_in?
Editors now have a css class added automatically:
"<class>_<feild>_editor", e.g. "person_name_editor"
In place editors now wrap the content in a div if the editor will be
a textarea or an html editor (was a span).
All the buttons now have automatically added css classes like
"delete_person_button", "create_person_button".
create_button now uses any passed field values in the check for
create permission.
object form now has a css class added: either the model class name, or
"new_<class>"
New tag <remote_method_form> for calling remote methods with parameters, either with a traditional
Model Extensions
Fix to HasManyAssociation#new (didn't support parameters)
Added block queries to has_many associations,
e.g. post.comments.find { published = 1 }
MyModel[...] equivalent to MyModel.find(...) (Thanks to Jamis Buck's
tip on his blog)
New feature: defined scopes
Field types set by set_field_type are now inherited
Model#conditions { ... } generates an sql where clause from a query
block.
Fix to #subclass_associations with has_many :through
Method #changed_fields? to complement #same_fields?. Useful in
permission methods.
Integration test extensions
#visits now can now be given http get parameters
#deletes added: bob.deletes(some_object)
#calls_method added: bob.calls_method(object, some_method)
General extensions
#extract_options_from_args! added to Kernel
Object#is_a? extended to support multiple args:
if foo.is_a?(Symbol, String)
_why's metaid added to Object
Added Hash#map_hash. e.g. a new hash with all values incremented
by 1:
my_hash.map_hash {|k, v| v+1}
Controller extensions
redirect_to can be passed an object, equivalent to
redirect_to(object_url(x)), e.g.
redirect_to current_user.adverts
Model controllers
Removed customisation hooks, create_response,
invalid_create_response, update_response etc.
New mechanism for customising actions.
def create
hobo_create ...customisation args...
end
web_method, show_method, and publish_collection declarations are now
inherited.
Helpers
debug can now be passed multiple values you'd like to inspect
param_name_for now accepts a string as well as an array for the
field path, e.g. param_name_for(current_user, "account.name")
Core tags
object_link automatically adds a css class "<class>_link",
e.g. "person_link"
Changed default date formatting to to_s(:long) for dates and times.
New tag transpose_and_repeat, useful for those tables when you wish
HTML grouped cells by column instead of by row.
New tag if_blank
Permission system
Hobo::Undefined#undefined? renamed to hobo_undefined?
can_edit? now works better with boolean fields
can_call_<method>? renamed to <method>_callable_by?
DRYML
Fix: options to inner-tags were leaking through to the HTML output.
Debug feature -- if the <def> tag has an attribute
hobo_debug_source, the generated ERB source will be output to
logger.debug
Dryml now reports an error if a part name occurs more than once
Inner tag names can now be generated at runtime, this allows
e.g. the object_table tag to generate inner-tags on the fly for
every editor and label:
<object_table fields.name_editor.update="my_part" />
Go read that last one again - it's awesome
New rake tasks
environments.rake defines tasks like dev, prod, testing so you can
e.g.:
rake prod db:migrate
(thanks to err.the_blog IIRC)
=== Release 0.5.1 ===
Fix to model extensions: hobo_user_model generator could not complete
because an attempt to access the database before the table exists was
made.
=== Release 0.5 ===
Tabla theme
Changed some heading levels to be more logical - e.g. now use H2 and
H3 inside a panel instead of H1 and H2
Various CSS tweaks
<page>
Upgraded to use inner tags
No longer imports public/stylesheets/application.css by default -
can easily be added using inner-tags
<application_nav> and <application_logo> moved into the theme (were
in Rapid)
Frontpage generator
Page templates modified to use <:intro>, <:main> etc
hobo_rapid generator
--import-tags option will add two tags to application.dryml:
<taglib src="plugins/hobo/tags/rapid"/>
<set_theme name="default"/>
Plugin initialisation
Theme no longer set to default in hobo/init.rb. Instead use
<set_theme> in application.dryml
Core extentions
Enumerable#map_with_index
Ajax Mechanism
Render parameters (http parameters) are passed in as a hash of
requests with numeric keys rather than an array.
(e.g. render[1][id]=foo rather than render[][id]=foo
Hobo.ajaxRequest (javascript) now displays error messages in an
alert box. (Known issue: seems to show these twice for some reason)
In-place-editor support extended to allow other parts to be updated at
the same time.
Automatic mechanism for updating multiple displays of the same field
after an in-place-edit
In-place-editor for html fields will now use TinyMCE if installed
(integrated with Ajax.InPlaceEditor)
Select based ajax editor for numbers, suited for small ranges,
e.g. 1 to 10
Hobo.removeButton (javascript) now supports updating of other parts
along with the removal.
Dom attribute "model_id" renamed to "hobo_model_id"
Fix to Ajax.InPlaceEditor - no longer removes <p> tags
before_ajax hook. This method is called immediately before the ajax
response is performed. A chance for the controller to make extra
instance variabled available to the part methods.
If a custom JS function is specified for an ajax update
(render[...][function]=f), this name is no longer camelised - it is
called as-is.
The object (render[...][object]=...) is now allowed to be nil
In-place-editor fields now reset automatically to a preset message
when the field is blank (e.g. "click to edit")
Core helpers
Fix: object_url gives correct urls when the action is a web-method
(controller-name/id/method-name)
<show> will wrap the displayed content in a <span> with a
hobo_model_id. This enables the automatic update of multiple
displays of a field value after an ajax edit.
<show> uses the new type-system added to Hobo models. The main
benefit is that values that don't come directly from AR should
display without problem, and more types are supported (e.g. float)
<show> supports a format attribute for numbers:
<show attr="price" format="%.2f"/>
<show> will not display password attributes (e.g. in your model
set_field_type :password => :password)
New tags <show_belongs_to> and <show_has_many> can be overriden to
handle the way these relationships are displayed by <show>
display_name moved into core (was in Rapid, but is needed by <show>)
display_name uses <show>, so will wrap the name in a span with a
hobo_model_id
<repeat> supports an 'else' attribute, used when the collection is
empty.
Debug methods abort_with and debug are now helpers so they are
available from views as well as controllers.
User Authentication
Username validations are customisable - pass a block to
set_login_attr and do validations in there. Otherwise default
validations are used.
Hobo::Controller
hobo_ajax_reponse will use @this if no page context is passed
Module defined tags
Can provide a predicate as a block, e.g. to have a different nav bar onced logged in.
def_tag :nav, (proc {logged_in?}) do ...
def_tag :nav do ...
The tag with no predicate will always take precedence if no
predicate is true. If the proc has a single parameter, it is
passed the options hash.
DRYML
Changes to taglib cache system.
A list of known HTML tags is defined in lib/hobo/static_tags. These
are available as an array by calling Hobo.static_tags. Any tags
parsed that are not in here are compiled as method calls. Thus the
order of tag definitions is no longer as critical, making it easier
to split large taglibs into multiple files. As a result, tag modules
no longer need to track defined tags in a module variable.
XML comments now passed through to the generated HTML.
<set_theme> tag to set current theme. Was previously a configuration
variable. This way it is easier to change or disable the theme.
New feature - inner tags
<def> now supports alias_current attribute, e.g.
<def tag="page" alias_current="theme_page">
This overrides the current <page> definition and makes the old one
available as <theme_page>
<tagbody> supports obj= and attr= at the same time, as with regular
tag calls
Hobo models
New type system. This is the extended type system that allows you to
say, e.g. `set_field_type :intro => :html`. Previously this was
returned as a symbol from MyModel.field_type(:intro). The new system
uses wrapper types (simple subclasses of String), and modified your
model to return these. e.g.
MyModel.find(:first).intro.class => Hobo::HtmlString
There are similar types for textile, markdown, passwords, and text
(the text type just denotes a longer string, and is used for the
'text' sql type).
Hobo model controller
`show_method` renamed to `show_action`
New class method `publish_collection`. Any `has_many` collections
are published automatically. This method allows custom collections,
i.e. model methods that return arrays, to be published also.
create action for an STI base-class controller can now be used to
create subclass instances by passing the 'type' parameter.
update action enhanced to allow a full Hobo ajax-reponse (i.e. part
updates) after in-place-edits.
Controllers can define a `find_for_show` method to provide a custom
instance finder, e.g. a chance to perform eager loading.
Association actions now check for permission to view the association
owner
Model Queries
<field>_is predicates now work with belongs_to associations.
Hobo Rapid
rapid.dryml split up into rapid.dryml, rapid_pages.dryml
rapid_editing.dryml and rapid_navigation.dryml
New set of tags for creating navigation bars.
<no_break> tag replaces spaces with in entire content.
<edit> tag customisation - for form fields (i.e. new records), will
delegate to one of:
has_many_field
belongs_to_field
string_field
textarea_field
password_field
html_field
boolean_field
date_field
datetime_field
integer_field
float_field
Redfine these to customise forms throughout the app.
Similarly, editor fields (i.e. ajax fields for existing records)
use:
has_many_editor
belongs_to_editor
string_editor
textarea_editor
password_editor
html_editor
boolean_editor
datetime_editor
date_editor
integer_editor
float_editor
Redefine these to customise ajax editors throughout the app.
Note has_many_field and has_many_editor are just placeholders,
they are not implemented.
<update_button> supports a params attribute, to send extra params
along with the HTTP PUT.
<delete_button> now supports part updates and use of
Hobo.removeButton together. (i.e. you can have the fade effect and
also have other parts updated)
<object_form> does not create a hidden field for the STI 'type' field.
New feature - Composite models
Experimental new feature - mapping tags
New feature - Predicate dispatch modules
=== Release 0.4.3 ===
Front-controller now filters parameter logging so that passwords are
not logged.
Check if a controller is a Hobo model-controller before installing
Hobo routes.
DRYML
Can now use obj= and attr= on the same tag, so you can e.g.
<edit obj="#@this" attr="name"/>
(The alternative, <edit obj="@this.name"> would not work as
<edit> needs this_field which would be nil)
Shorthand obj="page" for obj="#@this"
Various fixes and enhancements to the permission system. Things are somewhat
experimental and subject to change!
Core tags/helpers
`viewable` method filters a collection down to objects that are
viewable.
Hobo Rapid:
<new_in_collection_page> now includes belongs_to associations in the
form.
Cleanup of form field / editor tags
<ul_for> and <table_for> now skip non-viewable objects
Fix: even/odd cycle in table_for and ul_for was broken with nested lists/tables.
Page navigation enhanced to allow URL query parameters to be
maintained from page to page.
<show_collection_page> now only includes a "New Whatever" link if
the collection is a "simple" has_many collection (no conditions, not
:through)
<object_link> now has a view attribute to link to alternate views of
the object (see below: alternate show pages)
<object_table>
Now allows additional rows to be added by giving a tag-body.
skip_fields attribute to remove fields from the table
Better support for confirmation dialogues in <delete_button>
Tabla theme:
Increased width to 800px;
Small style enhancements
Hobo Module
Fix to dom_id for objects in an array that is not an AR association
(e.g. an array returned by find(:all))
Support for alternative "show" pages. E.g. to add a "profile" page to a User, add
show_method :profile
To the UsersController and create
app/views/people/profile.dryml. You also get a named route
"user_profile" (e.g. you can call user_profile_url(fred) )
(Using Hobo Rapid you can link to these with <object_link view="profile"/>)
Fix to template lookup for association pages (e.g. posts/12/comments
and posts/12/comments/new)
Support for permission class methods (experimental). If you can define
permission without access to the object state, you can now do so on
the class:
def self.viewable_by(viewer, field)
false
end
This helps Hobo in places where there is no object. e.g. in deciding
whether or not to present a "New Whatsit" link
Fix: pagination was broken on index pages with data-filters.
Hobo::ModelController
Enhanced to allow updating of date and datetime fields. Dates and
date-times can be provided either as strings (Hobo will use Chronic
for parsing if it's installed) or hashes with :year, :month, :day
etc. keys (as used by the select_date helper).
find_by_data_filter renamed to find_with_data_filter and now does a
non-filtered find if no filters were given in the request.
Added count_with_data_filter
Fixes to checking create permission when the post parameters
contains related sub-objects.
Access to the new page is forbidden if the current user does not
have create permission.
Hobo::Model
New model queries <field>_starts and <field>_ends
The <field>_is query will now use an "IS NULL" query if you pass
nil.
Added support for counts with queries, e.g:
User.count { name_starts 't' }
Calling `new` on a has_many association (e.g. post.comments.new) has
enhanced behaviour for new records (those not in the db). Hobo will
try to set up the reciprocal belongs_to association on the created
object. This is needed by the permission system when testing
can_create?
#reverse_reflection will attempt to find the reciprocal belongs_to
association from a has_many association.
Ajax mechanism
Fix when using multiple instances of the same part on the same page
(i.e. when a part_id attribute appears in a loop).
Fix when the this_field for the part context is an array index.
Chronic fix to handle dates like "11th Jan" (it can handle "Jan 11th"
and "11 Jan" but not "11th Jan")
New feature - Integration testing DSL. Adds an easy to use DSL for
integration tests.
Fix: search page in IE
=== Release 0.4.2 ===
Fix in permission system
=== Release 0.4.1 ===
New feature: "web-methods" -- RPC style actions in model-controllers. Including
support for ajax responses.
New named route "home" to FrontController#index
Hobo Rapid:
Renamed <object_small> to <object_card>
Added support for ajax responses to web-methods
Removed <possessive> (too app specific)
<object_link> now passes extra options to the generated <a> tag
(e.g. class, id)
Extra options to <edit> are now passed on to the delegate.
Naming of edit controls reworked. <editor> is an ajax editor,
<form_field> is a non-ajax form field, <edit> chooses automatically
between the two. Other tags renamed too -
e.g. <in_place_edit_for_boolean> renamed to
<boolean_checkbox_editor>
Support for datetime and date selects in form fields (not editors)
Added autosubmit option to autocompleters - submits the form as soon
as an option is selected.
Added confirm option to ajax_updater (wraps call in a JS confirm
dialogue)
More data types supported by <editor> (formerly in_place_edit)
New tag <belongs_to_editor>. Currently just delegates to
<belongs_to_menu_editor> but is intended to switch to an
autocompleter if there are too many options for a menu.
New css classes create_button, update_button, delete_button added to
button tags.
Image attribute for delete_button for <input type="image">
buttons. Needs implementing on the other buttons (or maybe we should
be using css styling only!)
New tag: <remote_method_button>
<object_form> updated to only add hidden tags for fields that don't
appear in the form.
hobo_rapid.js
Fix: in-place-edit controls were displaying the JavaScript source of
an alert message after a validation error.
Support for ajax responses to RPC actions.
Fix in Hobo.ajaxRequest when no `method` option was given.
Hobo.applyEvents can now be given an element or a DOM ID.
Hobo.removeButton: changed duration of Fade effect
Fix in objectElementFor
Re-enabled applyEvents in Hobo.updateElement
Tabla theme
Various CSS refinements
Added account_nav attribute to <page>
Added class attribute to page - applied to body tag
Disable account nav if no `login_url` route exists
hobo_user_model generator
Migration
Changed `login` column to `username`.
Changed to use Hobo migration syntax
Model: Uses new `set_login_attr`
Plugin initialiser (init.rb)
Fixed problem with ordering of requires
Eliminated code to load all models at startup (now done on demand in Hobo module)
This reduces the footprint of Hobo, e.g. for apps that want only DRYML.
ActiveRecord extensions
Added HasManyAssociation#new_without_appending. Creates a model with
the correct belongs_to association but doesn't add it to the
array. Needed for the permission system.
Added #member_class to HasManyAssociation and
HasManyThroughAssociation - convenience method for
proxy_reflection.klass
General Ruby extensions
Renamed is_in? to in? to conform with ruby-extensions project.
Added Module#inheriting_attr_accessor. Creates an attribute accessor
that looks in the superclass if the attribute does not exist on
self. Should be used on classes (e.g. inside class << self)
User Authentication
The user model can now override the class-method
`password_validations` to customise those.
Virtual fields `password` and `password_confirmation` now declared
with field type :password. Hobo Rapid will now generate
password-edit fields for these.
Column used for the user-name is now declared by the user-model
class, e.g.
class User; set_login_attr :email; end
Extracted acts_as_authenticated controller extensions into
Hobo::AuthenticationSupport (was in Hobo::Controller)
Hobo will manage a last_login_at datetime if such a column exists on
the user model.
Site-wide search
Added message when no results found
Remove objects from results that are not viewable by the current_user
Hobo Controller
Fix: render_tags - hoboParts JavaScript was rendered multiple times
Ajax mechanism updated to support RPC actions.
Core tags & DRYML helpers
Fix: per-request cache of current_user was not working
Fix: can_update? was broken
Fix: can_view_this? handles non-ActiveRecord objects better
can_view_this? delegates to can_view if this_parent or this_field
is null (previously an error).
Fix: tag_for_object was broken
<show> supports more field types
<repeat> now sets the model_id attribute on the repeated element.
new conditions <unless_blank>, <unless_empty>, <if_can_edit>
add_classes split into two methods, one that modifies the hash
(add_classes!) and one that generates a new one (add_classes)
Made the new object optional on can_update
Added a style attribute to <human_type> can be any string method,
e.g. pluralize, downcase etc.
DRYML
Form fields that appear within a DRYML form context are now tracked,
so that hidden fields can be automatically added for just those
fields that do not appear in the form.
Renamed instance variable to current context to @_this. Was clashing
with @this page context.
Fix: this_type was failing to default to this.class when using the
obj="" attribute
Renamed method _part_context_js to part_context_js
Model Extensions (hobo_model)
Renamed set_fields_types to set_field_type
Added set_search_columns declaration as a shorthand alternative to
defining class method search_columns. e.g.
class Foo < ActiveRecord::Base
hobo_model
set_search_columns :content, :notes
end
An id_name with the :underscore option no longer returns the name
with underscores by default. By default you get the name as it is in
the DB, if you call id_name(true) you get it with underscores
instead of spaces (e.g. for use in URLs).
Added Hobo::Model.set_default_order e.g.
class User < ActiveRecord::Base
set_default_order "name"
end
To use: User.find(:all, :order => :default). Default order is used
by the hobo_model_controller
Model Controller
Fix: show-collection action (e.g. post/12/comments) now uniquifies
the collection if the :uniq option was given on the has_many
declaration.
hobo_render now allows the template to be looked for in other
classes (e.g. in app/views/other_class)
Added web_method declaration for RPC-style actions. e.g.
class Users < ApplicationController
web_method :reset_password
def reset_password
new_pw = @this.reset_password
hobo_ajax_response(@this, :password => new_pw)
end
end
show action now calls permission_denied unless the current user can
view the object.
Added customisation hooks create_response, update_response,
destroy_response. And for invalid records: invalid_create_response,
and invalid_update_response. The default response will only happen
if these methods don't do a render or a redirect.
Added before filter to prepare for a web_method
Template lookup path changed for
collections. e.g. /posts/12/comments will now fallback on
app/vews/comments/show_in_collection and /posts/12/comments/12 will
fallback on app/views/comments/new_in_collection
index action respects the model's default_order
Model Queries
Renamed predicate in_association to is_in
Added predicate not_in
Added support for model-defined predicates. Any predicate not found
will be looked up on the model class.
Hobo module
Removed guest_user attribute
Hobo.models now loads all model classes on demand the first time it
is called.
Removed parentheses from query in find_by_search (SQLite
compatibility)
add_routes now adds routes for web methods
can_create? uses new_without_appending when passed a has_many
association to check if the user is allowed to create an object in
that collection.
can_edit? returns false for polymorphic associations (for now!)
can_view? can now handle AR classes (can view instances of this
class?) and associations (can view items in this association?)
Added can_call? permission method for web-methods
Added Rakefile with rdoc task