249 lines
12 KiB
Plaintext
249 lines
12 KiB
Plaintext
|
<% 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(@visualization.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="https://www.mozilla.org/en-US/firefox/" 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 %>
|