luizpicolo / rails_admin_content_builder

:eyes: Easy way for create contents using rails_admin
MIT License
20 stars 5 forks source link

Link form the model #3

Open luizpicolo opened 7 years ago

luizpicolo commented 7 years ago

The link to the news should be modified as the user's needs. Today the link is fixed by the name of 'noticias', but it could be anything, 'Blog', "Texts". We should have a way so that the route could follow the name defined in the model. Example:

If model is Blog

element += '<a href="/blog/' + ui.item.content_builder_category.slug + '/' + ui.item.slug + '" class="cb-relational__link" target="blank"></a>';

if model is Text

element += '<a href="/texts/' + ui.item.content_builder_category.slug + '/' + ui.item.slug + '" class="cb-relational__link" target="blank"></a>';

of course, all dynamically without changing the name manually https://github.com/luizpicolo/rails_admin_content_builder/blob/master/app/assets/javascripts/rails_admin/content_builder.js.erb#L468

DearGrenadier commented 7 years ago

I'll try, if you don't mind

luizpicolo commented 7 years ago

Hey my friend @dimanazarchuk, go ahead 👍