[Nitro] Re: fixed boolean
Michael Neumann
mneumann at ntecs.de
Thu Jan 27 11:29:38 EST 2005
George Moschovitis wrote:
>>Could you give a little example on how you generate just a session-id?
>
>
> Sure:
>
> # Calculates a unique id.
> #
> # The session id must be unique, a monotonically
> # increasing function like time is appropriate. Random
> # may produce equal ids? add a prefix (SALT) to stop
> # hackers from creating session_ids.
>
> def create_id
> now = Time.now
> md5 = Digest::MD5.new
> md5.update(now.to_s)
> md5.update(now.usec.to_s)
> md5.update(rand(0).to_s)
> md5.update(Session.session_id_salt)
> md5.hexdigest
> end
Thanks. Will use this as default session-id generator until I include ISAAC.
>>I've now taken a look at your FormBuilder. How exactly can I define
>>those meta-attributes? I saw, you use meta[:ui] == :textarea...
>>Ah sorry, I found it already myself:
>>
>> prop_accessor :attr, :ui => :textarea
>>
>>will do.
>
>
> As you can see the FormBuilder is under construction, If you have any
> good ideas, let me know :) I do have some cool ideas for this, you
> will see in Nitro 0.10.0 :)
Mine is called OgScaffolder::Editor. I factored the rendering into
following methods:
* render (top level)
-> calls render_property for each property
-> then calls render_buttons
* render_property
-> calls render_label
-> then calls depending on the property type one of
render_numeric, render_string, render_bool etc.
This makes it easier to customize layout. My editor also does not render
a <form> tag, this can be done by adding a FormDecoration to the
component. The advantage: You can put as many Editors on a page as you
like, and when you hit a button, you don't loose what you entered in the
other forms. If you click Save or Cancel, my editor returns (answers),
so that you can use it like this:
def show_editor
call Editor.new(Customer.new), :on_answer
end
def on_answer(res)
...
end
Of course you can use it without using #call. But then you have to wrap
it with a AnswerDecoration.
Then I'll have a OgScaffolder::ListView which shows multiple
domain-objects in a table.
Regards,
Michael
More information about the Nitro-general
mailing list