Compare commits
No commits in common. "dd47a5f4bf37140525a84a77875875536ccad7fb" and "388124860356221014f7b263d4ee01a37d3f81c1" have entirely different histories.
dd47a5f4bf
...
3881248603
|
@ -10,6 +10,4 @@
|
||||||
|
|
||||||
--notice-bg-color: #5cb85c;
|
--notice-bg-color: #5cb85c;
|
||||||
--notice-text-color: #fff;
|
--notice-text-color: #fff;
|
||||||
|
|
||||||
--invalid-alert: #d00;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,4 @@ form {
|
||||||
input[type="submit"] {
|
input[type="submit"] {
|
||||||
grid-column: 1/3;
|
grid-column: 1/3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field_with_errors {
|
|
||||||
display: contents;
|
|
||||||
border: 1px solid var(--invalid-alert);
|
|
||||||
color: var(--invalid-alert);
|
|
||||||
}
|
|
||||||
|
|
||||||
.invalid-feedback {
|
|
||||||
grid-column: 2;
|
|
||||||
color: var(--invalid-alert);
|
|
||||||
font-size: .8em;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,6 @@ aside.flash {
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
aside.alert {
|
|
||||||
background-color: var(--invalid-alert);
|
|
||||||
}
|
|
||||||
|
|
||||||
section.inset {
|
section.inset {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
max-width: 60em;
|
max-width: 60em;
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def display_form_errors(object, attr)
|
|
||||||
return unless object.errors.include?(attr)
|
|
||||||
|
|
||||||
content_tag(:div, class: "invalid-feedback") do
|
|
||||||
object.errors.full_messages_for(attr).join(". ")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<%# locals: (game_system: @game_system, button_text:, url:) %>
|
<% # locals: (game_system: @game_system, button_text:, url:) %>
|
||||||
|
|
||||||
<%= form_with model: @game_system, url: do |f| %>
|
<%= form_with model: @game_system, url: do |f| %>
|
||||||
<%= f.label :name %>
|
<%= f.label :name %>
|
||||||
<%= f.text_field :name, required: true %>
|
<%= f.text_field :name %>
|
||||||
<%= display_form_errors(@game_system, :name) %>
|
|
||||||
|
|
||||||
<%= f.submit button_text %>
|
<%= f.submit button_text %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
<section class="inset">
|
<section class="inset">
|
||||||
<%= form_with url: sessions_path do |f| %>
|
<%= form_with url: sessions_path do |f| %>
|
||||||
<%= f.label :username %>
|
<%= f.label :username %>
|
||||||
<%= f.text_field :username, required: true %>
|
<%= f.text_field :username %>
|
||||||
|
|
||||||
<%= f.label :password %>
|
<%= f.label :password %>
|
||||||
<%= f.password_field :password, required: true %>
|
<%= f.password_field :password %>
|
||||||
|
|
||||||
<%= f.submit t(".log_in") %>
|
<%= f.submit t(".log_in") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<%# locals: (button_text:) -%>
|
<%# locals: (table:, button_text:) -%>
|
||||||
|
|
||||||
<%= form_with model: @table do |f| %>
|
<%= form_with model: @table do |f| %>
|
||||||
<%= f.label :name %>
|
<%= f.label :name %>
|
||||||
<%= f.text_field :name%>
|
<%= f.text_field :name %>
|
||||||
<%= display_form_errors(@table, :name) %>
|
|
||||||
|
|
||||||
<%= f.label :game_system_id %>
|
<%= f.label :game_system_id %>
|
||||||
<%= f.collection_select :game_system_id, GameSystem.all, :id, :name, required: true, include_blank: " " %>
|
<%= f.collection_select :game_system_id, GameSystem.all, :id, :name %>
|
||||||
<%= display_form_errors(@table, :game_system) %>
|
|
||||||
|
|
||||||
<%= f.submit button_text %>
|
<%= f.submit button_text %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
<%= link_to t(".delete_table", name: @table.name), table_path(@table),
|
<%= link_to t(".delete_table", name: @table.name), table_path(@table),
|
||||||
data: { turbo_method: :delete, turbo_confirm: t(".delete_table_confirmation", name: @table.name) } %>
|
data: { turbo_method: :delete, turbo_confirm: t(".delete_table_confirmation", name: @table.name) } %>
|
||||||
<%= render partial: "tables/form",
|
<%= render partial: "tables/form",
|
||||||
locals: { button_text: t(".update_table") } %>
|
locals: { table: @table, button_text: t(".update_table") } %>
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
<h2><%= t(".new_table") %></h2>
|
<h2><%= t(".new_table") %></h2>
|
||||||
|
|
||||||
<%= render partial: "tables/form",
|
<%= render partial: "tables/form",
|
||||||
locals: { button_text: t(".create_table") } %>
|
locals: { table: @table, button_text: t(".create_table") } %>
|
||||||
|
|
|
@ -3,28 +3,22 @@
|
||||||
<section class="inset">
|
<section class="inset">
|
||||||
<%= form_with model: user do |f| %>
|
<%= form_with model: user do |f| %>
|
||||||
<%= f.label :username %>
|
<%= f.label :username %>
|
||||||
<%= f.text_field :username, required: true %>
|
<%= f.text_field :username %>
|
||||||
<%= display_form_errors(user, :username) %>
|
|
||||||
|
|
||||||
<%= f.label :first_name %>
|
<%= f.label :first_name %>
|
||||||
<%= f.text_field :first_name %>
|
<%= f.text_field :first_name %>
|
||||||
<%= display_form_errors(user, :first_name) %>
|
|
||||||
|
|
||||||
<%= f.label :last_name %>
|
<%= f.label :last_name %>
|
||||||
<%= f.text_field :last_name %>
|
<%= f.text_field :last_name %>
|
||||||
<%= display_form_errors(user, :last_name) %>
|
|
||||||
|
|
||||||
<%= f.label :email %>
|
<%= f.label :email %>
|
||||||
<%= f.text_field :email, required: true %>
|
<%= f.text_field :email %>
|
||||||
<%= display_form_errors(user, :email) %>
|
|
||||||
|
|
||||||
<%= f.label :password %>
|
<%= f.label :password %>
|
||||||
<%= f.password_field :password, required: true %>
|
<%= f.password_field :password %>
|
||||||
<%= display_form_errors(user, :password) %>
|
|
||||||
|
|
||||||
<%= f.label :password_confirmation %>
|
<%= f.label :password_confirmation %>
|
||||||
<%= f.password_field :password_confirmation, required: true %>
|
<%= f.password_field :password_confirmation %>
|
||||||
<%= display_form_errors(user, :password_confirmation) %>
|
|
||||||
|
|
||||||
<%= f.submit button_text %>
|
<%= f.submit button_text %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue