birt-view 0.1.1 → 0.1.2

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: 3d518ff08d2fb771785b2d500b22d07c91e18c4f
4
- data.tar.gz: ba5045daa59c6ff7fe1255f6bb8ada541c9a7693
3
+ metadata.gz: 6439f3db796a906fa6652d1666146f1aefdf8d4a
4
+ data.tar.gz: 4f3624367d220b5cd3a5b1ea7b6d9b874e4f2e28
5
5
  SHA512:
6
- metadata.gz: aab4e354fb2d5d599930248754cb8b7288f83eadeed3fcc96d9eb99614f3c34b81376a26111ca42a3e80077751713de8294f26504faf4bab50221335de7af5b3
7
- data.tar.gz: 9055b834ed8f5fc87202966d631bb1d46c1a6f06a260832d5576f4a51b37fe5cb768179525acaf007a78cbb18d53c73c7a74473f91d84534f73f36d96a110200
6
+ metadata.gz: 0ebaa98845be089d4fe270e735aa9e8f368414b840f434fb61c35d778451b6418de6590820e2acdcc8fd21936783ff37518f47342f4fd16364d968d9b3f66c7e
7
+ data.tar.gz: 745117087c5ee212d339c020dd82ea44d96067218e27e5d8b4852102b975fb3d7e8f4ce4565cea3b673edeb766909acefe647642b9b5a085febe3cc0948ca5fb
data/.gitignore CHANGED
@@ -14,4 +14,5 @@
14
14
  /tmp/
15
15
  /public/assets/
16
16
  /config/database.yml
