thredded-workgroup 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +23 -6
  3. data/.rubocop_todo.yml +392 -0
  4. data/.travis.yml +20 -28
  5. data/CHANGELOG.md +18 -0
  6. data/Gemfile +1 -0
  7. data/Guardfile +17 -40
  8. data/README.md +27 -10
  9. data/RELEASE_CHECKLIST.md +1 -2
  10. data/Rakefile +5 -0
  11. data/app/assets/config/thredded_workgroup_manifest.js +3 -0
  12. data/app/assets/images/thredded/workgroup/envelope-o.svg +2 -0
  13. data/app/assets/images/thredded/workgroup/envelope-open-o.svg +2 -0
  14. data/app/assets/javascripts/thredded/workgroup/components/followers.es6 +24 -0
  15. data/app/assets/javascripts/thredded/workgroup/components/overflow.es6 +60 -0
  16. data/app/assets/javascripts/thredded/workgroup/components/topics.es6 +151 -0
  17. data/app/assets/javascripts/thredded/workgroup/core/thredded_workgroup.js +1 -0
  18. data/app/assets/javascripts/thredded/workgroup/core/touch.es6 +16 -0
  19. data/app/assets/javascripts/thredded/workgroup/index.js +3 -0
  20. data/app/assets/javascripts/thredded-workgroup.js +1 -13
  21. data/app/assets/stylesheets/thredded/workgroup/_followers.scss +51 -0
  22. data/app/assets/stylesheets/thredded/workgroup/_navs.scss +29 -7
  23. data/app/assets/stylesheets/thredded/workgroup/_overflow.scss +71 -0
  24. data/app/assets/stylesheets/thredded/workgroup/_topics.scss +186 -16
  25. data/app/assets/stylesheets/thredded-workgroup.scss +2 -0
  26. data/app/controllers/concerns/thredded/workgroup/all_unread_followed_topics.rb +35 -0
  27. data/app/controllers/thredded/application_controller.rb +23 -0
  28. data/app/controllers/thredded/posts_controller.rb +3 -2
  29. data/app/controllers/thredded/workgroup/application_controller.rb +1 -0
  30. data/app/controllers/thredded/workgroup/navs_controller.rb +1 -0
  31. data/app/controllers/thredded/workgroup/read_states_controller.rb +14 -0
  32. data/app/controllers/thredded/workgroup/topics_controller.rb +18 -0
  33. data/app/helpers/thredded/application_helper.rb +1 -0
  34. data/app/helpers/thredded/workgroup/application_helper.rb +1 -0
  35. data/app/jobs/thredded/workgroup/mark_all_topics_read_job.rb +13 -0
  36. data/app/view_hooks/thredded/all_view_hooks.rb +9 -0
  37. data/app/view_hooks/thredded/workgroup/view_hooks.rb +28 -0
  38. data/app/view_models/thredded/topic_view.rb +17 -0
  39. data/app/view_models/thredded/topics_page_view.rb +1 -0
  40. data/app/views/thredded/shared/nav/_unread_topics.html.erb +1 -0
  41. data/app/views/thredded/topics/_followers.html.erb +23 -0
  42. data/app/views/thredded/topics/_topic.html.erb +25 -28
  43. data/app/views/thredded/workgroup/navs/_personal_nav.html.erb +7 -1
  44. data/app/views/thredded/workgroup/navs/all_topics.html.erb +1 -1
  45. data/app/views/thredded/workgroup/navs/awaiting.html.erb +1 -1
  46. data/app/views/thredded/workgroup/navs/following.html.erb +1 -1
  47. data/app/views/thredded/workgroup/navs/unread.html.erb +1 -1
  48. data/app/views/thredded/workgroup/topics/_controls.html.erb +21 -0
  49. data/app/views/thredded/workgroup/topics/_last_post.html.erb +11 -0
  50. data/app/views/thredded/workgroup/topics/_last_post_with_controls.html.erb +12 -0
  51. data/app/views/thredded/workgroup/topics/_topics_with_last_post.html.erb +16 -0
  52. data/bin/rails.rb +1 -0
  53. data/bin/rspec +1 -0
  54. data/bin/update_from_thredded +2 -1
  55. data/config/locales/en.yml +11 -0
  56. data/config/routes.rb +9 -0
  57. data/docs/followers-above-post.png +0 -0
  58. data/docs/navbar.png +0 -0
  59. data/lib/thredded/workgroup/engine.rb +11 -2
  60. data/lib/thredded/workgroup/thredded_route_delegator.rb +1 -0
  61. data/lib/thredded/workgroup/version.rb +2 -1
  62. data/lib/thredded/workgroup.rb +1 -0
  63. data/shared.gemfile +23 -16
  64. data/thredded-workgroup.gemspec +14 -18
  65. metadata +83 -88
  66. data/app/assets/javascripts/thredded/workgroup/follow.js +0 -36
  67. data/app/assets/javascripts/thredded/workgroup/topics.js +0 -18
  68. data/app/views/thredded/topics/_topics_with_last_post.html.erb +0 -14
