Replace leex templates with heex

This commit is contained in:
Shadowfacts 2022-09-13 22:10:57 -04:00
parent 052926791a
commit 3046fc9b14
6 changed files with 31 additions and 29 deletions

View File

@ -1,16 +1,16 @@
<div id="<%= @id %>">
<div id={@id}>
<%= if Mix.env == :dev do %>
<pre><%= Jason.encode!(@opts, pretty: true) %></pre>
<% end %>
<%= f = form_for @opts, "#", [as: :opts, phx_change: :update_stage, phx_target: @myself] %>
<%= form_for @opts, "#", [as: :opts, phx_change: :update_stage, phx_target: @myself], fn f -> %>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="<%= @id %>-stage">Module</label>
<label class="col-sm-2 col-form-label" for={"#{@id}-stage"}>Module</label>
<div class="col-sm-10">
<%= select f, :stage, @stages, prompt: "Select a stage...", id: "#{@id}-stage", class: "custom-select" %>
</div>
</div>
</form>
<% end %>
<div class="card mb-2">
<div class="card-header">
@ -32,7 +32,7 @@
<h4 class="m-0">Condition: Filter</h4>
</div>
<div class="col text-right">
<button phx-click="convert_to_rule" phx-target="#<%= @id %>" class="btn btn-primary btn-sm">Convert to Rule</button>
<button phx-click="convert_to_rule" phx-target={@id} class="btn btn-primary btn-sm">Convert to Rule</button>
</div>
</div>
</div>
@ -40,8 +40,8 @@
<%= if @confirm_convert_to_rule do %>
<div class="alert alert-danger mb-2">
<p>This will modify the conditional stage to only run when the first rule is met. Are you sure you want to proceed?</p>
<button class="btn btn-danger btn-sm" phx-click="confirm_convert_to_rule" phx-target="#<%= @id %>">Convert to Rule</button>
<button class="btn btn-secondary btn-sm" phx-click="cancel_convert_to_rule" phx-target="#<%= @id %>">Cancel</button>
<button class="btn btn-danger btn-sm" phx-click="confirm_convert_to_rule" phx-target={@id}>Convert to Rule</button>
<button class="btn btn-secondary btn-sm" phx-click="cancel_convert_to_rule" phx-target={@id}>Cancel</button>
</div>
<% end %>
@ -56,7 +56,7 @@
<h4 class="m-0">Condition: Rule</h4>
</div>
<div class="col text-right">
<button phx-click="convert_to_filter" phx-target="#<%= @id %>" class="btn btn-primary btn-sm">Convert to Filter</button>
<button phx-click="convert_to_filter" phx-target={@id} class="btn btn-primary btn-sm">Convert to Filter</button>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
<div id="<%= @id %>">
<div id={@id}>
<%= if Mix.env == :dev do %>
<pre><%= Jason.encode!(@opts, pretty: true) %></pre>
<% end %>

View File

@ -1,17 +1,17 @@
<div id="<%= @id %>">
<div id={@id}>
<%= if Mix.env == :dev do %>
<pre><%= Jason.encode!(@opts, pretty: true) %></pre>
<% end %>
<%= f = form_for @opts, "#", [as: :opts, phx_change: :update_stage, phx_target: @myself] %>
<%= form_for @opts, "#", [as: :opts, phx_change: :update_stage, phx_target: @myself], fn f -> %>
<div class="form-group form-check">
<%= checkbox f, :convert_to_data_uris, id: "#{@id}-convert_to_data_uris", class: "form-check-input" %>
<label class="form-check-label" for="<%= @id %>-convert_to_data_uris">Convert Images to Embedded Data URIs</label>
<label class="form-check-label" for={"#{@id}-convert_to_data_uris"}>Convert Images to Embedded Data URIs</label>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="<%= @id %>-extractor">Extractor</label>
<label class="col-sm-2 col-form-label" for={"#{@id}-extractor"}>Extractor</label>
<div class="col-sm-10">
<%= select f, :extractor, @extractors, id: "#{@id}-extractor", class: "custom-select" %>
</div>
</div>
</form>
<% end %>
</div>

View File

@ -1,6 +1,6 @@
<h1>Edit <%= @pipeline.name %></h1>
<a href="<%= Routes.pipeline_path(FrenzyWeb.Endpoint, :edit, @pipeline.id, json: "") %>" class="btn btn-primary">Edit as JSON</a>
<a href={Routes.pipeline_path(FrenzyWeb.Endpoint, :edit, @pipeline.id, json: "")} class="btn btn-primary">Edit as JSON</a>
<%= for {stage, index} <- Enum.with_index(@pipeline.stages) do %>
<div class="card mt-4">
@ -14,7 +14,7 @@
<%= content_tag :button, "Move Down", [phx_click: :move_down, phx_value_index: index, disabled: index == length(@pipeline.stages) - 1, class: "btn btn-secondary btn-sm"] %>
<button phx-click="delete_stage" phx-value-index="<%= index %>" class="btn btn-danger btn-sm">Delete</button>
<button phx-click="delete_stage" phx-value-index={index} class="btn btn-danger btn-sm">Delete</button>
</div>
</div>
</div>
@ -24,7 +24,7 @@
</div>
<% end %>
<%= f = form_for :stage, "#", [class: "mt-4 mb-4", phx_submit: :add_stage] %>
<%= form_for :stage, "#", [class: "mt-4 mb-4", phx_submit: :add_stage], fn f -> %>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="module_name">Module</label>
<div class="col-sm-10">
@ -32,4 +32,4 @@
</div>
</div>
<%= submit "Add Stage", class: "btn btn-primary" %>
</form>
<% end %>

View File

@ -1,18 +1,18 @@
<div id="<%= @id %>">
<%= f = form_for @filter, "#", [phx_change: :update_filter, phx_target: "##{@parent_id}"] %>
<div id={@id}>
<%= form_for @filter, "#", [phx_change: :update_filter, phx_target: "##{@parent_id}"], fn f -> %>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="<%= @id %>-mode">Mode</label>
<label class="col-sm-2 col-form-label" for={"#{@id}-mode"}>Mode</label>
<div class="col-sm-10">
<%= select f, :mode, @modes, id: "#{@id}-mode", class: "custom-select" %>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="<%= @id %>-score">Score</label>
<label class="col-sm-2 col-form-label" for={"#{@id}-score"}>Score</label>
<div class="col-sm-10">
<%= number_input f, :score, id: "#{@id}-score", class: "form-control" %>
</div>
</div>
</form>
<% end %>
<%= for {rule, index} <- Enum.with_index(@filter["rules"]) do %>
<div class="card mt-2">
<div class="card-header container-fluid">
@ -21,7 +21,7 @@
<h4 class="m-0">Rule <%= index %></h4>
</div>
<div class="col text-right">
<button phx-click="delete_rule" phx-value-index="<%= index %>" phx-target="#<%= @id %>" class="btn btn-danger btn-sm">Delete</button>
<button phx-click="delete_rule" phx-value-index={index} phx-target={"##{@id}"} class="btn btn-danger btn-sm">Delete</button>
</div>
</div>
@ -31,7 +31,7 @@
</div>
</div>
<% end %>
<%= f = form_for :rule, "#", class: "mt-2", phx_submit: :add_rule, phx_target: "##{@parent_id}" %>
<%= form_for :rule, "#", [class: "mt-2", phx_submit: :add_rule, phx_target: "##{@parent_id}"], fn f -> %>
<%= submit "Add Rule", class: "btn btn-primary" %>
</form>
<% end %>
</div>

View File

@ -1,4 +1,5 @@
<div id="<%= @id %>"><%= f = form_for @rule, "#", [phx_change: :update_rule, phx_target: "##{@parent_id}"] %>
<div id={@id}>
<%= form_for @rule, "#", [phx_change: :update_rule, phx_target: "##{@parent_id}"], fn f -> %>
<%= hidden_input f, :index, value: @index %>
<div class="row">
<div class="col-3">
@ -12,9 +13,10 @@
</div>
</div>
<div class="form-group row mb-0 mt-4">
<label class="col-sm-2 col-form-label" for="<%= @id %>-weight">Rule Weight</label>
<label class="col-sm-2 col-form-label" for={"#{@id}-weight"}>Rule Weight</label>
<div class="col-sm-10">
<%= number_input f, :weight, id: "#{@id}-weight", class: "form-control" %>
</div>
</div>
</form></div>
<% end %>
</div>