redmine-project_custom_style 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7fd7763621290b94ab72a2256832f4b21194bae2
4
+ data.tar.gz: 592dd65bcd167c3ec5a15c0405ba996061194b2e
5
+ SHA512:
6
+ metadata.gz: ae2567680e6ce886acb271fead96c7cf5819f2c3aaee5c4c04bc359db88d0f0409e0d4a67adcac1a053da2ac937f758922e7329f11808ec8a4d066be6a4f4965
7
+ data.tar.gz: 45f3af3407536618ce34742bb553641ff91bc79eeb1a235ddef1ee218eff8af76c93668fef6d1ea0a5766c50e3ca585df6e32f8c6d7fd6d32e0376f0d2b7a94d
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ pkg
@@ -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
@@ -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.
@@ -0,0 +1,31 @@
1
+ # redmine-project_custom_style
2
+
3
+ Allows additional CSS / JS styling via a special wiki page
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-personal_wiki_page"
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
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/redmine-project_custom_style/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -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,5 @@
1
+ <p>
2
+ <%= label_tag :settings_project, l(:project_custom_style_page) %>
3
+ <%= text_field_tag "settings[page]", @settings["page"] %>
4
+ <span class="hint"><%= l(:project_custom_style_page_hint) %></span>
5
+ </p>
@@ -0,0 +1,4 @@
1
+ en:
2
+ project_custom_style_label: Custom Style
3
+ project_custom_style_page: Wiki page to use
4
+ project_custom_style_page_hint: Wiki page which will be used for per-project custom styling
@@ -0,0 +1,10 @@
1
+ require "project_custom_style/redmine_plugin"
2
+
3
+ module ProjectCustomStyle
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,53 @@
1
+ module ProjectCustomStyle
2
+ class Hooks < Redmine::Hook::ViewListener
3
+ STYLE_WRAPPER = %(<style type="text/css">%s</style>)
4
+
5
+ def view_layouts_base_html_head(context)
6
+ page = find_wiki_page(context)
7
+ wrap_style_content(page.content.text) if page
8
+ end
9
+
10
+ def view_projects_contextual(context)
11
+ link_to(
12
+ l("project_custom_style_label"),
13
+ edit_path(context),
14
+ class: "icon icon-copy"
15
+ )
16
+ end
17
+
18
+ private
19
+
20
+ def edit_path(context)
21
+ edit_project_wiki_page_path(
22
+ project_id: context[:project].id,
23
+ id: custom_style_wiki_page
24
+ )
25
+ end
26
+
27
+ def custom_style_wiki_page
28
+ settings["page"]
29
+ end
30
+
31
+ def settings
32
+ Setting.plugin_project_custom_style
33
+ end
34
+
35
+ def find_wiki_page(context)
36
+ (project = context[:project]) &&
37
+ project.wiki &&
38
+ project.wiki.find_page(custom_style_wiki_page)
39
+ end
40
+
41
+ def wrap_style_content(text)
42
+ if starts_with_style_or_script_tag?(text)
43
+ text
44
+ else
45
+ STYLE_WRAPPER % text
46
+ end
47
+ end
48
+
49
+ def starts_with_style_or_script_tag?(text)
50
+ text =~ /\A\s*<(style|script)/
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,11 @@
1
+ module ProjectCustomStyle
2
+ module Infos
3
+ NAME = "redmine-project_custom_style"
4
+ DESCRIPTION = "Allows additional CSS / JS styling via a special wiki page"
5
+ LICENSE = "MIT"
6
+ URL = "https://github.com/neopoly/redmine-project_custom_style"
7
+ AUTHORS = {
8
+ "Jonas Thiel" => "jt@neopoly.de"
9
+ }.freeze
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ module ProjectCustomStyle
2
+ # Registers this gems a Redmine plugin and applies the needed patches
3
+ class RedminePlugin
4
+ include ProjectCustomStyle::Infos
5
+
6
+ DEFAULT_SETTINGS = {
7
+ "page" => "CustomStyle"
8
+ }.freeze
9
+
10
+ SETTING_PARTIAL = "settings/project_custom_style_settings"
11
+
12
+ def initialize
13
+ register!
14
+ boot!
15
+ end
16
+
17
+ private
18
+
19
+ def register!
20
+ Redmine::Plugin.register :project_custom_style do
21
+ name NAME
22
+ author AUTHORS.keys.join(", ")
23
+ description DESCRIPTION
24
+ version VERSION
25
+ url URL
26
+ author_url URL
27
+ directory Engine.root
28
+
29
+ settings default: DEFAULT_SETTINGS, partial: SETTING_PARTIAL
30
+ end
31
+ end
32
+
33
+ def boot!
34
+ require "project_custom_style/hooks"
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module ProjectCustomStyle
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,8 @@
1
+ require "project_custom_style/version"
2
+ require "project_custom_style/infos"
3
+ require "project_custom_style/engine"
4
+
5
+ # Redmine plugin for to use a dedicated project's wiki page
6
+ # to include some per-project custom styling
7
+ module ProjectCustomStyle
8
+ 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 "project_custom_style/version"
5
+ require "project_custom_style/infos"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "redmine-project_custom_style"
9
+ spec.version = ProjectCustomStyle::VERSION
10
+ spec.authors = ProjectCustomStyle::Infos::AUTHORS.keys
11
+ spec.email = ProjectCustomStyle::Infos::AUTHORS.values
12
+ spec.summary = ProjectCustomStyle::Infos::DESCRIPTION
13
+ spec.description = ProjectCustomStyle::Infos::DESCRIPTION
14
+ spec.homepage = ProjectCustomStyle::Infos::URL
15
+ spec.license = ProjectCustomStyle::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
+ spec.add_dependency "redmine-more_view_hooks"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.7"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rubocop"
28
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redmine-project_custom_style
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-19 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: redmine-more_view_hooks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.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 additional CSS / JS styling via a special wiki page
84
+ email:
85
+ - jt@neopoly.de
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rubocop.yml"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - app/views/settings/_project_custom_style_settings.html.erb
97
+ - config/locales/en.yml
98
+ - lib/project_custom_style/engine.rb
99
+ - lib/project_custom_style/hooks.rb
100
+ - lib/project_custom_style/infos.rb
101
+ - lib/project_custom_style/redmine_plugin.rb
102
+ - lib/project_custom_style/version.rb
103
+ - lib/redmine-project_custom_style.rb
104
+ - redmine-personal_wiki_page.gemspec
105
+ homepage: https://github.com/neopoly/redmine-project_custom_style
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.2.2
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Allows additional CSS / JS styling via a special wiki page
129
+ test_files: []