initial commit

This commit is contained in:
Alex Turchyn
2023-05-21 17:59:36 +03:00
commit 97c462ead2
159 changed files with 10987 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
Hellp
<div>
<%= link_to 'Create Flow', new_flow_path, data: { turbo_frame: :modal } %>
<%= link_to 'Storage settings', settings_storage_index_path %>
<%= link_to 'Email settings', settings_email_index_path %>
<%= link_to 'Users', settings_users_path %>
</div>
<div>
<% @flows.each do |flow| %>
<div>
<%= flow.name %> |
<a href="<%= flow_path(flow) %>">edit</a> |
<a href="<%= flow_submissions_path(flow) %>">submissions</a> |
</div>
<% end %>
</div>
@@ -0,0 +1,5 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
+20
View File
@@ -0,0 +1,20 @@
<h2>Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= render 'devise/shared/error_messages', resource: %>
<%= f.hidden_field :reset_password_token %>
<div class="field">
<%= f.label :password, 'New password' %><br>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br>
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: 'new-password' %>
</div>
<div class="field">
<%= f.label :password_confirmation, 'Confirm new password' %><br>
<%= f.password_field :password_confirmation, autocomplete: 'new-password' %>
</div>
<div class="actions">
<%= f.submit 'Change my password' %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
+12
View File
@@ -0,0 +1,12 @@
<h2>Forgot your password?</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= render 'devise/shared/error_messages', resource: %>
<div class="field">
<%= f.label :email %><br>
<%= f.email_field :email, autofocus: true, autocomplete: 'email' %>
</div>
<div class="actions">
<%= f.submit 'Send me reset password instructions' %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
@@ -0,0 +1,34 @@
<h2>Sign up</h2>
<%= form_for('', as: resource_name, url: registration_path) do |f| %>
<%= render 'devise/shared/error_messages', resource: %>
<%= f.fields_for resource do |ff| %>
<div>
<%= ff.label :first_name %>
<%= ff.text_field :first_name, required: true %>
</div>
<div>
<%= ff.label :last_name %>
<%= ff.text_field :last_name, required: true %>
</div>
<% end %>
<%= f.fields_for resource.account do |ff| %>
<div>
<%= ff.label :name, 'Company name' %>
<%= ff.text_field :name, required: true %>
</div>
<% end %>
<%= f.fields_for resource do |ff| %>
<div>
<%= ff.label :email %>
<%= ff.email_field :email, required: true %>
</div>
<div>
<%= ff.label :password %>
<%= ff.password_field :password, required: true %>
</div>
<% end %>
<div class="actions">
<%= f.submit 'Sign up' %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
+21
View File
@@ -0,0 +1,21 @@
<h2>Log in</h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br>
<%= f.email_field :email, autofocus: true, autocomplete: 'email' %>
</div>
<div class="field">
<%= f.label :password %><br>
<%= f.password_field :password, autocomplete: 'current-password' %>
</div>
<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me, checked: true %>
<%= f.label :remember_me %>
</div>
<% end %>
<div class="actions">
<%= f.submit 'Log in' %>
</div>
<% end %>
<%= render 'devise/shared/links' %>
@@ -0,0 +1,14 @@
<% if resource.errors.any? %>
<div id="error_explanation" data-turbo-cache="false">
<h2>
<%= I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase) %>
</h2>
<ul>
<% resource.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
+25
View File
@@ -0,0 +1,25 @@
<%- if controller_name != 'sessions' %>
<%= link_to 'Log in', new_session_path(resource_name) %><br>
<% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to 'Sign up', new_registration_path %><br>
<% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to 'Forgot your password?', new_password_path(resource_name) %><br>
<% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br>
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br>
<% end %>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br>
<% end %>
<% end %>
+27
View File
@@ -0,0 +1,27 @@
Email settings
<% value = @encrypted_config.value || {} %>
<%= form_for @encrypted_config, url: settings_email_index_path, method: :post, html: { autocomplete: 'off' } do |f| %>
<%= f.fields_for :value do |ff| %>
<div>
<%= ff.label :host %>
<%= ff.text_field :host, value: value['host'], required: true %>
</div>
<div>
<%= ff.label :port %>
<%= ff.text_field :port, value: value['port'], required: true %>
</div>
<div>
<%= ff.label :username %>
<%= ff.text_field :username, value: value['username'], required: true %>
</div>
<div>
<%= ff.label :password %>
<%= ff.password_field :password, value: value['password'], required: true %>
</div>
<div>
<%= ff.label :from_email, 'Send from' %>
<%= ff.email_field :from_email, value: value['from_email'], required: true %>
</div>
<% end %>
<%= f.button button_title %>
<% end %>
+9
View File
@@ -0,0 +1,9 @@
<%= render 'shared/turbo_modal' do %>
<%= form_for @flow, data: { turbo_frame: :_top } do |f| %>
<div>
<%= f.label :name %>
<%= f.text_field :name, required: true %>
</div>
<%= f.button button_title %>
<% end %>
<% end %>
+1
View File
@@ -0,0 +1 @@
<flow-builder data-flow="<%= @flow.to_json(include: { documents: { include: { preview_images: { methods: %i[url metadata filename] } } } }) %>"></flow-builder>
+19
View File
@@ -0,0 +1,19 @@
<h2>Welcome to Docuseal</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= render 'devise/shared/error_messages', resource: %>
<%= f.hidden_field :reset_password_token %>
<div class="field">
<%= f.label :password, 'Set password' %><br>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br>
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: 'new-password' %>
</div>
<div class="field">
<%= f.label :password_confirmation, 'Confirm new password' %><br>
<%= f.password_field :password_confirmation, autocomplete: 'new-password' %>
</div>
<div class="actions">
<%= f.submit 'Save password and Sign in' %>
</div>
<% end %>
+22
View File
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>
Docuseal
</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= javascript_pack_tag 'application', defer: true %>
<%= stylesheet_pack_tag 'application', media: 'all' %>
<%= yield :head %>
</head>
<body class="font-sans antialiased font-normal leading-normal bg-white text-gray-700">
<turbo-frame id="modal"></turbo-frame>
<%= render 'shared/navbar' %>
<div>
<%= flash[:notice] || flash[:alert] %>
</div>
<%= yield %>
</body>
</html>
+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>
Docuseal
</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= javascript_pack_tag 'flow', defer: true %>
<%= stylesheet_pack_tag 'flow', media: 'all' %>
<%= yield :head %>
</head>
<body class="font-sans antialiased font-normal leading-normal bg-white text-gray-700">
<%= yield %>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
</style>
</head>
<body>
<%= yield %>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
<%= yield %>
@@ -0,0 +1 @@
Email has bee sent
+30
View File
@@ -0,0 +1,30 @@
Setup
<%= form_for '', url: setup_index_path do |f| %>
<%= f.fields_for @user do |ff| %>
<div>
<%= ff.label :first_name %>
<%= ff.text_field :first_name, required: true %>
</div>
<div>
<%= ff.label :last_name %>
<%= ff.text_field :last_name, required: true %>
</div>
<% end %>
<%= f.fields_for @account do |ff| %>
<div>
<%= ff.label :name, 'Company name' %>
<%= ff.text_field :name, required: true %>
</div>
<% end %>
<%= f.fields_for @user do |ff| %>
<div>
<%= ff.label :email %>
<%= ff.email_field :email, required: true %>
</div>
<div>
<%= ff.label :password %>
<%= ff.password_field :password, required: true %>
</div>
<% end %>
<%= f.button button_title %>
<% end %>
+6
View File
@@ -0,0 +1,6 @@
<span class="enabled">
<%= title %>
</span>
<span class="disabled">
<%= disabled_with %>
</span>
+7
View File
@@ -0,0 +1,7 @@
<% if signed_in? %>
<div>
<%= link_to 'Home', root_path, class: 'bg-red-500' %>
<%= link_to 'Sign out', destroy_user_session_path, data: { turbo_method: :delete } %>
<%= current_user.email %>
</div>
<% end %>
+11
View File
@@ -0,0 +1,11 @@
<turbo-frame id="modal">
<turbo-modal class="left-52 absolute top-0 z-50 bg-white h-[100vh] w-full">
<div>
Modal window Title
<a href="#" data-action="click:turbo-modal#close">&times;</a>
</div>
<div>
<%= yield %>
</div>
</turbo-modal>
</turbo-frame>
+5
View File
@@ -0,0 +1,5 @@
<p>
Form has been submitted alredy by ypu - thanks!
</p>
<%= button_to button_title('Send copy to Email'), send_submission_email_index_path, params: { flow_slug: @flow.slug, email: params[:email] }, form: { onsubmit: 'event.submitter.disabled = true' } %>
<%# do not allow donwload for securetiy reaosn<a href="">Download documets</a> %>
+9
View File
@@ -0,0 +1,9 @@
You have been invited to submit flow <%= @flow.name %>
<%= form_for @submission, url: start_flow_path(@flow.slug), data: { turbo_frame: :_top }, method: :put do |f| %>
Provide youe email to start
<div>
<%= f.label :email %>
<%= f.email_field :email, required: true %>
</div>
<%= f.button button_title %>
<% end %>
+67
View File
@@ -0,0 +1,67 @@
Storage settings
<% value = @encrypted_config.value || { 'service' => 'disk' } %>
<% configs = value['configs'] || {} %>
<%= form_for @encrypted_config, url: settings_storage_index_path, method: :post, html: { autocomplete: 'off' } do |f| %>
<% options = [['Disk', 'disk'], ['AWS S3', 'aws_s3'], ['Google Cloud', 'google']] %>
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>">
<% [['Disk', 'disk'], ['AWS S3', 'aws_s3'], ['Google Cloud', 'google']].each do |(label, val)| %>
<%= f.radio_button :selected, val, checked: value['service'] == val, data: { action: 'change:toggle-visible#trigger' } %>
<%= f.label :selected, label, value: val %>
<% end %>
</toggle-visible>
<disable-hidden id="disk" class="<%= 'hidden' if value['service'] != 'disk' %>">
<%= f.fields_for :value do |ff| %>
<%= ff.hidden_field :service, value: 'disk' %>
<% end %>
<div>
Disk storage - no configs needed but make sure you have a persistant disk (heroku doesnt not have one)
</div>
</disable-hidden>
<disable-hidden id="aws_s3" class="<%= 'hidden' if value['service'] != 'aws_s3' %>">
<%= f.fields_for :value do |ff| %>
<%= ff.hidden_field :service, value: 'aws_s3' %>
<%= ff.fields_for :configs, configs do |fff| %>
<div>
<%= fff.label :access_key_id, 'Access key ID' %>
<%= fff.text_field :access_key_id, value: configs['access_key_id'], required: true %>
</div>
<div>
<%= fff.label :secret_access_key %>
<%= fff.password_field :secret_access_key, value: configs['secret_access_key'], required: true %>
</div>
<div>
<%= fff.label :region %>
<%= fff.text_field :region, value: configs['region'], required: true %>
</div>
<div>
<%= fff.label :bucket %>
<%= fff.text_field :bucket, value: value['service'] == 'aws_s3' ? configs['bucket'] : '', required: true %>
</div>
<div>
<%= fff.label :endpoint %>
<%= fff.text_field :endpoint, value: configs['endpoint'], type: :url %>
</div>
<% end %>
<% end %>
</disable-hidden>
<disable-hidden id="google" class="<%= 'hidden' if value['service'] != 'google' %>">
<%= f.fields_for :value do |ff| %>
<%= ff.hidden_field :service, value: 'google' %>
<%= ff.fields_for :configs, configs do |fff| %>
<div>
<%= fff.label :project, 'Project' %>
<%= fff.text_field :project, value: configs['project'], required: true %>
</div>
<div>
<%= fff.label :bucket %>
<%= fff.text_field :bucket, value: value['service'] == 'google' ? configs['bucket'] : '', required: true %>
</div>
<div>
<%= fff.label :credentials, 'Credentials (JSON key content)' %>
<%= fff.text_area :credentials, value: configs['credentials'], required: true %>
</div>
<% end %>
<% end %>
</disable-hidden>
<%= f.button button_title %>
<% end %>
@@ -0,0 +1,3 @@
<p>Hi</a>
<%= @submission.values %>
<%= link_to 'Download', submission_download_index_url(@submission.slug) %>
@@ -0,0 +1,4 @@
<p>Hi there</p>
<p>You have been invited to submit a form:</p>
<p><%= link_to 'Submit', submit_flow_index_url(slug: @submission.slug) %></p>
<p>If you didn't request this, please ignore this email.</p>
+40
View File
@@ -0,0 +1,40 @@
Submissions
Flow <%= @flow.name %>
Copy share link:
<input autocomplete="off" type="text" class="w-full" value="<%= start_flow_url(slug: @flow.slug) %>" disabled>
<a href="<%= new_flow_submission_path(@flow) %>" class="bg-green-600" data-turbo-frame="modal">Add Recepients</a>
<table>
<tr>
<th>
Email
</th>
<th>
Status
</th>
<th>
</th>
</tr>
<% @submissions.each do |submission| %>
<tr>
<td>
<%= submission.email %>
</td>
<td>
<% if submission.completed_at? %>
Completed
<% elsif submission.opened_at? %>
Opened
<% elsif submission.sent_at? %>
Sent
<% else %>
Awaiting
<% end %>
</td>
<td>
copy link<br>
<%= link_to 'View', submission_path(@flow) %>
<%= button_to 'Remove', submission_path(submission), method: :delete, data: { turbo_confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>
</table>
+19
View File
@@ -0,0 +1,19 @@
<%= render 'shared/turbo_modal' do %>
<%= form_for '', url: flow_submissions_path(@flow), data: { turbo_frame: :_top } do |f| %>
<div>
<%= f.label :emails %>
<%= f.text_area :emails, required: true %>
</div>
<div>
<%= f.check_box :send_email, { onchange: "message_field.classList.toggle('hidden', !event.currentTarget.checked)" } %>
<%= f.label :send_email %>
</div>
<div id="message_field" class="hidden">
Hi There,
<%= f.text_area :message, value: SubmissionMailer::DEFAULT_MESSAGE, required: true %>
Thanks,
<%= current_account.name %>
</div>
<%= f.button button_title %>
<% end %>
<% end %>
+21
View File
@@ -0,0 +1,21 @@
Flow: <%= @submission.flow.name %>
Sub: <%= @submission.slug %>
Copy share link:
<input autocomplete="off" type="text" class="w-full" value="<%= submit_flow_url(slug: @submission.slug) %>" disabled>
<% @submission.flow.fields.each do |field| %>
<div>
<%= field['name'] %>:
<% if ['image', 'signature'].include?(field['type']) %>
<% Array.wrap(@submission.values[field['uuid']]).each do |uuid| %>
<img src="<%= ActiveStorage::Attachment.find_by(uuid:).url %>">
<% end %>
<% elsif ['attachment'].include?(field['type']) %>
<% Array.wrap(@submission.values[field['uuid']]).each do |uuid| %>
<% attachment = ActiveStorage::Attachment.find_by(uuid:) %>
<a href="<%= attachment.url %>"><%= attachment.filename %></a>
<% end %>
<% else %>
<%= @submission.values[field['uuid']] %>
<% end %>
</div>
<% end %>
+3
View File
@@ -0,0 +1,3 @@
<flow-area data-field-uuid="<%= field['uuid'] %>" data-action="click:flow-view#focusField" data-targets="flow-view.areas" class=" cursor-pointer bg-red-100 absolute" style="width: <%= area['w'] * 100 / page.metadata['width'] %>%; height: <%= area['h'] * 100 / page.metadata['height'] %>%; left: <%= area['x'] * 100 / page.metadata['width'] %>%; top: <%= area['y'] * 100 / page.metadata['height'] %>%">
<%= submission.values[field['uuid']] %>
</flow-area>
+5
View File
@@ -0,0 +1,5 @@
<p>
Form completed - thanks!
</p>
<%= button_to button_title('Send copy to Email'), send_submission_email_index_path, params: { submission_slug: @submission.slug }, form: { onsubmit: 'event.submitter.disabled = true' } %>
<%= button_to button_title('Download documents'), submission_download_index_path(@submission.slug), method: :get, form: { onsubmit: 'event.submitter.disabled = true' } %>
+83
View File
@@ -0,0 +1,83 @@
<% fields_index = Flows.build_field_areas_index(@submission.flow) %>
<flow-view class="mx-auto block" style="max-width: 1000px">
<% @submission.flow.schema.each do |item| %>
<% document = @submission.flow.documents.find { |a| a.uuid == item['attachment_uuid'] } %>
<% document.preview_images.sort_by { |a| a.filename.base.to_i }.each_with_index do |page, index| %>
<div class="relative">
<img src="<%= page.url %>" width="<%= page.metadata['width'] %>" height="<%= page.metadata['height'] %>" loading="lazy">
<div class="top-0 bottom-0 left-0 right-0 absolute">
<% fields_index.dig(document.uuid, index)&.each do |values| %>
<%= render 'area', submission: @submission, page:, **values %>
<% end %>
</div>
</div>
<% end %>
<% end %>
<div class="sticky bottom-8 w-full">
<div class="bg-white mx-8 md:mx-32 border p-4 rounded">
<form data-target="flow-view.form" data-action="submit:flow-view#submitForm" action="<%= submit_flow_path(slug: @submission.slug) %>" method="post">
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>">
<input value="put" name="_method" type="hidden">
<% visible_step_index = nil %>
<% @submission.flow.fields.each_with_index do |field, index| %>
<% visible_step_index ||= index if @submission.values[field['uuid']].blank? %>
<disable-hidden data-field-uuid="<%= field['uuid'] %>" data-targets="flow-view.steps" class="block <%= 'hidden' if index != visible_step_index %>">
<% if index != 0 %>
<button data-action="click:flow-view#moveStepBack">
Back
</button>
<% end %>
<label for="<%= field['uuid'] %>"><%= field['name'].presence || 'FIeld' %></label>
<% if index == @submission.flow.fields.size - 1 %>
<input type="hidden" name="completed" value="true">
<% end %>
<% if field['type'].in?(['text', 'date']) %>
<input <%= html_attributes(required: 'true') if field['required'] %> id="<%= field['uuid'] %>" data-targets="flow-view.fields" data-action="input:flow-view#passValueToArea focus:flow-view#focusArea" value="<%= @submission.values[field['uuid']] %>" type="<%= field['type'] %>" name="values[<%= field['uuid'] %>]">
<% elsif field['type'] == 'select' %>
<select <%= html_attributes(required: 'true') if field['required'] %> id="<%= field['uuid'] %>" data-targets="flow-view.fields" data-action="input:flow-view#passValueToArea focus:flow-view#focusArea" name="values[<%= field['uuid'] %>]">
<option value="" disabled selected>Select your option</option>
<% field['options'].each do |option| %>
<option <%= html_attributes(selected: 'true') if @submission.values[field['uuid']] == option %> value="<%= option %>"><%= option %></option>
<% end %>
</select>
<% elsif field['type'] == 'image' || field['type'] == 'attachment' %>
<br>
<files-list data-field-uuid="<%= field['uuid'] %>">
<file-dropzone data-action="upload:files-list#add" data-submission-slug="<%= @submission.slug %>">
<% uuid = SecureRandom.uuid %>
<label for="<%= uuid %>">
Upload
<%= field['name'] || 'Attach' %>
</label>
<input multiple data-target="file-dropzone.input" data-action="change:file-dropzone#onSelectFiles" id="<%= uuid %>" type="file" class="hidden">
</file-dropzone>
</files-list>
<% elsif field['type'] == 'signature' %>
<signature-pad data-submission-slug="<%= @submission.slug %>" data-action="upload:flow-view#submitSignature">
<input data-target="signature-pad.input" type="hidden" name="values[<%= field['uuid'] %>]" value="<%= @submission.values[field['uuid']] %>">
<canvas data-target="signature-pad.canvas">
</canvas>
<button data-action="click:signature-pad#submit">
Ok
</button>
<button data-action="click:signature-pad#clear">
Clear
</button>
</signature-pad>
<% elsif field['type'] == 'radio' %>
<% elsif field['type'] == 'checkbox' %>
<% end %>
</disable-hidden>
<% end %>
<button data-target="flow-view.submitButton" type="submit"><%= button_title %></button>
</form>
<div data-target="flow-view.completed" class="hidden">
<p>
Form completed - thanks!
</p>
<%= button_to 'Send copy to Email', send_submission_email_index_path, params: { submission_slug: @submission.slug }, form: { onsubmit: 'event.submitter.disabled = true' } %>
<%= button_to button_title('Download documents'), submission_download_index_path(@submission.slug), method: :get, form: { onsubmit: 'event.submitter.disabled = true' } %>
</div>
</div>
</div>
</flow-view>
@@ -0,0 +1,4 @@
<p>Hello <%= @user.first_name %>,</p>
<p>You have been invited to Docuseal. You can sign up this through the link below.</p>
<p><%= link_to 'Set my password', invitation_url(reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
+19
View File
@@ -0,0 +1,19 @@
<%= form_for user, data: { turbo_frame: :_top } do |f| %>
<div>
<%= f.label :first_name %>
<%= f.text_field :first_name, required: true %>
</div>
<div>
<%= f.label :last_name %>
<%= f.text_field :last_name, required: true %>
</div>
<div>
<%= f.label :email %>
<%= f.email_field :email, required: true %>
</div>
<div>
<%= f.label :password %>
<%= f.password_field :password, required: user.new_record? %>
</div>
<%= f.button button_title %>
<% end %>
+3
View File
@@ -0,0 +1,3 @@
<%= render 'shared/turbo_modal' do %>
<%= render 'form', user: @user %>
<% end %>
+37
View File
@@ -0,0 +1,37 @@
<div>
Users
<a href="<%= new_user_path %>" data-turbo-frame="modal">New User</a>
</div>
<table>
<tr>
<th>
User
</th>
<th>
Role
</th>
<th>
Last session
</th>
<th>
</th>
</tr>
<% @users.each do |user| %>
<tr>
<td>
<%= user.full_name %><br>
<%= user.email %>
</td>
<td>
<%= user.role %>
</td>
<td>
<%= user.last_sign_in_at ? l(user.last_sign_in_at) : '-' %>
</td>
<td>
<%= link_to 'Edit', edit_user_path(user), data: { turbo_frame: 'modal' } %>
<%= button_to 'Remove', user_path(user), method: :delete, data: { turbo_confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>
</table>
+3
View File
@@ -0,0 +1,3 @@
<%= render 'shared/turbo_modal' do %>
<%= render 'form', user: @user %>
<% end %>