birt 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/birt/birt.js +32 -7
- data/app/assets/stylesheets/birt/base/constant.scss +4 -1
- data/app/assets/stylesheets/birt/components/menus.scss +23 -3
- data/app/assets/stylesheets/birt/components/{birt_reports.scss → reports.scss} +6 -2
- data/app/assets/stylesheets/birt.scss +10 -3
- data/lib/birt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 591788cc9db63198f8416d70130bd5e8212f3004
|
4
|
+
data.tar.gz: de1e8914cf9809c29106bc7b72f2871a9af447a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38d9145876ab625890ccf0bbd2835ba8322bcb2806eaa8eb7aad3fa4133c8da02e6d0a89bcfafc7450428cecd464957c6b07e00938626b720706a506f6c810dc
|
7
|
+
data.tar.gz: b3ea9af809f34db440b429162c713ae16659196d15505af262609ba91369211b67181d844856ff6e4cf6a7c998d476a3166c51d2a82a2bd33a2251819c2adc33
|
@@ -12,13 +12,15 @@ var Birt = (function () {
|
|
12
12
|
rptDesignJsonData = designJsonData;
|
13
13
|
}
|
14
14
|
|
15
|
+
Birt.prototype.file_name = ""; //birt报表文件名称
|
16
|
+
|
15
17
|
/**
|
16
18
|
* 开始加载
|
17
19
|
*/
|
18
20
|
Birt.prototype.run = function () {
|
19
21
|
_this.onCreate();
|
20
|
-
_this.getMenus();
|
21
22
|
_this.getRetDesign();
|
23
|
+
_this.getMenus();
|
22
24
|
};
|
23
25
|
|
24
26
|
/**
|
@@ -39,10 +41,12 @@ var Birt = (function () {
|
|
39
41
|
* @param rptDesignName
|
40
42
|
*/
|
41
43
|
Birt.prototype.getRetDesign = function (rptDesignName) {
|
44
|
+
_this.file_name = rptDesignName || $birt.data('rptdesign');
|
45
|
+
|
42
46
|
$.birtLoading();
|
43
47
|
$.ajax(
|
44
48
|
{
|
45
|
-
url: '/birt/api.json?_report={0}'.format(
|
49
|
+
url: '/birt/api.json?_report={0}'.format(_this.file_name),
|
46
50
|
type: 'GET',
|
47
51
|
success: function (data) {
|
48
52
|
$.birtLoading('hide');
|
@@ -72,23 +76,43 @@ var Birt = (function () {
|
|
72
76
|
* 获取报表的目录结构
|
73
77
|
*/
|
74
78
|
Birt.prototype.getMenus = function () {
|
75
|
-
|
79
|
+
var menus = _this.getMenusFromCache();
|
80
|
+
if (menus) {
|
81
|
+
_this.showMenus(menus);
|
82
|
+
return;
|
83
|
+
}
|
76
84
|
$.ajax(
|
77
85
|
{
|
78
86
|
url: '/birt/api/menus.json',
|
79
87
|
type: 'GET',
|
80
88
|
success: function (data) {
|
81
|
-
$.birtLoading('hide');
|
82
89
|
console.log(data);
|
83
90
|
_this.showMenus(data.menus);
|
91
|
+
_this.putMenusToCache(data.menus);
|
84
92
|
},
|
85
93
|
error: function (data) {
|
86
|
-
$.birtLoading('hide');
|
87
94
|
}
|
88
95
|
}
|
89
96
|
);
|
90
97
|
};
|
91
98
|
|
99
|
+
/**
|
100
|
+
* 从缓存中获取菜单列表
|
101
|
+
*/
|
102
|
+
Birt.prototype.getMenusFromCache = function () {
|
103
|
+
var menus = localStorage.getItem("birt_menus");
|
104
|
+
console.log(menus);
|
105
|
+
return menus ? JSON.parse(menus) : null;
|
106
|
+
};
|
107
|
+
|
108
|
+
/**
|
109
|
+
* 将菜单数据写入缓存
|
110
|
+
* @param menus
|
111
|
+
*/
|
112
|
+
Birt.prototype.putMenusToCache = function (menus) {
|
113
|
+
localStorage.setItem("birt_menus", JSON.stringify(menus));
|
114
|
+
};
|
115
|
+
|
92
116
|
/**
|
93
117
|
* 显示报表的名称
|
94
118
|
*/
|
@@ -103,7 +127,8 @@ var Birt = (function () {
|
|
103
127
|
Birt.prototype.showMenus = function (menus) {
|
104
128
|
for (var i = 0; i < menus.length; i++) {
|
105
129
|
var menu = menus[i];
|
106
|
-
|
130
|
+
var active = menu.file_name == _this.file_name.replace(".rptdesign", "") ? 'active' : '';
|
131
|
+
$menus.append("<li class='item {1}'><i class='icon'></i><a href='/?_report={2}'>{0}</a></li>".format(menu.display_name, active, menu.file_name));
|
107
132
|
}
|
108
133
|
};
|
109
134
|
|
@@ -154,7 +179,7 @@ var Birt = (function () {
|
|
154
179
|
|
155
180
|
|
156
181
|
Birt.prototype.showLineChart = function (lineChart) {
|
157
|
-
$
|
182
|
+
$reports.append("<div id='report_{0}'></div>".format(lineChart.id));
|
158
183
|
new Highcharts.Chart({
|
159
184
|
chart: {
|
160
185
|
renderTo: "report_{0}".format(lineChart.id),
|
@@ -32,6 +32,10 @@ $color-loading-point-grayer: #8C8990;
|
|
32
32
|
$color-switch-off: #ddd;
|
33
33
|
$color-switch-on: #4cd964;
|
34
34
|
|
35
|
+
$color-birt-menu-bg: #293038; //menu列表背景颜色
|
36
|
+
$color-birt-menu-item-hover-bg: #37424F; //menu列表背景颜色
|
37
|
+
|
38
|
+
|
35
39
|
/*num*/
|
36
40
|
$num-header-height: 45px;
|
37
41
|
$num-footer-tabs-height: 50px;
|
@@ -43,7 +47,6 @@ $num-button-small-height: 28px;
|
|
43
47
|
$border-color: #ddd;
|
44
48
|
$border-blue-color: #145fd7;
|
45
49
|
|
46
|
-
|
47
50
|
$blue: #4a87ee;
|
48
51
|
$hover: #f5f5f5;
|
49
52
|
|
@@ -1,11 +1,20 @@
|
|
1
1
|
.birt-menus {
|
2
|
-
|
2
|
+
position: fixed;
|
3
|
+
z-index: 100;
|
4
|
+
top: 0;
|
5
|
+
left: 0;
|
6
|
+
height: 100%;
|
3
7
|
width: 200px;
|
4
8
|
list-style: none;
|
5
|
-
border:
|
6
|
-
|
9
|
+
border: none;
|
10
|
+
margin: 0;
|
7
11
|
vertical-align: top;
|
12
|
+
background: $color-birt-menu-bg;
|
13
|
+
color: white;
|
14
|
+
padding: 0;
|
15
|
+
//菜单列表项
|
8
16
|
> .item {
|
17
|
+
padding: 5px 8px;
|
9
18
|
> .icon {
|
10
19
|
width: 20px;
|
11
20
|
height: 20px;
|
@@ -20,8 +29,19 @@
|
|
20
29
|
font: 14px/1.7 "微软雅黑";
|
21
30
|
height: 20px;
|
22
31
|
line-height: 20px;
|
32
|
+
color: white;
|
33
|
+
text-decoration: none;
|
23
34
|
vertical-align: top;
|
24
35
|
cursor: pointer;
|
25
36
|
}
|
26
37
|
}
|
38
|
+
//列表项被选中
|
39
|
+
> .item.active {
|
40
|
+
background: rgba(0, 0, 0, 0.6);
|
41
|
+
color: white;
|
42
|
+
}
|
43
|
+
|
44
|
+
> .item:hover {
|
45
|
+
background: $color-birt-menu-item-hover-bg;
|
46
|
+
}
|
27
47
|
}
|
data/lib/birt/version.rb
CHANGED
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
@@ -140,9 +140,9 @@ files:
|
|
140
140
|
- app/assets/stylesheets/birt.scss
|
141
141
|
- app/assets/stylesheets/birt/base/constant.scss
|
142
142
|
- app/assets/stylesheets/birt/base/mixins.scss
|
143
|
-
- app/assets/stylesheets/birt/components/birt_reports.scss
|
144
143
|
- app/assets/stylesheets/birt/components/loading.scss
|
145
144
|
- app/assets/stylesheets/birt/components/menus.scss
|
145
|
+
- app/assets/stylesheets/birt/components/reports.scss
|
146
146
|
- app/assets/stylesheets/birt/components/table.scss
|
147
147
|
- app/views/birt/api/index.json.jbuilder
|
148
148
|
- app/views/birt/api/menus.json.jbuilder
|