diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb new file mode 100644 index 00000000..b7f73c50 --- /dev/null +++ b/app/controllers/profile_controller.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ProfileController < ApplicationController + def index + @user = current_user + end + + def update + @user = current_user + + if @user.update(user_params) + redirect_to settings_profile_path, notice: 'Profile updated' + else + render :index + end + end + + private + + def user_params + params.require(:user).permit(:first_name, :last_name) + end +end diff --git a/app/views/email_settings/index.html.erb b/app/views/email_settings/index.html.erb index e0cd1fcc..3ac81552 100644 --- a/app/views/email_settings/index.html.erb +++ b/app/views/email_settings/index.html.erb @@ -1,48 +1,43 @@ -
-
- <%= render 'shared/settings_nav' %> -
-
-

Email SMTP

-

- Configure your to send emails (TODO) -

- <% value = @encrypted_config.value || {} %> - <%= form_for @encrypted_config, url: settings_email_index_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %> - <%= f.fields_for :value do |ff| %> -
-
- <%= ff.label :host, class: 'label' %> - <%= ff.text_field :host, value: value['host'], required: true, class: 'base-input' %> -
-
- <%= ff.label :port, class: 'label' %> - <%= ff.text_field :port, value: value['port'], required: true, class: 'base-input' %> -
-
-
-
- <%= ff.label :username, class: 'label' %> - <%= ff.text_field :username, value: value['username'], required: true, class: 'base-input' %> -
-
- <%= ff.label :password, class: 'label' %> - <%= ff.password_field :password, value: value['password'], required: true, class: 'base-input' %> -
-
-
- <%= ff.label :from_email, 'Send from', class: 'label' %> - <%= ff.email_field :from_email, value: value['from_email'], required: true, class: 'base-input' %> -
- <% end %> -
-
- <%= f.button button_title, class: 'base-button' %> -
+
+ <%= render 'shared/settings_nav' %> +
+

Email SMTP

+

+ Configure your to send emails (TODO) +

+ <% value = @encrypted_config.value || {} %> + <%= form_for @encrypted_config, url: settings_email_index_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %> + <%= f.fields_for :value do |ff| %> +
+
+ <%= ff.label :host, class: 'label' %> + <%= ff.text_field :host, value: value['host'], required: true, class: 'base-input' %>
- <% end %> +
+ <%= ff.label :port, class: 'label' %> + <%= ff.text_field :port, value: value['port'], required: true, class: 'base-input' %> +
+
+
+
+ <%= ff.label :username, class: 'label' %> + <%= ff.text_field :username, value: value['username'], required: true, class: 'base-input' %> +
+
+ <%= ff.label :password, class: 'label' %> + <%= ff.password_field :password, value: value['password'], required: true, class: 'base-input' %> +
+
+
+ <%= ff.label :from_email, 'Send from', class: 'label' %> + <%= ff.email_field :from_email, value: value['from_email'], required: true, class: 'base-input' %> +
+ <% end %> +
+
+ <%= f.button button_title, class: 'base-button' %> +
-
-
+ <% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7c6cd5cc..a1854407 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,6 +27,8 @@
<% end %> - <%= yield %> +
+ <%= yield %> +
diff --git a/app/views/profile/index.html.erb b/app/views/profile/index.html.erb new file mode 100644 index 00000000..36c11b0b --- /dev/null +++ b/app/views/profile/index.html.erb @@ -0,0 +1,21 @@ +
+ <%= render 'shared/settings_nav' %> +
+

Profile

+ <%= form_for @user, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %> +
+
+ <%= f.label :first_name, class: 'label' %> + <%= f.text_field :first_name, required: true, class: 'base-input' %> +
+
+ <%= f.label :last_name, class: 'label' %> + <%= f.text_field :last_name, required: true, class: 'base-input' %> +
+
+
+ <%= f.button button_title, class: 'base-button' %> +
+ <% end %> +
+
diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index c695e2c9..e4ad9727 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -1,4 +1,4 @@ -
+
DocuSeal diff --git a/app/views/shared/_settings_nav.html.erb b/app/views/shared/_settings_nav.html.erb index dc15437a..657b16fd 100644 --- a/app/views/shared/_settings_nav.html.erb +++ b/app/views/shared/_settings_nav.html.erb @@ -1,5 +1,5 @@ - -
+ +