-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path_form.html.erb
More file actions
113 lines (106 loc) · 4.24 KB
/
Copy path_form.html.erb
File metadata and controls
113 lines (106 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<%= simple_form_for @user, html: { multipart: true, class: "space-y-8" } do |f| %>
<%= render 'shared/errors', resource: user if user.errors.any? %>
<!-- Basic Info + Avatar -->
<!-- Container -->
<div class="flex gap-8 items-start">
<!-- LEFT COLUMN: 75% -->
<div class="flex-1">
<div class="space-y-6">
<div class="flex flex-col md:flex-row gap-2">
<% if @facilitator %>
<%= f.hidden_field :first_name, value: @facilitator.first_name %>
<%= f.hidden_field :last_name, value: @facilitator.last_name %>
<div>
<div class="w-full">
<label class="block text-md font-medium text-gray-700 mb-1">
First name
</label>
<div class="flex gap-x-2 items-center">
<div class="text-gray-900 font-medium mt-2">
<%= @facilitator.first_name %>
</div>
</div>
<p class="text-sm text-gray-500 mt-3">
Edit on <%= link_to "facilitator profile", facilitator_path(@facilitator), class: "underline" %>
</p>
</div>
</div>
<div>
<div class="w-full">
<label class="block text-md font-medium text-gray-700 mb-1">
Last name
</label>
<div class="flex gap-x-2 items-center">
<div class="text-gray-900 font-medium mt-2">
<%= @facilitator.last_name %>
</div>
</div>
<p class="text-sm text-gray-500 mt-3">
Edit on <%= link_to "facilitator profile", facilitator_path(@facilitator), class: "underline" %>
</p>
</div>
</div>
<% else %>
<%= f.input :first_name, input_html: { value: @facilitator&.first_name || f.object.first_name } %>
<%= f.input :last_name, input_html: { value: @facilitator&.last_name || f.object.last_name } %>
<% end %>
<div class="md:flex-grow md:basis-1/3">
<% if current_user.super_user? %>
<div class="admin-only bg-blue-100 w-full">
<%= f.input :email,
hint: "Only editable by admins",
input_html: { value: f.object.email.presence || @facilitator&.primary_email_address,
class: "w-full" },
wrapper_html: { class: "w-full" } %>
</div>
<% else %>
<div class="w-full">
<label class="block text-md font-medium text-gray-700 mb-3">
Email
</label>
<div class="flex gap-x-2 items-center">
<span class="text-gray-900 font-medium mb-2">
<%= f.object.email.presence || @facilitator&.primary_email_address %>
</span>
</div>
<p class="text-sm text-gray-500 mt-1">
Only editable by admins
</p>
</div>
<% end %>
</div>
<div>
<% if current_user.super_user? %>
<div class="admin-only bg-blue-100 w-full p-3">
<div class="flex flex-col md:flex-row gap-4">
<%= f.input :inactive, label: "No access?" %>
<%= f.input :super_user %>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Notes -->
<% if current_user.super_user? %>
<div class="admin-only bg-blue-100 p-3">
<%= f.input :comment, as: :text, input_html: { rows: 3, class: "w-full" } %>
</div>
<% end %>
<!-- Actions -->
<!-- Action buttons -->
<div class="mt-6 flex flex-wrap gap-3">
<% if @user.persisted? %>
<%= link_to "Delete", @user,
method: :delete,
data: { confirm: "Are you sure?" },
class: "btn btn-danger-outline" %>
<% end %>
<%= link_to 'Cancel', users_path,
class: "btn btn-secondary-outline" %>
<%= f.submit 'Submit',
class: "btn btn-primary" %>
</div>
<% end %>