@@ -0,0 +1,16 @@
1
+ <%= define_svg_icons 'thredded/follow.svg', 'thredded/unfollow.svg' %>
2
+
3
+ <%= thredded_page do %>
4
+ <%= content_tag :section, class: 'thredded--main-section thredded--topics', 'data-thredded-topics' => true do %>
5
+ <%= render @topics, show_messageboard: !messageboard_or_nil %>
6
+ <% end %>
7
+
8
+ <%= button_to t("thredded.nav.mark_all_read"),
9
+ mark_all_topics_read_path,
10
+ class: 'thredded--button thredded--button-light thredded--button-wide',
11
+ method: :put -%>
12
+
13
+ <footer>
14
+ <%= paginate @topics %>
15
+ </footer>
16
+ <% end %>
data/bin/rails.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  # This command will automatically be run when you run "rails"
4
5
  # with Rails 4 gems installed from the root of your application.
5
6
 
data/bin/rspec CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -20,7 +20,8 @@ rm -fR ./spec/dummy/
20
20
  cp -pR $(bundle show thredded)/spec/dummy ./spec/dummy
21
21
 
22
22
  # update some standard helpful files
23
- cp $(bundle show thredded)/spec/support/features/fake_content.rb spec/support/features/fake_content.rb
23
+ cp $(bundle show thredded)/spec/support/system/fake_content.rb spec/support/system/fake_content.rb
24
+ cp $(bundle show thredded)/spec/lib/thredded/all_view_hooks_spec.rb spec/lib/thredded/all_view_hooks_spec.rb
24
25
 
25
26
  # restore thredded-workgroup config, emoji
26
27
  mv ./tmp/upgradecache/thredded_workgroup.rb ./spec/dummy/config/initializers/
@@ -12,9 +12,20 @@ en:
12
12
  following:
13
13
  title: Topics you are following
14
14
  link: Follow
15
+ you: (You)
15
16
  messageboards:
16
17
  link: Messageboards
17
18
  condensed-link: M'boards
18
19
  all_topics:
19
20
  title: All topics
20
21
  link: All
22
+ condensable:
23
+ read_all: Read all
24
+ read_less: Read less
25
+ nav:
26
+ mark_all_read: Mark all as read
27
+ topics:
28
+ mark_all_unread:
29
+ mark_read: Mark as Read
30
+ mark_unread: Mark as Unread
31
+ view_or_reply: View/Reply
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  Thredded::Workgroup::Engine.routes.draw do
3
4
  controller "navs" do
4
5
  get "unread", action: :unread, as: :unread_nav
@@ -7,5 +8,13 @@ Thredded::Workgroup::Engine.routes.draw do
7
8
  get "awaiting", action: :awaiting, as: :awaiting_nav
8
9
  end
9
10
 
11
+ resources :topics, path: "w/topics", controller: "topics", only: [] do
12
+ member do
13
+ post "kick"
14
+ end
15
+ end
16
+
17
+ put :mark_all_topics_read, to: "read_states#mark_all_topics_read", as: :mark_all_topics_read
18
+
10
19
  mount Thredded::Engine => "/"
11
20
  end
Binary file
data/docs/navbar.png ADDED
Binary file
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "thredded/engine"
3
4
  require "thredded/workgroup/thredded_route_delegator"
4
5
  require "thredded/workgroup/route_delegator"
@@ -15,10 +16,18 @@ module Thredded
15
16
  Rails.application.reload_routes!
16
17
  ::Thredded::Workgroup::ThreddedRouteDelegator.add_thredded_proxies
17
18
  ::Thredded::Workgroup::RouteDelegator.add_my_proxies_to_thredded
19
+
20
+ Thredded::ApplicationController.module_eval do
21
+ Thredded.view_hooks.post_form.content_text_area.config.before do |form:, **_args|
22
+ if form.object.is_a?(Thredded::PostForm) && form.object.topic.persisted?
23
+ render partial: "thredded/topics/followers", locals: { topic: form.object.topic }
24
+ end
25
+ end
26
+ end
18
27
  end
19
- initializer "thredded.setup_assets" do
28
+ initializer "thredded_workgroup.setup_assets" do
20
29
  Thredded::Workgroup::Engine.config.assets.precompile += %w(
21
- thredded-workgroup.css
30
+ thredded_workgroup_manifest.js
22
31
  )
23
32
  end
24
33
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module Workgroup
4
5
  module ThreddedRouteDelegator
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module Workgroup
4
- VERSION = "0.2.0"
5
+ VERSION = "0.3.1"
5
6
  end
6
7
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "thredded/workgroup/engine"
3
4
  require "thredded/workgroup/version"
4
5
 
data/shared.gemfile CHANGED
@@ -1,27 +1,34 @@
1
- gem 'rake'
2
- gem 'test_after_commit', group: :test #only enabled on rails v4
3
- gem 'thredded', github: 'thredded/thredded', branch: 'master'
1
+ # frozen_string_literal: true
4
2
 
5
- if ENV['TRAVIS']
6
- gem 'codeclimate-test-reporter', group: :test, require: false
7
- else
3
+ gem "rake"
4
+ gem "thredded", github: "thredded/thredded", branch: "master"
5
+
6
+ unless ENV["TRAVIS"]
8
7
  group :development do
9
- gem 'guard'
10
- gem 'guard-rails'
11
- gem 'guard-livereload'
8
+ gem "guard"
9
+ gem "guard-rails"
10
+ gem "guard-livereload"
11
+ gem "rack-livereload"
12
12
  end
13
13
  end
14
14
 
15
- gem 'sassc', '>= 1.12.1'
15
+ group :development, :test do
16
+ gem "webdrivers", require: false
17
+ end
18
+ group :test do
19
+ gem "selenium-webdriver", require: false
20
+ end
21
+
22
+ gem "sassc", ">= 1.12.1"
16
23
 
17
24
  group :debug do
18
- gem 'derailed'
19
- gem 'pry-rails'
20
- gem 'rack-mini-profiler'
25
+ gem "derailed"
26
+ gem "pry-rails"
27
+ gem "rack-mini-profiler"
21
28
 
22
29
  platform :mri do
23
- gem 'byebug'
24
- gem 'flamegraph'
25
- gem 'stackprof'
30
+ gem "byebug"
31
+ gem "flamegraph"
32
+ gem "stackprof"
26
33
  end
27
34
  end
@@ -1,5 +1,6 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
+
3
4
  # rubocop:disable Style/GuardClause
4
5
  lib = File.expand_path("../lib", __FILE__)
5
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -13,31 +14,32 @@ Gem::Specification.new do |s|
13
14
 
14
15
  s.summary = "Extension to Thredded with features for workgroup messaging (Unread, Unreplied, Following)."
15
16
  s.description = "Write a longer description or delete this line."
16
- s.homepage = "https://github.com/red56/thredded-workgroup."
17
+ s.homepage = "https://github.com/thredded/thredded-workgroup"
17
18
  s.license = "MIT"
18
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|system)/}) }
19
20
  s.bindir = "exe"
20
21
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
22
  s.require_paths = ["lib"]
22
23
 
23
24
  # needs thredded, you can specify a specific fork or version (in **your** gemfile) if you need to!
24
- s.add_dependency "thredded", "~> 0.16"
25
+ s.add_dependency "thredded", ">= 0.16.1"
25
26
 
26
27
  # bundler added dependencies
27
- s.add_development_dependency "bundler", "~> 1.12"
28
- s.add_development_dependency "rake", "~> 10.0"
29
- s.add_development_dependency "rspec", "~> 3.0"
28
+ s.add_development_dependency "bundler"
29
+ s.add_development_dependency "rake"
30
+ s.add_development_dependency "rspec"
30
31
 
31
32
  # test dependencies
32
- s.add_development_dependency "capybara", "~> 2.4"
33
- s.add_development_dependency "capybara-webkit"
34
- s.add_development_dependency "database_cleaner"
33
+ s.add_development_dependency "capybara"
35
34
  s.add_development_dependency "factory_bot_rails"
36
35
  s.add_development_dependency "faker", ">= 1.6.2"
37
36
  s.add_development_dependency "launchy"
38
37
  s.add_development_dependency "rspec-rails", ">= 3.5.0"
39
- s.add_development_dependency "rubocop", "= 0.41.2"
40
- s.add_development_dependency "transactional_capybara"
38
+ s.add_development_dependency "rubocop", "= 1.25.1"
39
+ s.add_development_dependency "rubocop-rails", "= 2.13.2"
40
+ s.add_development_dependency "rubocop-rspec", "= 2.8.0"
41
+ s.add_development_dependency "rubocop-performance", "= 1.13.2"
42
+ s.add_development_dependency "bundle-audit"
41
43
 
42
44
  # dummy app dependencies
43
45
  s.add_development_dependency "rails-i18n"
@@ -50,16 +52,10 @@ Gem::Specification.new do |s|
50
52
  s.add_development_dependency "rails_email_preview", ">= 2.0.1"
51
53
  s.add_development_dependency "roadie-rails"
52
54
  s.add_development_dependency "i18n-tasks"
55
+ s.add_development_dependency "twemoji"
53
56
  s.add_development_dependency "web-console"
54
57
  s.add_development_dependency "jquery-rails"
55
58
 
56
- # add some plugins to the dummy app demo
57
- s.add_development_dependency "thredded-markdown_coderay"
58
- s.add_development_dependency "thredded-markdown_katex"
59
- s.add_development_dependency "twemoji"
60
-
61
59
  # dummy app frontend
62
60
  s.add_development_dependency "turbolinks"
63
- # required by the turbolinks gem
64
- s.add_development_dependency "coffee-rails"
65
61
  end