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

Custom Modal #105

Closed
guidotripaldi opened this issue Apr 18, 2018 · 4 comments
Closed

Custom Modal #105

guidotripaldi opened this issue Apr 18, 2018 · 4 comments

Comments

@guidotripaldi
Copy link
Contributor

I notice that if you want to render a custom template for a button when calling Drab.Modal.alert/4 from an umbrella app, you have to configure the full application path, because Drab doesn't prefix :templates_path with the current application directory:

# config/dev.exs
config :drab, 
  templates_path: "/my/app/full/path/priv/templates/drab"

so I've modify lib/drab/config.ex to read the app name from the configuration and add the right prefix to the template path:

# config/dev.exs
config :drab, 
  app: :my_app_web,
  templates_path: "priv/templates/drab"

Furthermore, I've modified Drab.Modal.alert/4 to support many different custom templates. Now you can pass the file name of the preferred custom template this way:

alert(socket, "Title", "Shows this message with default OK button", template: "my_custom.modal.alert.html.eex")

Try to take a look, then if you like I can PR the branch

@grych
Copy link
Owner

grych commented Apr 19, 2018

Closing this thread as you already introduced PR #106 :-)

@grych
Copy link
Owner

grych commented Apr 19, 2018

Could you please check the current master and let me know, if it solved your issue?

@guidotripaldi
Copy link
Contributor Author

Yes, it fix it! :)

@grych
Copy link
Owner

grych commented Apr 19, 2018

Cool!

@grych grych closed this as completed Apr 19, 2018
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

No branches or pull requests

2 participants