redmine-user_wiki_macro 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d785be13e4ddf9dde9e20a2c5bf4bca0475abb8d
4
+ data.tar.gz: 30d551125580685eed45b91b90175415877610bf
5
+ SHA512:
6
+ metadata.gz: 81a96675e5c8d682baf9955b5d6f04f90abd9e0f545f39a845ead1b7da7c9d4d8705f92456d31f370583160915485cf8f835ebee7aeba77ffb156c7ad6227b23
7
+ data.tar.gz: c54045ef95d8cbbb26993e7f659bb8bbeab33b336af2de22477ccf803f288cccec5897498703ac1a6e0a2962970c2a30a8655a6c4046d7c1a9ce90413deb2148
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ StringLiterals:
2
+ EnforcedStyle: "double_quotes"
3
+
4
+ Style/FileName:
5
+ Enabled: false
6
+
7
+ Documentation:
8
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in candy_check.gemspec
4
+ gemspec
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,39 @@
1
+ # redmine-user_wiki_macro
2
+
3
+ Adds a `{{user(login_name)}}` macro to the Redmine's wiki engine
4
+
5
+ ## Installation
6
+
7
+ Ensure you have a `Gemfile.local` file in your Redmine installation. Add to your `Gemfile.local`:
8
+
9
+ ```ruby
10
+ gem "redmine-user_wiki_macro"
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```
16
+ $ bundle
17
+ ```
18
+
19
+ Restart the Redmine application
20
+
21
+ ## Usage
22
+
23
+ No further steps needed
24
+
25
+ ## Testing
26
+
27
+ No automatic tests, sir! But this Redmine plugin is used in production.
28
+
29
+ ## TODO
30
+
31
+ * Find a way to test this Redmine plugin
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/redmine-user_wiki_macro/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: [:rubocop]
@@ -0,0 +1,9 @@
1
+ span.user-wiki-macro-user img{
2
+ padding: 2px;
3
+ border: 1px solid #d5d5d5;
4
+ background: #fff;
5
+ }
6
+
7
+ span.user-wiki-macro-user span{
8
+ padding-left: 5px;
9
+ }
@@ -0,0 +1,8 @@
1
+ require "user_wiki_macro/version"
2
+ require "user_wiki_macro/infos"
3
+ require "user_wiki_macro/engine"
4
+
5
+ # Redmine plugin to support HTTP basic authentication based
6
+ # authentication mechanism
7
+ module UserWikiMacro
8
+ end
@@ -0,0 +1,10 @@
1
+ require "user_wiki_macro/redmine_plugin"
2
+
3
+ module UserWikiMacro
4
+ # Simple engine to support the Redmine plugin
5
+ class Engine < ::Rails::Engine
6
+ config.to_prepare do
7
+ RedminePlugin.new
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module UserWikiMacro
2
+ class ApplicationHooks < Redmine::Hook::ViewListener
3
+ def view_layouts_base_html_head(_context)
4
+ stylesheet_link_tag "user_wiki_macro", plugin: "user_wiki_macro"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module UserWikiMacro
2
+ module Infos
3
+ NAME = "redmine-user_wiki_macro"
4
+ DESCRIPTION = "Adds a {{user(login_name)}} macro to Redmine's wiki engine"
5
+ LICENSE = "MIT"
6
+ URL = "https://github.com/neopoly/redmine-user_wiki_macro"
7
+ AUTHORS = {
8
+ "Jonas Thiel" => "jt@neopoly.de"
9
+ }.freeze
10
+ end
11
+ end
@@ -0,0 +1,34 @@
1
+ module UserWikiMacro
2
+ USER_SIZES = {
3
+ "default" => 24,
4
+ "small" => 14,
5
+ "large" => 50
6
+ }.freeze
7
+
8
+ Redmine::WikiFormatting::Macros.register do
9
+ desc "Creates link to a user page including an avatar. Examples:\n\n" \
10
+ "{{user(the_user_login)}}\n" \
11
+ "{{user(the_user_login, size=small)}}"
12
+ macro :user do |_obj, args|
13
+ args, options = extract_macro_options(args, :size)
14
+ return nil unless args.first.present?
15
+ username = args.first.strip
16
+ user = User.find_by_login(username)
17
+ return nil unless user
18
+
19
+ content_tag :span, class: "user-wiki-macro user-wiki-macro-user" do
20
+ label = avatar(user, size: UserWikiMacro.determine_size(options))
21
+ label += content_tag(:span, user.login)
22
+ link_to label, user_path(user)
23
+ end
24
+ end
25
+ end
26
+
27
+ def self.determine_size(options)
28
+ if options[:size]
29
+ USER_SIZES[options[:size]] || options[:size]
30
+ else
31
+ USER_SIZES["default"]
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ module UserWikiMacro
2
+ # Registers this gems a Redmine plugin and applies the needed patches
3
+ class RedminePlugin
4
+ include UserWikiMacro::Infos
5
+
6
+ def initialize
7
+ register!
8
+ boot!
9
+ mirror_assets!
10
+ end
11
+
12
+ private
13
+
14
+ def register!
15
+ @plugin = Redmine::Plugin.register :user_wiki_macro do
16
+ name NAME
17
+ author AUTHORS.keys.join(", ")
18
+ description DESCRIPTION
19
+ version VERSION
20
+ url URL
21
+ author_url URL
22
+ directory Engine.root
23
+ end
24
+ end
25
+
26
+ def boot!
27
+ require "user_wiki_macro/hooks"
28
+ require "user_wiki_macro/macros"
29
+ end
30
+
31
+ def mirror_assets!
32
+ @plugin.mirror_assets
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module UserWikiMacro
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "user_wiki_macro/version"
5
+ require "user_wiki_macro/infos"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "redmine-user_wiki_macro"
9
+ spec.version = UserWikiMacro::VERSION
10
+ spec.authors = UserWikiMacro::Infos::AUTHORS.keys
11
+ spec.email = UserWikiMacro::Infos::AUTHORS.values
12
+ spec.summary = UserWikiMacro::Infos::DESCRIPTION
13
+ spec.description = UserWikiMacro::Infos::DESCRIPTION
14
+ spec.homepage = UserWikiMacro::Infos::URL
15
+ spec.license = UserWikiMacro::Infos::LICENSE
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(/^(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 "rubocop"
27
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redmine-user_wiki_macro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jonas Thiel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-18 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: rubocop
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
+ description: Adds a {{user(login_name)}} macro to Redmine's wiki engine
70
+ email:
71
+ - jt@neopoly.de
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rubocop.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - assets/stylesheets/user_wiki_macro.css
83
+ - lib/redmine-user_wiki_macro.rb
84
+ - lib/user_wiki_macro/engine.rb
85
+ - lib/user_wiki_macro/hooks.rb
86
+ - lib/user_wiki_macro/infos.rb
87
+ - lib/user_wiki_macro/macros.rb
88
+ - lib/user_wiki_macro/redmine_plugin.rb
89
+ - lib/user_wiki_macro/version.rb
90
+ - redmine-user_wiki_macro.gemspec
91
+ homepage: https://github.com/neopoly/redmine-user_wiki_macro
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.4.6
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Adds a {{user(login_name)}} macro to Redmine's wiki engine
115
+ test_files: []
116
+ has_rdoc: