mno-enterprise-frontend 3.2.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/mno_enterprise/loader-32x32-bg-inverse.gif +0 -0
  3. data/app/assets/stylesheets/mno_enterprise/custom/utility/progress-bar.less +3 -3
  4. data/app/assets/stylesheets/mno_enterprise/custom/utility/text.less +0 -20
  5. data/app/assets/stylesheets/mno_enterprise/custom/views/pages/confirmation_lounge.less +3 -3
  6. data/app/assets/stylesheets/mno_enterprise/custom/views/registration.less +21 -10
  7. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/notification-widget.less +5 -5
  8. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/password-strength.less +4 -4
  9. data/app/assets/stylesheets/mno_enterprise/main.less +0 -6
  10. data/app/assets/stylesheets/mno_enterprise/variables.less +189 -77
  11. data/app/views/mno_enterprise/pages/app_access_unauthorized.html.haml +1 -1
  12. data/app/views/mno_enterprise/pages/app_logout.html.haml +1 -1
  13. data/app/views/mno_enterprise/pages/billing_details_required.html.haml +19 -17
  14. data/lib/mno_enterprise/frontend/locales_generator.rb +2 -1
  15. data/lib/tasks/mnoe_admin_tasks.rake +124 -28
  16. data/lib/tasks/mnoe_frontend_tasks.rake +2 -2
  17. data/lib/tasks/mnoe_locales.rake +16 -0
  18. data/lib/tasks/templates-admin/font-faces.less +2 -0
  19. data/lib/tasks/templates/package.json +3 -0
  20. data/spec/lib/tasks/mnoe_locales_rake_spec.rb +33 -0
  21. metadata +7 -12
  22. data/app/assets/stylesheets/mno_enterprise/custom/button.less +0 -84
  23. data/app/assets/stylesheets/mno_enterprise/custom/header.less +0 -281
  24. data/app/assets/stylesheets/mno_enterprise/custom/modal.less +0 -183
  25. data/app/assets/stylesheets/mno_enterprise/custom/utilities.less +0 -729
  26. data/app/assets/stylesheets/mno_enterprise/custom/utility/tabset.less +0 -87
  27. data/app/assets/stylesheets/mno_enterprise/custom/xeditable.less +0 -40
@@ -1,7 +1,7 @@
1
1
  .banners.promo.dark.darkblue
2
2
  .container
3
3
  .row.text-center
4
- = image_tag("mno_enterprise/main-logo.png")
4
+ = image_tag(main_logo_white_bg_path)
5
5
  .row
6
6
  %h2 App Access Not Granted
7
7
  %hr
@@ -1,7 +1,7 @@
1
1
  .banners.promo.dark.darkblue
2
2
  .container
3
3
  .row.text-center
4
- = image_tag("mno_enterprise/main-logo.png")
4
+ = image_tag(main_logo_white_bg_path)
5
5
  .row
6
6
  %h2 Successful logout
7
7
  %hr
@@ -1,19 +1,21 @@
1
- .banners.promo.dark.darkblue
1
+ .registration
2
2
  .container
3
- .row.text-center
4
- = image_tag("mno_enterprise/main-logo.png")
5
3
  .row
6
- %h2 Billing Details Required
7
- %hr
8
- .row
9
- .col-md-6.col-md-offset-3
10
- .align-center
11
- %h3
12
- Oops! It looks like the free trial has ended for this application and no billing details have been entered.
13
- %p Please ask your administrator to enter valid billing details for your company.
14
- .spacer4
15
- .align-center
16
- %h5
17
- If you think this is a mistake, please send us an email at
18
- = mail_to support_email
19
- .spacer4
4
+ .login-box-wrapper.large
5
+ .login-box-title
6
+ %h2 Billing Details Required
7
+ .login-box
8
+ .brand-logo
9
+
10
+ .row
11
+ .col-md-12
12
+ .align-center
13
+ %h3
14
+ Oops! It looks like the free trial has ended for this application and no billing details have been entered.
15
+ %p Please ask your administrator to enter valid billing details for your company.
16
+ .spacer4
17
+ .align-center
18
+ %h5
19
+ If you think this is a mistake, please send us an email at
20
+ = mail_to support_email
21
+ .spacer4
@@ -49,7 +49,8 @@ module MnoEnterprise
49
49
  flatten_translations(prefix + key.to_s, value, locale)
