thredded-workgroup 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.rubocop +1 -0
  5. data/.rubocop.yml +65 -0
  6. data/.travis.yml +45 -0
  7. data/CHANGELOG.md +9 -0
  8. data/CODE_OF_CONDUCT.md +49 -0
  9. data/Gemfile +6 -0
  10. data/Guardfile +77 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +125 -0
  13. data/RELEASE_CHECKLIST.md +19 -0
  14. data/Rakefile +161 -0
  15. data/app/assets/images/thredded/workgroup/.keep +0 -0
  16. data/app/assets/javascripts/thredded-workgroup.js +13 -0
  17. data/app/assets/javascripts/thredded/workgroup/follow.js +36 -0
  18. data/app/assets/javascripts/thredded/workgroup/topics.js +18 -0
  19. data/app/assets/stylesheets/thredded-workgroup.scss +3 -0
  20. data/app/assets/stylesheets/thredded/workgroup/_navs.scss +35 -0
  21. data/app/assets/stylesheets/thredded/workgroup/_topics.scss +52 -0
  22. data/app/controllers/thredded/posts_controller.rb +50 -0
  23. data/app/controllers/thredded/workgroup/application_controller.rb +7 -0
  24. data/app/controllers/thredded/workgroup/navs_controller.rb +41 -0
  25. data/app/helpers/thredded/application_helper.rb +9 -0
  26. data/app/helpers/thredded/workgroup/application_helper.rb +7 -0
  27. data/app/view_models/thredded/topic_view.rb +15 -0
  28. data/app/view_models/thredded/topics_page_view.rb +15 -0
  29. data/app/views/layouts/thredded/workgroup/application.html.erb +14 -0
  30. data/app/views/thredded/posts_common/form/_after_content.html.erb +1 -0
  31. data/app/views/thredded/shared/_header.html.erb +4 -0
  32. data/app/views/thredded/topics/_topic.html.erb +51 -0
  33. data/app/views/thredded/topics/_topics_with_last_post.html.erb +14 -0
  34. data/app/views/thredded/topics/topic/_body.html.erb +27 -0
  35. data/app/views/thredded/workgroup/navs/_personal_nav.html.erb +23 -0
  36. data/app/views/thredded/workgroup/navs/all_topics.html.erb +9 -0
  37. data/app/views/thredded/workgroup/navs/awaiting.html.erb +9 -0
  38. data/app/views/thredded/workgroup/navs/following.html.erb +9 -0
  39. data/app/views/thredded/workgroup/navs/unread.html.erb +9 -0
  40. data/bin/console +15 -0
  41. data/bin/dummy-rails +4 -0
  42. data/bin/rails.rb +14 -0
  43. data/bin/rspec +17 -0
  44. data/bin/setup +8 -0
  45. data/bin/update_from_thredded +40 -0
  46. data/config/locales/en.yml +20 -0
  47. data/config/routes.rb +11 -0
  48. data/lib/thredded/workgroup.rb +19 -0
  49. data/lib/thredded/workgroup/engine.rb +26 -0
  50. data/lib/thredded/workgroup/route_delegator.rb +25 -0
  51. data/lib/thredded/workgroup/thredded_route_delegator.rb +19 -0
  52. data/lib/thredded/workgroup/version.rb +6 -0
  53. data/script/create-db-users +42 -0
  54. data/script/dummy-console +3 -0
  55. data/shared.gemfile +27 -0
  56. data/thredded-workgroup.gemspec +65 -0
  57. metadata +520 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f28a842a59d912a9783e4e78221ac3e69be33e5f1591c1f797775b0b9a484edd
