Initial commit

This commit is contained in:
zhongjin
2020-06-15 10:58:47 +08:00
commit 4f1dfe7564
8590 changed files with 1516878 additions and 0 deletions
@@ -0,0 +1,15 @@
<div class="ApiKeysCTA-container">
<div class="u-flex u-justifySpace">
<div>
<p class="CDB-Text CDB-Size-large">Your plan doesn't include API keys</p>
<div class="u-flex u-justifySpace u-tSpace--m">
<p class="CDB-Text CDB-Size-medium u-altTextColor">Upgrade your plan to start developing custom applications with our suite of frontend libraries and APIs, and integrating spatial data into your Python scripts. Learn more about
<a href="https://carto.com/developers/fundamentals/authorization/" class="CDB-Text CDB-Size-medium" target="_blank">API keys</a>.
</p>
<div>
<a href="<%= current_user.upgrade_url(request.protocol) %>" class="u-iblock CDB-Button CDB-Button--primary CDB-Text CDB-Size-medium is-semibold u-whiteSpace-nowrap">Upgrade now</a>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,77 @@
<div class="ApiKeysForm-container">
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor FormAccount-label">Your API Key</label>
</div>
<div class="FormAccount-rowData">
<input type="text" class="CDB-InputText CDB-Text FormAccount-input FormAccount-input--long" placeholder="No API key" value="<%= current_user.api_key %>" readonly />
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
<a class="CDB-Size-medium js-regenerateApiKey" href="#">Request a new API key</a>
</div>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor FormAccount-label FormAccount-label--verticalAlignTop">Example write</label>
</div>
<div class="FormAccount-rowPreview">
<% if CartoDB.subdomainless_urls? %>
<p class="CDB-Size-small FormAccount-text FormAccount-text--preview">https://<%= CartoDB.account_host %>/user/<%= current_user.username %>/api/v2/sql?q=INSERT INTO table_name (the_geom, observation) VALUES (ST_GeomFromText(’POINT(-71.2 42.5)’, 4326),'rare bird spotted')&api_key=<%= current_user.api_key %></p>
<% else %>
<p class="CDB-Size-small FormAccount-text FormAccount-text--preview">https://<%= current_user.username %>.<%= CartoDB.account_host %>/api/v2/sql?q=INSERT INTO table_name (the_geom, observation) VALUES (ST_GeomFromText(’POINT(-71.2 42.5)’, 4326),'rare bird spotted')&api_key=<%= current_user.api_key %></p>
<% end%>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor FormAccount-label FormAccount-label--verticalAlignTop">Example read private</label>
</div>
<div class="FormAccount-rowPreview">
<% if CartoDB.subdomainless_urls? %>
<p class="CDB-Size-small FormAccount-text FormAccount-text--preview">https://<%= CartoDB.account_host %>/user/<%= current_user.username %>/api/v2/sql?q=SELECT * FROM private_table&api_key=<%= current_user.api_key %></p>
<% else %>
<p class="CDB-Size-small FormAccount-text FormAccount-text--preview">https://<%= current_user.username %>.<%= CartoDB.account_host %>/api/v2/sql?q=SELECT * FROM private_table&api_key=<%= current_user.api_key %></p>
<% end %>
</div>
</div>
<% if show_google_api_keys?(current_user) %>
<div class="FormAccount-title">
<p class="FormAccount-titleText">Configure API keys from external providers</p>
</div>
<span class="FormAccount-separator"></span>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor FormAccount-label">Google Maps</label>
</div>
<div class="FormAccount-rowData">
<input type="text" value="<%= current_user.organization.present? ? current_user.organization.google_maps_private_key : current_user.google_maps_private_key %>" class="CDB-InputText CDB-Text FormAccount-input FormAccount-input--long is-disabled" readonly />
</div>
<div class="FormAccount-rowInfo">
<% if !current_user.organization.present? %>
<p class="CDB-Text CDB-Size-small u-altTextColor">
This is your Google Maps query string, contact with <a href="mailto:support@carto.com">support@carto.com</a> to change it.
</p>
<% elsif current_user.organization.present? && current_user.organization_owner? %>
<p class="CDB-Text CDB-Size-small u-altTextColor">
This is the <%= current_user.organization.name %> Google Maps query string, contact with <a href="mailto:support@carto.com">support@carto.com</a> to change it.
</p>
<% else %>
<p class="CDB-Text CDB-Size-small u-altTextColor">This is the organization Google Maps API key</p>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="FormAccount-footer">
<p class="FormAccount-footerText">
<i class="CDB-IconFont CDB-IconFont-info FormAccount-footerIcon"></i>
<span>Learn more about location app authorization and API key management <%= link_to "here", "https://carto.com/developers/fundamentals/authorization/" %></span>
</p>
</div>
@@ -0,0 +1,45 @@
<% content_for(:page_title) do %>
Your API keys |
<% end %>
<%= content_for(:js) do %>
<script type="text/javascript">
var username = "<%= current_user.username %>";
var config = <%= safe_js_object frontend_config %>;
var user_data = <%= safe_js_object current_user.data.to_json %>;
var upgrade_url = "<%= current_user.upgrade_url(request.protocol) %>";
var mobile_enabled = "<%= current_user.mobile_sdk_enabled? %>";
var dashboardNotifications = <%= safe_js_object @dashboard_notifications.to_json %>;
var organization_notifications = <%= safe_js_object @organization_notifications.to_json %>;
</script>
<%= javascript_include_tag 'common', 'common_vendor', 'api_keys_new' %>
<% end %>
<%= content_for(:css) do %>
<% if @has_engine_enabled %>
<%= stylesheet_link_tag 'api_keys_new', :media => 'all' %>
<% else %>
<%= editor_stylesheet_link_tag 'api_keys', :media => 'all' %>
<% end %>
<% end %>
<%= render :partial => 'shared/flash_message' %>
<%= render :partial => 'admin/shared/trial_notification' %>
<div class="FormAccount-Section u-inner">
<%= render :partial => 'admin/shared/pages_subheader' %>
<div class="CDB-Text FormAccount-Content">
<%= render :partial => 'admin/shared/api_keys_subheader' %>
<% if @has_engine_enabled %>
<div class="api-keys js-api-keys-new"></div>
<% else %>
<%= render :partial => 'api_keys_cta' %>
<% end %>
</div>
</div>
<%= render 'admin/shared/new_private_footer' %>
@@ -0,0 +1,92 @@
<% content_for(:page_title) do %>
Your OAuth credentials |
<% end %>
<%= content_for(:js) do %>
<script type="text/javascript">
var username = "<%= current_user.username %>";
var config = <%= safe_js_object frontend_config %>;
var user_data = <%= safe_js_object current_user.data.to_json %>;
var upgrade_url = "<%= current_user.upgrade_url(request.protocol) %>";
</script>
<%= editor_javascript_include_tag 'cdb.js', 'models.js', 'keys_templates.js', 'keys_deps.js', 'keys.js' -%>
<% end %>
<%= content_for(:css) do %>
<%= stylesheet_link_tag 'keys.css', :media => 'all' %>
<% end %>
<%= render :partial => 'shared/flash_message' %>
<div class="FormAccount-Section u-inner">
<%= render :partial => 'admin/shared/pages_subheader' %>
<div class="FormAccount-Content">
<div class="FormAccount-title">
<p class="FormAccount-titleText">Approve applications to act on their behalf without sharing your password</p>
</div>
<span class="FormAccount-separator"></span>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="FormAccount-label">Consumer key</label>
</div>
<div class="FormAccount-rowData">
<input type="text" class="FormAccount-input FormAccount-input--long has-icon js-input" value="<%= current_user.client_application.key %>" readonly />
<i data-title="Copy this" class="CDB-IconFont CDB-IconFont-anchor FormAccount-inputIcon FormAccount-copyIcon js-copy-value"></i>
</div>
<div class="FormAccount-rowInfo">
<p class="FormAccount-rowInfoText">Learn more about <%= link_to "using oauth in CARTO", Cartodb.config[:developers_host] + "/cartodb-platform.html" %>.</p>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="FormAccount-label">Consumer secret</label>
</div>
<div class="FormAccount-rowData">
<input type="text" class="FormAccount-input FormAccount-input--long has-icon js-input" value="<%= current_user.client_application.secret %>" readonly />
<i data-title="Copy this" class="CDB-IconFont CDB-IconFont-anchor FormAccount-inputIcon FormAccount-copyIcon js-copy-value"></i>
</div>
</div>
<span class="FormAccount-separator FormAccount-separator--marginTop"></span>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="FormAccount-label">Request token URL</label>
</div>
<div class="FormAccount-rowData">
<input type="text" class="FormAccount-input FormAccount-input--long has-icon js-input" value="<%= CartoDB.url(self, 'request_token', user: current_user) %>" readonly />
<i data-title="Copy this" class="CDB-IconFont CDB-IconFont-anchor FormAccount-inputIcon FormAccount-copyIcon js-copy-value"></i>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="FormAccount-label">Access token URL</label>
</div>
<div class="FormAccount-rowData">
<input type="text" class="FormAccount-input FormAccount-input--long has-icon js-input" value="<%= CartoDB.url(self, 'access_token', user: current_user) %>" readonly />
<i data-title="Copy this" class="CDB-IconFont CDB-IconFont-anchor FormAccount-inputIcon FormAccount-copyIcon js-copy-value"></i>
</div>
</div>
<div class="FormAccount-footer">
<p class="FormAccount-footerText">
<i class="CDB-IconFont CDB-IconFont-info FormAccount-footerIcon"></i>
<span>Learn more about location app authorization and API key management <%= link_to "here", "https://carto.com/developers/fundamentals/authorization/" %></span>
</p>
<p class="FormAccount-footerText">
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
<a class="js-regenerateOauth Button Button--main" href="#"><span>Generate new keys</span></a>
</p>
</div>
</div>
</div>
<%= render 'admin/shared/new_private_footer' %>