tensiondriven / phoenix_slime_test Goto Github PK
View Code? Open in Web Editor NEWTest app for phoenix_slime and support for HEEx (.sheex)
Test app for phoenix_slime and support for HEEx (.sheex)
Hi, I have been trying to use your fork "tensiondriven/phoenix_slime" to get slim support in Phoenix 1.6.6.
But it seems this fork does not support generating correct .sheex templates yet?
E.g. when issuing this command in your phoenix_slime_test demo app:
mix phx.gen.html.slime Pets Dog dogs name:string breed:string age:integer weight:integer link:string
...it generates .hslime files in stead of .sheex files:
* creating lib/phoenix_slime_test_web/controllers/dog_controller.ex
* creating lib/phoenix_slime_test_web/templates/dog/edit.html.hslime
* creating lib/phoenix_slime_test_web/templates/dog/form.html.hslime
* creating lib/phoenix_slime_test_web/templates/dog/index.html.hslime
* creating lib/phoenix_slime_test_web/templates/dog/new.html.hslime
* creating lib/phoenix_slime_test_web/templates/dog/show.html.hslime
* creating lib/phoenix_slime_test_web/views/dog_view.ex
* creating test/phoenix_slime_test_web/controllers/dog_controller_test.exs
* creating lib/phoenix_slime_test/pets/dog.ex
* creating priv/repo/migrations/20220505020558_create_dogs.exs
* creating lib/phoenix_slime_test/pets.ex
* injecting lib/phoenix_slime_test/pets.ex
* creating test/phoenix_slime_test/pets_test.exs
* injecting test/phoenix_slime_test/pets_test.exs
* creating test/support/fixtures/pets_fixtures.ex
* injecting test/support/fixtures/pets_fixtures.ex
...and the contents of the files also look like a weird mixture between .heex syntax and .slime syntax:
# lib/phoenix_slime_test_web/templates/dog/form.html.hslime
<.form let={f} for={@changeset} action={@action}>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
= label f, :name, class: "control-label"
= text_input f, :name, class: "form-control"
= error_tag f, :name
= label f, :breed, class: "control-label"
= text_input f, :breed, class: "form-control"
= error_tag f, :breed
= label f, :age, class: "control-label"
= number_input f, :age, class: "form-control"
= error_tag f, :age
= label f, :weight, class: "control-label"
= number_input f, :weight, class: "form-control"
= error_tag f, :weight
= label f, :link, class: "control-label"
= text_input f, :link, class: "form-control"
= error_tag f, :link
<div>
<%= submit "Save" %>
</div>
</.form>
...or just plain .heex syntax with no .slime syntax at all:
# lib/phoenix_slime_test_web/templates/dog/index.html.hslime
<h1>Listing Dogs</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Breed</th>
<th>Age</th>
<th>Weight</th>
<th>Link</th>
<th></th>
</tr>
</thead>
<tbody>
<%= for dog <- @dogs do %>
<tr>
<td><%= dog.name %></td>
<td><%= dog.breed %></td>
<td><%= dog.age %></td>
<td><%= dog.weight %></td>
<td><%= dog.link %></td>
<td>
<span><%= link "Show", to: Routes.dog_path(@conn, :show, dog) %></span>
<span><%= link "Edit", to: Routes.dog_path(@conn, :edit, dog) %></span>
<span><%= link "Delete", to: Routes.dog_path(@conn, :delete, dog), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Dog", to: Routes.dog_path(@conn, :new) %></span>
Is generating .slime templates not supported yet or am I doing something wrong? I am new to Phoenix so I prefer to rely on generators for my templates.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.