How to allow users to edit dynamic slim page templates in production for rails 4? -


essentially i'm trying implement way users can edit slim stored in database.

for example use form create new page , insert html page in text field saved in database. want allow them edit page in slim. way html stored slim not plain html.

if store slim in database how rails render html on client side in production? in other words rails automatically since view being render so:

views/page/view.html.slim

  page.header    page.content   page.footer 

or have figure out way convert on fly? might making more complicated should i'm new

if understand correctly want convert slim html , output in views.

this directly slims doc. how processes slim files , outputs it.

tilt.new['template.slim'].render(scope) slim::template.new('template.slim', optional_option_hash).render(scope) slim::template.new(optional_option_hash) { source }.render(scope) 

so in short

slim::template.new(page/view.html.slim).render 

put in module make prettier , think you're good. may want use rails path helper direct link view. may want consider figuring out way catch errors in indentation output doesn't bug out in production. kind of validation prevents saving if not formatted should help.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -