Skip to content
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

Open
wants to merge 7 commits into
base: v6
Choose a base branch
from
Open

Richard/eco 63 #346

wants to merge 7 commits into from

Conversation

ricardoo27
Copy link
Contributor

Přidán concern Clonable umožňující vytvořit duplikát stránky a článku.

@mreq mreq changed the base branch from master to v6 November 28, 2024 08:44
date: Date.today.strftime("%d. %m. %Y"))
render :new
end

Copy link
Member

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) },
},
Copy link
Member

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: {
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

@ricardoo27
Copy link
Contributor Author

Pushnul jsem upravenou verzi. Prosím o review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants