Implantação da geração de mensagem de forma livre e mudança na engine de mensagem
This commit is contained in:
36
app/views/admin/grupos_contato/_form.html.erb
Normal file
36
app/views/admin/grupos_contato/_form.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<%# URL explícita: a rota se chama `grupo`/`grupos` (ver routes.rb), então a
|
||||
rota polimórfica de `model:` procuraria admin_grupo_contato_path e estouraria.
|
||||
O `model:` continua valendo para nomear os campos (grupo_contato[...]). %>
|
||||
<%= form_with model: [:admin, grupo],
|
||||
url: (grupo.persisted? ? admin_grupo_path(grupo) : admin_grupos_path),
|
||||
data: { turbo: false }, class: 'space-y-5' do |f| %>
|
||||
<% if grupo.errors.any? %>
|
||||
<div class="bg-red-500/10 border border-red-500/30 rounded-xl px-4 py-3 text-red-300 text-sm">
|
||||
<ul class="list-disc list-inside space-y-1">
|
||||
<% grupo.errors.full_messages.each do |msg| %><li><%= msg %></li><% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= f.label :nome, class: 'block text-gray-400 text-sm mb-1' %>
|
||||
<%= f.text_field :nome, required: true, placeholder: 'Diretoria',
|
||||
class: 'w-full bg-[#1a1a1a] border border-white/10 rounded-xl text-white text-sm px-3 py-2.5 focus:outline-none focus:border-orange-500' %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= f.label :descricao, 'Descrição', class: 'block text-gray-400 text-sm mb-1' %>
|
||||
<%= f.text_field :descricao, placeholder: 'Quem acompanha o fechamento',
|
||||
class: 'w-full bg-[#1a1a1a] border border-white/10 rounded-xl text-white text-sm px-3 py-2.5 focus:outline-none focus:border-orange-500' %>
|
||||
</div>
|
||||
|
||||
<label class="flex items-center gap-2 text-sm text-gray-300">
|
||||
<%= f.check_box :ativo, class: 'rounded border-white/20 bg-[#1a1a1a] text-orange-500' %>
|
||||
Ativo (grupo inativo não recebe nada)
|
||||
</label>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<%= f.submit 'Salvar', class: 'px-4 py-2.5 rounded-xl text-sm font-semibold bg-orange-500 text-black hover:bg-orange-400 cursor-pointer' %>
|
||||
<%= link_to 'Cancelar', admin_grupos_path, data: { turbo: false }, class: 'text-gray-400 hover:text-white text-sm' %>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user