[Nitro] TextArea and DateTime controls

Jonathan Buch john at oxyliquit.de
Mon Apr 9 03:20:24 EDT 2007


Hi,

> 1) The DateTime control ( raw/lib/raw/view/control/attribute/datetime.rb
> ) is not implemented.  If I'm feeling ambitious and have the time, does
> anyone have ideas on how they'd like to see it implemented, or are there
> partial implementations laying around just waiting to be finished?

A DateTime control would be very nice (to go with a DateTime aware Og DB type).
(I have implementation of that here, just not for mysql/sqlite)

What I'd rather see instead of 3+ fields (year, month, day, hour, minute),
.. I think it'd be nicer to have a single field... Or only 2, one date,
one time.

I find multi-fields more difficult to handle from the backend and less
pleasent to look at..

Sidenote:

George, I see you had removed the custom POST param parsing code.  Was there
anything wrong with it?

> 2) I've specified a textarea control for one of the attributes of a model:
>
>      attr_accessor :content, String, :control => :textarea
>
> How do I modify that to set row and col attributes for the textarea?

You modify either per CSS, or per overriding the control.

Raw::TextareaControl.style = 'width:....'

Or:

class Raw::TextareaControl < Raw::AttributeControl
   setting :rowcols, :default => nil, :doc => 'Define Rows and Cols'

   def render
   %{
   #{emit_label}
   <textarea id="#{control_id}" name="#{@attribute}"#{emit_style}#{emit_disabled}#{self.class.rowcols}>#{@object.send(@attribute)}</textarea>
   }
   end

end

Raw::TextareaControl.rowcols = 'cols="50" rows="10"'

> And one random idea:
>
> Someone sent me a link to a utility that compiles rails apps to native
> UI applications:
>
> I can envision doing the same thing with Nitro.   Assuming there existed
> a parallel set of controls that generates native UI components instead
> of HTML, it'd be neat if there were some global switch that could be
> flipped to switch between the two.

Well, Nitro can deliver any type of document, you just have to modify the
compiler pipeline if you don't want the templating.  And you also could
use the templates to generate... well, xml? for the user interface.

Just the 'delivering' the the app would be the problem, if it doesn't use
http then Nitro is definitly the wrong tool (right now).

Jo

-- 
Feel the love
http://pinkjuice.com/pics/ruby.png


More information about the Nitro-general mailing list