redmine-per_user_status 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +12 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +75 -0
- data/Rakefile +6 -0
- data/assets/stylesheets/per_user_status.css +3 -0
- data/config/locales/en.yml +3 -0
- data/db/migrate/20150505162200_add_custom_status_to_users.rb +9 -0
- data/lib/per_user_status/engine.rb +10 -0
- data/lib/per_user_status/hooks.rb +68 -0
- data/lib/per_user_status/infos.rb +13 -0
- data/lib/per_user_status/patches.rb +17 -0
- data/lib/per_user_status/patches/user_patch.rb +26 -0
- data/lib/per_user_status/redmine_plugin.rb +53 -0
- data/lib/per_user_status/version.rb +3 -0
- data/lib/redmine-per_user_status.rb +7 -0
- data/rakelib/rubocop.rake +18 -0
- data/redmine-per_user_status.gemspec +28 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 237f6295d21bc48cac6eb8b2e3c705907a0e2b6a
|
4
|
+
data.tar.gz: aa97ea8027717538f437b7d6437656ed022e6f35
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b67ac46e412c2d1be344ebcc98a14f5c2c83e5d14cefea6fbc342f6f60b8834b095d6c4aea40b9e59dde01366c288767948dd775c221e5ac8a2b478502ef5f2
|
7
|
+
data.tar.gz: ecd92717ee48d4df2b39187dc8a65d4f95b76e168588d445b08f4c4cd6f249fe6722ce1ed78c2aec9afd1f316e0f19d63b2f69bac752c287d7273ef4532ef306
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Jonas Thiel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
[github]: https://github.com/neopoly/redmine-per_user_status
|
2
|
+
[doc]: http://rubydoc.info/github/neopoly/redmine-per_user_status/master/file/README.md
|
3
|
+
[gem]: https://rubygems.org/gems/redmine-per_user_status
|
4
|
+
[gem-badge]: https://img.shields.io/gem/v/redmine-per_user_status.svg
|
5
|
+
[inchpages]: https://inch-ci.org/github/neopoly/redmine-per_user_status
|
6
|
+
[inchpages-badge]: https://inch-ci.org/github/neopoly/redmine-per_user_status.svg?branch=master&style=flat
|
7
|
+
|
8
|
+
# redmine-per_user_status
|
9
|
+
|
10
|
+
[![Gem Version][gem-badge]][gem]
|
11
|
+
[![Inline docs][inchpages-badge]][inchpages]
|
12
|
+
|
13
|
+
[Gem][gem] |
|
14
|
+
[Source][github] |
|
15
|
+
[Documentation][doc]
|
16
|
+
|
17
|
+
|
18
|
+
Allows users to set a custom status which will be displayed next to their names when choosing as assignee.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Ensure you have a `Gemfile.local` file in your Redmine installation. Add to your `Gemfile.local`:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem "redmine-per_user_status"
|
26
|
+
```
|
27
|
+
|
28
|
+
And then execute:
|
29
|
+
|
30
|
+
```
|
31
|
+
$ bundle
|
32
|
+
```
|
33
|
+
|
34
|
+
This plugin ships with a migration. To update the database run:
|
35
|
+
|
36
|
+
```
|
37
|
+
$ rake redmine:plugins:migrate
|
38
|
+
```
|
39
|
+
|
40
|
+
Restart the Redmine application
|
41
|
+
|
42
|
+
## Usage
|
43
|
+
|
44
|
+
1. Install the gem and require the gem
|
45
|
+
2. Switch to "My account" and set a custom status (Screenshot 1)
|
46
|
+
3. Or change a user's status using the administration panel
|
47
|
+
4. The custom user status will be displayed next to the full names
|
48
|
+
|
49
|
+
**Screenshot: Status next to assignee**
|
50
|
+
|
51
|
+
![Screenshot Issue](https://neopoly.github.io/redmine-per_user_status/images/screenshot1.png)
|
52
|
+
|
53
|
+
**Screenshot: My account**
|
54
|
+
|
55
|
+
![Screenshot MyAccount](https://neopoly.github.io/redmine-per_user_status/images/screenshot2.png)
|
56
|
+
|
57
|
+
**Screenshot: Administration**
|
58
|
+
|
59
|
+
![Screenshot Administration](https://neopoly.github.io/redmine-per_user_status/images/screenshot3.png)
|
60
|
+
|
61
|
+
## Testing
|
62
|
+
|
63
|
+
No automatic tests, sir! But this Redmine plugin is used in production.
|
64
|
+
|
65
|
+
## TODO
|
66
|
+
|
67
|
+
* Find a way to test this Redmine plugin
|
68
|
+
|
69
|
+
## Contributing
|
70
|
+
|
71
|
+
1. Fork it ( https://github.com/neopoly/redmine-per_user_status/fork )
|
72
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
75
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
module PerUserStatus
|
2
|
+
# Add custom CSS file to layout and includes an additional input field into
|
3
|
+
# the account settings and the user's administration pages
|
4
|
+
class Hooks < Redmine::Hook::ViewListener
|
5
|
+
# Inject stylesheet tags
|
6
|
+
# @param _context [Hash] ignored
|
7
|
+
def view_layouts_base_html_head(_context)
|
8
|
+
stylesheet_link_tag "per_user_status", plugin: "per_user_status"
|
9
|
+
end
|
10
|
+
|
11
|
+
# Inject input field into "My account" form
|
12
|
+
# @param context [Hash] hook context
|
13
|
+
def view_my_account(context)
|
14
|
+
extend_form(context)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Inject input field into "Edit user" form
|
18
|
+
# @param context [Hash] hook context
|
19
|
+
def view_users_form(context)
|
20
|
+
extend_form(context)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def extend_form(context)
|
26
|
+
view_context = context[:controller].view_context
|
27
|
+
form = context[:form]
|
28
|
+
FormExtender.new(view_context, form).to_html
|
29
|
+
end
|
30
|
+
|
31
|
+
# @private
|
32
|
+
class FormExtender
|
33
|
+
attr_reader :view_context, :f
|
34
|
+
|
35
|
+
def initialize(view_context, f)
|
36
|
+
@view_context = view_context
|
37
|
+
@f = f
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_html
|
41
|
+
content_tag(:p) do
|
42
|
+
input + hint
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def hint
|
49
|
+
content_tag :span, class: "hint" do
|
50
|
+
l(:per_user_status_form_hint)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def input
|
55
|
+
label = l(:per_user_status_form_custom_status)
|
56
|
+
f.text_field :custom_status, label: label
|
57
|
+
end
|
58
|
+
|
59
|
+
def content_tag(*args, &block)
|
60
|
+
view_context.content_tag(*args, &block)
|
61
|
+
end
|
62
|
+
|
63
|
+
def l(*args)
|
64
|
+
view_context.l(*args)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PerUserStatus
|
2
|
+
# Shared plugin description
|
3
|
+
module Infos
|
4
|
+
NAME = "redmine-per_user_status"
|
5
|
+
DESCRIPTION = "Allows users to set a custom status which will be " \
|
6
|
+
"displayed next to their names when choosing as assignee"
|
7
|
+
LICENSE = "MIT"
|
8
|
+
URL = "https://github.com/neopoly/redmine-per_user_status"
|
9
|
+
AUTHORS = {
|
10
|
+
"Jonas Thiel" => "jt@neopoly.de"
|
11
|
+
}.freeze
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "per_user_status/patches/user_patch"
|
2
|
+
|
3
|
+
module PerUserStatus
|
4
|
+
# This module holds all patches of a default Redmine application
|
5
|
+
module Patches
|
6
|
+
# Apply all patches
|
7
|
+
def self.apply!
|
8
|
+
apply_to(::User, UserPatch)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def self.apply_to(target, mod)
|
14
|
+
target.send(:include, mod)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module PerUserStatus
|
2
|
+
module Patches
|
3
|
+
# Patches the User#name method to allow injecting the
|
4
|
+
# current user status
|
5
|
+
module UserPatch
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
alias_method_chain :name, :custom_status
|
10
|
+
safe_attributes :custom_status
|
11
|
+
end
|
12
|
+
|
13
|
+
# Appends the custom user status to the base user name
|
14
|
+
# @param formatter The formatter to use for the name
|
15
|
+
# @see User#name
|
16
|
+
def name_with_custom_status(formatter = nil)
|
17
|
+
default = name_without_custom_status(formatter)
|
18
|
+
if custom_status.present?
|
19
|
+
"#{default} (#{custom_status})"
|
20
|
+
else
|
21
|
+
default
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "per_user_status/patches"
|
2
|
+
|
3
|
+
module PerUserStatus
|
4
|
+
# Registers this gems a Redmine plugin and applies the needed patches
|
5
|
+
class RedminePlugin
|
6
|
+
include PerUserStatus::Infos
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
register!
|
10
|
+
patch_migration_directory!
|
11
|
+
boot!
|
12
|
+
mirror_assets!
|
13
|
+
end
|
14
|
+
|
15
|
+
# As this plugin is realized as a gem Redmine won't detect the
|
16
|
+
# migration automatically.
|
17
|
+
# @return [String] Absolute path to "db/migrate"
|
18
|
+
def self.migration_directory
|
19
|
+
File.expand_path("../../../db/migrate", __FILE__)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def register!
|
25
|
+
@plugin = Redmine::Plugin.register :per_user_status do
|
26
|
+
name NAME
|
27
|
+
author AUTHORS.keys.join(", ")
|
28
|
+
description DESCRIPTION
|
29
|
+
version VERSION
|
30
|
+
url URL
|
31
|
+
author_url URL
|
32
|
+
directory Engine.root
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def boot!
|
37
|
+
require "per_user_status/hooks"
|
38
|
+
Patches.apply!
|
39
|
+
end
|
40
|
+
|
41
|
+
def patch_migration_directory!
|
42
|
+
@plugin.instance_eval do
|
43
|
+
def migration_directory
|
44
|
+
::PerUserStatus::RedminePlugin.migration_directory
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def mirror_assets!
|
50
|
+
@plugin.mirror_assets
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
begin
|
2
|
+
require "rubocop/rake_task"
|
3
|
+
|
4
|
+
Rake::Task[:default].enhance [:rubocop]
|
5
|
+
|
6
|
+
RuboCop::RakeTask.new do |task|
|
7
|
+
task.options << "--display-cop-names"
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :rubocop do
|
11
|
+
desc "Generate a configuration file acting as a TODO list."
|
12
|
+
task :auto_gen_config do
|
13
|
+
exec "bundle exec rubocop --auto-gen-config"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
rescue LoadError
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "per_user_status/version"
|
5
|
+
require "per_user_status/infos"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "redmine-per_user_status"
|
9
|
+
spec.version = PerUserStatus::VERSION
|
10
|
+
spec.authors = PerUserStatus::Infos::AUTHORS.keys
|
11
|
+
spec.email = PerUserStatus::Infos::AUTHORS.values
|
12
|
+
spec.summary = PerUserStatus::Infos::DESCRIPTION
|
13
|
+
spec.description = PerUserStatus::Infos::DESCRIPTION
|
14
|
+
spec.homepage = PerUserStatus::Infos::URL
|
15
|
+
spec.license = PerUserStatus::Infos::LICENSE
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "rails", "~> 4.2.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "inch"
|
27
|
+
spec.add_development_dependency "rubocop"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redmine-per_user_status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonas Thiel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: inch
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Allows users to set a custom status which will be displayed next to their
|
84
|
+
names when choosing as assignee
|
85
|
+
email:
|
86
|
+
- jt@neopoly.de
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- assets/stylesheets/per_user_status.css
|
98
|
+
- config/locales/en.yml
|
99
|
+
- db/migrate/20150505162200_add_custom_status_to_users.rb
|
100
|
+
- lib/per_user_status/engine.rb
|
101
|
+
- lib/per_user_status/hooks.rb
|
102
|
+
- lib/per_user_status/infos.rb
|
103
|
+
- lib/per_user_status/patches.rb
|
104
|
+
- lib/per_user_status/patches/user_patch.rb
|
105
|
+
- lib/per_user_status/redmine_plugin.rb
|
106
|
+
- lib/per_user_status/version.rb
|
107
|
+
- lib/redmine-per_user_status.rb
|
108
|
+
- rakelib/rubocop.rake
|
109
|
+
- redmine-per_user_status.gemspec
|
110
|
+
homepage: https://github.com/neopoly/redmine-per_user_status
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 2.2.2
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Allows users to set a custom status which will be displayed next to their
|
134
|
+
names when choosing as assignee
|
135
|
+
test_files: []
|
136
|
+
has_rdoc:
|