Skip to content

Commit f37366d

Browse files
committed
Print block with form
1 parent b27b5f9 commit f37366d

File tree

10 files changed

+62
-1
lines changed

10 files changed

+62
-1
lines changed

README.md

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p>
2+
<%= content_tag(:label, l(:field_gtt_print_server)) %>
3+
<%= text_field_tag 'settings[default_print_server]', @settings['default_print_server'], :size => 50 %>
4+
</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<% if @project.nil? or @project.module_enabled?(:gtt) %>
2+
<div class="print box">
3+
<%= content_tag(:h3, l(:label_gtt_print_title)) %>
4+
<form action="#" method="post">
5+
<select name="template">
6+
<option value="1">TPL-FORM-000001</option>
7+
<option value="2">TPL-FORM-000002</option>
8+
<option value="3">TPL-FORM-000003</option>
9+
<option value="4">TPL-FORM-000004</option>
10+
<option value="5">TPL-FORM-000005</option>
11+
<option value="6">TPL-FORM-000006</option>
12+
</select>
13+
<%= content_tag(:input, nil, type: "button", value: l(:button_gtt_print_submit)) %>
14+
</form>
15+
</div>
16+
<div style="clear: both;"></div>
17+
<% end %>

assets/javascripts/gtt_print.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$(document).on('click', '.print.box input[type=button]', function(e){
2+
console.log('TODO: submit print');
3+
return false;
4+
});

assets/stylesheets/gtt_print.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* CSS for gtt_print plugin */

config/locales/en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
en:
2+
field_gtt_print_server: Default print server URL
3+
label_gtt_print_title: Form Print
4+
button_gtt_print_submit: Print

config/locales/ja.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
ja:
2+
field_gtt_print_server: デフォルトのプリントサーバーURL
3+
label_gtt_print_title: フォーム印刷
4+
button_gtt_print_submit: 印刷

init.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
require 'redmine'
22

3+
Rails.configuration.to_prepare do
4+
RedmineGttPrint.setup
5+
end
6+
37
Redmine::Plugin.register :redmine_gtt_print do
48
name 'Redmine GTT Print Plugin'
59
author 'Georepublic'
@@ -8,5 +12,8 @@
812
version '0.1.0'
913

1014
requires_redmine version_or_higher: '3.4.0'
11-
end
1215

16+
settings( :default => { 'default_print_server' => "http://localhost:8080/mfp"},
17+
:partial => 'gtt_print/settings')
18+
19+
end

lib/redmine_gtt_print.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'redmine_gtt_print/view_hooks'
2+
3+
module RedmineGttPrint
4+
def self.setup
5+
6+
end
7+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module RedmineGttPrint
2+
class ViewHooks < Redmine::Hook::ViewListener
3+
4+
render_on :view_layouts_base_html_head, inline: <<-END
5+
<%= stylesheet_link_tag 'gtt_print', plugin: 'redmine_gtt_print' %>
6+
<%= javascript_include_tag 'gtt_print', plugin: 'redmine_gtt_print' %>
7+
END
8+
9+
render_on :view_issues_history_journal_bottom,
10+
partial: "hooks/print_issue_form"
11+
12+
end
13+
end
14+
15+

0 commit comments

Comments
 (0)