diff --git a/Gemfile b/Gemfile index 11145ebd..6eaa2a60 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' +# gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production @@ -66,4 +66,5 @@ gem 'dotenv-rails' gem 'jay_flavored_markdown', git: 'https://github.com/nomlab/jay_flavored_markdown' gem 'kaminari' -gem 'ransack' \ No newline at end of file +gem 'ransack' +gem 'turbo-rails' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index bc0b5490..2fd0c8d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -275,9 +275,10 @@ GEM rails (>= 6.0.0) thor (1.1.0) tilt (2.0.10) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) + turbo-rails (1.5.0) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) web-console (4.1.0) @@ -331,7 +332,7 @@ DEPENDENCIES spring sqlite3 (~> 1.4) tailwindcss-rails (~> 0.3.3) - turbolinks (~> 5) + turbo-rails tzinfo-data web-console (>= 4.1.0) webdrivers diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index f1c64c6d..810193f2 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -31,6 +31,12 @@ def index @q.sorts = sort_check(params[:q][:s]) end @tasks = @q.result.page(params[:page]).per(50).includes(:user, :state) + @mytasks = @q.result.joins(:user).where(users: {screen_name: current_user&.screen_name}).page(params[:page]).per(50).includes(:user, :state) + + respond_to do |format| + format.html + format.turbo_stream + end end # GET /tasks/1 or /tasks/1.json diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index ddcdede2..45571d10 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -5,7 +5,7 @@ import '@fortawesome/fontawesome-free/js/all'; import Rails from "@rails/ujs" -import Turbolinks from "turbolinks" +// import Turbolinks from "turbolinks" import * as ActiveStorage from "@rails/activestorage" import "channels" // ここから追加 @@ -15,7 +15,8 @@ window.$ = window.jQuery = jQuery; import "jquery-textcomplete" Rails.start() -Turbolinks.start() +// Turbolinks.start() ActiveStorage.start() import "stylesheets/application" +import "@hotwired/turbo-rails" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8f7da8bb..b65eeae7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,8 +14,8 @@ <%= stylesheet_link_tag 'jfm' %> <%= stylesheet_link_tag 'github-markdown' %> - <%# %> - + + <%# %> <%# %> <%# %> diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb new file mode 100644 index 00000000..7d6fffb0 --- /dev/null +++ b/app/views/tasks/_task.html.erb @@ -0,0 +1,34 @@ +
+ <% if task.completed? %> + + <% else %> + + <% end %> + <%= link_to task.content, task %> +
++ <% if task.project %> + <%= link_to task.project.name, task.project %> + <% end %> + <%= link_to task.assigner.name, task.assigner %> + <%= task.show_days_ago.round.to_s + "日前" %> + <% task.tags.each do |tag| %> + <%= link_to tag_label(tag), tag %> + <% end %> +
+期限切れです!
+ <% else %> +<%= days_to_deadline_as_string task %>
+ <% end %> +- <% if task.completed? %> - - <% else %> - - <% end %> - <%= link_to task.content, task %> -
-- <% if task.project %> - <%= link_to task.project.name, task.project %> - <% end %> - <%= link_to task.assigner.name, task.assigner %> - <%= task.show_days_ago.round.to_s + "日前" %> - <% task.tags.each do |tag| %> - <%= link_to tag_label(tag), tag %> - <% end %> -
-期限切れです!
- <% else %> -<%= days_to_deadline_as_string task %>
- <% end %> -