17
- *.gem
17
+ *.gem
18
+ /birt/reports/*.rptdesign
data/Gemfile CHANGED
@@ -10,7 +10,8 @@ gem 'jquery-rails'
10
10
  gem 'turbolinks'
11
11
  gem 'jbuilder', '~> 2.0'
12
12
  gem 'sdoc', '~> 0.4.0', group: :doc
13
- gem 'birt-api', '~> 0.1.6'
13
+ gem 'birt-api', '~> 0.1.8'
14
+ gem 'highcharts-rails', '~> 4.1'
14
15
 
15
16
  group :development, :test do
16
17
  gem 'byebug'
data/birt-view.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/mumaoxi/birt-view"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(db|log|public|config|test|spec|features)/}) }
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(app|birt|db|log|public|config|test|spec|features)/}) }
18
18
  spec.bindir = "exe"
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
@@ -25,5 +25,6 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.9"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_runtime_dependency "birt-api", "~> 0.1.6"
28
+ spec.add_runtime_dependency "birt-api", "~> 0.1.8"
29
+ spec.add_runtime_dependency "highcharts-rails", "~> 4.1"
29
30
  end
@@ -0,0 +1,90 @@
1
+ var Birt = (function () {
2
+ var _this;
3
+
4
+ var rptDesignJsonData;
5
+
6
+ var $birt;
7
+
8
+ function Birt(designJsonData) {
9
+ _this = this;
10
+ rptDesignJsonData = designJsonData;
11
+ $birt = $('.birt');
12
+ }
13
+
14
+ /**
15
+ * 获取报表数据
16
+ * @param rptDesignName
17
+ */
18
+ Birt.prototype.getRetDesign = function (rptDesignName) {
19
+ $.birtLoading();
20
+ $.ajax(
21
+ {
22
+ url: '/birt/api.json?_report={0}'.format(rptDesignName),
23
+ type: 'GET',
24
+ success: function (data) {
25
+ $.birtLoading('hide');
26
+ rptDesignJsonData = data.rpt_design;
27
+ _this.showDisplayName();
28
+ console.log(data.rpt_design.tables);
29
+ var tables = data.rpt_design.tables;
30
+ for (var i = 0; i < tables.length; i++) {
31
+ var table = tables[i];
32
+ _this.showTable(table);
33
+ }
34
+ },
35
+ error: function (data) {
36
+ $.birtLoading('hide');
37
+ }
38
+ }
39
+ );
40
+ };
41
+
42
+ Birt.prototype.showDisplayName = function () {
43
+ $birt.append('<h2>{0}</h2>'.format(rptDesignJsonData.display_name));
44
+ };
45
+
46
+ /**
47
+ * 显示行
48
+ * @param rowData
49
+ * @param cellName
50
+ * @returns {string}
51
+ */
52
+ Birt.prototype.showTableRow = function (rowData, cellName) {
53
+
54
+ var row_html = '<tr>';
55
+ for (var i = 0; i < rowData.length; i++) {
56
+ if (cellName == 'th') {
57
+ row_html += "<th>{0}</th>".format(rowData[i]);
58
+ } else {
59
+ row_html += "<td>{0}</td>".format(rowData[i]);
60
+ }
61
+ }
62
+ row_html += '</tr>';
63
+ return row_html;
64
+ };
65
+
66
+ /**
67
+ * 显示表格
68
+ * @param table
69
+ * @returns {string}
70
+ */
71
+ Birt.prototype.showTable = function (table) {
72
+ var table_html = '<table class="birt-table">';
73
+
74
+ for (var i = 0; i < table.header.length; i++) {
75
+ table_html += _this.showTableRow(table.header[i], 'th');
76
+ }
77
+
78
+
79
+ for (var i = 0; i < table.detail.length; i++) {
80
+ table_html += _this.showTableRow(table.detail[i], 'td');
81
+ }
82
+
83
+ table_html += "</table>";
84
+
85
+ $(".birt").append(table_html);
86
+ console.log(table);
87
+ return table_html;
88
+ };
89
+ return Birt;
90
+ })();
@@ -0,0 +1,28 @@
1
+ ;
2
+ (function ($) {
3
+ $.extend({
4
+ birtLoading: function (action) {
5
+ var loadingHtml = '<div class="birt-loading">' +
6
+ '<div class="icon">' +
7
+ '<img src="http://img.tanliani.com/public/assets/vd/icon_loading.png">' +
8
+ '</div>' +
9
+ '<p class="label">' +
10
+ 'Birt报表' +
11
+ '</p>' +
12
+
13
+ ' <div class="points">' +
14
+ ' <i class="one"></i>' +
15
+ ' <i class="two"></i>' +
16
+ ' <i class="three"></i>' +
17
+ ' </div>' +
18
+ '</div>';
19
+ $('.birt-loading').remove();
20
+ $('body').append(loadingHtml);
21
+ if (action == undefined || action == 'show') {
22
+ $(".birt-loading").show();
23
+ } else {
24
+ $(".birt-loading").hide();
25
+ }
26
+ }
27
+ });
28
+ })(jQuery);
@@ -0,0 +1,22 @@
1
+ String.prototype.format = function (args) {
2
+ var result = this;
3
+ if (arguments.length > 0) {
4
+ if (arguments.length == 1 && typeof (args) == "object") {
5
+ for (var key in args) {
6
+ if (args[key] != undefined) {
7
+ var reg = new RegExp("({" + key + "})", "g");
8
+ result = result.replace(reg, args[key]);
9
+ }
10
+ }
11
+ }
12
+ else {
13
+ for (var i = 0; i < arguments.length; i++) {
14
+ if (arguments[i] != undefined) {
15
+ var reg = new RegExp("({[" + i + "]})", "g");
16
+ result = result.replace(reg, arguments[i]);
17
+ }
18
+ }
19
+ }
20
+ }
21
+ return result;
22
+ }
@@ -0,0 +1,8 @@
1
+ //= require highcharts
2
+ //= require birt/components/loading
3
+ //= require birt/utils/string
4
+ //= require birt/birt
5
+
6
+ var birt = new Birt();
7
+
8
+ birt.getRetDesign('003.rptdesign');
@@ -0,0 +1,48 @@
1
+ /*z-index*/
2
+ $z-index-content: 999;
3
+ $z-index-header: 1000;
4
+ $z-index-footer: 1000;
5
+ $z-index-top-menu: 1001;
6
+ $z-index-option-menu: 1002;
7
+ $z-index-select: 1001;
8
+ $z-index-modal-view: 1001;
9
+
10
+ $z-index-input-dialog: 1102;
11
+ $z-index-confirm: 1102;
12
+ $z-index-loading: 1103;
13
+ $z-index-toast: 1104;
14
+
15
+ /*color*/
16
+ $color-line: #EBEBEB;
17
+ $color-text-orange: #FC7203;
18
+ $color-text-green: #44AD1C;
19
+ $color-text-gray: #ABABAB;
20
+ $color-text-danger: red;
21
+ $color-text-danger-press: #b30000;
22
+ $color-text-danger-disabled: #ff8080;
23
+ $color-white-press: #cccccc;
24
+ $color-btn-success: #44AD1C;
25
+ $color-btn-success-press: #338014;
26
+ $color-btn-success-disabled: #99cc99;
27
+
28
+ $color-loading-point-white: #fff;
29
+ $color-loading-point-gray: #A9A5AD;
30
+ $color-loading-point-grayer: #8C8990;
31
+
32
+ $color-switch-off: #ddd;
33
+ $color-switch-on: #4cd964;
34
+
35
+ /*num*/
36
+ $num-header-height: 45px;
37
+ $num-footer-tabs-height: 50px;
38
+ $num-button-height: 38px;
39
+ $num-button-normal-height: 35px;
40
+ $num-button-small-height: 28px;
41
+
42
+ /*other*/
43
+ $border-color: #ddd;
44
+ $border-blue-color: #145fd7;
45
+
46
+ $blue: #4a87ee;
47
+ $hover: #f5f5f5;
48
+
@@ -0,0 +1,30 @@
1
+ @mixin float-middle-center {
2
+ top: 50%;
3
+ left: 50%;
4
+ transform: translate(-50%, -50%);
5
+ -webkit-transform: translate(-50%, -50%);
6
+ }
7
+
8
+ @mixin mix_loading_point {
9
+ animation-duration: 1000ms;
10
+ -webkit-animation-duration: 1000ms;
11
+ animation-iteration-count: infinite;
12
+ -webkit-animation-iteration-count: infinite;
13
+ animation-timing-function: linear;
14
+ -webkit-animation-timing-function: linear;
15
+ }
16
+
17
+ @mixin mix_button {
18
+ -webkit-appearance: none;
19
+ height: $num-button-height;
20
+ border-radius: 4px;
21
+ min-width: 120px;
22
+ outline: none;
23
+ box-shadow: none;
24
+ }
25
+
26
+ @mixin birt_base {
27
+ -webkit-box-sizing: border-box;
28
+ -moz-box-sizing: border-box;
29
+ box-sizing: border-box;
30
+ }
@@ -0,0 +1,158 @@
1
+ @keyframes loading_point {
2
+ 0% {
3
+ background-color: $color-loading-point-white;
4
+ }
5
+
6
+ 33.3% {
7
+ background-color: $color-loading-point-gray;
8
+ }
9
+
10
+ 66.6% {
11
+ background-color: $color-loading-point-grayer;
12
+ }
13
+
14
+ 100% {
15
+ background-color: $color-loading-point-white;
16
+ }
17
+ }
18
+
19
+ @-webkit-keyframes loading_point {
20
+ 0% {
21
+ background-color: $color-loading-point-white;
22
+ }
23
+
24
+ 33.3% {
25
+ background-color: $color-loading-point-gray;
26
+ }
27
+
28
+ 66.6% {
29
+ background-color: $color-loading-point-grayer;
30
+ }
31
+
32
+ 100% {
33
+ background-color: $color-loading-point-white;
34
+ }
35
+ }
36
+
37
+ @keyframes loading_point_two {
38
+ 0% {
39
+ background-color: $color-loading-point-grayer;
40
+ }
41
+
42
+ 33.3% {
43
+ background-color: $color-loading-point-white;
44
+ }
45
+
46
+ 66.6% {
47
+ background-color: $color-loading-point-gray;
48
+ }
49
+
50
+ 100% {
51
+ background-color: $color-loading-point-grayer;
52
+ }
53
+ }
54
+
55
+ @-webkit-keyframes loading_point_two {
56
+ 0% {
57
+ background-color: $color-loading-point-grayer;
58
+ }
59
+
60
+ 33.3% {
61
+ background-color: $color-loading-point-white;
62
+ }
63
+
64
+ 66.6% {
65
+ background-color: $color-loading-point-gray;
66
+ }
67
+
68
+ 100% {
69
+ background-color: $color-loading-point-grayer;
70
+ }
71
+ }
72
+
73
+ @keyframes loading_point_three {
74
+ 0% {
75
+ background-color: $color-loading-point-gray;
76
+ }
77
+
78
+ 33.3% {
79
+ background-color: $color-loading-point-grayer;
80
+ }
81
+
82
+ 66.6% {
83
+ background-color: $color-loading-point-white;
84
+ }
85
+
86
+ 100% {
87
+ background-color: $color-loading-point-gray;
88
+ }
89
+ }
90
+
91
+ @-webkit-keyframes loading_point_three {
92
+ 0% {
93
+ background-color: $color-loading-point-gray;
94
+ }
95
+
96
+ 33.3% {
97
+ background-color: $color-loading-point-grayer;
98
+ }
99
+
100
+ 66.6% {
101
+ background-color: $color-loading-point-white;
102
+ }
103
+
104
+ 100% {
105
+ background-color: $color-loading-point-gray;
106
+ }
107
+ }
108
+
109
+
110
+ .birt-loading {
111
+ @include birt_base;
112
+ width: 120px;
113
+ height: 120px;
114
+ background: rgba(0, 0, 0, 0.6);
115
+ display: none;
116
+ position: fixed;
117
+ z-index: $z-index-loading;
118
+ color: white;
119
+ text-align: center;
120
+ vertical-align: middle;
121
+ border-radius: 5px;
122
+ padding: 12px;
123
+ @include float-middle-center;
124
+ .icon > img {
125
+ width: 35px;
126
+ margin: 8px;
127
+ }
128
+ p.label {
129
+ font-size: 12pt;
130
+ font-weight: normal;
131
+ margin: 0;
132
+ }
133
+ .points {
134
+ margin-top: 5px;
135
+ text-align: center;
136
+ > i {
137
+ display: inline-table;
138
+ width: 5px;
139
+ height: 5px;
140
+ margin: 2px;
141
+ background: white;
142
+ border-radius: 100%;
143
+ animation: loading_point;
144
+ -webkit-animation: loading_point;
145
+ @include mix_loading_point;
146
+ &.two {
147
+ animation: loading_point_two;
148
+ -webkit-animation: loading_point_two;
149
+ @include mix_loading_point;
150
+ }
151
+ &.three {
152
+ animation: loading_point_three;
153
+ -webkit-animation: loading_point_three;
154
+ @include mix_loading_point;
155
+ }
156
+ }
157
+ }
158
+ }
@@ -0,0 +1,20 @@
1
+ table.birt-table {
2
+ width: 100%;
3
+ border: 1px solid #ddd;
4
+ border-radius: 0;
5
+ border-spacing: 0;
6
+ margin-bottom: 12px;
7
+ tr {
8
+ td, th {
9
+ border-bottom: 1px solid #ddd;
10
+ border-right: 1px solid #ddd;
11
+ padding: 5px 8px;
12
+ &:last-child {
13
+ border-right: none;
14
+ }
15
+ }
16
+ &:last-child td {
17
+ border-bottom: none;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ @import "birt/base/*";
2
+ @import "birt/components/table";
3
+ @import "birt/components/loading";
4
+
5
+ .birt {
6
+ @include birt_base;
7
+ width: 100%;
8
+ padding: 12px;
9
+ }
@@ -1,5 +1,5 @@
1
1
  module Birt
2
2
  module View
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birt-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saxer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-01 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.6
47
+ version: 0.1.8
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.6
54
+ version: 0.1.8
55
+ - !ruby/object:Gem::Dependency
56
+ name: highcharts-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.1'
55
69
  description: birt view includes csss javascript etc.
56
70
  email:
57
71
  - 15201280641@qq.com
@@ -66,15 +80,6 @@ files:
66
80
  - README.md
67
81
  - README.rdoc
68
82
  - Rakefile
69
- - app/assets/images/.keep
70
- - app/assets/javascripts/application.js
71
- - app/assets/stylesheets/application.css
72
- - app/controllers/application_controller.rb
73
- - app/controllers/concerns/.keep
74
- - app/helpers/application_helper.rb
75
- - app/models/.keep
76
- - app/models/concerns/.keep
77
- - app/views/layouts/application.html.erb
78
83
  - bin/bundle
79
84
  - bin/console
80
85
  - bin/rails
@@ -84,6 +89,15 @@ files:
84
89
  - birt-view.gemspec
85
90
  - config.ru
86
91
  - lib/assets/.keep
92
+ - lib/assets/javascripts/birt/birt.js
93
+ - lib/assets/javascripts/birt/components/loading.js
94
+ - lib/assets/javascripts/birt/utils/string.js
95
+ - lib/assets/javascripts/birt_view.js
96
+ - lib/assets/stylesheets/birt/base/constant.scss
97
+ - lib/assets/stylesheets/birt/base/mixins.scss
98
+ - lib/assets/stylesheets/birt/components/loading.scss
99
+ - lib/assets/stylesheets/birt/components/table.scss
100
+ - lib/assets/stylesheets/birt_view.scss
87
101
  - lib/birt/view.rb
88
102
  - lib/birt/view/version.rb
89
103
  - lib/tasks/.keep
@@ -108,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
122
  version: '0'
109
123
  requirements: []
110
124
  rubyforge_project:
111
- rubygems_version: 2.4.3
125
+ rubygems_version: 2.4.6
112
126
  signing_key:
113
127
  specification_version: 4
114
128
  summary: birt view
File without changes
@@ -1,16 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require turbolinks
16
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
File without changes
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
data/app/models/.keep DELETED
File without changes
File without changes
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>BirtView</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>