elixir-framework

Elixir Phoenix inlining css for sending emails

早过忘川 提交于 2019-12-12 14:19:15
问题 I am sending emails using the mailgun library in Phoenix. Turns out that when i look at the email in my gmail account, it has been stripped off of all the css classes and the link to external css files. Mailgun suggests using a css inline library http://blog.mailgun.com/transactional-html-email-templates/ Tried search a lot, but could not find a css inline library for Phoenix/Elixir like the premailer gem in Ruby. Does anyone know of a way to achieve this? 回答1: I just released Smoothie, an

How to add Semantic-UI to Phoenix

偶尔善良 提交于 2019-12-06 03:27:21
How do I add Semantic-UI to Phoenix? Semantic-UI is installed in a folder and updated using NPM, and the actual CSS and Javascript files are built using GULP. Where should the full install folder be placed? Can it be automatically updated through Mix like the rest of the dependencies? Should the generated css and javascript be placed in project/web/static/css (or /js) or /vendor? How do set up Gulp/Sematic-UI configuration to automatically put the files in the right places? Again, can Mix run Gulp/Semantic-UI build automatically? Where should the full install folder be placed? Actually, you

What's the meaning of “!”, “?”, “_”, and “.” syntax in elixir

风流意气都作罢 提交于 2019-12-03 12:27:52
问题 I need help regarding understanding the following syntaxes in elixir ! , ? , _ , and . . What's those syntaxes role in elixir's function? For example Repo.get! . I'm not sure whether they were just function name, or has a role. Though I know . is for calling anonymous function. And _ for any or variadic? 回答1: ! - Convention for functions which raise exceptions on failure. ? - Convention for functions which return a boolean value _ - Used to ignore an argument or part of a pattern match

What's the meaning of “!”, “?”, “_”, and “.” syntax in elixir

你离开我真会死。 提交于 2019-12-03 02:01:33
I need help regarding understanding the following syntaxes in elixir ! , ? , _ , and . . What's those syntaxes role in elixir's function? For example Repo.get! . I'm not sure whether they were just function name, or has a role. Though I know . is for calling anonymous function. And _ for any or variadic? ! - Convention for functions which raise exceptions on failure. ? - Convention for functions which return a boolean value _ - Used to ignore an argument or part of a pattern match expression. . - As you mentioned is used for calling an anonymous function, but is also used for accessing a

Phoenix Channels - Multiple channels per socket

耗尽温柔 提交于 2019-11-29 15:22:58
I'm writing an application using Elixir Channels to handle realtime events. I understand that there will be 1 socket open per client and can multiplex multiple channels over it. So my app is a chat application where users are part of multiple group chats. I have 1 Phoenix Channel called MessageChannel where the join method will handle dyanamic topics. def join("groups:" <> group_id, payload, socket) do .... Let's say John joins groups/topics A and B while Bob only join group/topic B. When john sends a message to group/topic A, broadcast!/3 will also send that message to Bob too correct?

Phoenix Channels - Multiple channels per socket

亡梦爱人 提交于 2019-11-28 08:47:40
问题 I'm writing an application using Elixir Channels to handle realtime events. I understand that there will be 1 socket open per client and can multiplex multiple channels over it. So my app is a chat application where users are part of multiple group chats. I have 1 Phoenix Channel called MessageChannel where the join method will handle dyanamic topics. def join("groups:" <> group_id, payload, socket) do .... Let's say John joins groups/topics A and B while Bob only join group/topic B. When

In Elixir how do you initialize a struct with a map variable

最后都变了- 提交于 2019-11-27 13:23:50
I know its possible to create a struct via %User{ email: 'blah@blah.com' } . But if I had a variable params = %{email: 'blah@blah.com'} is there a way to create that struct using that variable for eg, %User{ params } . This gives an error, just wondering if you can explode it or some other way? José Valim You should use the struct/2 function. From the docs: defmodule User do defstruct name: "john" end struct(User) #=> %User{name: "john"} opts = [name: "meg"] user = struct(User, opts) #=> %User{name: "meg"} struct(user, unknown: "value") #=> %User{name: "meg"} The previous answers are both good

In Elixir how do you initialize a struct with a map variable

馋奶兔 提交于 2019-11-26 18:16:50
问题 I know its possible to create a struct via %User{ email: 'blah@blah.com' } . But if I had a variable params = %{email: 'blah@blah.com'} is there a way to create that struct using that variable for eg, %User{ params } . This gives an error, just wondering if you can explode it or some other way? 回答1: You should use the struct/2 function. From the docs: defmodule User do defstruct name: "john" end struct(User) #=> %User{name: "john"} opts = [name: "meg"] user = struct(User, opts) #=> %User{name