diff --git a/app/views/conditions/_condition.html.erb b/app/views/conditions/_condition.html.erb index 91b2628..b987ac2 100644 --- a/app/views/conditions/_condition.html.erb +++ b/app/views/conditions/_condition.html.erb @@ -1,32 +1,32 @@ -
+
-

+

Enabled: <%= condition.enabled %> -

+
-

+

Property type: <%= condition.property_type %> -

+
-

+

Property value: <%= condition.property_value %> -

+
-

+

Test method: <%= condition.test_method %> -

+
-

+

Test value: <%= condition.test_value %> -

+
-

+

Inverted: <%= condition.inverted %> -

+
diff --git a/app/views/conditions/_form.html.erb b/app/views/conditions/_form.html.erb index 8440723..66e4ac5 100644 --- a/app/views/conditions/_form.html.erb +++ b/app/views/conditions/_form.html.erb @@ -14,7 +14,10 @@
<%= form.label :enabled %> - <%= form.check_box :enabled %> + <%= form.radio_button :enabled, true %> + <%= form.label :enabled_true, "Yes" %> + <%= form.radio_button :enabled, false %> + <%= form.label :enabled_false, "No" %>
@@ -39,7 +42,10 @@
<%= form.label :inverted %> - <%= form.check_box :inverted %> + <%= form.radio_button :inverted, true %> + <%= form.label :inverted_true, "Yes" %> + <%= form.radio_button :inverted, false %> + <%= form.label :inverted_false, "No" %>
diff --git a/app/views/filters/_filter.html.erb b/app/views/filters/_filter.html.erb index 11fe47f..77a67a2 100644 --- a/app/views/filters/_filter.html.erb +++ b/app/views/filters/_filter.html.erb @@ -1,27 +1,33 @@ -
+
-
+
Description: <%= filter.description || "No description" %>
-
+
Operator: <%= filter.operator %>
-
+
Inverted: <%= filter.inverted? ? 'Yes' : 'No' %>
-
- <%= link_to 'Edit', edit_filter_path(@filter), class: "flex items-center" %> - <%= button_to 'Delete', @filter, method: :delete, data: { confirm: 'Are you sure?' }, class: "flex items-center" %> - <% if filter.enabled? %> - <%= button_to 'Disable', filter_disable_path(@filter), data: { method: :patch }, class: "flex items-center" %> - <% else %> - <%= button_to 'Enable', filter_enable_path(@filter), data: { method: :patch }, class: "flex items-center" %> - <% end %> +
+
+ <%= link_to 'Edit', edit_filter_path(@filter) %> +
+
+ <%= link_to 'Delete', @filter, method: :delete, data: { confirm: 'Are you sure you want to delete this filter?' } %> +
+
+ <% if filter.enabled? %> + <%= link_to 'Disable', disable_filter_path(@filter), data: { method: :patch, confirm: 'Are you sure you want to disable this filter?' } %> + <% else %> + <%= link_to 'Enable', enable_filter_path(@filter), data: { method: :patch, confirm: 'Are you sure you want to enable this filter?' } %> + <% end %> +
diff --git a/app/views/filters/_form.html.erb b/app/views/filters/_form.html.erb index c3acd6d..5e25349 100644 --- a/app/views/filters/_form.html.erb +++ b/app/views/filters/_form.html.erb @@ -1,37 +1,48 @@ -<%= form_with(model: filter) do |form| %> - <% if filter.errors.any? %> -
-

<%= pluralize(filter.errors.count, "error") %> prohibited this filter from being saved:

+<%= turbo_frame_tag "filter" do %> + <%= form_with(model: filter) do |form| %> + <% if filter.errors.any? %> +
+

<%= pluralize(filter.errors.count, "error") %> prohibited this filter from being saved:

-
    - <% filter.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
+
    + <% filter.errors.each do |error| %> +
  • <%= error.full_message %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= form.label :description %> + <%= form.text_field :description %> +
+ +
+ <%= form.label :enabled %> + <%= form.radio_button :enabled, true %> + <%= form.label :enabled_true, "Yes" %> + <%= form.radio_button :enabled, false %> + <%= form.label :enabled_false, "No" %> +
+ +
+ <%= form.label :operator %> + <%= form.radio_button :operator, "AND" %> + <%= form.label :operator_and, "AND" %> + <%= form.radio_button :operator, "OR" %> + <%= form.label :operator_or, "OR" %> +
+ +
+ <%= form.label :inverted %> + <%= form.radio_button :inverted, true %> + <%= form.label :inverted_true, "Yes" %> + <%= form.radio_button :inverted, false %> + <%= form.label :inverted_false, "No" %> +
+ +
+ <%= form.submit %>
<% end %> - -
- <%= form.label :description %> - <%= form.text_field :description %> -
- -
- <%= form.label :enabled %> - <%= form.check_box :enabled %> -
- -
- <%= form.label :operator %> - <%= form.text_field :operator %> -
- -
- <%= form.label :inverted %> - <%= form.check_box :inverted %> -
- -
- <%= form.submit %> -
-<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/filters/show.html.erb b/app/views/filters/show.html.erb index d2bb45d..182e5b0 100644 --- a/app/views/filters/show.html.erb +++ b/app/views/filters/show.html.erb @@ -11,15 +11,19 @@ <% end %>
-

Conditions

- <%= render(@filter.conditions) || "No conditions yet" %> +

Conditions

+ <%= render(@filter.conditions) || "No conditions yet" %>
-<%= turbo_frame_tag "new_condition", src: new_filter_condition_path(@filter), target: "_top" %> +<%= turbo_frame_tag "new_condition" do %> + <%= link_to "Add a new condition", new_filter_condition_path(@filter) %> +<% end %>
-

Operations

- <%= render(@filter.operations) || "No operations yet" %> +

Operations

+ <%= render(@filter.operations) || "No operations yet" %>
-<%= turbo_frame_tag "new_operation", src: new_filter_operation_path(@filter), target: "_top" %> +<%= turbo_frame_tag "new_operation" do %> + <%= link_to "Add a new operation", new_filter_operation_path(@filter) %> +<% end %> \ No newline at end of file diff --git a/app/views/operations/_form.html.erb b/app/views/operations/_form.html.erb index fde3f23..71a0738 100644 --- a/app/views/operations/_form.html.erb +++ b/app/views/operations/_form.html.erb @@ -14,7 +14,10 @@
<%= form.label :enabled %> - <%= form.check_box :enabled %> + <%= form.radio_button :enabled, true %> + <%= form.label :enabled_true, "Yes" %> + <%= form.radio_button :enabled, false %> + <%= form.label :enabled_false, "No" %>
diff --git a/app/views/operations/_operation.html.erb b/app/views/operations/_operation.html.erb index 9240263..ef014f9 100644 --- a/app/views/operations/_operation.html.erb +++ b/app/views/operations/_operation.html.erb @@ -1,17 +1,17 @@ -
+
-

- Enabled: +

+ Enabled: <%= operation.enabled %> -

+
-

- Class name: +

+ Class name: <%= operation.class_name %> -

+
-

- Argument: +

+ Argument: <%= operation.argument %> -

+
diff --git a/config/routes.rb b/config/routes.rb index 19485a9..cfef8b4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,8 +6,8 @@ Rails.application.routes.draw do resources :emails resources :metadata_mappings resources :filters do - patch :enable - patch :disable + patch :enable, on: :member + patch :disable, on: :member resources :conditions resources :operations end