birt 0.2.2 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d17fdc7fb01954788c080eeb639a7b7445c2c030
4
- data.tar.gz: 2dbf5737474092bf6d09bdfc6f9994938d934bb3
3
+ metadata.gz: 591788cc9db63198f8416d70130bd5e8212f3004
4
+ data.tar.gz: de1e8914cf9809c29106bc7b72f2871a9af447a2
5
5
  SHA512:
6
- metadata.gz: db5677cbc475cca359859fb168ed9bc9d7b227521ddb89807252fdfbbbdd7086c0dbd1d68241092bd01f009cbbb2b27a23f80bbf14603824a124c8765caf8d87
7
- data.tar.gz: dd24ead72fc2c37d57f3dede77823894ce827f02e8864ce443a605882e27a6ac7ad29410affa701659fbfc3913d7841432e8cb08eb8e3e37cbe710e93d0444de
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(rptDesignName || $birt.data('rptdesign')),
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
- $.birtLoading();
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
- $menus.append("<li class='item'><i class='icon'></i><a>{0}</a></li>".format(menu.display_name));
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
- $(".birt").append("<div id='report_{0}'></div>".format(lineChart.id));
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
- display: table-cell;
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: 1px solid #ddd;
6
- padding: 8px;
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
  }
@@ -1,8 +1,12 @@
1
1
  .birt-reports {
2
- display: table-cell;
3
2
  vertical-align: top;
4
- padding-left: 8px;
5
3
  text-align: left;
4
+ position: absolute;
5
+ left: 208px;
6
+ top: 0;
7
+ right: 0;
8
+ width: auto;
9
+ padding: 0 8px 5px 3px;
6
10
  > .display-name {
7
11
  margin: 0 0 12px 0;
8
12
  }
@@ -2,9 +2,16 @@
2
2
  @import "birt/components/*";
3
3
 
4
4
  .birt {
5
- @include birt_base;
6
5
  width: 100%;
7
- padding: 12px;
6
+ padding: 0;
8
7
  position: relative;
9
- display: table;
8
+ }
9
+
10
+ body {
11
+ padding: 0;
12
+ margin: 0;
13
+ }
14
+
15
+ * {
16
+ @include birt_base;
10
17
  }
data/lib/birt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Birt
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  module Core
4
4
 
5
5
  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.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