50
50
  }
51
51
  else
52
- locale.merge!({prefix => x})
52
+ locale[prefix] = x
53
+ locale
53
54
  end
54
55
  end
55
56
  end
@@ -1,4 +1,6 @@
1
1
  require 'fileutils'
2
+ require 'erb'
3
+ require 'rake/clean'
2
4
 
3
5
  #=============================================
4
6
  # Enterprise Express Tasks
@@ -6,48 +8,61 @@ require 'fileutils'
6
8
  # Enterprise Express related tasks
7
9
  namespace :mnoe do
8
10
  namespace :admin do
9
- admin_dist_folder = "public/admin"
10
- frontend_tmp_folder = 'tmp/build/admin'
11
- frontend_orig_folder = 'frontend-admin'
11
+ # Default version
12
+ MNOE_ADMIN_PANEL_VERSION = 'v1.0.x'
13
+ MNOE_ADMIN_PANEL_PKG = "git+https://git@github.com/maestrano/mnoe-admin-panel.git##{MNOE_ADMIN_PANEL_VERSION}"
12
14
 
13
- # Use bundled gulp
14
- gulp = "./node_modules/.bin/gulp"
15
+ # Final build
16
+ admin_panel_dist_folder = 'public/admin'
17
+ # Local overrides
18
+ admin_panel_project_folder = 'frontend-admin-panel'
19
+ # Tmp build
20
+ admin_panel_tmp_folder = 'tmp/build/admin_panel'
21
+ # Frontend package
22
+ ADMIN_PANEL_PKG_FOLDER = 'node_modules/mnoe-admin-panel'
15
23
 
16
- desc "Install dependencies"
17
- task :install_dependencies do
18
- # Install required tools
19
- sh("which bower || npm install -g bower")
24
+ ## Helper methods
25
+ def render_template(template_file, output_file, binding = nil)
26
+ File.open(output_file, "w+") do |f|
27
+ f.write(ERB.new(File.read(template_file)).result(binding))
28
+ end
20
29
  end
21
30
 
31
+ desc 'Setup the Enterprise Express Admin Panel'
32
+ task :install do
33
+ Rake::Task['mnoe:admin:add_package'].invoke
34
+
35
+ Rake::Task['mnoe:admin:install_frontend'].invoke
36
+
37
+ # Bootstrap frontend folder
38
+ Rake::Task['mnoe:admin:bootstrap_override_folder'].invoke
22
39
 
23
- desc "Setup the Enterprise Express Admin Dashboard"
24
- task install: :install_dependencies do
25
- # Build the admin
26
- Rake::Task['mnoe:admin:dist'].invoke
40
+ # Build the frontend
41
+ Rake::Task['mnoe:admin:build'].invoke
27
42
  end
28
43
 
29
- desc "Rebuild the Enterprise Express Admin Dashboard"
30
- task :dist do
44
+ desc 'Build/Rebuild the Enterprise Express Admin Panel'
45
+ task :build do
31
46
  # Prepare the build folder
32
47
  Rake::Task['mnoe:admin:prepare_build_folder'].execute
33
48
 
34
49
  # Build frontend using Gulp
35
- Dir.chdir(frontend_tmp_folder) do
36
- sh "npm install"
37
- sh "bower install"
38
- sh gulp
50
+ Dir.chdir(admin_panel_tmp_folder) do
51
+ sh 'yarn install'
52
+ sh 'bower install'
53
+ sh 'npm run build'
39
54
  end
