Trouble with generating IDs for in-place editor for a rich type.

31 views
Skip to first unread message

paulj...@gmail.com

unread,
Feb 23, 2012, 6:15:37 PM2/23/12
to hobo...@googlegroups.com
I am trying to add a rich type for a four-digit year and provide an in-place editor for it.

The problem I am having is that the editor never activates, apparently because an ID is not generated.

The type definition is very simple:

class NthpYear < Integer

  COLUMN_TYPE = :integer

  HoboFields.register_type(:nthp_year, self)

  def validate
    "Your entry for year is too long: It must have four digits" if length > 4
    "Your entry for year is too short: It must have four digits" if length < 4
  end

  def format
    self
  end

  def to_html(xmldoctype = true)
    self
  end

end

The editor definition is just:

    <def tag="editor" for="nthp_year"><%= in_place_editor(attributes, this) %></def>

The DRYML for the form looks like this, for the two relevant variants of question_type:

(the section that generates a working editor)

<div part="tc" id="tc-#{typed_id}" if="&this.question.question_type.name == 'short_text' || this.question.question_type.name == 'long_text' ">
<b>Enter text:</b> <editor:response_data update="tc-#{typed_id}"/>
<br/>
/div>

(this section generates an editor lacking an id, so it never activates)
<div part="ny" id="ny-#{typed_id}" if="&this.question.question_type.name == 'nthp_year'">
<b>Enter the year:</b> <editor:response_year update="ny-#{typed_id}"/>
<br/>
</div>

And the generated HTML sections are:

(working editor with id)

<div class="text response_response_data editor in-place-edit model::response:53:response-data update::tc-response:53 view response-response-data " hobo-blank-message="(click to edit)" hobo-edit-text="test edited" id="uid1" title="Click to edit">test edited</div>

(non-activating editor, lacking id)

<span class="nthp_year response_response_year editor in-place-edit model::response:54:response-year update::ny-response:54 view response-response-year " hobo-blank-message="(click to edit)">(click to edit)</span>

Any insight into errors in my DRYML, type, or editor definitions, so I can get my editor working?

Thanks!

    

paulj...@gmail.com

unread,
Feb 23, 2012, 6:16:51 PM2/23/12
to hobo...@googlegroups.com
Also - forgot to note - I wonder if it is clue that the working version generates a div, but the broken one generates a span.

Thanks for any thoughts.

paulj...@gmail.com

unread,
Feb 27, 2012, 11:30:06 PM2/27/12
to hobo...@googlegroups.com
I am still hoping for some help on this issue.

Can I add any info to this? Should I put it in a different format?

Is there a reason why I am not getting any response to this?

Thanks for any help.

Matt Jones

unread,
Feb 28, 2012, 12:08:48 AM2/28/12
to hobo...@googlegroups.com

Do you have a <view> tag defined for NthpYear? The in_place_editor tag uses that, and I'm not sure where else the <span> could be coming from.

--Matt Jones

paulj...@gmail.com

unread,
Feb 28, 2012, 1:30:27 PM2/28/12
to hobo...@googlegroups.com
I don't have a view defined. I will give it a try.

Thank you very much, Matt!

On Monday, February 27, 2012 9:08:48 PM UTC-8, Matt jones wrote:
Reply all
Reply to author
Forward
0 new messages