On Miércoles, 16 de Septiembre de 2009 06:52:51 alexp escribió:
> I'm quite young in programming so please forgive my ignorance if I
> missed something here.
>
> I'm pondering to get rid of AS due to lots of issues with constraints,
> and limitations. I know that alof of work has gone into this but the
> thought process behind it doesnt add up. Some things are possible for
> only certain CRUD methods when you expect them to be available for all
> CRUD methods, espcially the labelling/descriptions, and constraints.
>
> I have 25 columns, so I have to make abbreviations for the labels I
> set the following e.g.
>
> config.columns[:attack].label = "AT" (works in LIST)
> config.columns[:attack].description = "Attack" (UPDATE / CREATE)
>
> but this doesnt work for a standard SHOW method as it defaults to the
> label, so description is not being used in the show method. I prefer
> not to have to make 100+ versions of the rhtml files as overrides
> needed for my 100 entities, hence pref to get AS to do this
You don't need so many versions, you only need to put your override in a
views/active_scaffold_overrides directory.
Copy frontends/default/views/_show_columns.html.erb to
app/views/active_scaffold_overrides and modify it as you want.
>
> I've tried
> path = ActionController::Routing::Routes.recognize_path request.env
> ['PATH_INFO']
>
> :current_action = path[:action]
>
It's simpler, use action_name method of controller.
> I can then call this in my controller to redefine labels accordingly
> e.g.
> if :current_action =='index'
> config.columns[:attack].label = "AT"
> else
> config.columns[:attack].label = "Attack"
> end
>
> but the AJAX call updates after the 1 time per page load with the
> correct labels, hence the labels are out ot sync with the list and
> show mode.
Set that code in a method and add a before_filter for it.
def set_labels
if %(new create edit update show).include? action_name
config.columns[:attack].label = 'Attack'
else
config.columns[:attack].label = 'AT'
end
end
Check index or list action is more complex, due to pagination, but maybe you
can try with %w(index list update_table)
--
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
-~----------~----~----~----~------~----~------~--~---