diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 607a2f1e..04eab55f 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -7,7 +7,8 @@ class ApplicationController < ActionController::Base
before_action :authenticate_user!, unless: :devise_controller?
helper_method :button_title,
- :current_account
+ :current_account,
+ :svg_icon
private
@@ -19,7 +20,11 @@ class ApplicationController < ActionController::Base
redirect_to setup_index_path unless User.exists?
end
- def button_title(title = 'Submit', disabled_with = 'Submitting...')
- render_to_string(partial: 'shared/button_title', locals: { title:, disabled_with: })
+ def button_title(title: 'Submit', disabled_with: 'Submitting', icon: nil)
+ render_to_string(partial: 'shared/button_title', locals: { title:, disabled_with:, icon: })
+ end
+
+ def svg_icon(icon_name, options = {})
+ render_to_string(partial: "icons/#{icon_name}", locals: { attibutes: options })
end
end
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb
index 3282fbda..f55f112d 100644
--- a/app/views/devise/passwords/edit.html.erb
+++ b/app/views/devise/passwords/edit.html.erb
@@ -19,7 +19,7 @@
- <%= f.submit 'Change my password', class: 'base-button' %>
+ <%= f.button button_title(title: 'Change my password', disabled_with: 'Changing password'), class: 'base-button' %>
<%= render 'devise/shared/links' %>
<% end %>
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
index 9313095c..bda755a8 100644
--- a/app/views/devise/passwords/new.html.erb
+++ b/app/views/devise/passwords/new.html.erb
@@ -9,7 +9,7 @@
- <%= f.submit 'Reset password', class: 'base-button' %>
+ <%= f.button button_title(title: 'Reset password', disabled_with: 'Resetting password'), class: 'base-button' %>
<% end %>
<%= render 'devise/shared/links' %>
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb
index 75ba53e5..bdf5988c 100644
--- a/app/views/devise/registrations/new.html.erb
+++ b/app/views/devise/registrations/new.html.erb
@@ -31,7 +31,7 @@
<% end %>
- <%= f.submit 'Sign up', class: 'base-button' %>
+ <%= f.button button_title(title: 'Sign up', disabled_with: 'Signing up'), class: 'base-button' %>
<% end %>
<%= render 'devise/shared/links' %>
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb
index e30dde83..72dac935 100644
--- a/app/views/devise/sessions/new.html.erb
+++ b/app/views/devise/sessions/new.html.erb
@@ -20,7 +20,7 @@
<% end %>
- <%= f.submit 'Log in', class: 'base-button' %>
+ <%= f.button button_title(title: 'Log In', disabled_with: 'Logging In'), class: 'base-button' %>
<% end %>
<%= render 'devise/shared/links' %>
diff --git a/app/views/email_settings/index.html.erb b/app/views/email_settings/index.html.erb
index 0df5646e..497982f2 100644
--- a/app/views/email_settings/index.html.erb
+++ b/app/views/email_settings/index.html.erb
@@ -34,7 +34,7 @@
<% end %>
- <%= f.button button_title, class: 'base-button' %>
+ <%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button' %>
<% end %>
diff --git a/app/views/esign_settings/index.html.erb b/app/views/esign_settings/index.html.erb
index 279c6f61..97bb3c93 100644
--- a/app/views/esign_settings/index.html.erb
+++ b/app/views/esign_settings/index.html.erb
@@ -13,7 +13,7 @@
Cick to upload
- <%= f.button button_title %>
+ <%= f.button button_title(title: 'Save', disabled_with: 'Saving') %>
<% end %>
diff --git a/app/views/icons/_loader.html.erb b/app/views/icons/_loader.html.erb
new file mode 100644
index 00000000..01867c9b
--- /dev/null
+++ b/app/views/icons/_loader.html.erb
@@ -0,0 +1,4 @@
+
diff --git a/app/views/icons/_save.html.erb b/app/views/icons/_save.html.erb
new file mode 100644
index 00000000..ecede00a
--- /dev/null
+++ b/app/views/icons/_save.html.erb
@@ -0,0 +1,6 @@
+
diff --git a/app/views/invitations/edit.html.erb b/app/views/invitations/edit.html.erb
index f0851643..75bbb9e5 100644
--- a/app/views/invitations/edit.html.erb
+++ b/app/views/invitations/edit.html.erb
@@ -19,7 +19,7 @@
- <%= f.submit 'Save password and Sign in', class: 'base-button' %>
+ <%= f.button button_title(title: 'Save password and Sign in', disabled_with: 'Saving'), class: 'base-button' %>
<% end %>
diff --git a/app/views/profile/index.html.erb b/app/views/profile/index.html.erb
index 67612ea6..ec9244a7 100644
--- a/app/views/profile/index.html.erb
+++ b/app/views/profile/index.html.erb
@@ -27,7 +27,7 @@
<% end %>
- <%= f.button button_title, class: 'base-button' %>
+ <%= f.button button_title(title: 'Update', disabled_with: 'Updating'), class: 'base-button' %>
<% end %>
Change Password
@@ -41,7 +41,7 @@
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'base-input' %>
- <%= f.button button_title, class: 'base-button' %>
+ <%= f.button button_title(title: 'Update', disabled_with: 'Updating'), class: 'base-button' %>
<% end %>
diff --git a/app/views/setup/index.html.erb b/app/views/setup/index.html.erb
index d57c3a8b..f49f6a74 100644
--- a/app/views/setup/index.html.erb
+++ b/app/views/setup/index.html.erb
@@ -32,7 +32,7 @@
<% end %>
- <%= f.button button_title, class: 'base-button' %>
+ <%= f.button button_title(title: 'Confirm', disabled_with: 'Processing'), class: 'base-button' %>
<% end %>
diff --git a/app/views/shared/_button_title.html.erb b/app/views/shared/_button_title.html.erb
index bb0a21cb..99d9cbfb 100644
--- a/app/views/shared/_button_title.html.erb
+++ b/app/views/shared/_button_title.html.erb
@@ -1,6 +1,12 @@
- <%= title %>
+
+ <%= icon if icon %>
+ <%= title %>
+
- <%= disabled_with %>
+
+ <%= svg_icon('loader', class: 'w-6 h-6 animate-spin') %>
+ <%= disabled_with %>...
+
diff --git a/app/views/start_form/completed.html.erb b/app/views/start_form/completed.html.erb
index 53e687b3..6ce0db85 100644
--- a/app/views/start_form/completed.html.erb
+++ b/app/views/start_form/completed.html.erb
@@ -1,5 +1,5 @@
Form has been submitted alredy by ypu - thanks!
-<%= button_to button_title('Send copy to Email'), send_submission_email_index_path, params: { template_slug: @template.slug, email: params[:email] }, form: { onsubmit: 'event.submitter.disabled = true' } %>
+<%= button_to button_title(title: 'Send copy to Email', disabled_with: 'Sending'), send_submission_email_index_path, params: { template_slug: @template.slug, email: params[:email] }, form: { onsubmit: 'event.submitter.disabled = true' } %>
<%# do not allow donwload for securetiy reaosnDownload documets %>
diff --git a/app/views/start_form/show.html.erb b/app/views/start_form/show.html.erb
index 34d3cd37..c55f6725 100644
--- a/app/views/start_form/show.html.erb
+++ b/app/views/start_form/show.html.erb
@@ -5,5 +5,5 @@ You have been invited to submit template <%= @template.name %>
<%= f.label :email %>
<%= f.email_field :email, required: true %>
- <%= f.button button_title %>
+ <%= f.button button_title(title: 'Confirm', disabled_with: 'Processing') %>
<% end %>
diff --git a/app/views/storage_settings/index.html.erb b/app/views/storage_settings/index.html.erb
index 08b399f3..6ee4c689 100644
--- a/app/views/storage_settings/index.html.erb
+++ b/app/views/storage_settings/index.html.erb
@@ -34,7 +34,7 @@
<%= render "azure_form", f: f, configs: configs, value: value %>
- <%= f.button button_title('OK'), class: 'base-button' %>
+ <%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button' %>
<% end %>
diff --git a/app/views/submissions/new.html.erb b/app/views/submissions/new.html.erb
index 57cc3bd2..ff2b97e6 100644
--- a/app/views/submissions/new.html.erb
+++ b/app/views/submissions/new.html.erb
@@ -28,7 +28,7 @@
- <%= f.button button_title, class: 'base-button' %>
+ <%= f.button button_title(title: 'Confirm', disabled_with: 'Processing'), class: 'base-button' %>
<% end %>
<% end %>
diff --git a/app/views/submit_form/completed.html.erb b/app/views/submit_form/completed.html.erb
index 5369cbc9..f95300a7 100644
--- a/app/views/submit_form/completed.html.erb
+++ b/app/views/submit_form/completed.html.erb
@@ -1,5 +1,5 @@
Form completed - thanks!
-<%= 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' } %>
+<%= button_to button_title(title: 'Send copy to Email', disabled_with: 'Sending'), send_submission_email_index_path, params: { submission_slug: @submission.slug }, form: { onsubmit: 'event.submitter.disabled = true' } %>
+<%= button_to button_title(title: 'Download documents', disabled_with: 'Downloading'), submission_download_index_path(@submission.slug), method: :get, form: { onsubmit: 'event.submitter.disabled = true' } %>
diff --git a/app/views/templates/new.html.erb b/app/views/templates/new.html.erb
index 00233c05..efc1ab96 100644
--- a/app/views/templates/new.html.erb
+++ b/app/views/templates/new.html.erb
@@ -4,7 +4,7 @@
<%= f.text_field :name, required: true, placeholder: 'Template Name', class: 'base-input' %>
- <%= f.button button_title('Create'), class: 'base-button' %>
+ <%= f.button button_title(title: 'Create', disabled_with: 'Creating'), class: 'base-button' %>
<% end %>
<% end %>
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 3358d240..1fb5d128 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -18,6 +18,6 @@
- <%= f.button button_title, class: 'base-button' %>
+ <%= f.button button_title(title: 'Confirm', disabled_with: 'Processing'), class: 'base-button' %>
<% end %>