40
55
 
41
56
  # Ensure distribution folder exists
42
- mkdir_p admin_dist_folder
57
+ mkdir_p admin_panel_dist_folder
43
58
 
44
59
  # Cleanup previously compiled files
45
- Dir.glob("#{admin_dist_folder}/{styles,scripts}/app-*.{css,js}").each do |f|
60
+ Dir.glob("#{admin_panel_dist_folder}/{styles,scripts}/*.{css,js}").each do |f|
46
61
  rm_f f
47
62
  end
48
63
 
49
64
  # Copy assets to public
50
- cp_r("#{frontend_tmp_folder}/dist/.", "#{admin_dist_folder}/")
65
+ cp_r("#{admin_panel_tmp_folder}/dist/.", "#{admin_panel_dist_folder}/")
51
66
 
52
67
  # Clear tmp cache in development - recompile assets otherwise
53
68
  if Rails.env.development? || Rails.env.test?
@@ -57,13 +72,94 @@ namespace :mnoe do
57
72
  end
58
73
  end
59
74
 
60
- desc "Reset the admin build folder"
75
+ # Alias to dist for backward compatibility
76
+ task dist: :build
77
+
78
+ desc 'Update the admin panel and rebuild it'
79
+ task update: :install_dependencies do
80
+ # Fetch new version of the packages
81
+ sh 'yarn upgrade --ignore-scripts --ignore-engines'
82
+
83
+ # Cleanup
84
+ rm_rf "#{admin_panel_tmp_folder}/bower_components"
85
+
86
+ # Rebuild the admin panel
87
+ Rake::Task['mnoe:admin:build'].execute
88
+ end
89
+
90
+ # Install dependencies
91
+ task :install_dependencies do
92
+ unless system('which yarn')
93
+ puts 'Yarn executable was not detected in the system.'
94
+ puts 'Download Yarn at https://yarnpkg.com/en/docs/install'
95
+ raise
96
+ end
97
+
98
+ # Install required tools
99
+ sh('which bower || npm install -g bower')
100
+ end
101
+
102
+ # Add 'mnoe-admin-panel' to package.json
103
+ task :add_package do
104
+ sh "yarn add --ignore-scripts --ignore-engines #{MNOE_ADMIN_PANEL_PKG}"
105
+ end
106
+
107
+ task install_frontend: [:install_dependencies] do
108
+ # Fetch the packages
109
+ sh('yarn install --ignore-scripts --ignore-engines')
110
+ end
111
+
112
+ # Create & populate the admin panel override folder
113
+ task :bootstrap_override_folder do
114
+ # Create admin panel override folder
115
+ mkdir_p(admin_panel_project_folder)
116
+ touch "#{admin_panel_project_folder}/.keep"
117
+
118
+ # Bootstrap override folder
119
+ # Replace relative image path by absolute path in the LESS files
120
+ mkdir_p("#{admin_panel_project_folder}/src/app/stylesheets")
121
+ %w(src/app/stylesheets/theme.less src/app/stylesheets/variables.less).each do |path|
122
+ next if File.exist?("#{admin_panel_project_folder}/#{path}")
123
+
124
+ # Generate file from template
125
+ cp("#{ADMIN_PANEL_PKG_FOLDER}/#{path}","#{admin_panel_project_folder}/#{path}")
126
+
127
+ # Replace image relative path
128
+ content = File.read("#{admin_panel_project_folder}/#{path}")
129
+ File.open("#{admin_panel_project_folder}/#{path}", 'w') do |f|
130
+ f << content.gsub('../images', File.join(admin_panel_dist_folder.gsub('public', ''), 'images'))
131
+ end
132
+ end
133
+
134
+ # Create custom fonts files so we can safely include them in main.less
135
+ admin_panel_font_folder = File.join(admin_panel_project_folder, 'src/fonts')
136
+ unless File.exist?(File.join(admin_panel_font_folder, 'font-faces.less'))
137
+ font_src = File.join(File.expand_path(File.dirname(__FILE__)),'templates','font-faces.less')
138
+
139
+ mkdir_p(admin_panel_font_folder)
140
+ cp(font_src, admin_panel_font_folder)
141
+ end
142
+ end
143
+
144
+ # Reset the frontend build folder and apply local customisations
61
145
  task :prepare_build_folder do
