refactor comments, select language
This commit is contained in:
@@ -2,15 +2,20 @@
|
||||
# - f: form builder object
|
||||
# - show_category: boolean (default: true) - whether to show category field
|
||||
# - show_notes: boolean (default: true) - whether to show notes field
|
||||
# - category_prompt: string or false (default: "Select a category") - prompt for category select, or false for no prompt
|
||||
%>
|
||||
|
||||
<% show_category = local_assigns.fetch(:show_category, true) %>
|
||||
<% show_notes = local_assigns.fetch(:show_notes, true) %>
|
||||
<% category_prompt = local_assigns.fetch(:category_prompt, "Select a category") %>
|
||||
|
||||
<% if show_category %>
|
||||
<div>
|
||||
<%= f.label :category, "Category", class: "block text-sm font-semibold text-gray-700 mb-2" %>
|
||||
<%= f.select :category, Entry.categories.keys.map { |cat| [cat.humanize, cat] }, { prompt: "Select a category" }, { required: true, class: "w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition" } %>
|
||||
<%= f.select :category,
|
||||
Entry.categories.keys.map { |cat| [cat.humanize, cat] },
|
||||
category_prompt ? { prompt: category_prompt } : {},
|
||||
{ required: category_prompt.present?, class: "w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user