Initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<% require_dependency 'static_maps_url_helper' %>
|
||||
|
||||
<%= content_for(:title) do %><%= @visualization.name %><% end %>
|
||||
|
||||
<%= content_for(:description) do %><%= @visualization.description.present? ? "#{markdown_html_clean(@visualization.description)}. Map created by #{@name} in CARTO" : "Map created by #{@name} in CARTO" %><% end %>
|
||||
|
||||
<%= content_for(:twitter_card) do %><%= Carto::StaticMapsURLHelper.new.url_for_static_map(request, @visualization, 560, 300) %><% end %>
|
||||
<%= content_for(:facebook_card) do %><%= Carto::StaticMapsURLHelper.new.url_for_static_map(request, @visualization, 1200, 630) %><% end %>
|
||||
|
||||
<%= content_for(:css) do %>
|
||||
<%= render :partial => 'admin/visualizations/public/embed_map_inline_css' %>
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:body_class) do %>
|
||||
embed-map
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:content) do %>
|
||||
<% if @visualization.public? || @visualization.public_with_link? || @visualization.password_protected? || @visualization.organization? %>
|
||||
<div id="map"></div>
|
||||
|
||||
<div id="not_supported_dialog" style="display: none">
|
||||
<h2>CARTO</h2>
|
||||
<p>This visualization only works in modern browsers. Upgrade yours and enjoy.</p>
|
||||
<ul>
|
||||
<li><a href="http://www.apple.com/safari/" class="safari">Safari</a></li>
|
||||
<li><a href="https://www.google.com/chrome/" class="chrome">Chrome</a></li>
|
||||
<li class="last"><a href="http://www.mozilla.org/en-US/firefox/all/" class="firefox">Firefox</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="cartodb-text">
|
||||
Map created by
|
||||
<% username = @visualization.user.name_or_username %>
|
||||
<a class="user" href="<%= CartoDB.url(self, 'public_user_feed_home', user: @visualization.user) %>?utm_source=Footer_Link&utm_medium=referral&utm_campaign=Embed_v1&utm_content=<%= @visualization.user.username %>" target="_blank">
|
||||
<% if !@visualization.user.avatar_url.blank? %>
|
||||
<img src="<%= @visualization.user.avatar_url %>" width="16" height="16" alt="<%= username %>" title="<%= username %>" />
|
||||
<% end %>
|
||||
<span class="username"><%= username %></span>
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:js) do %>
|
||||
<%= insert_trackjs('embeds', Cartodb.get_config(:trackjs, 'frequency')) %>
|
||||
<%= render :partial => 'admin/visualizations/public/embed_map_inline_js' %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Embed error | 快点</title>
|
||||
<%= editor_stylesheet_link_tag 'password_protected.css' %>
|
||||
<%= insert_google_tag_manager('embeds') %>
|
||||
</head>
|
||||
|
||||
<body class='PublicPage-body PublicPage-background--grey'>
|
||||
<%= insert_google_tag_manager_no_script('embeds') %>
|
||||
<div class='PublicPage-centerContainer'>
|
||||
<div class='PublicPage-container'>
|
||||
<div class='PublicPage-protectedEmbed-iconContainer'>
|
||||
<svg version="1.1" id="Outline_Icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="50px" height="50px" viewBox="0 0 24 24">
|
||||
<g id="Editor-private-embed" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path fill='#27353C' d="M17.479,11.035c-3.584,0-6.5,2.916-6.5,6.5s2.916,6.5,6.5,6.5s6.5-2.916,6.5-6.5S21.062,11.035,17.479,11.035z
|
||||
M17.479,23.035c-3.033,0-5.5-2.467-5.5-5.5s2.467-5.5,5.5-5.5s5.5,2.467,5.5,5.5S20.511,23.035,17.479,23.035z"/>
|
||||
<circle fill='#27353C' cx="17.479" cy="20.802" r="0.593"/>
|
||||
<path fill='#27353C' d="M17.479,13.484c-1.256,0-2.277,1.022-2.277,2.278c0,0.276,0.224,0.5,0.5,0.5s0.5-0.224,0.5-0.5
|
||||
c0-0.705,0.573-1.278,1.277-1.278c0.706,0,1.279,0.573,1.279,1.278c0,0.705-0.574,1.278-1.279,1.278c-0.276,0-0.5,0.224-0.5,0.5
|
||||
v1.779c0,0.276,0.224,0.5,0.5,0.5s0.5-0.224,0.5-0.5v-1.334c1.017-0.229,1.779-1.138,1.779-2.223
|
||||
C19.758,14.506,18.735,13.484,17.479,13.484z"/>
|
||||
<path fill='#27353C' d="M1,1h10v4.5C11,5.776,11.224,6,11.5,6H16v4h1V5.5c0-0.067-0.014-0.132-0.039-0.192c-0.025-0.061-0.062-0.116-0.108-0.162
|
||||
l-4.999-4.999c-0.046-0.046-0.101-0.083-0.162-0.108C11.632,0.014,11.567,0,11.5,0h-11C0.224,0,0,0.224,0,0.5v21
|
||||
C0,21.776,0.224,22,0.5,22H11v-1H1V1z M12,1.707L15.293,5H12V1.707z"/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<p class='CDB-Text CDB-Size-large'>
|
||||
未找到地图或数据表, 也许是没有登录权限. 请重新 <%= link_to "登录", login_url(after: request.original_url) %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,40 @@
|
||||
(function() {
|
||||
|
||||
function get_url_params(url, conversion) {
|
||||
conversion = conversion || {};
|
||||
if(!url) {
|
||||
return {};
|
||||
}
|
||||
var search = url.split('?');
|
||||
if(search.length < 2) {
|
||||
return {};
|
||||
}
|
||||
search = search[1];
|
||||
var tokens = search.split('&');
|
||||
var params = {};
|
||||
for(var i = 0; i < tokens.length; ++i) {
|
||||
var tk = tokens[i].split('=');
|
||||
var fn = conversion[tk[0]] || function(v) { return v };
|
||||
if(tk.length === 2) {
|
||||
params[tk[0]] = fn(decodeURIComponent(tk[1]));
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
var url = location.search;
|
||||
var opt = get_url_params(url);
|
||||
|
||||
var height = opt.height || '400';
|
||||
if(height.indexOf('%') == -1) {
|
||||
height += 'px';
|
||||
}
|
||||
|
||||
var l = document.createElement("a");
|
||||
l.href = url
|
||||
if(l.protocol.indexOf('http') != -1) {
|
||||
var port = l.port ? ':' + l.port: '';
|
||||
document.write('<iframe src="' + l.protocol + '//' + l.hostname + port + '/viz/embed_forbidden" frameborder="0" width="100%" height="' + height +'" ></iframe>');
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,27 @@
|
||||
<%= content_for(:title) do %>
|
||||
Protected embed
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:header_title) do %>
|
||||
This embed is protected with password
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:password_form) do %>
|
||||
<%= form_tag(CartoDB.url(self, 'protected_embed_map', params: { :protocol => Rails.env.development? ? 'http' : 'https' }) + '?' + request.query_string, {:method=>'POST',:authenticity_token=>false}) do %>
|
||||
|
||||
<div class='PublicPage-field-withTooltip'>
|
||||
<%= password_field_tag 'password', params[:password], class: "PublicPage-form--inputText RoundBorders-all CDB-Text CDB-Size-medium is-light u-whiteTextColor #{ flash[:error].present? ? 'is-alert' : ''}", placeholder: 'Insert your password'%>
|
||||
|
||||
<%- if flash[:error].present? %>
|
||||
<div class="PublicPage-inputTooltip CDB-InfoTooltip CDB-InfoTooltip--left u-lSpace--xl is-error">
|
||||
<p class='CDB-Text CDB-Size-medium CDB-InfoTooltip-text'><%= flash[:error] %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:ua) do %>
|
||||
embeds
|
||||
<% end %>
|
||||
@@ -0,0 +1,44 @@
|
||||
<style type="text/css">
|
||||
html, body, #map {height: 100%; padding: 0; margin: 0;}
|
||||
/* footer */
|
||||
.cartodb-text {position:absolute; display:none; bottom:0; left:0; right:0; margin:0; padding:0 10px; background:white; font:normal 11px "Helvetica",Arial; color:#999999; border-top:1px solid #CCC; border-top:1px solid rgba(0,0,0,0); box-shadow:rgba(0,0,0,0.6) 0 0 1px 0; -webkit-box-shadow:rgba(0,0,0,0.6) 0 0 1px 0; -moz-box-shadow:rgba(0,0,0,0.6) 0 0 1px 0; -o-box-shadow:rgba(0,0,0,0.6) 0 0 1px 0; line-height:29px; z-index:2; }
|
||||
.cartodb-text a {color:#397DB8; text-decoration:underline;}
|
||||
.cartodb-text a.user { text-decoration:none }
|
||||
.cartodb-text img {display:inline-block; *display:inline; vertical-align:middle; border-radius:16px; -webkit-border-radius:16px; -moz-border-radius:16px; zoom:1; text-decoration:none }
|
||||
.cartodb-text span.username { text-decoration:underline }
|
||||
|
||||
/* not supported dialog */
|
||||
#not_supported_dialog {position:absolute; width:356px; height:213px; top:50%; left:50%; margin-top:-107px; margin-left:-178px; padding:0; background-color:#FFF; text-align:center; font-family:'Helvetica', Arial; color:#666666; z-index:10000;}
|
||||
#not_supported_dialog h2 {display:inline-block; width:77px; margin:30px 0 0; padding-bottom:16px; font-size:13px; font-weight:bold; border-bottom:1px solid #D9D9D9; vertical-align:top; zoom:1; *display:inline;}
|
||||
#not_supported_dialog p {display:block; padding:0 40px; margin:12px 0 0; font-size:15px;}
|
||||
#not_supported_dialog ul {position:absolute; bottom:0; left:0; right:0; display:block; margin:0; padding:0; list-style:none; border-top:1px solid #D9D9D9;}
|
||||
#not_supported_dialog ul li {float:left; margin:0; padding:0; border-right:1px solid #D9D9D9;}
|
||||
#not_supported_dialog ul li a {display:block; width:118px; height:74px; background-repeat:no-repeat; background-position:center center; font-size:0; line-height:0; text-indent:-9999px;}
|
||||
#not_supported_dialog ul li.last {border:none;}
|
||||
#not_supported_dialog a.safari {background-image:url('<%= editor_image_path "layout/safari.png" %>');}
|
||||
#not_supported_dialog a.chrome {background-image:url('<%= editor_image_path "layout/chrome.png" %>');}
|
||||
#not_supported_dialog a.firefox {background-image:url('<%= editor_image_path "layout/firefox.png" %>');}
|
||||
|
||||
|
||||
:-webkit-full-screen .cartodb-map-wrapper { height: 100%!important; }
|
||||
:-moz-full-screen .cartodb-map-wrapper { height: 100%!important; }
|
||||
:-ms-fullscreen .cartodb-map-wrapper { height: 100%!important; }
|
||||
:fullscreen .cartodb-map-wrapper { height: 100%!important; }
|
||||
|
||||
<% if @hide_logo %>
|
||||
<% else %>
|
||||
/* Styles showing up new cartodb text */
|
||||
<% if @visualization.user.remove_logo? && !Cartodb.config[:cartodb_com_hosted].present? %>
|
||||
<% if !params['cartodb_logo'] || params['cartodb_logo'] == "true" %>
|
||||
.cartodb-map-wrapper {bottom:30px!important;}
|
||||
.cartodb-text {display:block;}
|
||||
<% end %>
|
||||
<% else %>
|
||||
.cartodb-map-wrapper {bottom:30px!important;}
|
||||
.cartodb-text {display:block;}
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</style>
|
||||
|
||||
<%= editor_stylesheet_link_tag 'cartodb.css' %>
|
||||
@@ -0,0 +1,155 @@
|
||||
<% if @visualization.map.provider == 'googlemaps' %>
|
||||
<%= insert_google_maps(@visualization.user.google_maps_query_string) %>
|
||||
<% end %>
|
||||
|
||||
<%= editor_javascript_include_tag 'embed.js' %>
|
||||
|
||||
<script>
|
||||
|
||||
// Get url parameters
|
||||
function get_url_params(conversion) {
|
||||
conversion = conversion || {};
|
||||
|
||||
var tokens = location.search.slice(1).split('&');
|
||||
var params = {};
|
||||
|
||||
for (var i = 0; i < tokens.length; ++i) {
|
||||
|
||||
var tk = tokens[i].split('=');
|
||||
var fn = conversion[tk[0]] || function(v) { return v };
|
||||
|
||||
if (tk.length === 2) {
|
||||
params[tk[0]] = fn(decodeURIComponent(tk[1]));
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
// Manage errors
|
||||
function manageError(err, layer) {
|
||||
if(layer && layer.get('type') === 'torque') {
|
||||
$('#not_supported_dialog').show();
|
||||
// hide all the overlays
|
||||
var overlays = this.getOverlays()
|
||||
for (var i = 0; i < overlays.length; ++i) {
|
||||
var o = overlays[i];
|
||||
o.hide && o.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send stats
|
||||
function stats() {
|
||||
var browser;
|
||||
var ua = navigator.userAgent;
|
||||
var checks = [
|
||||
['MSIE 11.0', 'ms11'],
|
||||
['MSIE 10.0', 'ms10'],
|
||||
['MSIE 9.0', 'ms9'],
|
||||
['MSIE 8.0', 'ms8'],
|
||||
['MSIE 7.0','ms7'],
|
||||
['Chrome', 'chr'],
|
||||
['Firefox', 'ff'],
|
||||
['Safari', 'ff']
|
||||
]
|
||||
for(var i = 0; i < checks.length && !browser; ++i) {
|
||||
if(ua.indexOf(checks[i][0]) !== -1) browser = checks[i][1];
|
||||
}
|
||||
browser = browser || 'none';
|
||||
cartodb.core.Profiler.metric('cartodb-js.embed.' + browser).inc();
|
||||
}
|
||||
|
||||
// On load...
|
||||
$(function(){
|
||||
// Set visualization user url prefix
|
||||
cartodb.config.set('url_prefix', '<%= @visualization.user.public_url(nil, request.protocol == "https://" ? "https" : "http") %>');
|
||||
|
||||
var bool_fn = function(v) { return v == 'true' };
|
||||
var is_custom_install = <%= Cartodb.config[:cartodb_com_hosted].present? %>;
|
||||
var logo_fn = function(v) { return ( <%= !@visualization.user.remove_logo? %> || is_custom_install ) ? true : v == 'true' };
|
||||
var layer_fn = function(v) {
|
||||
if(!v || !v.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return _.map(v.split("|"), function(v) {
|
||||
return { visible: !!parseInt(v, 10) }
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var opt = get_url_params({
|
||||
'force_mobile': bool_fn,
|
||||
'search': bool_fn,
|
||||
'title': bool_fn,
|
||||
'description': bool_fn,
|
||||
'shareable': bool_fn,
|
||||
'fullscreen': bool_fn,
|
||||
'cartodb_logo': logo_fn,
|
||||
'scrollwheel': bool_fn,
|
||||
'sublayer_options': layer_fn,
|
||||
'layer_selector': bool_fn,
|
||||
'legends': bool_fn
|
||||
});
|
||||
|
||||
<% if (@visualization.password_protected? or @visualization.is_privacy_private?) and @protected_map_tokens %>
|
||||
opt.auth_token = [];
|
||||
<% @protected_map_tokens.each do |token| %>
|
||||
opt.auth_token.push('<%= token %>');
|
||||
<% end %>
|
||||
opt.https = true; // when auth_token is used tiles should be fetch using https
|
||||
<% end %>
|
||||
|
||||
<% if Rails.env.development? || Cartodb.config[:no_cdn] == true %>
|
||||
opt.no_cdn = true;
|
||||
<% end %>
|
||||
|
||||
<% if @hide_logo %>
|
||||
opt.cartodb_logo = false;
|
||||
<% end %>
|
||||
|
||||
opt.mobile_layout = true;
|
||||
|
||||
cartodb.config.set({
|
||||
cartodb_attributions: "CARTO <a href='https://carto.com/attributions?utm_source=Footer_Link&utm_medium=referral&utm_campaign=Embed_v1&utm_content=Attributions&utm_term=<%= @visualization.user.username %>' target='_blank'>attribution</a>",
|
||||
cartodb_logo_link: "https://carto.com?utm_source=Footer_Link&utm_medium=referral&utm_campaign=Embed_v1&utm_content=Logo"
|
||||
})
|
||||
|
||||
var loadingTime = cartodb.core.Profiler.metric('cartodb-js.embed.time_full_loaded').start();
|
||||
var visReadyTime = cartodb.core.Profiler.metric('cartodb-js.embed.time_vis_loaded').start();
|
||||
cartodb.createVis('map', <%= safe_js_object @visualization.to_vizjson({https_request: request.protocol == 'https://'}).to_json %>, opt, function(vis) {
|
||||
visReadyTime.end();
|
||||
vis.on('load', function() {
|
||||
loadingTime.end();
|
||||
});
|
||||
|
||||
window.vis = vis;
|
||||
|
||||
// fixes default position of the overlays
|
||||
setTimeout(function() {
|
||||
$(window).trigger("map_resized");
|
||||
}, 400);
|
||||
// some stats
|
||||
stats();
|
||||
}).on('error', manageError);
|
||||
});
|
||||
|
||||
//<!-- load stats -->
|
||||
<% if Cartodb.config[:graphite_public] %>
|
||||
if (location.protocol.indexOf('https') === -1) {
|
||||
jQuery.getScript('<%= javascript_path "statsc.js" %>', function(ready) {
|
||||
statsc.connect('http://<%= Cartodb.config[:graphite_public]['host'] %>:<%= Cartodb.config[:graphite_public]['port'] %>/');
|
||||
cartodb.core.Profiler.backend(function () {
|
||||
statsc.send.apply(statsc, arguments);
|
||||
})
|
||||
// stop sending stats after 11 seconds
|
||||
// statsc send stats in 5 secs interval so allow to send at least twice
|
||||
setTimeout(function() {
|
||||
cartodb.core.Profiler.backend(null);
|
||||
}, 11*1000);
|
||||
})
|
||||
}
|
||||
<% end %>
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,16 @@
|
||||
<%# Still used for public dataset page %>
|
||||
<div class="cartodb-footer">
|
||||
<div class="inner">
|
||||
<div class="copyright embed-left-col">
|
||||
<div class="content">
|
||||
© <%= Time.now.year %> CARTO - <a href="https://carto.com/signup" title="Create your own maps with CARTO">Create your own maps</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="terms embed-right-col">
|
||||
<div class="content">
|
||||
<a href="https://carto.com/terms/" target="blank">Terms of Service</a> ·
|
||||
<a href="https://carto.com/privacy/" target="blank">Privacy policy</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,248 @@
|
||||
<% require_dependency 'static_maps_url_helper' %>
|
||||
|
||||
<%= content_for(:page_title) do %><%= @table.name.gsub(/_/," ") %><% end %>
|
||||
|
||||
<%= content_for(:description) do %><%= @table.description ? "#{@table.description}. Map created by #{@name} in CARTO" : "Map created by #{@name} in CARTO" %><% end %>
|
||||
|
||||
<%= content_for(:twitter_card) do %><%= Carto::StaticMapsURLHelper.new.url_for_static_map(request, @table.table_visualization, 560, 300) %><% end %>
|
||||
<%= content_for(:facebook_card) do %><%= Carto::StaticMapsURLHelper.new.url_for_static_map(request, @table.table_visualization, 1200, 630) %><% end %>
|
||||
|
||||
<%= content_for(:css) do %>
|
||||
<%= stylesheet_link_tag 'common_new', 'public_table_new', 'public_map_new' %>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:js) do %>
|
||||
<% if @table.map.provider == 'googlemaps' %>
|
||||
<%= insert_google_maps(@user.google_maps_query_string) %>
|
||||
<% end %>
|
||||
|
||||
<%= javascript_include_tag 'common', 'common_vendor', 'public_table_new' %>
|
||||
|
||||
<script>
|
||||
var table_name = '<%=raw @table.qualified_table_name %>';
|
||||
var table_id = '<%= @table.id %>';
|
||||
var schema = <%= safe_js_object @table.schema.to_json %>;
|
||||
var user_name = '<%= @user.username %>';
|
||||
var owner_username = '<%= @table.owner.username %>';
|
||||
var belong_organization = <%= @table.owner.has_organization? %>;
|
||||
var map = <%= safe_js_object @table.map.to_json %>;
|
||||
var config = <%= safe_js_object frontend_config_public({https_apis: request.protocol == 'https://' }) %>;
|
||||
var vizjson_obj = <%= safe_js_object @vizjson.to_json %>;
|
||||
var auth_token = <%= safe_js_object @auth_tokens.to_json %>;
|
||||
var use_https = <%= @use_https =%>;
|
||||
var api_key = <%= safe_js_object @api_key.to_json %>;
|
||||
var base_url = '<%= @table.owner.public_url(nil, request.protocol == "https://" ? "https" : "http") %>';
|
||||
var login_url = "<%= CartoDB.url(self, 'login') %>";
|
||||
</script>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:content) do %>
|
||||
<%= render 'admin/shared/public_header' %>
|
||||
|
||||
<div class="CDB-Text PublicMap-map js-map" id="map">
|
||||
<div class="Spinner Spinner--center js-spinner"></div>
|
||||
|
||||
<div class="panes pane_table"></div>
|
||||
<div class="panes pane_map"></div>
|
||||
|
||||
<div class="navigation u-showOnTablet">
|
||||
<ul>
|
||||
<li><a href="#/table" data-pane="table" class=" tab selected u-valign"><i class="Navmenu-tableIcon CDB-IconFont CDB-IconFont-table u-iblock u-malign"></i></a></li>
|
||||
<li><a href="#/map" data-pane="map" class="u-valign"><i class="CDB-IconFont CDB-IconFont-map u-iblock u-malign"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%# Legacy from current embed %>
|
||||
<div class="NotSupportedDialog" id="not_supported_dialog" style="display: none">
|
||||
<h2 class="NotSupportedDialog-title">CARTO</h2>
|
||||
<p class="NotSupportedDialog-desc">This visualization only works in modern browsers. Upgrade yours and enjoy.</p>
|
||||
<ul class="NotSupportedDialog-list">
|
||||
<li class="NotSupportedDialog-item"><a class="NotSupportedDialog-itemLink NotSupportedDialog-itemLink--Safari" href="http://www.apple.com/safari/" class="safari">Safari</a></li>
|
||||
<li class="NotSupportedDialog-item"><a class="NotSupportedDialog-itemLink NotSupportedDialog-itemLink--Chrome" href="https://www.google.com/chrome/" class="chrome">Chrome</a></li>
|
||||
<li class="NotSupportedDialog-item is-last"><a class="NotSupportedDialog-itemLink NotSupportedDialog-itemLink--Firefox" href="http://www.mozilla.org/en-US/firefox/all/" class="firefox">Firefox</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="separator bottom"></div>
|
||||
|
||||
<div class="CDB-Text CDB-Size-medium Navmenu js-Navmenu">
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block">
|
||||
<div class="PublicMap-gradient"></div>
|
||||
|
||||
<div class="PublicMap-leftBlock PublicMap-leftBlock--owner">
|
||||
<ul class="Navmenu-list Navmenu-list--owner Navmenu-list--avatar">
|
||||
<li class="Navmenu-item">
|
||||
<a href="<%= @user_url %>" class="UserAvatar">
|
||||
<img class="UserAvatar-img--medium" src="<%= @visualization.user.avatar %>" alt="<%= @name %>" title="<%= @name %>" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="Navmenu-list Navmenu-list--owner">
|
||||
<li class="Navmenu-item u-hideOnTablet last-child">
|
||||
<a href="<%= @user_url %>" class="Navmenu-link Navmenu-link--owner" title="<%= @name %>"><%= @name %></a>
|
||||
</li>
|
||||
|
||||
<% unless @is_data_library %>
|
||||
<li class="Navmenu-item">
|
||||
<i class="Navmenu-rarrow CDB-IconFont CDB-IconFont-rArrowLight"></i>
|
||||
<a href="<%= CartoDB.url(self, 'public_datasets_home', user: @visualization.user) %>" class="Navmenu-link">Datasets</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="PublicMap-rightBlock PublicMap-rightBlock--owner u-txt-right">
|
||||
<ul class="Navmenu-list">
|
||||
<li class="Navmenu-item Navmenu-item--action Navmenu-item--withsep u-hideOnTablet">
|
||||
<div class="Navmenu-sep"></div>
|
||||
|
||||
<i class="Navmenu-actionIcon CDB-IconFont CDB-IconFont-markup"></i>
|
||||
<a href="#" class="Navmenu-link Navmenu-link--action js-Navmenu-link--api">API call</a>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-item Navmenu-item--action u-hideOnTablet">
|
||||
<i class="Navmenu-actionIcon CDB-IconFont CDB-IconFont-floppy"></i>
|
||||
<a href="#" class="Navmenu-link Navmenu-link--action js-Navmenu-link--download">Download</a>
|
||||
</li>
|
||||
|
||||
<% if !Cartodb.config[:cartodb_com_hosted].present? %>
|
||||
<li class="Navmenu-item u-hideOnTablet">
|
||||
<a class="Button Button--main Navmenu-editLink Navmenu-editLink--edit Navmenu-editLink--oneclick is-active js-oneclick" href="https://oneclick.carto.com/?file=<%= CGI.escape( @export_sql_api_url ) %>&provider=<%= URI.encode(@table.owner.username) %>&logo=<%= URI.encode(@avatar_url) %>">Create map</a>
|
||||
<a href="<%= CartoDB.url(self, 'public_tables_show', params: { id: @table.name }, user: @table.owner.organization ? @table.owner : nil) %>" class="Button Button--main Navmenu-editLink Navmenu-editLink--edit Navmenu-editLink--oneclick js-edit">Edit in CARTO</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="CDB-Text PublicMap-secondary PublicMap-secondary--bottom">
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block">
|
||||
<div class="PublicMap-leftBlock PublicMap-leftBlock--large">
|
||||
<div class="js-user-meta">
|
||||
<h1 class="PublicMap-title js-PublicMap-title Title Title--m"><%= @visualization.display_name_or_name %></h1>
|
||||
<% if @visualization.description.present? %>
|
||||
<div class="PublicMap-description"><%= raw markdown_html_safe(@visualization.description) %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="PublicMap-meta">
|
||||
<ul class="PublicMap-metaList">
|
||||
<li class="PublicMap-metaItem"><i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-calendar"></i> <span title="<%= time_ago_in_words(@visualization.updated_at) %> ago"><%= time_ago_in_words(@visualization.updated_at) %> ago</span></li>
|
||||
</ul>
|
||||
|
||||
<ul class="PublicMap-metaList PublicMap-metaList--mobile js-PublicMap-metaList--mobile">
|
||||
<% if !@table.rows_counted.blank? %>
|
||||
<li class="PublicMap-metaItem">
|
||||
<i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-rows RowsIndicator-icon"></i>
|
||||
<% if @table.rows_counted < 10000 %>
|
||||
<%= number_with_delimiter(@table.rows_counted) %>
|
||||
<% else %>
|
||||
<%= number_to_human(@table.rows_counted, units: { unit:"", thousand: "K", million: "M" }, precision: 2, format: '%n%u') %>
|
||||
<% end %>
|
||||
<span title="<%= 'row'.pluralize(@table.rows_counted) %>"><%= 'row'.pluralize(@table.rows_counted) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if !@visualization.visualization.license_info.nil? %>
|
||||
<li class="PublicMap-metaItem">
|
||||
<%# Defaulting on CC icon for license https://github.com/CartoDB/cartodb/issues/6413 %>
|
||||
<i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-creativeCommons iconFont-License iconFont-License<%= @visualization.visualization.license_info.id.to_s.gsub(/_/,"").downcase %>"></i>
|
||||
<%# Keep on one line to avoid unwanted spaces %>
|
||||
<span title="<%= @visualization.visualization.license_info.name %>"><%= @visualization.visualization.license_info.name %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if @visualization.visualization.source.present? %>
|
||||
<li class="PublicMap-metaItem">
|
||||
<i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-anchor"></i>
|
||||
<%# Keep on one line to avoid unwanted spaces %>
|
||||
<span title="<%= @visualization.visualization.source %>"><%= raw markdown_html_safe(@visualization.source) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="Navmenu-editLink Navmenu-editLink--more js-Navmenu-editLink--more" href="#/more">More info</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%# Related maps %>
|
||||
<% if @total_visualizations.count > 0 %>
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block with-padding">
|
||||
<h3 class="PublicMap-secondaryTitle">Maps using this dataset</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="MapsList PublicMap-mapsList">
|
||||
<% @total_visualizations.last(3).each do |vis| %>
|
||||
<li class="MapsList-item">
|
||||
<div class="MapCard" data-vis-id="<%= vis.id %>" data-vis-owner-name="<%= vis.user[:username] %>">
|
||||
<a href="<%= CartoDB.url(self, 'public_visualizations_public_map', params: { id: vis.id }, user: vis.user) %>" class="MapCard-header js-header">
|
||||
<div class="MapCard-loader"></div>
|
||||
</a>
|
||||
<div class="MapCard-content MapCard-content--compact">
|
||||
<div class="MapCard-contentBody">
|
||||
<div class="MapCard-contentBodyRow MapCard-contentBodyRow--flex">
|
||||
<h3 class="MapCard-title DefaultTitle CDB-Text is-semibold CDB-Size-large">
|
||||
<a href="<%= CartoDB.url(self, 'public_visualizations_public_map', params: { id: vis.id }, user: vis.user) %>" class="DefaultTitle-link u-ellipsLongText" title="<%= vis.name %>"><%= vis.name %></a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="MapCard-contentFooterTimeDiff DefaultTimeDiff CDB-Text CDB-Size-medium u-altTextColor">
|
||||
<i class="CDB-IconFont CDB-IconFont-clock DefaultTimeDiff-icon"></i>
|
||||
<%= time_ago_in_words(vis.updated_at) %> ago
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%# at most 3 cards per line, visbility is handled by CSS depending on viewport size %>
|
||||
<% if @total_visualizations.count < 3 %>
|
||||
<% ((3 - @total_visualizations.count + 3) % 3).times.each do %>
|
||||
<li class="MapsList-item MapsList-item--fake">
|
||||
<div class="MapCard">
|
||||
<div class="MapCard-header MapCard-header--fake"></div>
|
||||
<div class="MapCard-content MapCard-content--compact"></div>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<%# DISQUS %>
|
||||
<% if @table.owner.disqus_shortname.present? %>
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block PublicMap-info">
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = '<%= @disqus_shortname %>';
|
||||
var disqus_identifier = '<%= @visualization.id %>';
|
||||
|
||||
(function() {
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if cartodb_com_hosted? %>
|
||||
<%= render 'admin/shared/footer', :light => true %>
|
||||
<% else %>
|
||||
<%= render 'admin/shared/public_footer', :light => false %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,415 @@
|
||||
<% require_dependency 'static_maps_url_helper' %>
|
||||
|
||||
<%= content_for(:title) do %><%= @visualization.name %><% end %>
|
||||
|
||||
<%= content_for(:description) do %><%= @visualization.description.present? ? "#{markdown_html_clean(@visualization.description)} — Map created by #{@name} in CARTO" : "Map created by #{@name} in CARTO" %><% end %>
|
||||
|
||||
<%= content_for(:twitter_card) do %><%= Carto::StaticMapsURLHelper.new.url_for_static_map(request, @visualization, 560, 300) %><% end %>
|
||||
<%= content_for(:facebook_card) do %><%= Carto::StaticMapsURLHelper.new.url_for_static_map(request, @visualization, 1200, 630) %><% end %>
|
||||
|
||||
<%= content_for(:body_class) do %> PublicMap <% end %>
|
||||
|
||||
<%= content_for(:css) do %>
|
||||
<%= editor_stylesheet_link_tag 'cartodb', 'common', 'public_map' %>
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:content) do %>
|
||||
<% if @visualization.is_accesible_by_user?(current_user) %>
|
||||
<%= render 'admin/shared/public_header' %>
|
||||
|
||||
<div class="PublicMap-map js-map" id="map">
|
||||
<div class="Spinner Spinner--center js-spinner"></div>
|
||||
</div>
|
||||
|
||||
<%# Legacy from current embed %>
|
||||
<div class="NotSupportedDialog" id="not_supported_dialog" style="display: none">
|
||||
<h2 class="NotSupportedDialog-title">CARTO</h2>
|
||||
<p class="NotSupportedDialog-desc">This visualization only works in modern browsers. Upgrade yours and enjoy.</p>
|
||||
<ul class="NotSupportedDialog-list">
|
||||
<li class="NotSupportedDialog-item"><a class="NotSupportedDialog-itemLink NotSupportedDialog-itemLink--Safari" href="http://www.apple.com/safari/" class="safari">Safari</a></li>
|
||||
<li class="NotSupportedDialog-item"><a class="NotSupportedDialog-itemLink NotSupportedDialog-itemLink--Chrome" href="https://www.google.com/chrome/" class="chrome">Chrome</a></li>
|
||||
<li class="NotSupportedDialog-item is-last"><a class="NotSupportedDialog-itemLink NotSupportedDialog-itemLink--Firefox" href="http://www.mozilla.org/en-US/firefox/all/" class="firefox">Firefox</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="CDB-Text CDB-Size-medium Navmenu js-Navmenu">
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block">
|
||||
<div class="PublicMap-gradient"></div>
|
||||
|
||||
<div class="PublicMap-leftBlock PublicMap-leftBlock--owner">
|
||||
<ul class="Navmenu-list Navmenu-list--owner Navmenu-list--avatar">
|
||||
<li class="Navmenu-item">
|
||||
<a href="<%= CartoDB.url(self, 'public_user_feed_home', user: @visualization.user) %>" target="_blank" class="UserAvatar">
|
||||
<img class="UserAvatar-img--medium" src="<%= @visualization.user.avatar %>" alt="<%= @name %>" title="<%= @name %>" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="Navmenu-list Navmenu-list--owner">
|
||||
<li class="Navmenu-item u-hideOnTablet last-child">
|
||||
<a href="<%= CartoDB.url(self, 'public_user_feed_home', user: @visualization.user) %>" class="Navmenu-link Navmenu-link--owner" title="<%= @name %>"><%= @name %></a>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-item">
|
||||
<i class="Navmenu-rarrow CDB-IconFont CDB-IconFont-rArrowLight"></i>
|
||||
<a href="<%= CartoDB.url(self, 'public_maps_home', user: @visualization.user) %>" class="Navmenu-link">Maps</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="PublicMap-rightBlock PublicMap-rightBlock--owner u-txt-right">
|
||||
<ul class="Navmenu-list">
|
||||
<li class="Navmenu-item Navmenu-item--buttons">
|
||||
<ul class="u-valign">
|
||||
<li class="Navmenu-subItem">
|
||||
<a href="<%= CartoDB.url(self, 'public_visualizations_embed_map', params: { id: @visualization.id }, user: @visualization.user) %>" target="_blank" class="Navmenu-link">
|
||||
<i class="CDB-IconFont CDB-IconFont-fullscreen Navmenu-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-subItem">
|
||||
<a href="#" class="Navmenu-link js-Navmenu-link--download-map">
|
||||
<i class="CDB-IconFont CDB-IconFont-downloadCircle Navmenu-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-item Navmenu-item--buttons js-Navmenu-share u-showOnTablet">
|
||||
<div class="Navmenu-sep u-showOnTablet"></div>
|
||||
|
||||
<a href="#" class="Navmenu-link Navmenu-shareLink js-Navmenu-shareLink">
|
||||
<i class="CDB-IconFont CDB-IconFont-share Navmenu-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="Navmenu-list Navmenu-shareList js-Navmenu-shareList u-valign">
|
||||
<li class="Navmenu-item Navmenu-item--buttons">
|
||||
<div class="Navmenu-sep u-hideOnTablet"></div>
|
||||
|
||||
<ul class="u-valign">
|
||||
<li class="Navmenu-subItem">
|
||||
<a href="https://twitter.com/intent/tweet?text=<%= url_encode(@visualization.name) %>&url=<%= url_encode(request.original_url) %>&via=CARTO">
|
||||
<i class="CDB-IconFont CDB-IconFont-twitter Navmenu-icon Navmenu-icon--twitter"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-subItem">
|
||||
<a href="http://www.facebook.com/sharer.php?u=<%= url_encode(request.original_url) %>" target="_blank" class="Navmenu-link js-Navmenu-link--facebook">
|
||||
<i class="CDB-IconFont CDB-IconFont-facebookSquare Navmenu-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-subItem">
|
||||
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<%= url_encode(request.original_url) %>&title=<%= url_encode(@visualization.name) %>&summary=<%= url_encode(@visualization.description.present? ? "#{markdown_html_clean(@visualization.description)} — Map created by #{@name} in CARTO" : "Map created by #{@name} in CARTO") %>&source=CARTO" target="_blank" class="Navmenu-link js-Navmenu-link--linkedin">
|
||||
<i class="CDB-IconFont CDB-IconFont-linkedin Navmenu-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="Navmenu-subItem u-showOnTablet">
|
||||
<button class="ImportItem-closeButton Navmenu-link js-Navmenu-closeLink Navmenu-closeLink">
|
||||
<i class="CDB-IconFont CDB-IconFont-close ImportItem-closeButtonIcon"></i>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="Navmenu-list u-hideOnTablet">
|
||||
<li class="Navmenu-item">
|
||||
<a class="Button Button--main Navmenu-editLink Navmenu-editLink--edit js-Navmenu-editLink" href="<%= CartoDB.url(self, 'public_visualizations_show', params: { id: @visualization.id }, user: @visualization.user) %>">Edit in CARTO</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="CDB-Text PublicMap-secondary">
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block">
|
||||
<div class="PublicMap-leftBlock PublicMap-leftBlock--large">
|
||||
<div class="js-user-meta">
|
||||
<h1 class="PublicMap-title js-PublicMap-title Title Title--m"><%= @visualization.name %></h1>
|
||||
<% if @visualization.description.present? %>
|
||||
<div class="PublicMap-description"><%= raw markdown_html_safe(@visualization.description) %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="PublicMap-meta">
|
||||
<ul class="PublicMap-metaList">
|
||||
<li class="PublicMap-metaItem"><i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-calendar"></i> <%= time_ago_in_words(@visualization.updated_at) %> ago</li>
|
||||
</ul>
|
||||
|
||||
<ul class="PublicMap-metaList PublicMap-metaList--mobile js-PublicMap-metaList--mobile">
|
||||
<li class="PublicMap-metaItem"><i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-stats"></i> <%= number_with_delimiter(@mapviews) %> <%= 'mapview'.pluralize(@mapviews) %></li>
|
||||
|
||||
<% if @visualization.tags.size > 0 %>
|
||||
<li class="PublicMap-metaItem">
|
||||
<i class="PublicMap-metaIcon CDB-IconFont CDB-IconFont-label"></i>
|
||||
<%# Keep on one line to avoid unwanted spaces %>
|
||||
<% formatted_tags(@visualization.tags) do |tag| %><a class="PublicMap-metaLink" href="<%= CartoDB.url(self, 'public_tag', params: { tag: tag }, user: @visualization.user) %>"><%= tag %></a><% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="Navmenu-editLink Navmenu-editLink--more js-Navmenu-editLink--more" href="#/more">More info</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%# Datasets %>
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block with-padding">
|
||||
<h3 class="PublicMap-secondaryTitle">Datasets in use</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block">
|
||||
<ul>
|
||||
<% if @related_canonical_visualizations.present? %>
|
||||
<% @related_canonical_visualizations.each do |vis| %>
|
||||
<% if vis.privacy == "public" %>
|
||||
<li class="DatasetsList-item">
|
||||
<div class="DatasetsList-itemCategory is--<%= vis.related_visualizations_simple_geometry_types[0] if vis.related_visualizations_simple_geometry_types.present? %>Dataset"></div>
|
||||
|
||||
<div class="DatasetsList-itemInfo">
|
||||
<div class="DatasetsList-itemPrimaryInfo">
|
||||
<h3 class="DatasetsList-itemTitle DefaultTitle u-ellipsLongText CDB-Text CDB-Size-large u-mainTextColor">
|
||||
<a href="<%= CartoDB.url(self, 'public_table', params: { id: vis.user_table.name }, user: @user_domain.nil? ? nil : @related_tables_owners[vis.user_table.user_id]) %>" title="<%= vis.user_table.name %>" class="DefaultTitle-link u-ellipsLongText"><%= vis.user_table.name %></a>
|
||||
</h3>
|
||||
<% if vis.description %>
|
||||
<div class="DefaultDescription DatasetsList-itemDescription u-ellipsLongText CDB-Text CDB-Size-medium u-altTextColor"><%= raw markdown_html_safe(vis.description) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="DatasetsList-itemSecondaryInfo">
|
||||
<div class="DatasetsList-itemMeta CDB-Size-medium">
|
||||
<span class="CDB-Tag CDB-Text CDB-Size-small is-semibold u-upperCase PrivacyIndicator is-<%= vis.privacy %> u-hideOnTablet"><%= vis.privacy %></span>
|
||||
<% if (vis.user_table.service.rows_counted) %>
|
||||
<span class="RowsIndicator u-hideOnTablet">
|
||||
<i class="CDB-IconFont CDB-IconFont-rows RowsIndicator-icon u-altTextColor CDB-Size-small"></i>
|
||||
<%= "#{number_to_human(vis.user_table.service.rows_counted, format: "%n%u", units: { unit: "", thousand: "K", million: "M" }, delimiter: ",")} row#{vis.user_table.service.rows_counted.size == 1 ? "" : "s"}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<span class="DatasetsList-itemTimeDiff DefaultTimeDiff u-hideOnTablet">
|
||||
<i class="CDB-IconFont CDB-IconFont-clock DefaultTimeDiff-icon"></i>
|
||||
<%= time_ago_in_words(vis.updated_at) %> ago
|
||||
<% if vis.user.username != @visualization.user.username %>
|
||||
by
|
||||
<span class="UserAvatar">
|
||||
<img class="UserAvatar-img UserAvatar-img--smaller" src="<%= vis.user.avatar_url %>" alt="<%= vis.user.name_or_username %>" title="<%= vis.user.name_or_username %>" />
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @nonpublic_tables_count.present? && @nonpublic_tables_count > 0 %>
|
||||
<li class="DatasetsList-item">
|
||||
<div class="LayoutIcon">
|
||||
<i class="CDB-IconFont CDB-IconFont-lock"></i>
|
||||
</div>
|
||||
<div class="DefaultTitle PublicMap-privateDatasets"><%= pluralize(@nonpublic_tables_count, 'private dataset') %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%# DISQUS %>
|
||||
<% if @visualization.user.disqus_shortname.present? %>
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block PublicMap-info">
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = '<%= @disqus_shortname %>';
|
||||
var disqus_identifier = '<%= @visualization.id %>';
|
||||
|
||||
(function() {
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%# Related %>
|
||||
<% if @more_visualizations && @more_visualizations.count > 0 %>
|
||||
<div class="u-inner">
|
||||
<div class="PublicMap-block">
|
||||
<h3 class="PublicMap-secondaryTitle">More from <%= @name %></h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="MapsList PublicMap-mapsList">
|
||||
<% @more_visualizations.each do |vis| %>
|
||||
<li class="MapsList-item">
|
||||
<div class="MapCard" data-vis-id="<%= vis.id %>" data-vis-owner-name="<%= vis.user.username %>">
|
||||
<a href="<%= CartoDB.url(self, 'public_visualizations_public_map', params: { id: vis.id }, user: vis.user) %>" class="MapCard-header js-header">
|
||||
<div class="MapCard-loader"></div>
|
||||
</a>
|
||||
<div class="MapCard-content MapCard-content--compact">
|
||||
<div class="MapCard-contentBody">
|
||||
<div class="MapCard-contentBodyRow MapCard-contentBodyRow--flex">
|
||||
<h3 class="MapCard-title DefaultTitle CDB-Text is-semibold CDB-Size-large">
|
||||
<a href="<%= CartoDB.url(self, 'public_visualizations_public_map', params: { id: vis.id }, user: vis.user) %>" class="DefaultTitle-link u-ellipsLongText" title="<%= vis.name %>"><%= vis.name %></a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="MapCard-contentFooterTimeDiff DefaultTimeDiff CDB-Text CDB-Size-medium u-altTextColor">
|
||||
<i class="CDB-IconFont CDB-IconFont-clock DefaultTimeDiff-icon"></i>
|
||||
<%= time_ago_in_words(vis.updated_at) %> ago
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<%# at most 3 cards per line, visbility is handled by CSS depending on viewport size %>
|
||||
<% ((3 - @more_visualizations.count + 3) % 3).times.each do %>
|
||||
<li class="MapsList-item MapsList-item--fake">
|
||||
<div class="MapCard">
|
||||
<div class="MapCard-header MapCard-header--fake"></div>
|
||||
<div class="MapCard-content MapCard-content--compact"></div>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if cartodb_com_hosted? %>
|
||||
<%= render 'admin/shared/footer', :light => true %>
|
||||
<% else %>
|
||||
<%= render 'admin/shared/public_footer', :light => false %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= content_for(:js) do %>
|
||||
<%= insert_trackjs('embeds', Cartodb.get_config(:trackjs, 'frequency')) %>
|
||||
|
||||
<% if @visualization.map.provider == 'googlemaps' %>
|
||||
<%= insert_google_maps(@google_maps_query_string) %>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
function get_url_params(conversion) {
|
||||
conversion = conversion || {};
|
||||
|
||||
var tokens = location.search.slice(1).split('&');
|
||||
var params = {};
|
||||
|
||||
for (var i = 0; i < tokens.length; ++i) {
|
||||
|
||||
var tk = tokens[i].split('=');
|
||||
var fn = conversion[tk[0]] || function(v) { return v };
|
||||
|
||||
if (tk.length === 2) {
|
||||
params[tk[0]] = fn(decodeURIComponent(tk[1]));
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
var user_name = '<%= @user_domain %>';
|
||||
var owner_username = '<%= @visualization.user.username %>';
|
||||
var base_url = '<%= @visualization.user.public_url(nil, request.protocol == 'https://' ? 'https' : 'http') %>';
|
||||
var vis_id = "<%= @visualization.id %>";
|
||||
var vis_name = "<%= @visualization.name %>";
|
||||
var belong_organization = <%= @visualization.user.has_organization? %>;
|
||||
var config = <%= safe_js_object frontend_config_public({https_apis: request.protocol == 'https://' }) %>;
|
||||
var vizdata = <%= safe_js_object @visualization.to_vizjson({https_request: request.protocol == 'https://'}).to_json %>;
|
||||
var login_url = "<%= CartoDB.url(self, 'login') %>";
|
||||
|
||||
// Generating map options
|
||||
var bool_fn = function(v) { return v == 'true' };
|
||||
var is_custom_install = <%= Cartodb.config[:cartodb_com_hosted].present? %>;
|
||||
var logo_fn = function(v) { return ( <%= !@visualization.user.remove_logo? %> || is_custom_install ) ? true : v == 'true' };
|
||||
var layer_fn = function(v) {
|
||||
if (!v || !v.length) {
|
||||
return null;
|
||||
}
|
||||
return _.map(v.split("|"), function(v) {
|
||||
return { visible: !!parseInt(v, 10) }
|
||||
});
|
||||
};
|
||||
|
||||
var map_options = get_url_params({
|
||||
'search': bool_fn,
|
||||
'title': bool_fn,
|
||||
'description': bool_fn,
|
||||
'shareable': bool_fn,
|
||||
'fullscreen': bool_fn,
|
||||
'cartodb_logo': bool_fn,
|
||||
'scrollwheel': bool_fn,
|
||||
'sublayer_options': layer_fn,
|
||||
'layer_selector': bool_fn,
|
||||
'legends': bool_fn
|
||||
});
|
||||
|
||||
<% if (@visualization.password_protected? or @visualization.is_privacy_private?) and @protected_map_tokens %>
|
||||
map_options.auth_token = [];
|
||||
<% @protected_map_tokens.each do |token| %>
|
||||
map_options.auth_token.push('<%= token %>');
|
||||
<% end %>
|
||||
map_options.https = true; // when auth_token is used tiles should be fetch using https
|
||||
<% end %>
|
||||
|
||||
<% if Rails.env.development? || Cartodb.config[:no_cdn] == true %>
|
||||
map_options.no_cdn = true;
|
||||
<% end %>
|
||||
|
||||
// Description and title should be hidden
|
||||
// because we already have that info
|
||||
map_options.description = false;
|
||||
map_options.title = false;
|
||||
// Logo MUST be hidden in this view
|
||||
map_options.cartodb_logo = false;
|
||||
// Fullscreen button should be hidden
|
||||
// because we already have a full page button
|
||||
map_options.fullscreen = false;
|
||||
map_options.scrollwheel = false;
|
||||
map_options.mobile_layout = true;
|
||||
|
||||
</script>
|
||||
|
||||
<%= editor_javascript_include_tag 'cdb.js', 'templates.js', 'public_map_deps', 'public_map' %>
|
||||
|
||||
<script>
|
||||
|
||||
$(function() {
|
||||
<% if Cartodb.config[:graphite_public] %>
|
||||
if (location.protocol.indexOf('https') === -1) {
|
||||
jQuery.getScript('<%= javascript_path "statsc.js" %>', function(ready) {
|
||||
statsc.connect('http://<%= Cartodb.config[:graphite_public]['host'] %>:<%= Cartodb.config[:graphite_public]['port'] %>/');
|
||||
cartodb.core.Profiler.backend(function () {
|
||||
statsc.send.apply(statsc, arguments);
|
||||
})
|
||||
// stop sending stats after 11 seconds
|
||||
// statsc send stats in 5 secs interval so allow to send at least twice
|
||||
setTimeout(function() {
|
||||
cartodb.core.Profiler.backend(null);
|
||||
}, 11*1000);
|
||||
})
|
||||
}
|
||||
<% end %>
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<% end %>
|
||||
@@ -0,0 +1,27 @@
|
||||
<%= content_for(:title) do %>
|
||||
Protected map
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:header_title) do %>
|
||||
This map is protected with password
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:password_form) do %>
|
||||
<%= form_tag(CartoDB.url(self, 'protected_public_map', params: { :protocol => Rails.env.development? ? 'http' : 'https'}) + '?' + request.query_string, { :method => 'POST', :authenticity_token => false}) do %>
|
||||
|
||||
<div class='PublicPage-field-withTooltip'>
|
||||
<%= password_field_tag 'password', params[:password], class: "PublicPage-form--inputText RoundBorders-all CDB-Text CDB-Size-medium is-light u-whiteTextColor #{ flash[:error].present? ? 'is-alert' : ''}", placeholder: 'Insert your password'%>
|
||||
|
||||
<%- if flash[:error].present? %>
|
||||
<div class="PublicPage-inputTooltip CDB-InfoTooltip CDB-InfoTooltip--left u-lSpace--xl is-error">
|
||||
<p class='CDB-Text CDB-Size-medium CDB-InfoTooltip-text'><%= flash[:error] %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:ua) do %>
|
||||
primary
|
||||
<% end %>
|
||||
@@ -0,0 +1,26 @@
|
||||
<% content_for(:page_title) do %>
|
||||
<%= @visualization.name %> |
|
||||
<% end %>
|
||||
|
||||
<% content_for(:css) do %>
|
||||
<%= editor_stylesheet_link_tag 'old_common_without_core.css', 'common.css', 'cdb.css', 'table.css', 'editor.css', 'map.css', :media => 'all' %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript" id="dropboxjs" src="//www.dropbox.com/static/api/1/dropins.js" data-app-key="<%= Cartodb.config[:dropbox_api_key] %>"></script>
|
||||
<script>
|
||||
var vis_data = <%= safe_js_object @visualization.to_hash.to_json %>;
|
||||
var user_data = <%= safe_js_object current_user.data({ show_api_calls: false }).to_json %>;
|
||||
var config = <%= safe_js_object frontend_config %>;
|
||||
var map_data = <%= safe_js_object @visualization.map.public_values.to_json %>;
|
||||
var basemaps = <%=raw Cartodb.config[:basemaps].present? ? Cartodb.config[:basemaps].to_json.html_safe: 'null' %>;
|
||||
var authTokens = <%= safe_js_object @auth_tokens.to_json %>;
|
||||
</script>
|
||||
|
||||
<% content_for(:js) do %>
|
||||
<% if !@google_maps_query_string.blank? %>
|
||||
<%= insert_google_maps(@google_maps_query_string) %>
|
||||
<% end %>
|
||||
<%= editor_javascript_include_tag 'cdb.js','models.js', 'templates.js', 'templates_mustache.js', 'table.js', 'editor.js' %>
|
||||
<% end %>
|
||||
|
||||
<div class="panes"></div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user