62
- # Reset tmp folder from mno-enterprise/frontend-admin source
63
- rm_rf "#{admin_dist_folder}"
64
- rm_rf "#{frontend_tmp_folder}"
65
- mkdir_p frontend_tmp_folder
66
- cp_r(File.join(Gem.loaded_specs["mno-enterprise"].full_gem_path, "#{frontend_orig_folder}/."), "#{frontend_tmp_folder}/")
146
+ # Ensure frontend is downloaded
147
+ Rake::Task['mnoe:admin:install_frontend'].invoke unless File.directory?(ADMIN_PANEL_PKG_FOLDER)
148
+
149
+ # Reset tmp folder from mnoe-admin-panel source
150
+ rm_rf "#{admin_panel_tmp_folder}/src"
151
+ rm_rf "#{admin_panel_tmp_folder}/e2e"
152
+ mkdir_p admin_panel_tmp_folder
153
+ cp_r("#{ADMIN_PANEL_PKG_FOLDER}/.", "#{admin_panel_tmp_folder}/")
154
+
155
+ # Apply frontend customisations
156
+ cp_r("#{admin_panel_project_folder}/.", "#{admin_panel_tmp_folder}/")
157
+ end
158
+
159
+ desc 'Remove all generated files'
160
+ task :clean do
161
+ clean = FileList[admin_panel_tmp_folder, admin_panel_dist_folder, ADMIN_PANEL_PKG_FOLDER, 'node_modules/.yarn-integrity']
162
+ Rake::Cleaner.cleanup_files(clean)
67
163
  end
68
164
  end
69
165
  end
@@ -9,8 +9,8 @@ require 'rake/clean'
9
9
  namespace :mnoe do
10
10
  namespace :frontend do
11
11
  # Default version
12
- MNOE_ANGULAR_VERSION = "1.0.x"
13
- IMPAC_ANGULAR_VERSION = "1.4.x"
12
+ MNOE_ANGULAR_VERSION = "v1.1.x"
13
+ IMPAC_ANGULAR_VERSION = "v1.5.x"
14
14
 
15
15
  # Final build
16
16
  frontend_dist_folder = "public/dashboard"
@@ -13,6 +13,22 @@ namespace :mnoe do
13
13
 
14
14
  # Copy locales to public
15
15
  cp_r("#{locales_tmp_folder}/.","#{locales_dist_folder}/")
16
+
17
+ Rake::Task['mnoe:locales:impac'].invoke
18
+ end
19
+
20
+ desc "Copy impac locales to the public locales folder"
21
+ task :impac do
22
+ locales_impac_folder = 'tmp/build/frontend/bower_components/impac-angular/dist/locales'
23
+ cp_r("#{locales_impac_folder}/.","#{locales_dist_folder}/impac/")
24
+
25
+ # TODO: remove when locales moved to four letters
26
+ # 4-letters locales --> 2-letters locales
27
+ dir = "#{locales_dist_folder}/impac/"
28
+ Dir.foreach(dir) do |f|
29
+ next unless f.include?(".json")
30
+ File.rename("#{dir}#{f}", "#{dir}#{f.slice(0,2)}.json")
31
+ end
16
32
  end
17
33
  end
18
34
  end
@@ -0,0 +1,2 @@
1
+ // Use this file to declare your custom fonts
2
+ // See https://github.com/maestrano/mno-enterprise#adding-a-custom-font
@@ -4,5 +4,8 @@
4
4
  "dependencies": {
5
5
  "mno-enterprise-angular": "<%= mnoe_angular_pkg %>",
6
6
  "impac-angular": "<%= impac_angular_pkg %>"
7
+ },
8
+ "engines": {
9
+ "node": ">= 6.9.0"
7
10
  }
8
11
  }
@@ -10,6 +10,7 @@ describe 'mnoe:locales:generate' do
10
10
  allow(MnoEnterprise::Frontend::LocalesGenerator).to receive(:new) { generator }
11
11
  allow(generator).to receive(:generate_json)
12
12
  allow_any_instance_of(Rake::FileUtilsExt).to receive(:cp_r)
13
+ allow(rake['mnoe:locales:impac']).to receive(:invoke)
13
14
  end
14
15
 
15
16
  it { expect(subject.prerequisites).to include('environment') }
@@ -28,4 +29,36 @@ describe 'mnoe:locales:generate' do
28
29
  expect_any_instance_of(Rake::FileUtilsExt).to receive(:cp_r).with('tmp/build/frontend/src/locales/.', 'public/dashboard/locales/')
29
30
  subject.invoke
30
31
  end
32
+
33
+ it 'invokes the mnoe:locales:impac task' do
34
+ expect(rake['mnoe:locales:impac']).to receive(:invoke)
35
+ subject.invoke
36
+ end
37
+ end
38
+
39
+
40
+ describe 'mnoe:locales:impac' do
41
+ include_context 'rake_task'
42
+
43
+ before do
44
+ allow_any_instance_of(Rake::FileUtilsExt).to receive(:cp_r)
45
+ allow(Dir).to receive(:foreach) { [] }
46
+ end
47
+
48
+ it 'copies the locales to the public folder' do
49
+ expect_any_instance_of(Rake::FileUtilsExt).to receive(:cp_r).with(
50
+ 'tmp/build/frontend/bower_components/impac-angular/dist/locales/.',
51
+ 'public/dashboard/locales/impac/'
52
+ )
53
+ subject.invoke
54
+ end
55
+
56
+ it 'transform 4 letters locales to 2 letters locales' do
57
+ allow(Dir).to receive(:foreach).and_yield('en-GB.json')
58
+ expect(File).to receive(:rename).with(
59
+ 'public/dashboard/locales/impac/en-GB.json',
60
+ 'public/dashboard/locales/impac/en.json'
61
+ )
62
+ subject.invoke
63
+ end
31
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mno-enterprise-frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Lachaume
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-09 00:00:00.000000000 Z
12
+ date: 2017-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mno-enterprise-core
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 3.2.1
20
+ version: 3.3.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 3.2.1
27
+ version: 3.3.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: mno-enterprise-api
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 3.2.1
34
+ version: 3.3.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 3.2.1
41
+ version: 3.3.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: less-rails
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -172,22 +172,16 @@ files:
172
172
  - app/assets/stylesheets/mno_enterprise/custom/angular-animate.less
173
173
  - app/assets/stylesheets/mno_enterprise/custom/angular-material.less
174
174
  - app/assets/stylesheets/mno_enterprise/custom/bootstrap-on-juice.less
175
- - app/assets/stylesheets/mno_enterprise/custom/button.less
176
175
  - app/assets/stylesheets/mno_enterprise/custom/footer.less
177
176
  - app/assets/stylesheets/mno_enterprise/custom/form.less
178
- - app/assets/stylesheets/mno_enterprise/custom/header.less
179
- - app/assets/stylesheets/mno_enterprise/custom/modal.less
180
- - app/assets/stylesheets/mno_enterprise/custom/utilities.less
181
177
  - app/assets/stylesheets/mno_enterprise/custom/utility/progress-bar.less
182
178
  - app/assets/stylesheets/mno_enterprise/custom/utility/step.less
