darraghenright

darraghenright

Module aliases not working in colocated .holo templates

Been playing with Hologram for the first time this evening, and I am enjoying it a lot!

A couple of questions:

  1. Is the source code for the SVG Drawing Demo available online?
  2. Is it possible to reference aliased modules in colocated .holo templates?

The following didn’t work for me, but maybe I am not doing something right:

# in post_preview.ex
defmodule Blog.Components.PostPreview do
  use Hologram.Component
  alias Hologram.UI.Link

  prop :post, :map
end
<!-- in post_preview.holo -->
<article class="post-preview">
  <h2>{@post.title}</h2>
  <p>{@post.excerpt}</p>
  <Link to={Blog.Pages.PostPage, id: @post.id}>Read more</Link>
</article>

Using the fully qualified module name for the link worked as expected:

<Hologram.UI.Link to={Blog.Pages.PostPage, id: @post.id}>Read more</Hologram.UI.Link>

Anyway, this is a super interesting library, I’ll star and keep a close eye!

Marked As Solved

bartblast

bartblast

Creator of Hologram

@darraghenright, I’ve just pushed a fix for the alias resolving bug in colocated templates.
The fix is now in the dev branch, but since I have a new v0.6.0 minor release coming very soon, I’ll include this fix in that release rather than doing a patch release now.
In the meantime, if you’d like to use the fix right away, you can point to the specific commit in your mix.exs dependencies:

{:hologram, git: "https://github.com/bartblast/hologram.git", ref: "690868ac666ee50125079e9529129e6b6fda43da"}

Also Liked

darraghenright

darraghenright

Damn you’re good. Just sanity checked, works a treat!

bartblast

bartblast

Creator of Hologram

@darraghenright :slight_smile:

Here’s the most important part:
https://forum.elixirforum.net/t/hologram-v0-5-0-released/71830/11
There’s really nothing much more to it - the rest is just the layout. I plan to eventually add a “Demos” section to the website that will feature different demos from users with their source code."

Yes, it should work - I believe you discovered a bug. I’ll prioritize it.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

We're in Beta

About us Mission Statement