El Viernes, 7 de noviembre de 2014 22:15:12 Jeff Surrett escribió:
> I am trying to create a customized view with a couple of related embedded
> active_scaffold areas. I have a family controller and have added an action
> link:
> config.action_links.member.batch do |group|
> group.name = :'member_actions.macros.menu'
> group.add :tuition_detail, label: :set_tuition, position: :after
> group.add(
>
> :detail_view,
>
> label: :detail_view,
> inline: false,
> page: true
> )
> end
>
> The method is:
>
> def detail_view
> @family = Family.find(params[:id])
> end
>
> The relevant route is:
>
> resources :families do
> as_routes
> get :detail_view, on: :member
> end
>
> The view contains:
> <%= render :active_scaffold => 'family_billing_details',
> constraints: { family: @family.id } %>
>
> When I click the action link, active_scaffold renders one row with no
> header, footer, etc.
You should post log of requests to detail_view action and embedded scaffold.
>
> It seems that the active_scaffold-3.4.8/lib/active_scaffold/actions/list.rb
> index method is not detecting if it should just print a row or a full list.
> def index
> if params[:id] && !params[:id].is_a?(Array) && request.xhr?
> row
> else
> list
> end
> end
>
> Should the last part (request.xhr?) be false? Since I have set page: true,
> and inline: false, shouldn't the request.xhr? evaluate to false, making the
> whole if statement false and rendering the list?
> I can get it to render properly with the following changes to the route and
> method entering the url directly
> (http://localhost:3000/families/1/detail_view). But then, the families
> index won't work (ActionView::Template::Error (No route matches
> {:action=>"detail_view", :controller=>"families", :id=>"--ID--"}): I want
> the link to appear on each member but I want the view to be able to have
> the complete embedded active_scaffold.
>
> resources :families do
> as_routes
> get :detail_view
> end
>
> def detail_view
> @family = Family.find(params[:family_id])
> end
>
> Am I doing something wrong, is this not possible, is there a bug?
If family has_many detail_views you could try using nested.add_link:
config.nested.add_link :detail_view, label: :detail_view, page: true,
action_group:
'member.batch'
>
> Using:
> ruby 2.1.2
> rails 4.1.7
> active_scaffold 3.4.8
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.