Problem 1: fixed, so bundle update hobo-jquery.
The other two only apply to new actions, not to edit's. So the short
answer is "don't use select-one-or-new-dialog on new items."
Problem 2:
On a new action, Hobo cannot resurrect the context from the database,
so it just uses whatever 'this' the controller is spitting out. For
class Story
hobo_model
fields do
name :string
end
belongs_to :story_status
# plus permissions, etc...
end
app/views/stories/new.dryml:
<new-page>
<field-list:>
<story-status-view:>
<select-one-or-new-dialog/>
</story-status-view:>
</field-list:>
</new-page>
The initial action is Story#new, but select-one-or-new-dialog posts to
StoryStatus#create. You can fix this by fiddling with the
controller:
app/controllers/story_statuses_controller.rb:
class StoryStatusesController < ApplicationController
def create
hobo_create do
if request.xhr?
self.this = Story.new
end
end
end
end
You'd think this would break Story#edit, but it doesn't because Hobo
ignores self.this when it can resurrect the story from the database.
Problem 3: The above works in Hobo 1.0, but not in Hobo 1.3.
If you look at the console in Hobo 1.0, it will say:
> Call part: select_one_or_new_dialog_select. this-id = this:city, locals = []
> : form_field_path = ["property", "city"]
Hobo 1.3 says:
> Call part: select_one_or_new_dialog_select. this-id = :city, locals = []
> : form_field_path = ["property", "city"]
I'm still looking into the 3rd problem.
Bryan
On Wed, Jun 29, 2011 at 2:26 PM, kevinpfromnm <kevinp...@gmail.com> wrote:
> Trying to do a select-one-or-new-dialog in Hobo 1.3.0.RC with rails 3.0.9
> and the form comes up and on clicking OK, nothing appears to happen. the
> new item does get created but looking in the console I get an invalid
> typed-id error.
>
> Call part: select_one_or_new_dialog_select. this-id = :city, locals = []
> : form_field_path = ["property", "city"]
> Completed 500 Internal Server Error in 600ms
>
> ArgumentError (invalid typed-id: :city):
>
Bryan
http://jqueryui.com/demos/dialog/#option-position
Try this:
<select-one-or-new-dialog>
<hjq-dialog: position="center"/>
</select-one-or-new-dialog>
Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/ply_Q8Y9E7sJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
>
cheers,
Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/g_gyKKJAtlEJ.
So you can either specify all of the inner content:
<def tag="input" for="Material">
<select-one include-none="&false"/>
<formlet merge>
<field-list fields="name"/>
<hjq-submit/>
<or-cancel/>
</formlet>
</def>
Or you can copy the appropriate form definition from forms.dryml into
application.dryml, and replace "form" with "formlet".
Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/1WTA9z1poecJ.