Hi Dennis
You should be able to get the edit link from active_scaffold_config:
active_scaffold_config.action_links[:edit]
And the record should be in @record variable.
Then you can add to your view:
<%= render_action_link(active_scaffold_config.action_links[:edit], @record,
authorized: true) %>
It will work if you opened the show action with JS, below the row on the table
list. If you opened the show action with the page: true setting in show
action_link, or clicking open in new path, I think the JS won't work to
display the row, as I think it looks for the row.
Other way would be mimic the html generated by the AS helper,
render_action_link:
<%= link_to "(Edit SubTDN)", edit_sub_tdn_path(adapter:
'_list_inline_adapter'), class: "button as_action", data: {position: :after},
remote: true %>
Regards
El domingo, 2 de abril de 2023 6:33:16 (CEST) Dennis Bulgatz escribió:
> HI Sergio,
>
> I was not able to understand what you meant below.
>
> In my view, I currently have this call to render a show HTML link:
> <%= link_to "(Edit SubTDN)", edit_sub_tdn_path(adapter:
> '_list_inline_adapter'), class: "button" %>
>
> Not sure what object I’d pass for a link in render_action_link(link, record,
> :authorized => true).
>
> I could not find the API call “display_link_in_show?” you mentioned. Could
> you possibly send a git link? I was looking
> here<https://www.rubydoc.info/gems/active_scaffold_san/ActiveScaffold/Helpe
> rs/ViewHelpers#get_action_link_id-instance_method>.
>
> As an aside, do you have a “demo” AS application you use for testing that
> has many of the controller config options in use, and helpers etc.?
>
> Thanks
>
> Dennis
>
> From: Sergio Cambra <[email protected]>
> Date: Friday, March 24, 2023 at 3:45 AM
> To: ActiveScaffold : Ruby on Rails Gem <[email protected]>
> Cc: Dennis Bulgatz <[email protected]>
> Subject: Re: Creating an "Edit' link back to AS edit form (JS, not HTML)
> Hi Dennis
>
> ActiveScaffold has a setting to show all the actions (same actions displayed
> in the row) on the show action, when open on a page, not inline. It's the
> partial _show_actions.html.erb, called in show.html.erb. There is a helper
> method that you can override to control what links are displayed,
> display_link_in_show? (link, position). You can check it to see how it
> works, but you can't use it in your custom view, as it renders the links to
> load as HTML, not as JS.
>
> You could be just get the link from active_scaffold_config.action_links, and
> render it with render_action_link(link, record, :authorized => true). If
> you want to check if link is authorized, you can use
> action_link_authorized?(link, record)[0].
>
> Regards
>
> El jueves, 23 de marzo de 2023 16:55:17 (CET) Dennis Bulgatz escribió:
> > Hi Sergio,
> >
> > I have created a custom show template, and would like to provide a link on
> > the show template to edit the record.
> >
> > I am using TinyMCE, so for the edit link to work properly, it must be
> > "processed as JS"
> >
> > Using the "Edit Action" from a list view
> > Started GET "/sub_tdns/6/edit?adapter=_list_inline_adapter" for ::1 at
> > 2023-03-23 10:47:58 -0500
> > Processing by SubTdnsController#edit as JS
> >
> >
> > Using a link from a helper: link_to "Edit SubTDN",
> > edit_sub_tdn_path(adapter: '_list_inline_adapter')N, class: "button"
> > Started GET "/sub_tdns/5/edit?adapter=_list_inline_adapter" for ::1 at
> > 2023-03-23 10:48:50 -0500
> > Processing by SubTdnsController#edit as HTML
> >
> > Possible to use a link_to helper and get the same edit "form" (using JS
> > and
> > TinyMCE working) that the "edit" button in the list view renders?
> >
> > Assume it might be needed to do this with a custom action in the
> > controller? If so, what would that look like?
> >
> > Thanks!
> >
> > Dennis
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/activescaffold/2295836.ElGaqSPkdT%40pc-sergio.