chili_pdf 0.4.0 → 0.4.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.
- data.tar.gz.sig +0 -0
- data/History.txt +11 -0
- data/Manifest.txt +1 -0
- data/README.md +7 -4
- data/app/helpers/chili_pdf_helper.rb +18 -0
- data/app/views/extended_wiki/show.pdf.html.erb +2 -0
- data/app/views/settings/_chili_pdf_settings.html.erb +2 -1
- data/app/views/settings/_chili_pdf_typical_settings.html.erb +14 -17
- data/app/views/settings/_chili_pdf_watermark_settings.html.erb +13 -0
- data/assets/stylesheets/chili_pdf_settings_tweaks.css +5 -0
- data/assets/stylesheets/pdf.css +20 -0
- data/config/locales/en.yml +17 -4
- data/lib/chili_pdf.rb +1 -1
- data/lib/chili_pdf/config.rb +11 -1
- data/test/unit/helpers/chili_pdf_helper_test.rb +22 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 0.4.1 / 2011-06-19
|
2
|
+
|
3
|
+
* New features:
|
4
|
+
* 'Logo' support. Admins can add the URL of an image on the plugin
|
5
|
+
configuration page. The logo will show up on the top-right corner
|
6
|
+
of the first page of all exported PDFs. [closes #15]
|
7
|
+
* Converted settings page to fully-support localization. [closes #14]
|
8
|
+
|
9
|
+
* Minor enhancements:
|
10
|
+
* Style updates for <pre> & <img> tags (thanks, @roykolak!)
|
11
|
+
|
1
12
|
=== 0.4.0 / 2011-06-18
|
2
13
|
|
3
14
|
* New features:
|
data/Manifest.txt
CHANGED
@@ -13,6 +13,7 @@ app/views/layouts/pdf.pdf.erb
|
|
13
13
|
app/views/settings/_chili_pdf_advanced_settings.html.erb
|
14
14
|
app/views/settings/_chili_pdf_settings.html.erb
|
15
15
|
app/views/settings/_chili_pdf_typical_settings.html.erb
|
16
|
+
app/views/settings/_chili_pdf_watermark_settings.html.erb
|
16
17
|
assets/javascripts/chili_pdf.js
|
17
18
|
assets/stylesheets/chili_pdf_settings_tweaks.css
|
18
19
|
assets/stylesheets/pdf.css
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ChiliPDF Plugin - Flexible PDF exporting for ChiliProject/Redmine
|
2
2
|
|
3
|
-
* http://github.com/tomkersten/
|
3
|
+
* http://github.com/tomkersten/chili_pdf
|
4
4
|
|
5
5
|
## DESCRIPTION:
|
6
6
|
|
@@ -30,10 +30,13 @@ ChiliProject (/Redmine) plugin which implements/enhances PDF-export functionalit
|
|
30
30
|
plugin configuration page.
|
31
31
|
1. Flexible/easy PDF styling. The styling can be customized by adding your
|
32
32
|
own CSS and/or JavaScript on the plugin configuration page.
|
33
|
+
1. Custom logo support. You can specify the URL of an image to place in the
|
34
|
+
top-right corner of the first page of all exported PDFs.
|
33
35
|
|
34
36
|
## SCREENSHOTS:
|
35
37
|
|
36
|
-
You can find a few screenshots [here](http://www.flickr.com/photos/tomkersten/
|
38
|
+
You can find a few screenshots [here](http://www.flickr.com/photos/tomkersten/tags/chilipdf/).
|
39
|
+
(Release-specific screenshots are in [sets named 'chili_pdf,...'](http://www.flickr.com/photos/tomkersten/sets/)).
|
37
40
|
|
38
41
|
## PROBLEMS:
|
39
42
|
|
@@ -51,7 +54,7 @@ You can find a few screenshots [here](http://www.flickr.com/photos/tomkersten/se
|
|
51
54
|
1. Cycle your application servers (Mongrel, unicorn, Passenger, etc)
|
52
55
|
1. Visit any wiki page and manually add a '.pdf' extension to the URL
|
53
56
|
1. **NOTE:** You must be on an individual wiki page. Manually adding
|
54
|
-
the '.pdf' on the 'default wiki page' URL (/projects/:project_id/wiki)
|
57
|
+
the '.pdf' on the 'default wiki page' URL (http://yoursite.com/projects/:project_id/wiki)
|
55
58
|
will not work correctly at this time. The manual step will be removed
|
56
59
|
in a future release.
|
57
60
|
|
@@ -110,7 +113,7 @@ config.gem 'chili_pdf'
|
|
110
113
|
|
111
114
|
Cycle your application server (mongrel, unicorn, whatevs)...
|
112
115
|
|
113
|
-
Then, uninstall the
|
116
|
+
Then, uninstall the gem:
|
114
117
|
|
115
118
|
```
|
116
119
|
gem uninstall chili_pdf
|
@@ -94,6 +94,24 @@ module ChiliPdfHelper
|
|
94
94
|
end
|
95
95
|
|
96
96
|
|
97
|
+
# Public: Generates an image tag with the appropriate mark-up for the ChiliPDF
|
98
|
+
# 'logo'.
|
99
|
+
#
|
100
|
+
# wants_html - specifies whether the 'src' attribute should be formatted
|
101
|
+
# for HTML or PDF requests (local vs. relative paths). Added to
|
102
|
+
# keep excessive boolean logic out of views.
|
103
|
+
#
|
104
|
+
# Returns an '<img>' tag for your view template with a properly formatted 'src'
|
105
|
+
# attribute, depending on whether the user is requesting an HTML or PDF
|
106
|
+
# format. If no logo is defined in the plugin configuration, nothing is
|
107
|
+
# rendered in the view tempalate.
|
108
|
+
def logo_img_tag(wants_html)
|
109
|
+
if ChiliPDF::Config.logo_url?
|
110
|
+
img_tag = image_tag(ChiliPDF::Config.logo_url, :id => "chili-pdf-logo")
|
111
|
+
update_img_src_tags_of(img_tag, wants_html)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
97
115
|
private
|
98
116
|
# Updates the value of the specified attribute of any `tag_type` tags
|
99
117
|
# contained in `content` to be compatible with the `wkhtmltopdf`
|
@@ -5,5 +5,7 @@
|
|
5
5
|
<%= normalize_custom_js_src_tags_in(ChiliPDF::Config.custom_js, @requesting_html_version) %>
|
6
6
|
<% end %>
|
7
7
|
|
8
|
+
<%= logo_img_tag(@requesting_html_version) %>
|
9
|
+
|
8
10
|
<%- html_content = textilizable(@content.text, :attachments => @content.page.attachments) %>
|
9
11
|
<%= update_img_src_tags_of(html_content, @requesting_html_version) %>
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
<%= render_tabs([
|
6
6
|
{:name => 'typical_settings', :partial => 'settings/chili_pdf_typical_settings', :label => :typical_plugin_settings},
|
7
|
-
{:name => '
|
7
|
+
{:name => 'watermark_settings', :partial => 'settings/chili_pdf_watermark_settings', :label => :watermark_plugin_settings},
|
8
|
+
{:name => 'advanced_settings', :partial => 'settings/chili_pdf_advanced_settings', :label => :advanced_plugin_settings}
|
8
9
|
]) %>
|
9
10
|
|
@@ -1,35 +1,32 @@
|
|
1
1
|
<p class="chili-pdf-instructions">
|
2
|
-
<span class="tip-label"
|
3
|
-
|
4
|
-
"<em>.pdf?as_html=true</em>" to the URL of any wiki page. This will give you an
|
5
|
-
idea of what your style/behavior changes will look like (without headers, margins,
|
6
|
-
et cetera).
|
2
|
+
<span class="tip-label"><%= l(:tip_label) %>:</span>
|
3
|
+
<%= l(:tip_view_as_html) %>
|
7
4
|
</p>
|
8
5
|
|
9
6
|
<p>
|
10
|
-
<label for='settings_<%= ChiliPDF::Config::HEADER_ENABLED_KEYNAME %>'><%= l(:
|
7
|
+
<label for='settings_<%= ChiliPDF::Config::HEADER_ENABLED_KEYNAME %>'><%= l(:label_header_enabled) %></label>
|
11
8
|
<%= check_box_tag "settings[#{ChiliPDF::Config::HEADER_ENABLED_KEYNAME}]", ChiliPDF::Config::ENABLED_VALUE, ChiliPDF::Config.header_enabled? %>
|
12
9
|
</p>
|
13
10
|
|
14
11
|
<p>
|
15
|
-
<label for='settings_<%= ChiliPDF::Config::FOOTER_ENABLED_KEYNAME %>'><%= l(:
|
12
|
+
<label for='settings_<%= ChiliPDF::Config::FOOTER_ENABLED_KEYNAME %>'><%= l(:label_footer_enabled) %></label>
|
16
13
|
<%= check_box_tag "settings[#{ChiliPDF::Config::FOOTER_ENABLED_KEYNAME}]", ChiliPDF::Config::ENABLED_VALUE, ChiliPDF::Config.footer_enabled? %>
|
17
14
|
</p>
|
18
15
|
|
19
|
-
<h3
|
16
|
+
<h3><%= l(:section_heading_custom_header_footer_content) %></h3>
|
20
17
|
|
21
|
-
<table>
|
18
|
+
<table id="header-footer-settings">
|
22
19
|
<thead>
|
23
20
|
<tr>
|
24
21
|
<td></td>
|
25
|
-
<td
|
26
|
-
<td
|
27
|
-
<td
|
22
|
+
<td><%= l(:table_header_footer_labels_left) %></td>
|
23
|
+
<td><%= l(:table_header_footer_labels_center) %></td>
|
24
|
+
<td><%= l(:table_header_footer_labels_right) %></td>
|
28
25
|
</tr>
|
29
26
|
</thead>
|
30
27
|
<tbody>
|
31
28
|
<tr>
|
32
|
-
<td
|
29
|
+
<td><%= l(:table_header_footer_labels_header) %></td>
|
33
30
|
<td>
|
34
31
|
<%= text_field_tag "settings[#{ChiliPDF::Config::HEADER_LEFT_KEYNAME}]", ChiliPDF::Config.header_values[:left] %>
|
35
32
|
</td>
|
@@ -41,7 +38,7 @@
|
|
41
38
|
</td>
|
42
39
|
</tr>
|
43
40
|
<tr>
|
44
|
-
<td
|
41
|
+
<td><%= l(:table_header_footer_labels_footer) %></td>
|
45
42
|
<td>
|
46
43
|
<%= text_field_tag "settings[#{ChiliPDF::Config::FOOTER_LEFT_KEYNAME}]", ChiliPDF::Config.footer_values[:left] %>
|
47
44
|
</td>
|
@@ -56,12 +53,12 @@
|
|
56
53
|
</table>
|
57
54
|
|
58
55
|
<div id="pdf-token-help">
|
59
|
-
<h4
|
56
|
+
<h4><%= l(:section_heading_dynamic_text_legend) %></h4>
|
60
57
|
<table>
|
61
58
|
<thead>
|
62
59
|
<tr>
|
63
|
-
<td
|
64
|
-
<td
|
60
|
+
<td><%= l(:table_dyanmic_header_enter_this) %></td>
|
61
|
+
<td>...<%= l(:table_dyanmic_header_to_show_this) %></td>
|
65
62
|
</tr>
|
66
63
|
</thead>
|
67
64
|
<tbody>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<p class="chili-pdf-instructions">
|
2
|
+
Enter the URL of an image you would like to appear on the first
|
3
|
+
page of all exported PDFs. You can enter a URL of a file you
|
4
|
+
have uploaded to this site, or any public URL.
|
5
|
+
<p>
|
6
|
+
<label for='settings_<%= ChiliPDF::Config::LOGO_KEYNAME%>'><%= l(:label_logo_url) %></label>
|
7
|
+
<%= text_field_tag "settings[#{ChiliPDF::Config::LOGO_KEYNAME}]", ChiliPDF::Config.logo_url, :class => 'url' %>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<%- if ChiliPDF::Config.logo_url? %>
|
11
|
+
<h4>Current logo</h4>
|
12
|
+
<%= image_tag ChiliPDF::Config.logo_url %>
|
13
|
+
<%- end %>
|
@@ -3,6 +3,11 @@ textarea {width: 600px; height: 200px;}
|
|
3
3
|
|
4
4
|
p.chili-pdf-instructions {padding-left: 0;}
|
5
5
|
.tip-label {font-weight: bold; text-decoration: underline;}
|
6
|
+
.url {width: 600px;}
|
7
|
+
|
8
|
+
#header-footer-settings input {
|
9
|
+
width: 300px;
|
10
|
+
}
|
6
11
|
|
7
12
|
#pdf-token-help {margin-top: 20px;}
|
8
13
|
#pdf-token-help table {width: 100%; border: 1px #AAA solid;}
|
data/assets/stylesheets/pdf.css
CHANGED
@@ -34,3 +34,23 @@ ol li {list-style-type: decimal;}
|
|
34
34
|
ul li {list-style-type: disc;}
|
35
35
|
h1, h2 {font-weight: bold;}
|
36
36
|
img {max-width: 100%;}
|
37
|
+
img {border:1px solid #888;}
|
38
|
+
#chili-pdf-logo {max-height:50px; float:right; border:none;}
|
39
|
+
|
40
|
+
pre {
|
41
|
+
// found at http://www.longren.org/wrapping-text-inside-pre-tags/
|
42
|
+
overflow: auto;
|
43
|
+
font-family: ?Consolas?,monospace;
|
44
|
+
font-size: 9pt;
|
45
|
+
text-align:left;
|
46
|
+
background-color: #FCF7EC;
|
47
|
+
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not
|
48
|
+
white-space: pre-wrap; /* css-3 */
|
49
|
+
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
|
50
|
+
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
51
|
+
margin: 0px 0px 0px 0px;
|
52
|
+
padding:5px 5px 3px 5px;
|
53
|
+
white-space : normal; /* crucial for IE 6, maybe 7? */
|
54
|
+
padding:10px; background:#DDD;
|
55
|
+
margin:5px 0;
|
56
|
+
}
|
data/config/locales/en.yml
CHANGED
@@ -1,9 +1,22 @@
|
|
1
1
|
# English strings go here for Rails i18n
|
2
2
|
en:
|
3
3
|
chili_pdf_instructions: 'You can customize the behavior of the ChiliPDf plugin with the settings below'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
typical_plugin_settings: Typical
|
5
|
+
advanced_plugin_settings: Technical
|
6
|
+
watermark_plugin_settings: Logo
|
7
|
+
label_header_enabled: Display page header?
|
8
|
+
label_footer_enabled: Display page footer?
|
8
9
|
label_custom_css: Custom CSS
|
9
10
|
label_custom_js: Custom JavaScript
|
11
|
+
label_logo_url: Logo URL
|
12
|
+
section_heading_dynamic_text_legend: Dynamic text legend
|
13
|
+
section_heading_custom_header_footer_content: Custom Header/Footer Content
|
14
|
+
table_header_footer_labels_left: Left
|
15
|
+
table_header_footer_labels_center: Center
|
16
|
+
table_header_footer_labels_right: Right
|
17
|
+
table_header_footer_labels_header: Header
|
18
|
+
table_header_footer_labels_footer: Footer
|
19
|
+
table_dyanmic_header_enter_this: Enter this
|
20
|
+
table_dyanmic_header_to_show_this: to show this
|
21
|
+
tip_label: Pro Tip
|
22
|
+
tip_view_as_html: You can see what impact your settings have on exported items by appending a "<em>.pdf?as_html=true</em>" to the URL of any wiki page. This will give you an idea of what your style/behavior changes will look like (without headers, margins, et cetera).
|
data/lib/chili_pdf.rb
CHANGED
data/lib/chili_pdf/config.rb
CHANGED
@@ -16,6 +16,7 @@ module ChiliPDF
|
|
16
16
|
FOOTER_LEFT_KEYNAME = :footer_content_left
|
17
17
|
FOOTER_CENTER_KEYNAME = :footer_content_center
|
18
18
|
FOOTER_RIGHT_KEYNAME = :footer_content_right
|
19
|
+
LOGO_KEYNAME = :watermarks_logo
|
19
20
|
|
20
21
|
HEADER_LEFT_DEFAULT_VALUE = '{{page_title}}'
|
21
22
|
HEADER_CENTER_DEFAULT_VALUE = ''
|
@@ -54,7 +55,8 @@ END_OF_JS_DEF
|
|
54
55
|
FOOTER_CENTER_KEYNAME => FOOTER_CENTER_DEFAULT_VALUE,
|
55
56
|
FOOTER_RIGHT_KEYNAME => FOOTER_RIGHT_DEFAULT_VALUE,
|
56
57
|
CUSTOM_CSS_KEYNAME => CUSTOM_CSS_DEFAULT_VALUE,
|
57
|
-
CUSTOM_JS_KEYNAME => CUSTOM_JS_DEFAULT_VALUE
|
58
|
+
CUSTOM_JS_KEYNAME => CUSTOM_JS_DEFAULT_VALUE,
|
59
|
+
LOGO_KEYNAME => ''
|
58
60
|
}
|
59
61
|
end
|
60
62
|
|
@@ -111,6 +113,14 @@ END_OF_JS_DEF
|
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
116
|
+
def logo_url
|
117
|
+
plugin_settings[LOGO_KEYNAME]
|
118
|
+
end
|
119
|
+
|
120
|
+
def logo_url?
|
121
|
+
!logo_url.blank?
|
122
|
+
end
|
123
|
+
|
114
124
|
private
|
115
125
|
def default_header_values
|
116
126
|
{:left => HEADER_LEFT_DEFAULT_VALUE,
|
@@ -98,4 +98,26 @@ class ChiliPdfHelperTest < HelperTestCase
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
context "#logo_img_tag" do
|
103
|
+
context "when no logo URL is defined for the plugin" do
|
104
|
+
setup do
|
105
|
+
ChiliPDF::Config.stubs(:logo_url).returns("")
|
106
|
+
end
|
107
|
+
|
108
|
+
should "return nil" do
|
109
|
+
assert_nil logo_img_tag(true)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "when a logo URL is defined" do
|
114
|
+
setup do
|
115
|
+
ChiliPDF::Config.stubs(:logo_url).returns("/images/cancel.png")
|
116
|
+
end
|
117
|
+
|
118
|
+
should "return an '<img>' tag with an 'id' of 'chili-pdf-logo'" do
|
119
|
+
assert_match /id="chili-pdf-logo"/, logo_img_tag(true)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
101
123
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chili_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Kersten
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
NVADJA==
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-06-
|
39
|
+
date: 2011-06-19 00:00:00 -05:00
|
40
40
|
default_executable:
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- app/views/settings/_chili_pdf_advanced_settings.html.erb
|
114
114
|
- app/views/settings/_chili_pdf_settings.html.erb
|
115
115
|
- app/views/settings/_chili_pdf_typical_settings.html.erb
|
116
|
+
- app/views/settings/_chili_pdf_watermark_settings.html.erb
|
116
117
|
- assets/javascripts/chili_pdf.js
|
117
118
|
- assets/stylesheets/chili_pdf_settings_tweaks.css
|
118
119
|
- assets/stylesheets/pdf.css
|
@@ -140,7 +141,7 @@ files:
|
|
140
141
|
- test/test_helper.rb
|
141
142
|
- test/unit/helpers/chili_pdf_helper_test.rb
|
142
143
|
has_rdoc: true
|
143
|
-
homepage: http://github.com/tomkersten/
|
144
|
+
homepage: http://github.com/tomkersten/chili_pdf
|
144
145
|
licenses: []
|
145
146
|
|
146
147
|
post_install_message:
|
metadata.gz.sig
CHANGED
Binary file
|