diff --git a/Gemfile b/Gemfile index 5a5afc4a..5751d452 100644 --- a/Gemfile +++ b/Gemfile @@ -54,7 +54,7 @@ gem "jquery-rails" gem "pg" -gem "jquery-ui-rails", "~> 5.0", ">= 5.0.5" +gem "jquery-ui-rails", "~> 6.0" gem "acts_as_list" gem "mimemagic", "~> 0.3.8" diff --git a/Gemfile.lock b/Gemfile.lock index 7f8802e9..a732409c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,7 +77,7 @@ GEM tzinfo (~> 2.0) acts_as_list (1.1.0) activerecord (>= 4.2) - addressable (2.8.1) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) autoprefixer-rails (10.4.13.0) @@ -146,7 +146,7 @@ GEM globalid (1.1.0) activesupport (>= 5.0) hashie (5.0.0) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -155,7 +155,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (5.0.5) + jquery-ui-rails (6.0.1) railties (>= 3.2.16) json (2.6.3) jwt (2.7.0) @@ -165,9 +165,9 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.19.1) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) madmin (1.2.7) pagy (>= 3.5, < 6.0) rails (>= 6.0.3) @@ -182,8 +182,8 @@ GEM mimemagic (0.3.10) nokogiri (~> 1) rake - mini_mime (1.1.2) - minitest (5.18.0) + mini_mime (1.1.5) + minitest (5.20.0) multi_xml (0.6.0) net-imap (0.3.4) date @@ -198,11 +198,11 @@ GEM next_rails (1.2.2) colorize (>= 0.8.1) nio4r (2.5.9) - nokogiri (1.14.3-arm64-darwin) + nokogiri (1.15.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.3-x86_64-darwin) + nokogiri (1.15.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.14.3-x86_64-linux) + nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -237,13 +237,13 @@ GEM parser (3.2.1.1) ast (~> 2.4.1) pg (1.4.6) - public_suffix (5.0.1) + public_suffix (5.0.3) puma (6.3.1) nio4r (~> 2.0) pundit (2.3.0) activesupport (>= 3.0.0) - racc (1.6.2) - rack (2.2.6.4) + racc (1.7.1) + rack (2.2.8) rack-mini-profiler (3.0.0) rack (>= 1.2.0) rack-protection (3.0.5) @@ -268,11 +268,13 @@ GEM actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) railties (7.0.4.3) actionpack (= 7.0.4.3) activesupport (= 7.0.4.3) @@ -287,7 +289,7 @@ GEM ffi (~> 1.0) recursive-open-struct (1.1.3) redcarpet (3.5.1) - regexp_parser (2.7.0) + regexp_parser (2.8.1) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) @@ -369,7 +371,7 @@ GEM rubocop-performance (~> 1.16.0) standardrb (1.0.1) standard - thor (1.2.1) + thor (1.2.2) tilt (2.1.0) timeout (0.3.2) turbolinks (5.2.1) @@ -393,12 +395,12 @@ GEM rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.7) + zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 @@ -420,7 +422,7 @@ DEPENDENCIES faker jbuilder (~> 2.5) jquery-rails - jquery-ui-rails (~> 5.0, >= 5.0.5) + jquery-ui-rails (~> 6.0) listen (~> 3.7) madmin (~> 1.2) matrix diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 6ededb59..b8ed8646 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,7 +14,7 @@ //= require jquery //= require bootstrap-sprockets //= require jquery-ui/widget -//= require jquery-ui/sortable +//= require jquery-ui/widgets/sortable //= require turbolinks //= require clipboard.min //= require sortable_list diff --git a/app/assets/stylesheets/project.scss b/app/assets/stylesheets/project.scss index d470e8d6..1a128dd9 100644 --- a/app/assets/stylesheets/project.scss +++ b/app/assets/stylesheets/project.scss @@ -267,24 +267,7 @@ i { position: relative; border-radius: 50%; - padding: 5px; - opacity: 0; - transition: transform 0.5s, opacity 0.5s; - transform: translateX(-100%); - } - - &:hover { - i { - opacity: 1; - transform: translateX(0); - } - } - - &:active { - i { - background: #f70a7c; - color: white; - } + padding-right: 5px; } } diff --git a/app/assets/stylesheets/stories.scss b/app/assets/stylesheets/stories.scss index 57b7da52..3ace7f06 100644 --- a/app/assets/stylesheets/stories.scss +++ b/app/assets/stylesheets/stories.scss @@ -61,6 +61,10 @@ padding-bottom: 1.3em; } +.modal strong { + font-weight: bold; +} + .new_story, .edit_story { display: grid; @@ -125,8 +129,8 @@ .popup { display: none; position: absolute; - top: 5px; - left: 30px; + right: 30px; + z-index: 50; background: #d9f1f1; height: 30px; width: 140px; diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 84537228..b9c352bd 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ class ProjectsController < ApplicationController before_action :authenticate_user! - before_action :find_project, only: [:show, :edit, :update, :sort, :sort_stories, :destroy, :new_sub_project, :toggle_archive, :toggle_locked] + before_action :find_project, only: [:show, :edit, :update, :sort, :sort_stories, :destroy, :new_sub_project, :toggle_archive, :toggle_locked, :open_delete_modal] before_action :ensure_unarchived!, only: [:edit, :new_sub_project, :update] def index @@ -70,9 +70,14 @@ def create end def destroy - @project.destroy respond_to do |format| - format.html { redirect_to projects_path, notice: "Project was successfully destroyed." } + if @project.title.strip.eql?(params.dig(:project, :title)&.strip) + @project.destroy + flash[:success] = "Project was successfully destroyed." + else + flash[:error] = "Make sure you added the correct project's title" + end + format.html { redirect_to projects_path } end end @@ -104,6 +109,10 @@ def new_sub_project @sub = Project.new(parent_id: @project) end + # GET /projects/1/open_delete_modal.js + def open_delete_modal + end + private def find_project diff --git a/app/views/projects/_delete_form.html.erb b/app/views/projects/_delete_form.html.erb new file mode 100644 index 00000000..ec2694bd --- /dev/null +++ b/app/views/projects/_delete_form.html.erb @@ -0,0 +1,12 @@ +<%= form_with(model: project, method: :delete) do |f| %> + This action cannot be undone. + This will permanently delete the <%= project.title %> project, + stories, and associated estimations. + +