jreport 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bd893d8e9d6b1ff33693ddd4568a97611f14cbe
4
- data.tar.gz: a314cd1fb10aa121a271776a8f17e46231bff652
3
+ metadata.gz: eeb00636766f8affe56c46d9563a8e9b90b55614
4
+ data.tar.gz: 3fa524a0f106dabb9a0362407720c40bb024f6c0
5
5
  SHA512:
6
- metadata.gz: fcb8c9bdfa57840764dd76adc176c0301f51afa993a9e32bd891c46fecdf0a974dd612374e3bac9460d10f8bf2119b681478d1525090fc3ab734ada00aa8322e
7
- data.tar.gz: e557e1b95dce1cb52094d9ee046cd695ad6604217b14b41ed3160342020f47b633a42e94cf883c5837dd3c5f29e3c07610b1d11b5a755a2f1a5145e9acd9df48
6
+ metadata.gz: 66e04621a3d014a94bc420b79d6d9ecd5553ea694c8fb81cbab3d9dfec6edc72d93f79ab963570f1f7ec38e6dcb9c14bb7e206ae0f2e0eec35e8efd9d21e9172
7
+ data.tar.gz: 18bc69d08eae6df63e5431d62af26b7d9553160646f210dfdd05bbcac70b495e803d4f594ea744e10093470010530c6459a7b7472a4f177cbcc2ecc2e5e12efa
@@ -4,4 +4,5 @@ require "jreport/assembler"
4
4
 
5
5
  module Jreport
6
6
  # Your code goes here...
7
+ Style={ :css=>:highlight }
7
8
  end
@@ -29,15 +29,15 @@ module Jreport
29
29
  ctrl.send m
30
30
  dir="#{@root}/views/#{@_report}"
31
31
  html=render_html(dir,m.to_s,:data=>ctrl.data)
32
- puts "Below is content body\n#{'-'*20}"
33
- puts html
34
- `echo "#{html}" > "#{ctrl.save_to}"` if ctrl.save_to
32
+ if ctrl.save_to
33
+ File.open(ctrl.save_to,'w'){|fi| fi.write(html) }
34
+ end
35
35
  ops=ctrl.options.merge!('body'=>html,'content-type'=>"text/html;charset=UTF-8")
36
- puts "Sending email for #{m}..."
36
+ puts "Sending #{m}..."
37
37
  if ctrl.respond_to? :send_mail
38
38
  ctrl.send :send_mail,ops
39
39
  else
40
- puts "Send with default mailer"
40
+ puts "Send with default mail client"
41
41
  send_mail ops
42
42
  end
43
43
  rescue=>e
@@ -51,12 +51,18 @@ module Jreport
51
51
  def render_html(dir,report_name,bindings)
52
52
  base="#{dir}/#{report_name}"
53
53
  html=Erubis::Eruby.new(File.read("#{base}.eruby")).result(bindings)
54
- if File.exist? "#{base}.css"
54
+ if Jreport::Style[:css]==:custom && File.exist?("#{base}.css")
55
55
  css=File.read "#{base}.css"
56
56
  html<<%Q{<style type="text/css" media="screen">#{css}</style>}
57
57
  html=InlineStyle.process(html)
58
- end
59
- html
58
+ else
59
+ fcss=File.expand_path('../../../skel/views',__FILE__)+"/#{Jreport::Style[:css].to_s}.css"
60
+ css=File.read fcss
61
+ html<<%Q{<style type="text/css" media="screen">#{css}</style>}
62
+ html=InlineStyle.process(html)
63
+
64
+ end
65
+ html
60
66
  end
61
67
 
62
68
  def send_mail(options)
@@ -74,7 +80,7 @@ module Jreport
74
80
  end
75
81
  end
76
82
  m.deliver!
77
- puts 'Sent!'
83
+ puts 'Report sent!'
78
84
  rescue=>e
79
85
  puts "Send mail faild!"
80
86
  puts e.backtrace
@@ -1,3 +1,3 @@
1
1
  module Jreport
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -5,4 +5,5 @@ gem 'mail'
5
5
  gem 'inline-style'
6
6
  gem 'erubis'
7
7
  gem 'sqlite3'
8
+ #gem 'activerecord-jdbcsqlite3-adapter'
8
9
  gem 'activerecord'
@@ -1,6 +1,7 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require 'bundler'
3
3
  Bundler.require(:default)
4
+ require 'date'
4
5
 
5
6
  JreportRoot=File.expand_path('..',__FILE__)
6
7
 
@@ -0,0 +1,89 @@
1
+ body {
2
+ margin:0;
3
+ padding:20px;
4
+ font:13px "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif;
5
+ }
6
+
7
+ /* ---- Some Resets ---- */
8
+
9
+ p,
10
+ table, caption, td, tr, th {
11
+ margin:0;
12
+ padding:0;
13
+ font-weight:normal;
14
+ }
15
+
16
+ /* ---- Paragraphs ---- */
17
+
18
+ p {
19
+ margin-bottom:15px;
20
+ }
21
+
22
+ /* ---- Table ---- */
23
+
24
+ table {
25
+ border-collapse:collapse;
26
+ margin-bottom:15px;
27
+ width:90%;
28
+ }
29
+
30
+ caption {
31
+ text-align:left;
32
+ font-size:15px;
33
+ padding-bottom:10px;
34
+ }
35
+
36
+ table td,
37
+ table th {
38
+ padding:5px;
39
+ border:1px solid #fff;
40
+ border-width:0 1px 1px 0;
41
+ }
42
+
43
+ thead th {
44
+ background:#91c5d4;
45
+ }
46
+
47
+ thead th[colspan],
48
+ thead th[rowspan] {
49
+ background:#66a9bd;
50
+ }
51
+
52
+ tbody th,
53
+ tfoot th {
54
+ text-align:left;
55
+ background:#91c5d4;
56
+ }
57
+
58
+ tbody td,
59
+ tfoot td {
60
+ text-align:center;
61
+ background:#d5eaf0;
62
+ }
63
+
64
+ tfoot th {
65
+ background:#b0cc7f;
66
+ }
67
+
68
+ tfoot td {
69
+ background:#d7e1c5;
70
+ font-weight:bold;
71
+ }
72
+
73
+ tbody tr.odd td {
74
+ background:#bcd9e1;
75
+ }
76
+ .alert{
77
+ font-weight:bolder;
78
+ color:white;
79
+ background:red;
80
+ }
81
+ .good{
82
+ font-weight:bolder;
83
+ color:#00CC00;
84
+ }
85
+ .jtitle{
86
+ font-weight:bolder;
87
+ font-family:隶书;
88
+ font-size: 300%;
89
+ }
@@ -0,0 +1,96 @@
1
+ table {
2
+ *border-collapse: collapse; /* IE7 and lower */
3
+ border-spacing: 0;
4
+ width: 100%;
5
+ border: solid #ccc 1px;
6
+ -moz-border-radius: 6px;
7
+ -webkit-border-radius: 6px;
8
+ border-radius: 6px;
9
+ -webkit-box-shadow: 0 1px 1px #ccc;
10
+ -moz-box-shadow: 0 1px 1px #ccc;
11
+ box-shadow: 0 1px 1px #ccc;
12
+ }
13
+
14
+
15
+ tr:hover {
16
+ background: #fbf8e9;
17
+ -o-transition: all 0.1s ease-in-out;
18
+ -webkit-transition: all 0.1s ease-in-out;
19
+ -moz-transition: all 0.1s ease-in-out;
20
+ -ms-transition: all 0.1s ease-in-out;
21
+ transition: all 0.1s ease-in-out;
22
+ }
23
+
24
+ td, th {
25
+ border-left: 1px solid #ccc;
26
+ border-top: 1px solid #ccc;
27
+ padding: 10px;
28
+ text-align: center;
29
+ }
30
+
31
+ th {
32
+ background-color: #dce9f9;
33
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
34
+ background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
35
+ background-image: -moz-linear-gradient(top, #ebf3fc, #dce9f9);
36
+ background-image: -ms-linear-gradient(top, #ebf3fc, #dce9f9);
37
+ background-image: -o-linear-gradient(top, #ebf3fc, #dce9f9);
38
+ background-image: linear-gradient(top, #ebf3fc, #dce9f9);
39
+ -webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
40
+ -moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
41
+ box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
42
+ border-top: none;
43
+ text-shadow: 0 1px 0 rgba(255,255,255,.5);
44
+ }
45
+ tfoot {
46
+ text-align:center;
47
+ font-weight:bold;
48
+ }
49
+
50
+ td:first-child, th:first-child {
51
+ border-left: none;
52
+ }
53
+
54
+ th:first-child {
55
+ -moz-border-radius: 6px 0 0 0;
56
+ -webkit-border-radius: 6px 0 0 0;
57
+ border-radius: 6px 0 0 0;
58
+ }
59
+
60
+ th:last-child {
61
+ -moz-border-radius: 0 6px 0 0;
62
+ -webkit-border-radius: 0 6px 0 0;
63
+ border-radius: 0 6px 0 0;
64
+ }
65
+
66
+ th:only-child{
67
+ -moz-border-radius: 6px 6px 0 0;
68
+ -webkit-border-radius: 6px 6px 0 0;
69
+ border-radius: 6px 6px 0 0;
70
+ }
71
+
72
+ tr:last-child td:first-child {
73
+ -moz-border-radius: 0 0 0 6px;
74
+ -webkit-border-radius: 0 0 0 6px;
75
+ border-radius: 0 0 0 6px;
76
+ }
77
+
78
+ tr:last-child td:last-child {
79
+ -moz-border-radius: 0 0 6px 0;
80
+ -webkit-border-radius: 0 0 6px 0;
81
+ border-radius: 0 0 6px 0;
82
+ }
83
+ .alert{
84
+ font-weight:bolder;
85
+ color:white;
86
+ background:red;
87
+ }
88
+ .good{
89
+ font-weight:bolder;
90
+ color:#00CC00;
91
+ }
92
+ .jtitle{
93
+ font-weight:bolder;
94
+ font-family:隶书;
95
+ font-size: 300%;
96
+ }
@@ -1 +1,29 @@
1
- <h1><%=report_name%>_report</h1>
1
+ <p class="jtitle"><%=report_name%></p>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>head1</th>
6
+ <th>head2</th>
7
+ <th>head3</th>
8
+ </tr>
9
+ </thead>
10
+
11
+ <tfoot>
12
+ <tr>
13
+ <th>foot</th>
14
+ <td>-</td>
15
+ <td>-</td>
16
+ </tr>
17
+ </tfoot>
18
+
19
+ <tbody>
20
+ <!-- Add your data rows here -->
21
+ <tr>
22
+ <th>name</th>
23
+ <td>1</th>
24
+ <td>2</th>
25
+ </tr>
26
+
27
+ </tbody>
28
+ </table>
29
+ <p>Created at:<%= Date.today.to_s %></p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jreport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - qjpcpu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-19 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -152,6 +152,8 @@ files:
152
152
  - skel/helpers/.gitkeep
153
153
  - skel/models/template.eruby
154
154
  - skel/rakefile
155
+ - skel/views/green.css
156
+ - skel/views/highlight.css
155
157
  - skel/views/template.eruby
156
158
  homepage: https://github.com/qjpcpu/jreport
157
159
  licenses: