Enable new dashboard for feature flag users

pull/13614/head
jesusbotella 7 years ago
parent 526ee0c84a
commit f61a33f51e

@ -14,6 +14,7 @@ class Carto::Admin::MobileAppsController < Admin::AdminController
before_filter :login_required
before_filter :check_user_permissions
before_filter :initialize_cartodb_central_client
before_filter :get_viewed_user
before_filter :load_organization_notifications
before_filter :validate_id, only: [:show, :update, :destroy]
before_filter :load_mobile_app, only: [:show, :update]
@ -29,6 +30,7 @@ class Carto::Admin::MobileAppsController < Admin::AdminController
@mobile_apps = response[:mobile_apps].map { |a| Carto::MobileApp.new(a) }
@open_monthly_users = response[:monthly_users][:open]
@private_monthly_users = response[:monthly_users][:private]
@has_new_dashboard = @viewed_user.builder_enabled? && @viewed_user.has_feature_flag?('dashboard_migration')
rescue CartoDB::CentralCommunicationFailure => e
@mobile_apps = []
CartoDB::Logger.error(message: 'Error loading mobile apps from Central', exception: e)
@ -140,6 +142,11 @@ class Carto::Admin::MobileAppsController < Admin::AdminController
flash: { error: 'Unable to connect to license server. Try again in a moment.' })
end
def get_viewed_user
username = CartoDB.extract_subdomain(request).strip.downcase
@viewed_user = User.where(username: username).first
end
def get_default_avatar
if Cartodb.asset_path
"#{Cartodb.asset_path}/assets/unversioned/images/avatars/mobile_app_default_avatar.png"

@ -7,7 +7,12 @@
var user_data = <%= safe_js_object current_user.data.to_json %>;
var organization_notifications = <%= safe_js_object @organization_notifications.to_json %>;
</script>
<%= javascript_include_tag 'cdb.js', 'models.js', 'mobile_apps_templates.js', 'account_deps.js', 'mobile_apps.js' -%>
<% if @has_new_dashboard %>
<%= javascript_include_tag 'common_dashboard', 'mobile_apps_new_vendor', 'mobile_apps_new' -%>
<% else %>
<%= javascript_include_tag 'cdb.js', 'models.js', 'mobile_apps_templates.js', 'account_deps.js', 'mobile_apps.js' -%>
<% end %>
<% end %>
<%= content_for(:css) do %>
<%= stylesheet_link_tag 'mobile_apps.css', :media => 'all' %>

@ -9,7 +9,12 @@
var icon_valid_extensions = <%= raw @icon_valid_extensions %>;
var organization_notifications = <%= safe_js_object @organization_notifications.to_json %>;
</script>
<%= javascript_include_tag 'cdb.js', 'models.js', 'mobile_apps_templates.js', 'account_deps.js', 'mobile_apps.js' -%>
<% if @has_new_dashboard %>
<%= javascript_include_tag 'common_dashboard', 'mobile_apps_new_vendor', 'mobile_apps_new' -%>
<% else %>
<%= javascript_include_tag 'cdb.js', 'models.js', 'mobile_apps_templates.js', 'account_deps.js', 'mobile_apps.js' -%>
<% end %>
<% end %>
<%= render :partial => 'shared/flash_message' %>

@ -10,7 +10,12 @@
var authenticity_token = "<%= form_authenticity_token %>";
var organization_notifications = <%= safe_js_object @organization_notifications.to_json %>;
</script>
<%= javascript_include_tag 'cdb.js', 'models.js', 'mobile_apps_templates.js', 'account_deps.js', 'mobile_apps.js' -%>
<% if @has_new_dashboard %>
<%= javascript_include_tag 'common_dashboard', 'mobile_apps_new_vendor', 'mobile_apps_new' -%>
<% else %>
<%= javascript_include_tag 'cdb.js', 'models.js', 'mobile_apps_templates.js', 'account_deps.js', 'mobile_apps.js' -%>
<% end %>
<% end %>
<%= content_for(:css) do %>
<%= stylesheet_link_tag 'mobile_apps.css', :media => 'all' %>

Loading…
Cancel
Save