4
+ data.tar.gz: ffbe48d420241715d23dbaa34d2a6a71734c10c256532454d57d5e178e71ca66
5
+ SHA512:
6
+ metadata.gz: ce3484294af2edbe09f9bff0952b528c3714dee4b72623c55e7eab7375c25f9ec745a7cd9a7c7f2fcc0dc7bac4c06a4d1653312c5b3c8099ffb8aef41db52594
7
+ data.tar.gz: f4c04872bbed1da6e80ef89e2d6dafda15ca070b8fc408d0a19f75110bd5eb2841f83c69449ad177cb0a4d3ae654ac05ef608572e80db9768d59a17adf3295b6
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ *.gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ log/*.log
12
+ spec/dummy/db/*.sqlite3
13
+ spec/dummy/log/*.log
14
+ spec/dummy/tmp/
15
+ spec/dummy/.sass-cache
16
+ spec/dummy/public/uploads
17
+ spec/dummy/db/schema.rb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop ADDED
@@ -0,0 +1 @@
1
+ -D
data/.rubocop.yml ADDED
@@ -0,0 +1,65 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Exclude:
4
+ - 'spec/dummy/db/**/*'
5
+ - 'vendor/**/*'
6
+
7
+ Metrics/AbcSize:
8
+ Enabled: false
9
+
10
+ Metrics/ClassLength:
11
+ Max: 125
12
+
13
+ Metrics/LineLength:
14
+ Max: 120
15
+
16
+ Metrics/MethodLength:
17
+ Max: 25
18
+
19
+ Metrics/ModuleLength:
20
+ Exclude:
21
+ - spec/**/*_spec.rb
22
+
23
+ Metrics/PerceivedComplexity:
24
+ Enabled: false
25
+
26
+ Style/CollectionMethods:
27
+ Enabled: true
28
+
29
+ Style/Documentation:
30
+ Enabled: false
31
+
32
+ Style/MultilineMethodCallIndentation:
33
+ EnforcedStyle: indented
34
+
35
+ Style/PredicateName:
36
+ Exclude:
37
+ - spec/**/*.rb
38
+
39
+ Style/SignalException:
40
+ EnforcedStyle: semantic
41
+
42
+ Style/StringLiterals:
43
+ EnforcedStyle: double_quotes
44
+
45
+ Style/TrailingCommaInLiteral:
46
+ Enabled: false
47
+
48
+ Style/TrailingCommaInArguments:
49
+ Enabled: false
50
+
51
+ Rails:
52
+ Enabled: true
53
+
54
+ Rails/Date:
55
+ EnforcedStyle: strict
56
+
57
+ Rails/FindBy:
58
+ Enabled: true
59
+ Include:
60
+ - app/commands/**/*.rb
61
+ - app/models/**/*.rb
62
+ - app/view_models/**/*.rb
63
+
64
+ Lint/EndAlignment:
65
+ AutoCorrect: true
data/.travis.yml ADDED
@@ -0,0 +1,45 @@
1
+ # use travis defaults from capybara-webkit
2
+ sudo: required
3
+ dist: trusty
4
+
5
+ addons:
6
+ apt:
7
+ sources:
8
+ - ubuntu-sdk-team
9
+ packages:
10
+ - libqt5webkit5-dev
11
+ - qtdeclarative5-dev
12
+
13
+ language: ruby
14
+ rvm:
15
+ - 2.3
16
+ # - 2.4 # not till rails 4.2.8 is released
17
+ cache: bundler
18
+ bundler_args: --path ../../vendor/bundle --without debug
19
+ gemfile:
20
+ - spec/gemfiles/rails_4_2.gemfile
21
+ - spec/gemfiles/rails_5_0.gemfile
22
+ - spec/gemfiles/rails_5_1.gemfile
23
+ - spec/gemfiles/rails_5_2.gemfile
24
+
25
+ env:
26
+ global:
27
+ - QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
28
+ matrix:
29
+ # Username and password from http://docs.travis-ci.com/user/database-setup/
30
+ - DB=sqlite3 DBC_VERBOSE=true
31
+ # - DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
32
+ - DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
33
+
34
+ matrix:
35
+ fast_finish: true
36
+ allow_failures:
37
+ - env: DB=sqlite3 DBC_VERBOSE=true
38
+
39
+ before_script:
40
+ - RAILS_ENV=test bundle exec rake db:create db:migrate
41
+
42
+ script:
43
+ - xvfb-run bundle exec rspec
44
+ - bundle show rubocop
45
+ - bundle exec rubocop
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # v0.2.0
2
+
3
+ It's the first actual release (the theoretical v0.1.0 was only on github and never released as a gem)
4
+
5
+ This version supports:
6
+
7
+ * thredded v0.16.0+
8
+ * rails 4.2 - 5.2
9
+
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at tim@red56.co.uk. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
3
+
4
+ # if you switch rails version gemfile:
5
+ # bundle update rails json rails-i18n
6
+ eval_gemfile File.expand_path("spec/gemfiles/rails_5_2.gemfile", File.dirname(__FILE__))
data/Guardfile ADDED
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard "livereload" do
19
+ extensions = {
20
+ css: :css,
21
+ scss: :css,
22
+ sass: :css,
23
+ js: :js,
24
+ coffee: :js,
25
+ html: :html,
26
+ png: :png,
27
+ gif: :gif,
28
+ jpg: :jpg,
29
+ jpeg: :jpeg,
30
+ # less: :less, # uncomment if you want LESS stylesheets done in browser
31
+ }
32
+
33
+ rails_view_exts = %w(erb haml slim)
34
+
35
+ # file types LiveReload may optimize refresh for
36
+ compiled_exts = extensions.values.uniq
37
+ watch(%r{public/.+\.(#{compiled_exts * '|'})})
38
+
39
+ extensions.each do |ext, type|
40
+ watch(%r{
41
+ (?:app|vendor)
42
+ (?:/assets/\w+/(?<path>[^.]+) # path+base without extension
43
+ (?<ext>\.#{ext})) # matching extension (must be first encountered)
44
+ (?:\.\w+|$) # other extensions
45
+ }x) do |m|
46
+ path = m[1]
47
+ "/assets/#{path}.#{type}"
48
+ end
49
+ end
50
+
51
+ # file needing a full reload of the page anyway
52
+ watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$})
53
+ watch(%r{app/helpers/.+\.rb})
54
+ watch(%r{config/locales/.+\.yml})
55
+ end
56
+
57
+ # Guard-Rails supports a lot options with default values:
58
+ # daemon: false # runs the server as a daemon.
59
+ # debugger: false # enable ruby-debug gem.
60
+ # environment: 'development' # changes server environment.
61
+ # force_run: false # kills any process that's holding the listen port before attempting
62
+ # # to (re)start Rails.
63
+ # pid_file: 'tmp/pids/[RAILS_ENV].pid' # specify your pid_file.
64
+ # host: 'localhost' # server hostname.
65
+ # port: 3000 # server port number.
66
+ # root: '/spec/dummy' # Rails' root path.
67
+ # server: thin # webserver engine.
68
+ # start_on_start: true # will start the server when starting Guard.
69
+ # timeout: 30 # waits untill restarting the Rails server, in seconds.
70
+ # zeus_plan: server # custom plan in zeus, only works with `zeus: true`.
71
+ # zeus: false # enables zeus gem.
72
+ # CLI: 'rails server' # customizes runner command. Omits all options except `pid_file`!
73
+
74
+ guard "rails", port: 3012, root: "spec/dummy" do
75
+ watch("Gemfile.lock")
76
+ watch(%r{^(config|lib)/.*})
77
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Tim Diggins
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Thredded::Workgroup
2
+
3
+ Extension to [Thredded](http://github.com/thredded/thredded) with features useful to workgroup messaging (Unread,
4
+ Unreplied, Following).
5
+
6
+ originated in https://github.com/thredded/thredded/issues/347
7
+
8
+ Out the box enables a homepage with a top-level nav menu consisting of:
9
+
10
+ * Unread: a list of unread topics (ordered by last post) across all messageboards
11
+ * Following: a list of followed topics (ordered by last post) across all messageboards
12
+ * Awaiting reply: a list of all topics you follow where yours is the last post
13
+ * All topics: a list of all topics (ordered by last post) across all messageboards
14
+ * All messageboards: a list of messageboards (as present)
15
+
16
+ It adds a navbar like this:
17
+
18
+ <img width="898" alt="screenshot" src="https://cloud.githubusercontent.com/assets/18395/17519867/a07ca5e8-5e45-11e6-86e1-953fdc399168.png">
19
+
20
+
21
+ ## Installation
22
+
23
+ Add this line to your application's Gemfile (along with thredded if you want to specify a specific fork):
24
+
25
+ ```ruby
26
+ gem 'thredded-workgroup'
27
+ ```
28
+
29
+ ### Jquery
30
+
31
+ Since thredded v0.13.0, thredded doesn't need jquery, but thredded-workgroup (still) does.
32
+ So you need to include jquery and its ujs file, for example in your Gemfile:
33
+
34
+ ```ruby
35
+ gem "jquery-rails"
36
+ ```
37
+
38
+ __NB: (see below for using master vs a released version)__
39
+
40
+ And then execute:
41
+
42
+ $ bundle
43
+
44
+ Or install it yourself as:
45
+
46
+ $ gem install thredded-workgroup
47
+
48
+ ## Usage
49
+
50
+ add to routes.rb (**instead** of mounting Thredded)
51
+
52
+ ```
53
+ mount Thredded::Workgroup::Engine => "/thredded"
54
+ ```
55
+
56
+ You will also need to follow the guidelines for installing Thredded, see https://github
57
+ .com/thredded/thredded#installation.
58
+
59
+ If you use an application layout (see Add thredded styles to your `application.scss` (see https://github.com/thredded/thredded#application-layout) below for customizing the styles), you will need to include thredded **and** thredded-workgroup:
60
+
61
+
62
+ ```scss
63
+ @import "thredded";
64
+ @import "thredded-workgroup";
65
+ ```
66
+
67
+ Include thredded JavaScripts in your `application.js`:
68
+
69
+ ```js
70
+ //= require thredded
71
+ //= require jquery3
72
+ //= require jquery_ujs
73
+ //= require thredded-workgroup
74
+ ```
75
+
76
+ ## Master vs Released versions
77
+
78
+ NB: if you are using the master version rather than a release version
79
+ (and as no release has been made yet you must be! :) ) then you may well need
80
+ also to use the latest master release of thredded. So your gem file may need to say:
81
+
82
+ ```ruby
83
+ gem 'thredded', github: 'thredded/thredded', branch: 'master'
84
+ gem 'thredded-workgroup', github: 'red56/thredded-workgroup', branch: 'master'
85
+ ```
86
+
87
+ and you need to update both at the same time: `gem update thredded thredded-workgroup`
88
+
89
+ In the future we will be releasing thredded-workgroup versions soon after thredded versions.
90
+
91
+
92
+ ## Development
93
+
94
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
95
+
96
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
97
+
98
+ Then create a database and seed it (this is all very similar to Thredded)
99
+
100
+ ```
101
+ bundle exec rake db:create db:migrate db:seed
102
+ ```
103
+
104
+ Run the server
105
+
106
+ ```
107
+ dummy-rails s -p 3012
108
+ ```
109
+
110
+ ### Updating when thredded changes
111
+
112
+ For now, there are some copied resources from Thredded. When Thredded changes you need to update these too.
113
+ You need to have thredded installed with a github reference (check shared.gemfile)
114
+
115
+ run `bin/update_from_thredded`
116
+
117
+ ## Contributing
118
+
119
+ Bug reports and pull requests are welcome on GitHub at https://github.com/red56/thredded-workgroup. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
120
+
121
+
122
+ ## License
123
+
124
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
125
+
@@ -0,0 +1,19 @@
1
+ The checklist for releasing a new version of Thredded.
2
+
3
+ Pre-requisites for the releaser:
4
+
5
+ * The [gem-release gem](https://github.com/svenfuchs/gem-release): `gem install gem-release`.
6
+ * Push access to RubyGems.
7
+
8
+ Release checklist:
9
+
10
+ - [ ] Update gem version in `version.rb` and `README.md`.
11
+ - [ ] Update `CHANGELOG.md`. Ensure that the following link points to the future git tag for this version:
12
+ * [ ] The "See the full list of changes here" link.
13
+ - [ ] Wait for the Travis build to come back green.
14
+ - [ ] Tag the release and push it to rubygems:
15
+
16
+ ```bash
17
+ gem tag && gem release
18
+ ```
19
+ - [ ] Copy the release notes from the changelog to [GitHub Releases](https://github.com/thredded/thredded/releases).