bnb_blazer 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/.docker-development-vars +1 -0
  3. data/.gitignore +31 -0
  4. data/.rspec +3 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +6 -0
  7. data/Gemfile +54 -0
  8. data/Gemfile.lock +233 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +35 -0
  11. data/Rakefile +7 -0
  12. data/app/assets/config/manifest.js +3 -0
  13. data/app/assets/images/.keep +0 -0
  14. data/app/assets/images/bnb_intel_logo.png +0 -0
  15. data/app/assets/stylesheets/application.css +83 -0
  16. data/app/channels/application_cable/channel.rb +4 -0
  17. data/app/channels/application_cable/connection.rb +4 -0
  18. data/app/controllers/application_controller.rb +2 -0
  19. data/app/controllers/concerns/.keep +0 -0
  20. data/app/helpers/application_helper.rb +2 -0
  21. data/app/jobs/application_job.rb +2 -0
  22. data/app/mailers/application_mailer.rb +4 -0
  23. data/app/models/application_record.rb +3 -0
  24. data/app/models/concerns/.keep +0 -0
  25. data/app/models/user.rb +2 -0
  26. data/app/views/blazer/_variables.html.haml +104 -0
  27. data/app/views/blazer/checks/_form.html.haml +51 -0
  28. data/app/views/blazer/checks/edit.html.haml +2 -0
  29. data/app/views/blazer/checks/index.html.haml +50 -0
  30. data/app/views/blazer/checks/new.html.haml +2 -0
  31. data/app/views/blazer/dashboards/_form.html.haml +64 -0
  32. data/app/views/blazer/dashboards/edit.html.haml +2 -0
  33. data/app/views/blazer/dashboards/new.html.haml +2 -0
  34. data/app/views/blazer/dashboards/show.html.haml +30 -0
  35. data/app/views/blazer/queries/_form.html.haml +226 -0
  36. data/app/views/blazer/queries/edit.html.haml +2 -0
  37. data/app/views/blazer/queries/home.html.haml +142 -0
  38. data/app/views/blazer/queries/new.html.haml +2 -0
  39. data/app/views/blazer/queries/run.html.haml +152 -0
  40. data/app/views/blazer/queries/show.html.haml +45 -0
  41. data/app/views/layouts/blazer/_footer.html.haml +2 -0
  42. data/app/views/layouts/blazer/_navbar.html.haml +25 -0
  43. data/app/views/layouts/blazer/application.html.haml +21 -0
  44. data/bin/bundle +3 -0
  45. data/bin/console +14 -0
  46. data/bin/rails +9 -0
  47. data/bin/rake +9 -0
  48. data/bin/setup +36 -0
  49. data/bin/spring +17 -0
  50. data/bin/update +31 -0
  51. data/bin/yarn +11 -0
  52. data/bnb_blazer.gemspec +28 -0
  53. data/config/application.rb +19 -0
  54. data/config/blazer.yml +79 -0
  55. data/config/boot.rb +4 -0
  56. data/config/cable.yml +10 -0
  57. data/config/credentials.yml.enc +1 -0
  58. data/config/database.yml +19 -0
  59. data/config/environment.rb +5 -0
  60. data/config/environments/development.rb +61 -0
  61. data/config/environments/production.rb +94 -0
  62. data/config/environments/test.rb +46 -0
  63. data/config/initializers/application_controller_renderer.rb +8 -0
  64. data/config/initializers/assets.rb +14 -0
  65. data/config/initializers/backtrace_silencers.rb +7 -0
  66. data/config/initializers/content_security_policy.rb +25 -0
  67. data/config/initializers/cookies_serializer.rb +5 -0
  68. data/config/initializers/filter_parameter_logging.rb +4 -0
  69. data/config/initializers/inflections.rb +16 -0
  70. data/config/initializers/mime_types.rb +4 -0
  71. data/config/initializers/wrap_parameters.rb +14 -0
  72. data/config/locales/en.yml +33 -0
  73. data/config/puma.rb +37 -0
  74. data/config/routes.rb +3 -0
  75. data/config/spring.rb +6 -0
  76. data/config/storage.yml +34 -0
  77. data/config.ru +5 -0
  78. data/db/migrate/20210309231658_install_blazer.rb +47 -0
  79. data/db/migrate/20210309231908_create_users.rb +13 -0
  80. data/db/schema.rb +85 -0
  81. data/db/seeds.rb +45 -0
  82. data/docker-compose.yml +22 -0
  83. data/lib/assets/.keep +0 -0
  84. data/lib/bnb_blazer/bnb_blazer.rb +6 -0
  85. data/lib/bnb_blazer/version.rb +3 -0
  86. data/lib/tasks/.keep +0 -0
  87. data/log/.keep +0 -0
  88. data/package.json +5 -0
  89. data/public/404.html +67 -0
  90. data/public/422.html +67 -0
  91. data/public/500.html +66 -0
  92. data/public/apple-touch-icon-precomposed.png +0 -0
  93. data/public/apple-touch-icon.png +0 -0
  94. data/public/favicon.ico +0 -0
  95. data/public/robots.txt +1 -0
  96. data/tmp/.keep +0 -0
  97. data/vendor/.keep +0 -0
  98. metadata +156 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4868d7cfe0fa0b19df9b57edbe7be3b073905fddb4d33d63ae1bf821a6a6a4f1
