-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Richard/eco 63 #346
base: v6
Are you sure you want to change the base?
Richard/eco 63 #346
Conversation
date: Date.today.strftime("%d. %m. %Y")) | ||
render :new | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prosim do app/controllers/concerns/folio/console/default_actions.rb
, ne jen pro pages
name: :clone, | ||
icon: :plus_circle_multiple_outline, | ||
url: -> (record) { through_aware_console_url_for(record, action: :clone, safe: true) }, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jeste prosim upravme patricne cancancan, aby se pocitalo s clone
akci
@@ -35,6 +35,11 @@ def default_actions | |||
icon: :edit_box, | |||
url: -> (record) { through_aware_console_url_for(record, action: :edit, safe: true) }, | |||
}, | |||
clone: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
podle nejake tridni metody bych to zaroven pridal pro patricne tridy do default_actions
actions(:edit, :destroy) | ||
end | ||
|
||
transportable_dropdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nemelo by byt pri zmene default_actions
potreba prepisovat
puts "[CLONING] #{message}" | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moc se mi nelibi, ze je to cele jako concern na model. Pridava to strasne moc metod vcetne log
a nejakych dalsich, ktere jsou dost obecne nazvane.
Predstovoval bych si to jako concern, ktery prida neco jako self.is_clonable?
true / false a clone
metody. clone
by pak uz melo pracovat skrze vlastni tridu podobne jako napr. https://github.com/sinfin/folio/blob/v6/app/lib/folio/transportable/exporter.rb a jen vratit novy neulozeny zaznam.
Zaroven by to melo fungovat vice magicky a pro vsechny zaznamy (dejme to na Folio::ApplicationRecord
a cele to v default_actions
zapinejme pres Rails app config klic), lze pouzit reflect_on_all_associations
a spis nez whitelistovat naopak blacklistovat per-model pres nejakou self.metodu
, co nechci kopirovat. A pak pridat jeste nejaky volitelny callback na model zase jako tridni metodu.
Pushnul jsem upravenou verzi. Prosím o review. |
Přidán concern Clonable umožňující vytvořit duplikát stránky a článku.