diff --git a/README.md b/README.md index 5a189d9..e67d9ea 100644 --- a/README.md +++ b/README.md @@ -395,7 +395,7 @@ linkarooie/ ## Gather Script -[GRABIT.SH](https://grabit.sh) was inspired by this script. +- [GRABIT.SH](https://grabit.sh) was inspired by this script. The `gather.sh` script is a utility for collecting project information: diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index c28410a..a6f6967 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -59,18 +59,18 @@ def update protected def configure_permitted_parameters - devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation, :username, :full_name, :tags, :avatar, :banner, :description]) - devise_parameter_sanitizer.permit(:account_update, keys: [:email, :password, :password_confirmation, :username, :full_name, :tags, :avatar, :banner, :description]) + devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation, :username, :full_name, :tags, :avatar, :banner, :description, :banner_enabled]) + devise_parameter_sanitizer.permit(:account_update, keys: [:email, :password, :password_confirmation, :username, :full_name, :tags, :avatar, :banner, :description, :banner_enabled]) end def sign_up_params - params.require(:user).permit(:email, :password, :password_confirmation, :username, :full_name, :tags, :avatar, :banner, :description).tap do |user_params| + params.require(:user).permit(:email, :password, :password_confirmation, :username, :full_name, :tags, :avatar, :banner, :description, :banner_enabled).tap do |user_params| user_params[:tags] = user_params[:tags].split(',').map(&:strip).to_json if user_params[:tags].present? end end def account_update_params - params.require(:user).permit(:email, :password, :password_confirmation, :current_password, :username, :full_name, :tags, :avatar, :banner, :description, :public_analytics).tap do |user_params| + params.require(:user).permit(:email, :password, :password_confirmation, :current_password, :username, :full_name, :tags, :avatar, :banner, :description, :banner_enabled, :public_analytics).tap do |user_params| user_params[:tags] = user_params[:tags].split(',').map(&:strip).to_json if user_params[:tags].present? end end diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 2c3853f..e25531c 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -33,6 +33,11 @@ <%= f.text_field :banner, class: 'w-full p-1 rounded text-black' %> +
+ <%= f.label :banner_enabled, class: 'block text-gray-300 mb-1' %> + <%= f.check_box :banner_enabled, class: 'rounded text-black' %> +
+
<%= f.label :description, class: 'block text-gray-300 mb-1' %> <%= f.text_area :description, class: 'w-full p-1 rounded text-black' %> diff --git a/app/views/links/user_links.html.erb b/app/views/links/user_links.html.erb index 737f1c0..17808e1 100644 --- a/app/views/links/user_links.html.erb +++ b/app/views/links/user_links.html.erb @@ -1,20 +1,25 @@ <% set_open_graph_tags(@user) if @user %> -
-
+
+ <% if @user.banner_enabled && @user.banner.present? %> +
+ <%= image_tag @user.banner, class: "w-full h-full object-cover object-center" %> +
+ <% end %> +
<% local_avatar_path = "/avatars/#{@user.username}_avatar#{File.extname(@user.avatar)}" %> <% if File.exist?(Rails.root.join('public' + local_avatar_path)) %> - <%= image_tag local_avatar_path, alt: @user.email, class: "rounded-full border-4 border-white object-cover", style: "width: 8rem; height: auto;" %> + <%= image_tag local_avatar_path, alt: @user.email, class: "rounded-full border-4 border-gray-900 object-cover", style: "width: 8rem; height: 8rem;" %> <% elsif @user.avatar.present? %> - <%= image_tag @user.avatar, alt: @user.email, class: "rounded-full border-4 border-white object-cover", style: "width: 8rem; height: auto;" %> + <%= image_tag @user.avatar, alt: @user.email, class: "rounded-full border-4 border-gray-900 object-cover", style: "width: 8rem; height: 8rem;" %> <% else %> - <%= image_tag "greg.jpg", alt: @user.email, class: "rounded-full border-4 border-white object-cover", style: "width: 8rem; height: auto;" %> + <%= image_tag "greg.jpg", alt: @user.email, class: "rounded-full border-4 border-gray-900 object-cover", style: "width: 8rem; height: 8rem;" %> <% end %>