birt 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/tree.png +0 -0
- data/app/assets/javascripts/birt/birt.js +63 -5
- data/app/assets/javascripts/birt.js +1 -1
- data/app/assets/stylesheets/birt/components/birt_reports.scss +9 -0
- data/app/assets/stylesheets/birt/components/menus.scss +27 -0
- data/app/assets/stylesheets/birt.scss +4 -3
- data/app/views/birt/api/menus.json.jbuilder +1 -0
- data/config/routes.rb +1 -0
- data/lib/app/controllers/birt/api_controller.rb +6 -0
- data/lib/birt/routing.rb +1 -0
- data/lib/birt/version.rb +1 -1
- data/lib/birt.rb +4 -5
- metadata +6 -3
- data/config/database.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d17fdc7fb01954788c080eeb639a7b7445c2c030
|
4
|
+
data.tar.gz: 2dbf5737474092bf6d09bdfc6f9994938d934bb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db5677cbc475cca359859fb168ed9bc9d7b227521ddb89807252fdfbbbdd7086c0dbd1d68241092bd01f009cbbb2b27a23f80bbf14603824a124c8765caf8d87
|
7
|
+
data.tar.gz: dd24ead72fc2c37d57f3dede77823894ce827f02e8864ce443a605882e27a6ac7ad29410affa701659fbfc3913d7841432e8cb08eb8e3e37cbe710e93d0444de
|
Binary file
|
@@ -1,16 +1,39 @@
|
|
1
1
|
var Birt = (function () {
|
2
2
|
var _this;
|
3
3
|
|
4
|
-
var rptDesignJsonData;
|
4
|
+
var rptDesignJsonData; //报表的json数据
|
5
5
|
|
6
|
-
var $birt;
|
6
|
+
var $birt; //birt报表整个区域
|
7
|
+
var $reports; //报表区域
|
8
|
+
var $menus; //文件列表,菜单区域
|
7
9
|
|
8
10
|
function Birt(designJsonData) {
|
9
11
|
_this = this;
|
10
12
|
rptDesignJsonData = designJsonData;
|
11
|
-
$birt = $('.birt');
|
12
13
|
}
|
13
14
|
|
15
|
+
/**
|
16
|
+
* 开始加载
|
17
|
+
*/
|
18
|
+
Birt.prototype.run = function () {
|
19
|
+
_this.onCreate();
|
20
|
+
_this.getMenus();
|
21
|
+
_this.getRetDesign();
|
22
|
+
};
|
23
|
+
|
24
|
+
/**
|
25
|
+
* 被创建时
|
26
|
+
*/
|
27
|
+
Birt.prototype.onCreate = function () {
|
28
|
+
$birt = $('.birt');
|
29
|
+
|
30
|
+
$birt.append("<ul class='birt-menus'></ul>");
|
31
|
+
$menus = $birt.find(".birt-menus");
|
32
|
+
|
33
|
+
$birt.append("<div class='birt-reports'></div>");
|
34
|
+
$reports = $birt.find(".birt-reports");
|
35
|
+
};
|
36
|
+
|
14
37
|
/**
|
15
38
|
* 获取报表数据
|
16
39
|
* @param rptDesignName
|
@@ -45,8 +68,43 @@ var Birt = (function () {
|
|
45
68
|
);
|
46
69
|
};
|
47
70
|
|
71
|
+
/**
|
72
|
+
* 获取报表的目录结构
|
73
|
+
*/
|
74
|
+
Birt.prototype.getMenus = function () {
|
75
|
+
$.birtLoading();
|
76
|
+
$.ajax(
|
77
|
+
{
|
78
|
+
url: '/birt/api/menus.json',
|
79
|
+
type: 'GET',
|
80
|
+
success: function (data) {
|
81
|
+
$.birtLoading('hide');
|
82
|
+
console.log(data);
|
83
|
+
_this.showMenus(data.menus);
|
84
|
+
},
|
85
|
+
error: function (data) {
|
86
|
+
$.birtLoading('hide');
|
87
|
+
}
|
88
|
+
}
|
89
|
+
);
|
90
|
+
};
|
91
|
+
|
92
|
+
/**
|
93
|
+
* 显示报表的名称
|
94
|
+
*/
|
48
95
|
Birt.prototype.showDisplayName = function () {
|
49
|
-
$
|
96
|
+
$reports.append("<h2 class='display-name'>{0}</h2>".format(rptDesignJsonData.display_name));
|
97
|
+
};
|
98
|
+
|
99
|
+
/**
|
100
|
+
* 显示报表菜单
|
101
|
+
* @param menus
|
102
|
+
*/
|
103
|
+
Birt.prototype.showMenus = function (menus) {
|
104
|
+
for (var i = 0; i < menus.length; i++) {
|
105
|
+
var menu = menus[i];
|
106
|
+
$menus.append("<li class='item'><i class='icon'></i><a>{0}</a></li>".format(menu.display_name));
|
107
|
+
}
|
50
108
|
};
|
51
109
|
|
52
110
|
|
@@ -89,7 +147,7 @@ var Birt = (function () {
|
|
89
147
|
|
90
148
|
table_html += "</table>";
|
91
149
|
|
92
|
-
$
|
150
|
+
$reports.append(table_html);
|
93
151
|
console.log(table);
|
94
152
|
return table_html;
|
95
153
|
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.birt-menus {
|
2
|
+
display: table-cell;
|
3
|
+
width: 200px;
|
4
|
+
list-style: none;
|
5
|
+
border: 1px solid #ddd;
|
6
|
+
padding: 8px;
|
7
|
+
vertical-align: top;
|
8
|
+
> .item {
|
9
|
+
> .icon {
|
10
|
+
width: 20px;
|
11
|
+
height: 20px;
|
12
|
+
background-image: url(asset_path('tree.png'));
|
13
|
+
display: inline-block;
|
14
|
+
background-position: -100px -20px;
|
15
|
+
line-height: 20px;
|
16
|
+
vertical-align: top;
|
17
|
+
cursor: pointer;
|
18
|
+
}
|
19
|
+
> a {
|
20
|
+
font: 14px/1.7 "微软雅黑";
|
21
|
+
height: 20px;
|
22
|
+
line-height: 20px;
|
23
|
+
vertical-align: top;
|
24
|
+
cursor: pointer;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
json.menus @menus
|
data/config/routes.rb
CHANGED
data/lib/birt/routing.rb
CHANGED
data/lib/birt/version.rb
CHANGED
data/lib/birt.rb
CHANGED
@@ -26,17 +26,16 @@ module Birt
|
|
26
26
|
"<div class=\"birt\" data-rptdesign=\"#{rptdesign_name}.rptdesign\"></div>"
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
#获取报表的目录结构
|
30
30
|
def menus
|
31
|
-
|
32
31
|
Dir.glob("./reports/*.rptdesign").inject([]) { |acc, f|
|
33
32
|
names = REXML::Document.new(File.read(f)).root.get_elements("/report/text-property[@name='displayName']")
|
34
33
|
display_name = names[0].text if names && names[0]
|
34
|
+
file_name = f.split('/').last.split(".").first
|
35
35
|
acc << {
|
36
|
-
|
37
|
-
display_name: display_name
|
36
|
+
file_name: file_name,
|
37
|
+
display_name: display_name || file_name
|
38
38
|
}; acc
|
39
39
|
}
|
40
|
-
|
41
40
|
end
|
42
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: birt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- MIT-LICENSE
|
133
133
|
- README.rdoc
|
134
134
|
- Rakefile
|
135
|
+
- app/assets/images/tree.png
|
135
136
|
- app/assets/javascripts/birt.js
|
136
137
|
- app/assets/javascripts/birt/birt.js
|
137
138
|
- app/assets/javascripts/birt/components/loading.js
|
@@ -139,11 +140,13 @@ files:
|
|
139
140
|
- app/assets/stylesheets/birt.scss
|
140
141
|
- app/assets/stylesheets/birt/base/constant.scss
|
141
142
|
- app/assets/stylesheets/birt/base/mixins.scss
|
143
|
+
- app/assets/stylesheets/birt/components/birt_reports.scss
|
142
144
|
- app/assets/stylesheets/birt/components/loading.scss
|
145
|
+
- app/assets/stylesheets/birt/components/menus.scss
|
143
146
|
- app/assets/stylesheets/birt/components/table.scss
|
144
147
|
- app/views/birt/api/index.json.jbuilder
|
148
|
+
- app/views/birt/api/menus.json.jbuilder
|
145
149
|
- config/birt.yml
|
146
|
-
- config/database.yml
|
147
150
|
- config/routes.rb
|
148
151
|
- lib/app/controllers/birt/api_controller.rb
|
149
152
|
- lib/app/helpers/application_helper.rb
|
@@ -195,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
198
|
version: '0'
|
196
199
|
requirements: []
|
197
200
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.4.6
|
199
202
|
signing_key:
|
200
203
|
specification_version: 4
|
201
204
|
summary: birt report
|