Skip to content

Commit

Permalink
Merge pull request #433 from wearepal/custom-exp-cleaningup
Browse files Browse the repository at this point in the history
Updated UI and added delete button to Expressions
  • Loading branch information
paulthatjazz authored Sep 30, 2024
2 parents 0167dac + e6f7253 commit f2e4627
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/javascript/controllers/form_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class extends Controller {

try {
const result = parse(expression).evaluate(scope)
this.resultTarget.innerHTML = !isNaN(result) ? result : "..."
this.resultTarget.innerHTML = !isNaN(result) ? `<div class="p-3"> Result: ${result} </div>` : "..."
} catch (error) {
this.resultTarget.innerHTML = "Error"
}
Expand Down
11 changes: 8 additions & 3 deletions app/views/expressions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
</div>

<% @team_expressions.sort_by { |extent| extent.name.downcase }.each do |expression| %>
<div class="list-group-item list-group-item-action align-items-center" data-filter-target="item" style="display: flex;">
<div class="d-flex align-items-center justify-content-between">
<%= expression.name %>
<div class="list-group-item list-group-item-action align-items-center" data-filter-target="item" style="display: flex; justify-content: space-between;">
<div class="d-flex align-items-center">
<%= expression.name %>
</div>
<div class="ms-auto">
<%= link_to expression_path(expression.id), method: :delete, data: { confirm: "Are you sure you want to delete '#{expression.name}'?" }, class: "px-3 py-2 text-danger" do %>
<i class="fas fa-trash-alt"></i>
<% end %>
</div>
</div>
<% end %>
Expand Down

0 comments on commit f2e4627

Please sign in to comment.