diff --git a/Gemfile b/Gemfile index 77aa337..fb2dc7c 100644 --- a/Gemfile +++ b/Gemfile @@ -80,10 +80,10 @@ gem 'maglevcms', github: 'maglevhq/maglev-core', branch: 'master', require: fals source 'https://packages.nocoffee.fr/private' do # MaglevCMS PRO: multi-sites, multi-themes - gem 'maglevcms-pro', '~> 0.3.1', require: 'maglev/pro' + gem 'maglevcms-pro', '~> 0.4.0', require: 'maglev/pro' # NoCoffee UIKit to build sleek and consistent UI - gem 'ncuikit', '~> 0.1.1' + gem 'ncuikit', '~> 0.2.0' end gem "redcarpet", "~> 3.6" diff --git a/Gemfile.lock b/Gemfile.lock index 3288d2e..fbbaf18 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/maglevhq/maglev-core.git - revision: 302e7f63267379c5a2bf8ff18716ab38244ec5d0 + revision: da606a424d1781a59ed27fcadca8c610019fa074 branch: master specs: - maglevcms (1.6.0) + maglevcms (1.6.1) jbuilder (~> 2.11.2) kaminari (~> 1.2.1) maglev-injectable (~> 2.1.1) @@ -14,7 +14,7 @@ GIT GEM remote: https://packages.nocoffee.fr/private/ specs: - maglevcms-pro (0.3.2) + maglevcms-pro (0.4.0) concurrent-ruby faraday haikunator (= 1.1.0) @@ -22,7 +22,7 @@ GEM kaminari liquid (~> 5.4) rails (>= 6.1.6) - ncuikit (0.1.1) + ncuikit (0.2.0) importmap-rails (~> 2.0, >= 2.0.1) rails (>= 7.1.3.2) stimulus-rails (~> 1.2) @@ -134,7 +134,7 @@ GEM dry-cli (1.0.0) error_highlight (0.6.0) erubi (1.12.0) - faraday (2.9.1) + faraday (2.9.2) faraday-net_http (>= 2.0, < 3.2) faraday-net_http (3.1.0) net-http @@ -317,7 +317,7 @@ GEM vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.5.0) + vite_ruby (3.6.0) dry-cli (>= 0.7, < 2) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) @@ -354,8 +354,8 @@ DEPENDENCIES importmap-rails jbuilder maglevcms! - maglevcms-pro (~> 0.3.1)! - ncuikit (~> 0.1.1)! + maglevcms-pro (~> 0.4.0)! + ncuikit (~> 0.2.0)! pg (~> 1.1) puma (>= 5.0) rails (~> 7.1.2) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index c744667..b3a8ca7 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -3,4 +3,4 @@ //= link_tree ../../javascript .js //= link_tree ../../../vendor/javascript .js //= link_tree ../builds -//= link ncuikit_manifest.js \ No newline at end of file +//= link ncuikit_manifest.js diff --git a/app/controllers/current_user_controller.rb b/app/controllers/current_user_controller.rb index f632242..2cf65b5 100644 --- a/app/controllers/current_user_controller.rb +++ b/app/controllers/current_user_controller.rb @@ -33,11 +33,11 @@ def destroy private # Use callbacks to share common setup or constraints between actions. def set_user - @user = current_user + @user = User.find(current_user.id) end # Only allow a list of trusted parameters through. def user_params - params.require(:user).permit(:email, :password, :password_confirmation) + params.require(:user).permit(:avatar, :email, :password, :password_confirmation) end end \ No newline at end of file diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js index 1213e85..88bbd35 100644 --- a/app/javascript/controllers/application.js +++ b/app/javascript/controllers/application.js @@ -2,6 +2,8 @@ import { Application } from "@hotwired/stimulus" const application = Application.start() +ActiveStorage.start() + // Configure Stimulus development experience application.debug = false window.Stimulus = application diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js index 54ad4ca..1956261 100644 --- a/app/javascript/controllers/index.js +++ b/app/javascript/controllers/index.js @@ -8,4 +8,4 @@ eagerLoadControllersFrom("controllers", application) // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!) // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading" -// lazyLoadControllersFrom("controllers", application) +// lazyLoadControllersFrom("controllers", application) \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 3278cbb..3d4833d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,4 +8,7 @@ class User < ApplicationRecord ## validations ## validates :email, presence: true, uniqueness: true + ## Attachments ## + has_one_attached :avatar + end diff --git a/app/views/current_user/edit.html.erb b/app/views/current_user/edit.html.erb index 9ec1cc2..4c5ef05 100644 --- a/app/views/current_user/edit.html.erb +++ b/app/views/current_user/edit.html.erb @@ -3,6 +3,9 @@ <%= form_with(model: @user, url: current_user_path) do |form| %>
+ <%= render_ncuikit_form :avatar_field, form: form, attribute: :avatar %> +
+
<%= render_ncuikit_form :email_field, form: form, attribute: :email %>
@@ -16,7 +19,7 @@
- <%= render_ncuikit_button :primary_submit, label: 'Update' %> + <%= render_ncuikit_button :primary_submit, label: 'Update', size: 'lg' %>
<% end %> <% end %> \ No newline at end of file diff --git a/app/views/layouts/_authenticated_user.html.erb b/app/views/layouts/_authenticated_user.html.erb deleted file mode 100644 index d4b13a0..0000000 --- a/app/views/layouts/_authenticated_user.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
-
- <%= link_to 'My sites', sites_path %> -
-
/
-
- Signed in as - <%= link_to current_user.email, edit_current_user_path, class: 'font-bold' %> -
-
- <%= button_to "Sign out", session_path, method: :delete, class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> -
-
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 74df5af..d45c494 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,8 +11,9 @@ - <%= javascript_importmap_tags %> + <%= javascript_include_tag "activestorage" %> + <%= javascript_importmap_tags %> <%= javascript_import_module_tag "ncuikit/application" %>