4
+ data.tar.gz: ff9b5a03efce385bbbc63c1394e24df189a378b3cabadb5bb7a01ffdc53668a8
5
+ SHA512:
6
+ metadata.gz: a039e10d685545b983ba8d42976302f81b986696aaa88244270da8d984f278b9817dc61d371578523c0f8fbd5c4668ab99a69df76e8c3412ec092a69540cbb68
7
+ data.tar.gz: e486bff01d7c20234b5d03b311c2828cce5af89ff4fdf49959a56552fe0c9803fb24e3675598effe7db3f83037fb0820ae97c1f732530d64bee599e6ebc462d0
@@ -0,0 +1 @@
1
+ DATABASE_URL=postgresql://postgres:password@postgresql:5432
data/.gitignore ADDED
@@ -0,0 +1,31 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore all logfiles and tempfiles.
11
+ /log/*
12
+ /tmp/*
13
+ !/log/.keep
14
+ !/tmp/.keep
15
+
16
+ # Ignore uploaded files in development
17
+ /storage/*
18
+ !/storage/.keep
19
+
20
+ /node_modules
21
+ /yarn-error.log
22
+
23
+ /public/assets
24
+ .byebug_history
25
+
26
+ .DS_Store
27
+ /pgdata
28
+ /vendor/bundle
29
+
30
+ # Ignore master key for decrypting credentials and more.
31
+ /config/master.key
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.6
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5.3
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,54 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ gemspec
5
+
6
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7
+ gem 'rails', '~> 5.2.4', '>= 5.2.4.5'
8
+ # Use postgres as the database for Active Record
9
+ gem 'puma'
10
+ gem 'pg'
11
+ # Use SCSS for stylesheets
12
+ gem 'sass-rails', '~> 5.0'
13
+ # Use Uglifier as compressor for JavaScript assets
14
+ gem 'uglifier', '>= 1.3.0'
15
+
16
+ gem 'blazer'
17
+ gem 'faker'
18
+ gem 'bootstrap', '~> 4.6.0'
19
+ gem 'jquery-rails'
20
+ gem 'haml-rails'
21
+
22
+ # Use ActiveStorage variant
23
+ # gem 'mini_magick', '~> 4.8'
24
+
25
+ # Use Capistrano for deployment
26
+ # gem 'capistrano-rails', group: :development
27
+
28
+ # Reduces boot times through caching; required in config/boot.rb
29
+ gem 'bootsnap', '>= 1.1.0', require: false
30
+
31
+ group :development, :test do
32
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
33
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
34
+ end
35
+
36
+ group :development do
37
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
38
+ gem 'web-console', '>= 3.3.0'
39
+ gem 'listen', '>= 3.0.5', '< 3.2'
40
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
41
+ gem 'spring'
42
+ gem 'spring-watcher-listen', '~> 2.0.0'
43
+ end
44
+
45
+ group :test do
46
+ # # Adds support for Capybara system testing and selenium driver
47
+ # gem 'capybara', '>= 2.15'
48
+ # gem 'selenium-webdriver'
49
+ # # Easy installation and use of chromedriver to run system tests with Chrome
50
+ # gem 'chromedriver-helper'
51
+ end
52
+
53
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
54
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
data/Gemfile.lock ADDED
@@ -0,0 +1,233 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bnb_blazer (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (5.2.4.5)
10
+ actionpack (= 5.2.4.5)
11
+ nio4r (~> 2.0)
12
+ websocket-driver (>= 0.6.1)
13
+ actionmailer (5.2.4.5)
14
+ actionpack (= 5.2.4.5)
15
+ actionview (= 5.2.4.5)
16
+ activejob (= 5.2.4.5)
17
+ mail (~> 2.5, >= 2.5.4)
18
+ rails-dom-testing (~> 2.0)
19
+ actionpack (5.2.4.5)
20
+ actionview (= 5.2.4.5)
21
+ activesupport (= 5.2.4.5)
22
+ rack (~> 2.0, >= 2.0.8)
23
+ rack-test (>= 0.6.3)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ actionview (5.2.4.5)
27
+ activesupport (= 5.2.4.5)
28
+ builder (~> 3.1)
29
+ erubi (~> 1.4)
30
+ rails-dom-testing (~> 2.0)
31
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
32
+ activejob (5.2.4.5)
33
+ activesupport (= 5.2.4.5)
34
+ globalid (>= 0.3.6)
35
+ activemodel (5.2.4.5)
36
+ activesupport (= 5.2.4.5)
37
+ activerecord (5.2.4.5)
38
+ activemodel (= 5.2.4.5)
39
+ activesupport (= 5.2.4.5)
40
+ arel (>= 9.0)
41
+ activestorage (5.2.4.5)
42
+ actionpack (= 5.2.4.5)
43
+ activerecord (= 5.2.4.5)
44
+ marcel (~> 0.3.1)
45
+ activesupport (5.2.4.5)
46
+ concurrent-ruby (~> 1.0, >= 1.0.2)
47
+ i18n (>= 0.7, < 2)
48
+ minitest (~> 5.1)
49
+ tzinfo (~> 1.1)
50
+ arel (9.0.0)
51
+ autoprefixer-rails (10.2.4.0)
52
+ execjs
53
+ bindex (0.8.1)
54
+ blazer (2.4.2)
55
+ activerecord (>= 5)
56
+ chartkick (>= 3.2)
57
+ railties (>= 5)
58
+ safely_block (>= 0.1.1)
59
+ bootsnap (1.7.2)
60
+ msgpack (~> 1.0)
61
+ bootstrap (4.6.0)
62
+ autoprefixer-rails (>= 9.1.0)
63
+ popper_js (>= 1.14.3, < 2)
64
+ sassc-rails (>= 2.0.0)
65
+ builder (3.2.4)
66
+ byebug (11.1.3)
67
+ chartkick (3.4.2)
68
+ concurrent-ruby (1.1.8)
69
+ crass (1.0.6)
70
+ errbase (0.2.1)
71
+ erubi (1.10.0)
72
+ erubis (2.7.0)
73
+ execjs (2.7.0)
74
+ faker (2.16.0)
75
+ i18n (>= 1.6, < 2)
76
+ ffi (1.15.0)
77
+ globalid (0.4.2)
78
+ activesupport (>= 4.2.0)
79
+ haml (5.2.1)
80
+ temple (>= 0.8.0)
81
+ tilt
82
+ haml-rails (2.0.1)
83
+ actionpack (>= 5.1)
84
+ activesupport (>= 5.1)
85
+ haml (>= 4.0.6, < 6.0)
86
+ html2haml (>= 1.0.1)
87
+ railties (>= 5.1)
88
+ html2haml (2.2.0)
89
+ erubis (~> 2.7.0)
90
+ haml (>= 4.0, < 6)
91
+ nokogiri (>= 1.6.0)
92
+ ruby_parser (~> 3.5)
93
+ i18n (1.8.9)
94
+ concurrent-ruby (~> 1.0)
95
+ jquery-rails (4.4.0)
96
+ rails-dom-testing (>= 1, < 3)
97
+ railties (>= 4.2.0)
98
+ thor (>= 0.14, < 2.0)
99
+ listen (3.1.5)
100
+ rb-fsevent (~> 0.9, >= 0.9.4)
101
+ rb-inotify (~> 0.9, >= 0.9.7)
102
+ ruby_dep (~> 1.2)
103
+ loofah (2.9.0)
104
+ crass (~> 1.0.2)
105
+ nokogiri (>= 1.5.9)
106
+ mail (2.7.1)
107
+ mini_mime (>= 0.1.1)
108
+ marcel (0.3.3)
109
+ mimemagic (~> 0.3.2)
110
+ method_source (1.0.0)
111
+ mimemagic (0.3.5)
112
+ mini_mime (1.0.2)
113
+ mini_portile2 (2.5.0)
114
+ minitest (5.14.4)
115
+ msgpack (1.4.2)
116
+ nio4r (2.5.7)
117
+ nokogiri (1.11.1)
118
+ mini_portile2 (~> 2.5.0)
119
+ racc (~> 1.4)
120
+ pg (1.2.3)
121
+ popper_js (1.16.0)
122
+ puma (5.2.2)
123
+ nio4r (~> 2.0)
124
+ racc (1.5.2)
125
+ rack (2.2.3)
126
+ rack-test (1.1.0)
127
+ rack (>= 1.0, < 3)
128
+ rails (5.2.4.5)
129
+ actioncable (= 5.2.4.5)
130
+ actionmailer (= 5.2.4.5)
131
+ actionpack (= 5.2.4.5)
132
+ actionview (= 5.2.4.5)
133
+ activejob (= 5.2.4.5)
134
+ activemodel (= 5.2.4.5)
135
+ activerecord (= 5.2.4.5)
136
+ activestorage (= 5.2.4.5)
137
+ activesupport (= 5.2.4.5)
138
+ bundler (>= 1.3.0)
139
+ railties (= 5.2.4.5)
140
+ sprockets-rails (>= 2.0.0)
141
+ rails-dom-testing (2.0.3)
142
+ activesupport (>= 4.2.0)
143
+ nokogiri (>= 1.6)
144
+ rails-html-sanitizer (1.3.0)
145
+ loofah (~> 2.3)
146
+ railties (5.2.4.5)
147
+ actionpack (= 5.2.4.5)
148
+ activesupport (= 5.2.4.5)
149
+ method_source
150
+ rake (>= 0.8.7)
151
+ thor (>= 0.19.0, < 2.0)
152
+ rake (13.0.3)
153
+ rb-fsevent (0.10.4)
154
+ rb-inotify (0.10.1)
155
+ ffi (~> 1.0)
156
+ ruby_dep (1.5.0)
157
+ ruby_parser (3.15.1)
158
+ sexp_processor (~> 4.9)
159
+ safely_block (0.3.0)
160
+ errbase (>= 0.1.1)
161
+ sass (3.7.4)
162
+ sass-listen (~> 4.0.0)
163
+ sass-listen (4.0.0)
164
+ rb-fsevent (~> 0.9, >= 0.9.4)
165
+ rb-inotify (~> 0.9, >= 0.9.7)
166
+ sass-rails (5.1.0)
167
+ railties (>= 5.2.0)
168
+ sass (~> 3.1)
169
+ sprockets (>= 2.8, < 4.0)
170
+ sprockets-rails (>= 2.0, < 4.0)
171
+ tilt (>= 1.1, < 3)
172
+ sassc (2.4.0)
173
+ ffi (~> 1.9)
174
+ sassc-rails (2.1.2)
175
+ railties (>= 4.0.0)
176
+ sassc (>= 2.0)
177
+ sprockets (> 3.0)
178
+ sprockets-rails
179
+ tilt
180
+ sexp_processor (4.15.2)
181
+ spring (2.1.1)
182
+ spring-watcher-listen (2.0.1)
183
+ listen (>= 2.7, < 4.0)
184
+ spring (>= 1.2, < 3.0)
185
+ sprockets (3.7.2)
186
+ concurrent-ruby (~> 1.0)
187
+ rack (> 1, < 3)
188
+ sprockets-rails (3.2.2)
189
+ actionpack (>= 4.0)
190
+ activesupport (>= 4.0)
191
+ sprockets (>= 3.0.0)
192
+ temple (0.8.2)
193
+ thor (1.1.0)
194
+ thread_safe (0.3.6)
195
+ tilt (2.0.10)
196
+ tzinfo (1.2.9)
197
+ thread_safe (~> 0.1)
198
+ uglifier (4.2.0)
199
+ execjs (>= 0.3.0, < 3)
200
+ web-console (3.7.0)
201
+ actionview (>= 5.0)
202
+ activemodel (>= 5.0)
203
+ bindex (>= 0.4.0)
204
+ railties (>= 5.0)
205
+ websocket-driver (0.7.3)
206
+ websocket-extensions (>= 0.1.0)
207
+ websocket-extensions (0.1.5)
208
+
209
+ PLATFORMS
210
+ ruby
211
+
212
+ DEPENDENCIES
213
+ blazer
214
+ bnb_blazer!
215
+ bootsnap (>= 1.1.0)
216
+ bootstrap (~> 4.6.0)
217
+ byebug
218
+ faker
219
+ haml-rails
220
+ jquery-rails
221
+ listen (>= 3.0.5, < 3.2)
222
+ pg
223
+ puma
224
+ rails (~> 5.2.4, >= 5.2.4.5)
225
+ sass-rails (~> 5.0)
226
+ spring
227
+ spring-watcher-listen (~> 2.0.0)
228
+ tzinfo-data
229
+ uglifier (>= 1.3.0)
230
+ web-console (>= 3.3.0)
231
+
232
+ BUNDLED WITH
233
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Joe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # BnbBlazer
2
+
3
+ Welcome to BNB Blazer! This is a gem wrapper for the [Blazer](https://github.com/ankane/blazer) query tool designed specifically for BNB projects. In this directory, you'll find the files you need to edit the behavior/appearance of this gem. Additionally, you can spin up the test app to experiment with the appearance of the tool. Put your Ruby code in the file `lib/bnb_blazer`.
4
+
5
+ ## Installation
6
+
7
+ To use this wrapper in conjunction with Blazer, add this block to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem "blazer"
11
+ gem "bnb_blazer"
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ ## Development
19
+
20
+ This gem comes bundled with a test app to help you test out new display designs with pre-populated blazer queries. To get the environment up and running:
21
+
22
+ 1. Clone this repo down to your machine
23
+ 2. Make sure you have [Dip](https://github.com/brandnewbox/bnb-dip-defaults) installed and configured
24
+ 3. In your new `bnb_blazer` directory, run `docker-compose up`
25
+ 4. Once all your containers have spun up, run `dip setup`
26
+ 5. Navigate to http://localhost:300/blazer in your browser, and away you go!
27
+
28
+ ## Contributing
29
+
30
+ Bug reports and pull requests are welcome on GitHub at https://github.com/brandnewbox/bnb_blazer.
31
+
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+ require "bundler/gem_tasks"
6
+
7
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,83 @@
1
+
2
+ body {
3
+ background-color: #D3D3D3;
4
+ }
5
+
6
+ table{
7
+ table-layout: fixed;
8
+ }
9
+
10
+ .blazer-content {
11
+ padding-bottom: 2.5rem;
12
+ }
13
+
14
+ #footer {
15
+ position: relative;
16
+ bottom: 0;
17
+ width: 100%;
18
+ }
19
+
20
+ #results * {
21
+ background-color: #f5f5f5;
22
+ padding-left: 10px;
23
+ padding-right: 10px;
24
+ }
25
+
26
+ .results-container {
27
+ margin-top: 20px;
28
+ }
29
+
30
+ #branded-table {
31
+ background-color: #f5f5f5;
32
+ }
33
+
34
+ .chart-container {
35
+ background-color: #f5f5f5;
36
+ padding-top: 10px;
37
+ padding-bottom: 10px;
38
+ }
39
+
40
+ .navbar-default .navbar-nav > li > a {
41
+ color: #373737;
42
+ font-size: 18px;
43
+ }
44
+
45
+ .navbar-default .navbar-toggle .icon-bar {
46
+ background-color: #2EB1E6;
47
+ }
48
+
49
+ .dropdown {
50
+ background-color: #606060;
51
+ }
52
+
53
+ .btn-default {
54
+ background-color: #f8f8f8;
55
+ border-color: #f8f8f8;
56
+ color: #373737;
57
+ font-size: 18px;
58
+ }
59
+
60
+ .btn-default:hover {
61
+ color: #2EB1E6;
62
+ background-color: #f8f8f8;
63
+ border-color:#2EB1E6;
64
+ }
65
+
66
+ .btn-group > .btn + .dropdown-toggle:hover {
67
+ background-color: #f8f8f8;
68
+ border-color:#2EB1E6;
69
+ }
70
+
71
+ .btn-group.open .dropdown-toggle {
72
+ background-color: #f8f8f8;
73
+ border-color:#2EB1E6;
74
+ }
75
+
76
+ .navbar-default .navbar-nav > .open > a {
77
+ background-color: #f8f8f8;
78
+ border-color:#2EB1E6;
79
+ }
80
+
81
+ .navbar-nav .btn-group {
82
+ margin-top: 8px;
83
+ }
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ class User < ApplicationRecord
2
+ end
@@ -0,0 +1,104 @@
1
+ - if @bind_vars.any?
2
+ :javascript
3
+ #{blazer_js_var "timeZone", Blazer.time_zone.tzinfo.name}
4
+ var now = moment.tz(timeZone)
5
+ var format = "YYYY-MM-DD"
6
+
7
+ function toDate(time) {
8
+ return moment.tz(time.format(format), timeZone)
9
+ }
10
+ %form#bind.form-inline{:action => action, :method => "get", :style => "margin-bottom: 15px;"}
11
+ - date_vars = ["start_time", "end_time"]
12
+ - if (date_vars - @bind_vars).empty?
13
+ - @bind_vars = @bind_vars - date_vars
14
+ - else
15
+ - date_vars = nil
16
+ - @bind_vars.each_with_index do |var, i|
17
+ = label_tag var, var
18
+ - if (data = @smart_vars[var])
19
+ = select_tag var, options_for_select([[nil, nil]] + data, selected: params[var]), style: "margin-right: 20px; width: 200px; display: none;"
20
+ :javascript
21
+ $("##{var}").selectize({
22
+ create: true
23
+ });
24
+ - elsif var.end_with?("_at") || var == "start_time" || var == "end_time"
25
+ = hidden_field_tag var, params[var]
26
+ .selectize-control.single{:style => "width: 200px;"}
27
+ .selectize-input{:id => "#{var}-select", :style => "display: inline-block;"}
28
+ %span Select a date
29
+ :javascript
30
+ (function() {
31
+ var input = $("##{var}")
32
+ var datePicker = $("##{var}-select")
33
+ datePicker.daterangepicker({
34
+ singleDatePicker: true,
35
+ locale: {format: format},
36
+ autoUpdateInput: false,
37
+ autoApply: true,
38
+ startDate: input.val().length > 0 ? moment.tz(input.val(), timeZone) : now
39
+ })
40
+ // hack to start with empty date
41
+ datePicker.on("apply.daterangepicker", function(ev, picker) {
42
+ datePicker.find("span").html(toDate(picker.startDate).format("MMMM D, YYYY"))
43
+ input.val(toDate(picker.startDate).utc().format())
44
+ submitIfCompleted($("##{var}").closest("form"))
45
+ })
46
+ if (input.val().length > 0) {
47
+ var picker = datePicker.data("daterangepicker")
48
+ datePicker.find("span").html(toDate(picker.startDate).format("MMMM D, YYYY"))
49
+ }
50
+ })()
51
+ - else
52
+ = text_field_tag var, params[var], style: "width: 120px; margin-right: 20px;", autofocus: i == 0 && !var.end_with?("_at") && !params[var], class: "form-control"
53
+ - if date_vars
54
+ - date_vars.each do |var|
55
+ = hidden_field_tag var, params[var]
56
+ = label_tag nil, date_vars.join(" & ")
57
+ .selectize-control.single{:style => "width: 300px;"}
58
+ #reportrange.selectize-input{:style => "display: inline-block;"}
59
+ %span Select a time range
60
+ :javascript
61
+ function dateStr(daysAgo) {
62
+ return now.clone().subtract(daysAgo || 0, "days").format(format)
63
+ }
64
+
65
+ function setTimeInputs(start, end) {
66
+ $("#start_time").val(toDate(start).utc().format())
67
+ $("#end_time").val(toDate(end).endOf("day").utc().format())
68
+ }
69
+
70
+ $("#reportrange").daterangepicker(
71
+ {
72
+ ranges: {
73
+ "Today": [dateStr(), dateStr()],
74
+ "Last 7 Days": [dateStr(6), dateStr()],
75
+ "Last 30 Days": [dateStr(29), dateStr()]
76
+ },
77
+ locale: {
78
+ format: format
79
+ },
80
+ startDate: dateStr(29),
81
+ endDate: dateStr(),
82
+ opens: "right",
83
+ alwaysShowCalendars: true
84
+ },
85
+ function(start, end) {
86
+ setTimeInputs(start, end)
87
+ submitIfCompleted($("#start_time").closest("form"))
88
+ }
89
+ ).on("apply.daterangepicker", function(ev, picker) {
90
+ setTimeInputs(picker.startDate, picker.endDate)
91
+ $("#reportrange span").html(toDate(picker.startDate).format("MMMM D, YYYY") + " - " + toDate(picker.endDate).format("MMMM D, YYYY"))
92
+ })
93
+
94
+ if ($("#start_time").val().length > 0) {
95
+ var picker = $("#reportrange").data("daterangepicker")
96
+ picker.setStartDate(moment.tz($("#start_time").val(), timeZone))
97
+ picker.setEndDate(moment.tz($("#end_time").val(), timeZone))
98
+ $("#reportrange").trigger("apply.daterangepicker", picker)
99
+ } else {
100
+ var picker = $("#reportrange").data("daterangepicker")
101
+ $("#reportrange").trigger("apply.daterangepicker", picker)
102
+ submitIfCompleted($("#start_time").closest("form"))
103
+ }
104
+ %input.btn.btn-success{:style => "vertical-align: top;", :type => "submit", :value => "Run"}/