GithubHelp home page GithubHelp logo

phoenix_slime_test's People

Contributors

tensiondriven avatar

Watchers

 avatar  avatar

phoenix_slime_test's Issues

phx.gen.html.slime generates .hslime files with mixed heex/slime syntax?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.