On Lunes, 30 de Noviembre de 2009 20:25:01 Mat escribió:
> Fixed #1 by making a virtual attribute in my model that lets you set
> or read the long version. (Another post of yours Sergio was helpful,
> about including the virtual attribute in the columns so AS can detect
> it's there).
>
> This isn't a good solution for the currency field though as all the
> currency formatting code lives in Rails. I'd hate to have to cut/paste
> all that into a model... Any thoughts on how to do inline editing of
> formatted numbers & currency?

Currently you can use form_ui :i18n_number or :currency. I'm working in 
support localized numbers and numbers with dot separator for decimals. For 
example with spanish locale you could enter:
1,12 => 1.12
1.345,12 => 1345.12
1.345.120 => 1345120
1.12 => 1.12 (english format)
1.345 => 1345 (it can't recognize as english format becuase current locale has 
more precedence)

>
> M.
>
> On Nov 30, 11:31 am, Mat <[email protected]> wrote:
> > I can't use the built-in functionality if I have to process the column
> > in someway to display it. Examples:
> >
> > (1) Column contains 'locale'. There are only a few lcoales, i.e. not
> > enough to warrant an association. The column stores values like 'en',
> > 'it', and 'es' but I need to display to the user 'English', 'Italian',
> > 'Spanish'
> >
> > (2) Column contains a monetary value the formatting of which will vary
> > according to the locale. Column stores values like 1.5, 2.5, 350.50
> > but I need to display them to the user as "$1.50", "€2,50" and "351¥"
> >
> > A nasty hack is to edit Active Scaffold code so it checks for the
> > presence of inplace_edit before it checks for an override so
> > inplace_edit takes precendence but this could have some nasty
> > effects.
> >
> > It also means that when I format a currency field the currency
> > formatting (¥ € and ,) appear in the edit box and can cause a problem
> > when the user presses 'DONE'.
> >
> > On Nov 26, 4:53 am, "Sergio Cambra .:: entreCables S.L. ::."
> >
> > <[email protected]> wrote:
> > > On Miércoles, 25 de Noviembre de 2009 16:17:08 Mat escribió:
> > > > Thanks Volker, that was helpful. I spent yesterday afternoon patching
> > > > inplace_edit to support :select as well as :usa_states and found the
> > > > secret hidden javascript code in the column headers. I'll submit a
> > > > patch once I've got some tests and peer reviews done.
> > >
> > > Form_ui :select and :usa_states are working here both with inplace_edit
> > > true and :ajax. All you need is to set the form_ui and inplace_edit
> > > attributes: config.columns[:state].form_ui = :usa_state
> > > config.columns[:state].inplace_edit = true
> > >
> > > > Cheers
> > > >
> > > > M.
> > > >
> > > > On Nov 24, 3:32 pm, "[email protected]"
> > > >
> > > > <[email protected]> wrote:
> > > > > Hi,
> > > > >
> > > > > There are two different flavours of inplace_edit.
> > > > >
> > > > > inplace_edit = :ajax
> > > > > When clicking inplace edit link server is asked to send
> > > > > corresponding input form. Might be used for Recordselect,
> > > > > Multiselect, dynamic data, ...
> > > > >
> > > > > inplace_edit = true
> > > > > When clicking inplace edit link input form will be copied from a
> > > > > hidden template without server interaction. Might be used for
> > > > > boolean, static select, calendar_date_select,....
> > > > >
> > > > > You just have to pick the right strategy for your specific
> > > > > attribute. :-)
> > > > > number should be inplace_edit = true
> > > > > select might be both:
> > > > > lookup tables, static selects => true
> > > > > dynamic select options => ajax
> > > > >
> > > > > --
> > > > > Volker
> > > > >
> > > > > On Nov 24, 10:00 pm, Mat <[email protected]> wrote:
> > > > > > The API docs say this about inplace_edit:
> > > > > > > Since v2.3:
> > > > > > >
> > > > > > > For columns with form_ui or form override, it will copy the
> > > > > > > fields from a hidden template in the column header instead of
> > > > > > > use the default InPlaceEditor.
> > > > > > >
> > > > > > > If inplace_edit is set to :ajax, an AJAX request will be made
> > > > > > > to get the field, that option is needed for in place editing
> > > > > > > with RecordSelect.
> > > > > >
> > > > > > What is the 'hidden template in the column header' and how do I
> > > > > > access it? What does "an AJAX request will be made to get the
> > > > > > field, that option is needed for in place editing with
> > > > > > RecordSelect" mean?
> > > > > >
> > > > > > I'm trying to add support for inplace editing for :select and
> > > > > > currency fields but having some trouble figuring out what's
> > > > > > already here. Any pointers would be appreciated.
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > M.
> > > >
> > > > --
> > > >
> > > > You received this message because you are subscribed to the Google
> > > > Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this
> > > > group, send email to [email protected]. To unsubscribe
> > > > from this group, send email to
> > > > [email protected]. For more options, visit
> > > > this group at
> > > >http://groups.google.com/group/activescaffold?hl=en.
> > >
> > > --
> > > Sergio Cambra .:: entreCables S.L. ::.
> > > Mariana Pineda 23, 50.018 Zaragoza
> > > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send
> email to [email protected]. To unsubscribe from this group,
> send email to [email protected]. For more
> options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

--

You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.


Reply via email to