This repository has been archived by the owner on Sep 29, 2020. It is now read-only.
ViewHook調整その1 #2
Merged
+43
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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? |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このへんもうちょっとエレガントにしたいですね....
return result unless flag == 'true' でなくて、result.true? で済ませたい。