This repository has been archived by the owner on Sep 29, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from akiko-pusu/develop
ViewHook調整その1
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div class="form-inline issue_stamps"> | ||
<% unless Rails.env.production? %> | ||
<p> | ||
Display View Hook points | ||
<%= hidden_field_tag("settings[display_view_hook_points]", 0, :id => nil).html_safe %> | ||
<%= check_box_tag 'settings[display_view_hook_points]', true, @settings['display_view_hook_points'] == 'true' %> | ||
</p> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.redmine-issue-stamps-viewhook { | ||
background: #FFFFBF; | ||
color: darkred; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
require 'redmine' | ||
require 'issue_stamps/redmine_hook_patch' | ||
|
||
Redmine::Plugin.register :redmine_issue_stamps do | ||
name 'Redmine Issue Stamps plugin' | ||
author 'Akiko Takano' | ||
description 'This is a plugin for Redmine, which enables to display approval stamps on issue description page.' | ||
version '0.0.1-dev' | ||
url 'https://github.com/akiko-pusu/redmine_issue_stamps' | ||
author_url 'https://github.com/akiko-pusu' | ||
|
||
unless Rails.env.production? | ||
settings partial: 'settings/redmine_issue_stamps', | ||
default: { | ||
'display_view_hook_points' => false | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module IssueStamps | ||
class Hooks < Redmine::Hook::ViewListener | ||
include IssuesHelper | ||
|
||
def view_layouts_base_html_head(context = {}) | ||
stylesheet_link_tag('redmine_issue_stamps', plugin: 'redmine_issue_stamps') | ||
end | ||
end | ||
|
||
module RedmineHookPatch | ||
def call_hook(hook, context = {}) | ||
flag = Setting.plugin_redmine_issue_stamps['display_view_hook_points'] | ||
result = super | ||
return result unless flag == 'true' | ||
result << "<span class='redmine-issue-stamps-viewhook'>Hook point: #{hook}</span>".html_safe | ||
end | ||
end | ||
end | ||
|
||
ApplicationHelper.prepend IssueStamps::RedmineHookPatch unless Rails.env.production? |