183
- - app/assets/stylesheets/mno_enterprise/custom/utility/tabset.less
184
179
  - app/assets/stylesheets/mno_enterprise/custom/utility/text.less
185
180
  - app/assets/stylesheets/mno_enterprise/custom/views/pages/confirmation_lounge.less
186
181
  - app/assets/stylesheets/mno_enterprise/custom/views/pages/oauth-config-page.less
187
182
  - app/assets/stylesheets/mno_enterprise/custom/views/registration.less
188
183
  - app/assets/stylesheets/mno_enterprise/custom/views/templates/notification-widget.less
189
184
  - app/assets/stylesheets/mno_enterprise/custom/views/templates/password-strength.less
190
- - app/assets/stylesheets/mno_enterprise/custom/xeditable.less
191
185
  - app/assets/stylesheets/mno_enterprise/font-awesome/font-awesome-regular.less
192
186
  - app/assets/stylesheets/mno_enterprise/font-awesome/font-awesome-sprockets.less
193
187
  - app/assets/stylesheets/mno_enterprise/font-awesome/font-awesome.less
@@ -310,6 +304,7 @@ files:
310
304
  - lib/tasks/mnoe_admin_tasks.rake
311
305
  - lib/tasks/mnoe_frontend_tasks.rake
312
306
  - lib/tasks/mnoe_locales.rake
307
+ - lib/tasks/templates-admin/font-faces.less
313
308
  - lib/tasks/templates/bower.json
314
309
  - lib/tasks/templates/font-faces.less
315
310
  - lib/tasks/templates/package.json
@@ -1,84 +0,0 @@
1
- .btn-fluid-wrapper .btn {
2
- width: 100%;
3
- }
4
-
5
- .btn {
6
- &.float-right {
7
- float:right;
8
- }
9
- &.btn-promo {
10
- font-size:18px;
11
- padding-left:30px;
12
- padding-right:30px;
13
- }
14
-
15
- .subtitle {
16
- font-size:@small;
17
- font-weight:300;
18
- width:100%;
19
- display:block;
20
- text-align:center;
21
- }
22
-
23
- &.arrow,
24
- &.arrow-right {
25
- background-image: image-url('icons/icon-arrow-right.png');
26
- background-repeat: no-repeat;
27
- background-position: 96% 50%;
28
- }
29
-
30
- &.arrow-left {
31
- background-image: image-url('icons/icon-arrow-left.png');
32
- background-repeat: no-repeat;
33
- background-position: 4% 50%;
34
- }
35
-
36
- &.btn-dark {
37
- .font(16px, 300, @bg-main-color);
38
- background-color: @bg-inverse-color;
39
-
40
- &:hover {
41
- color: @elem-cozy-color;
42
- }
43
- }
44
-
45
- &.btn-shaded {
46
- background-color: @bg-inverse-color;
47
- border: solid 1px @bg-inverse-intense-color;
48
- color: @text-inverse-color;
49
- font-weight: 400;
50
-
51
- &:hover {
52
- color: lighten(@text-inverse-color,5%);
53
- background-color: lighten(@bg-inverse-color,5%);
54
- }
55
- }
56
-
57
- &.btn-grey {
58
- background-color: @bg-main-color;
59
- border: solid 1px @bg-main-color;
60
- color: lighten(@bg-inverse-color,5%);
61
- font-weight: 400;
62
-
63
- &:hover {
64
- color: @bg-inverse-color;
65
- background-color: darken(@bg-main-color,5%);
66
- }
67
-
68
- &.btn-grey-bordered {
69
- border: solid 1px darken(@bg-main-color,5%);
70
- }
71
- }
72
-
73
- &.btn-whited {
74
- background-color: lighten(#ccc,15%);
75
- border: solid 1px #ccc;
76
- color: #ccc;
77
- font-weight: 400;
78
-
79
- &:hover {
80
- color: darken(#ccc,20%);
81
- background-color: #ccc;
82
- }
83
- }
84
- }