diff --git a/app/views/admin/shared/_new_private_header.html.erb b/app/views/admin/shared/_new_private_header.html.erb new file mode 100644 index 0000000000..b6d2c7cad9 --- /dev/null +++ b/app/views/admin/shared/_new_private_header.html.erb @@ -0,0 +1,8 @@ + +<%= stylesheet_link_tag 'header.css', :media => 'all' %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5f7c44eb5b..9524411adb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -17,7 +17,11 @@ <%= insert_google_tag_manager_no_script('primary') %> <% if ( ( controller_name != "visualizations" && controller_name != "tables" ) || action_name != "show" ) %> <% breadcrumb = local_assigns.fetch(:breadcrumb, true) %> - <%= render 'admin/shared/new_private_header' %> + <% if current_user.has_feature_flag?('new-dashboard-feature') %> + <%= render 'admin/shared/new_private_header' %> + <% else %> + <%= render 'admin/shared/private_header' %> + <% end %> <% if current_user.notification.present? %>
@@ -42,5 +46,8 @@ <%= insert_google_analytics('primary') -%> <%= insert_hubspot() -%> <%= render 'admin/shared/intercom' %> + <% if current_user.has_feature_flag?('new-dashboard-feature') %> + <%= javascript_include_tag 'header' %> + <% end %> diff --git a/lib/assets/javascripts/dashboard/views/account/account-main-view.js b/lib/assets/javascripts/dashboard/views/account/account-main-view.js index 8c43e8b2f2..b7524ebd09 100644 --- a/lib/assets/javascripts/dashboard/views/account/account-main-view.js +++ b/lib/assets/javascripts/dashboard/views/account/account-main-view.js @@ -1,5 +1,7 @@ const CoreView = require('backbone/core-view'); const checkAndBuildOpts = require('builder/helpers/required-opts'); +const PrivateHeaderView = require('dashboard/components/private-header-view'); +const HeaderViewModel = require('dashboard/views/account/header-view-model'); const TrialNotificationView = require('dashboard/components/trial-notification/trial-notification-view'); const AccountContentView = require('./account-content-view'); const UpgradeMessage = require('dashboard/components/upgrade-message-view.js'); @@ -26,6 +28,18 @@ module.exports = CoreView.extend({ _initViews: function () { const $app = this.$('#app'); + const featureFlags = this._userModel.get('feature_flags'); + + if (!featureFlags.includes('new-dashboard-feature')) { + const headerView = new PrivateHeaderView({ + model: this._userModel, + configModel: this._configModel, + viewModel: new HeaderViewModel(), + organizationNotifications: this._organizationNotifications + }); + $app.prepend(headerView.render().el); + this.addView(headerView); + } if (this._userModel.get('account_type') === PERSONAL_30_ACCOUNT) { const trialNotificationView = new TrialNotificationView({ diff --git a/lib/assets/javascripts/dashboard/views/profile/profile-main-view.js b/lib/assets/javascripts/dashboard/views/profile/profile-main-view.js index f3d7b05fa1..d11fe0c95d 100644 --- a/lib/assets/javascripts/dashboard/views/profile/profile-main-view.js +++ b/lib/assets/javascripts/dashboard/views/profile/profile-main-view.js @@ -1,5 +1,7 @@ const CoreView = require('backbone/core-view'); const ProfileContentView = require('dashboard/views/profile/profile-content/profile-content-view'); +const PrivateHeaderView = require('dashboard/components/private-header-view'); +const HeaderViewModel = require('dashboard/views/account/header-view-model'); const SupportView = require('dashboard/components/support-view'); const UpgradeMessage = require('dashboard/components/upgrade-message-view.js'); const FooterView = require('dashboard/components/footer/footer-view'); @@ -28,6 +30,18 @@ module.exports = CoreView.extend({ _initViews: function () { const $app = this.$('#app'); + const featureFlags = this._userModel.get('feature_flags'); + + if (!featureFlags.includes('new-dashboard-feature')) { + const headerView = new PrivateHeaderView({ + model: this._userModel, + configModel: this._configModel, + viewModel: new HeaderViewModel(), + organizationNotifications: this._organizationNotifications + }); + $app.prepend(headerView.render().el); + this.addView(headerView); + } if (this._userModel.get('account_type') === PERSONAL_30_ACCOUNT) { const trialNotificationView = new TrialNotificationView({ diff --git a/lib/assets/test/spec/dashboard/views/account/account-main-view.spec.js b/lib/assets/test/spec/dashboard/views/account/account-main-view.spec.js index c45cbfa01d..2e9cd2efdc 100644 --- a/lib/assets/test/spec/dashboard/views/account/account-main-view.spec.js +++ b/lib/assets/test/spec/dashboard/views/account/account-main-view.spec.js @@ -16,7 +16,8 @@ describe('dashboard/views/account/account-main-view', function () { username: 'pepe', base_url: 'http://pepe.carto.com', email: 'pepe@carto.com', - account_type: 'FREE' + account_type: 'FREE', + feature_flags: ['new-dashboard-feature'] }); ConfigModelFixture.set('account_update_url', 'accountUpdateUrl'); @@ -56,7 +57,8 @@ describe('dashboard/views/account/account-main-view', function () { email: 'pepe@carto.com', account_type: 'PERSONAL30', id: 1, - api_key: 'hello-apikey' + api_key: 'hello-apikey', + feature_flags: ['new-dashboard-feature'] }); view = createViewFn({ userModel }); diff --git a/lib/assets/test/spec/dashboard/views/profile/profile-main-view.spec.js b/lib/assets/test/spec/dashboard/views/profile/profile-main-view.spec.js index 8aa10bb77b..47420a822c 100644 --- a/lib/assets/test/spec/dashboard/views/profile/profile-main-view.spec.js +++ b/lib/assets/test/spec/dashboard/views/profile/profile-main-view.spec.js @@ -20,7 +20,8 @@ describe('dashboard/views/profile/profile-main-view', function () { email: 'pepe@carto.com', account_type: 'FREE', id: 1, - api_key: 'hello-apikey' + api_key: 'hello-apikey', + feature_flags: ['new-dashboard-feature'] }, options) ); diff --git a/lib/build/files/webpack_files.js b/lib/build/files/webpack_files.js index bd1c38b44a..41487d70ef 100644 --- a/lib/build/files/webpack_files.js +++ b/lib/build/files/webpack_files.js @@ -151,6 +151,7 @@ var files = { scripts: [ '/javascripts/common.js', '/javascripts/common_vendor.js', + '/javascripts/account.js' ], feature_flags: { 'new-dashboard-feature': {