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 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)
will wrap the displayed content in a with a
hobo_model_id. This enables the automatic update of multiple
displays of a field value after an ajax edit.
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)
supports a format attribute for numbers:
will not display password attributes (e.g. in your model
set_field_type :password => :password)
New tags and can be overriden to
handle the way these relationships are displayed by
display_name moved into core (was in Rapid, but is needed by )
display_name uses , so will wrap the name in a span with a
hobo_model_id
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.
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
now supports alias_current attribute, e.g.
This overrides the current definition and makes the old one
available as
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
_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.
tag replaces spaces with in entire content.
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.
supports a params attribute, to send extra params
along with the HTTP PUT.
now supports part updates and use of
Hobo.removeButton together. (i.e. you can have the fade effect and
also have other parts updated)
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.
(The alternative, would not work as
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:
now includes belongs_to associations in the
form.
Cleanup of form field / editor tags
and 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.
now only includes a "New Whatever" link if
the collection is a "simple" has_many collection (no conditions, not
:through)
now has a view attribute to link to alternate views of
the object (see below: alternate show pages)
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
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 )
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 _starts and _ends
The _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 to
Added support for ajax responses to web-methods
Removed (too app specific)
now passes extra options to the generated tag
(e.g. class, id)
Extra options to are now passed on to the delegate.
Naming of edit controls reworked. is an ajax editor,
is a non-ajax form field, chooses automatically
between the two. Other tags renamed too -
e.g. renamed to
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 (formerly in_place_edit)
New tag . Currently just delegates to
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
buttons. Needs implementing on the other buttons (or maybe we should
be using css styling only!)
New tag:
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
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
supports more field types
now sets the model_id attribute on the repeated element.
new conditions , ,
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 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