Skip to content

Commit

Permalink
Merge master into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVelarde committed Jul 5, 2018
2 parents 36c5e87 + 1d7aa24 commit dfc02ec
Show file tree
Hide file tree
Showing 57 changed files with 453 additions and 210 deletions.
48 changes: 39 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ var _ = require('underscore');
var timer = require('grunt-timer');
var semver = require('semver');
var jasmineCfg = require('./lib/build/tasks/jasmine.js');
var execSync = require('child_process').execSync;
var shrinkwrapDependencies = require('./lib/build/tasks/shrinkwrap-dependencies.js');
var webpackTask = null;
var EDITOR_ASSETS_VERSION = require('./config/editor_assets_version.json').version;

var REQUIRED_NODE_VERSION = '6.9.2';
var REQUIRED_NPM_VERSION = '3.10.9';
Expand All @@ -24,6 +26,12 @@ var SHRINKWRAP_MODULES_TO_VALIDATE = [
'turbo-carto'
];

// Synchronously check if editor assets have changed
var diff = execSync('git diff --numstat $(git rev-list --tags --skip=1 --max-count=1) -- $(git symbolic-ref --short HEAD) config/editor_assets_version.json', {
cwd: __dirname
});
var EDITOR_ASSETS_CHANGED = diff.toString().length > 0;

function requireWebpackTask () {
if (webpackTask === null) {
webpackTask = require('./lib/build/tasks/webpack/webpack.js');
Expand Down Expand Up @@ -110,6 +118,7 @@ module.exports = function (grunt) {
var PUBLIC_DIR = './public/';
var ROOT_ASSETS_DIR = './public/assets/';
var ASSETS_DIR = './public/assets/<%= pkg.version %>';
var EDITOR_ASSETS_DIR = `./public/assets/editor/${EDITOR_ASSETS_VERSION}`;

/**
* this is being used by `grunt --environment=production release`
Expand Down Expand Up @@ -138,6 +147,8 @@ module.exports = function (grunt) {

public_dir: PUBLIC_DIR,
assets_dir: ASSETS_DIR,
editor_assets_dir: EDITOR_ASSETS_DIR,
editor_assets_version: EDITOR_ASSETS_VERSION,
root_assets_dir: ROOT_ASSETS_DIR,

// Concat task
Expand Down Expand Up @@ -384,9 +395,23 @@ module.exports = function (grunt) {
*/
grunt.registerTask('release', [
'check_release',
'build',
'build-static',
'npm-build',
'compress',
's3',
's3:js',
's3:css',
's3:images',
's3:fonts',
's3:flash',
's3:favicons',
's3:unversioned',
's3:static_pages',
'invalidate'
]);

grunt.registerTask('release_editor_assets', 'builds & uploads editor assets', [
'build-editor',
's3:frozen',
'invalidate'
]);

Expand Down Expand Up @@ -414,14 +439,9 @@ module.exports = function (grunt) {
requireWebpackTask().compile.call(this, 'dashboard_specs');
});

/**
* `grunt test`
*/
grunt.registerTask('test', '(CI env) Re-build JS files and run all tests. For manual testing use `grunt jasmine` directly', [
var testTasks = [
'connect:test',
'beforeDefault',
'js_editor',
'jasmine:cartodbui',
'generate_builder_specs',
'bootstrap_webpack_builder_specs',
'webpack:builder_specs',
Expand All @@ -431,7 +451,17 @@ module.exports = function (grunt) {
'webpack:dashboard_specs',
'jasmine:dashboard',
'lint'
]);
];

// If the editor assets version has changed, add the editor tests
if (EDITOR_ASSETS_CHANGED) {
testTasks.splice(testTasks.indexOf('generate_builder_specs'), 0, 'js_editor', 'jasmine:cartodbui');
}

/**
* `grunt test`
*/
grunt.registerTask('test', '(CI env) Re-build JS files and run all tests. For manual testing use `grunt jasmine` directly', testTasks);

/**
* `grunt test:browser` compile all Builder specs and launch a webpage in the browser.
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ This release introduces a new API Key system. In order to migrate existing users

### Bug fixes / enhancements
* Fix wrong style after creating a feature (https://github.com/CartoDB/cartodb/issues/13680)
* Fix bug computing next page in datasets (https://github.com/CartoDB/cartodb/issues/14138)
* Move to the last page after adding a row (https://github.com/CartoDB/cartodb/issues/10720)
* Fix pagination after deleting a row (https://github.com/CartoDB/cartodb/issues/9868)
* Fix Widget view click (https://github.com/CartoDB/cartodb/issues/13409)
* Improve style for Analysis modal blocks (https://github.com/CartoDB/cartodb/issues/13361)
* Use ellipsis for widgets title (https://github.com/CartoDB/cartodb/issues/13332)
* Fix dark menu links (https://github.com/CartoDB/cartodb/issues/11257)
* Fix legend editor margin (https://github.com/CartoDB/cartodb/issues/13338)
* Fix slider width for point/stroke size (https://github.com/CartoDB/support/issues/1641)
* Fix gradient legends margin (https://github.com/CartoDB/support/issues/1640)
* Fix drag new layer from Torque source (https://github.com/CartoDB/support/issues/1625)
* Fix custom carousel item select event (https://github.com/CartoDB/cartodb/issues/14070)
* Fix gaps in tiles (https://github.com/CartoDB/support/issues/1362)
Expand Down Expand Up @@ -60,6 +70,7 @@ This release introduces a new API Key system. In order to migrate existing users
* Triggering ghost tables and common data when visiting the dashboard (#14010)

### Internals
* Add `internal-carto.js` to transpilation process in Webpack (https://github.com/CartoDB/cartodb/pull/14117)
* Create a new JS bundle for Lockout page (https://github.com/CartoDB/cartodb/issues/14019)
* Update to Webpack 4, move CSS processing from Grunt to Webpack (https://github.com/CartoDB/cartodb/pull/14033)

Expand Down Expand Up @@ -703,6 +714,7 @@ ion for time-series (#12670)
* Fix bugs in legends (https://github.com/CartoDB/support/issues/1339, )

### Internals
* Editor assets are frozen now (#14090)
* Added specs for the migrated dashboard (#14037)
* Profile and Account pages are now static and served via NGINX in production/staging enviroment (#13958)
* CARTO.js internal version is now called internal-carto.js (#13960)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/carto/admin/mobile_apps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def get_default_avatar
if Cartodb.asset_path
"#{Cartodb.asset_path}/assets/unversioned/images/avatars/mobile_app_default_avatar.png"
else
"#{relative_url_root}/images/avatars/mobile_app_default_avatar.png"
"#{relative_url_root}/#{frontend_version}/images/avatars/mobile_app_default_avatar.png"
end
end

Expand Down
58 changes: 52 additions & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,63 @@ def insert_google_maps(query_string)
render(partial: 'shared/google_maps', locals: { query_string: query_string })
end

def sources_with_path(asset_type, sources)
path = if sources.first == :editor
sources.shift
"editor/#{editor_assets_version}"
else
frontend_version
end

raise_on_asset_absence sources

sources_with_prefix("/#{path}/#{asset_type}/", sources)
end

def sources_with_prefix(path, sources)
options = sources.extract_options!.stringify_keys
with_full_path = []
sources.each do |source|
with_full_path << path + source
end

with_full_path << options
end

##
# Checks that the precompile list contains this file or raises an error, in dev only
# Note: You will need to move config.assets.precompile to application.rb from production.rb
def javascript_include_tag *sources
raise_on_asset_absence sources
super *sources

def javascript_include_tag(*sources)
super *sources_with_path('javascripts', sources)
end

def stylesheet_link_tag *sources
raise_on_asset_absence sources
super *sources
def stylesheet_link_tag(*sources)
super *sources_with_path('stylesheets', sources)
end

def image_path(source, editor = false)
if editor
super "/editor/#{editor_assets_version}/images/#{source}"
else
super "/#{frontend_version}/images/#{source}"
end
end

def editor_image_path(source)
image_path(source, true)
end

def favicon_link_tag(source)
super "/#{frontend_version}/#{source}"
end

def editor_stylesheet_link_tag(*sources)
stylesheet_link_tag *([:editor] + sources)
end

def editor_javascript_include_tag(*sources)
javascript_include_tag *([:editor] + sources)
end

def raise_on_asset_absence *sources
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/client_applications/api_key.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<% if @has_new_dashboard %>
<%= stylesheet_link_tag 'api_keys_new', :media => 'all' %>
<% else %>
<%= stylesheet_link_tag 'api_keys', :media => 'all' %>
<%= editor_stylesheet_link_tag 'api_keys', :media => 'all' %>
<% end %>
<% end %>
Expand Down Expand Up @@ -49,5 +49,5 @@
<% if @has_new_dashboard %>
<%= javascript_include_tag 'common', 'common_vendor', 'api_keys_new' %>
<% else %>
<%= javascript_include_tag 'cdb.js', 'models.js', 'keys_templates.js', 'keys_deps.js', 'keys.js' -%>
<%= editor_javascript_include_tag 'cdb.js', 'models.js', 'keys_templates.js', 'keys_deps.js', 'keys.js' -%>
<% end %>
2 changes: 1 addition & 1 deletion app/views/admin/client_applications/oauth.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var user_data = <%= safe_js_object current_user.data.to_json %>;
var upgrade_url = "<%= current_user.upgrade_url(request.protocol) %>";
</script>
<%= javascript_include_tag 'cdb.js', 'models.js', 'keys_templates.js', 'keys_deps.js', 'keys.js' -%>
<%= 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' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/visualizations/embed_map_error.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Embed error | CARTO</title>
<%= stylesheet_link_tag 'password_protected.css' %>
<%= editor_stylesheet_link_tag 'password_protected.css' %>
<%= insert_google_tag_manager('embeds') %>
</head>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
.cartodb-text span.username { text-decoration:underline }
/* likes */
.cartodb-text .like { float: right; display:inline-block; *display:inline; vertical-align:middle; zoom:1; text-decoration: none; color: #666; }
.cartodb-text .like .icon { display:inline-block; *display:inline; vertical-align:middle; zoom:1; position:relative; top: -1px; width: 14px; height: 14px; background-image:url('<%= image_path "layout/heart.png" %>'); background-size: 14px 14px; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); }
.cartodb-text .like.is-highlighted .icon { background-image:url('<%= image_path "layout/heart_highlighted.png" %>'); background-size: 14px 14px; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); }
.cartodb-text .like .icon { display:inline-block; *display:inline; vertical-align:middle; zoom:1; position:relative; top: -1px; width: 14px; height: 14px; background-image:url('<%= editor_image_path "layout/heart.png" %>'); background-size: 14px 14px; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); }
.cartodb-text .like.is-highlighted .icon { background-image:url('<%= editor_image_path "layout/heart_highlighted.png" %>'); background-size: 14px 14px; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); }
.cartodb-text .like .icon.is-animated { -ms-animation-duration: 400ms; -webkit-animation-duration: 400ms; animation-duration: 400ms; -webkit-animation-fill-mode: both; -ms-animation-fill-mode: both; animation-fill-mode: both; animation-timing-function: ease-in; -webkit-animation-timing-function: ease-in; }
@-webkit-keyframes pulse { 0% { -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); } 25% { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } 50% { -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5); } 75% { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } 100% { -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); } }
@keyframes pulse { 0% { -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); } 25% { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } 50% { -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5); } 75% { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } 100% { -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7); } }
Expand All @@ -23,9 +23,9 @@
#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('<%= image_path "layout/safari.png" %>');}
#not_supported_dialog a.chrome {background-image:url('<%= image_path "layout/chrome.png" %>');}
#not_supported_dialog a.firefox {background-image:url('<%= image_path "layout/firefox.png" %>');}
#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; }
Expand All @@ -49,4 +49,4 @@

</style>

<%= stylesheet_link_tag 'cartodb.css' %>
<%= editor_stylesheet_link_tag 'cartodb.css' %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= insert_google_maps(@visualization.user.google_maps_query_string) %>
<% end %>
<%= javascript_include_tag 'embed.js', 'public_like.js' %>
<%= editor_javascript_include_tag 'embed.js', 'public_like.js' %>

<script>

Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/visualizations/public_dataset.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<% if @has_new_dashboard %>
<%= stylesheet_link_tag 'common_new', 'public_table_new', 'public_map_new' %>
<% else %>
<%= stylesheet_link_tag 'cartodb', 'common', 'public_table', 'public_map' %>
<%= editor_stylesheet_link_tag 'cartodb', 'common', 'public_table', 'public_map' %>
<% end %>
<% end %>
Expand All @@ -23,7 +23,7 @@
<% if @has_new_dashboard %>
<%= javascript_include_tag 'common', 'common_vendor', 'public_table_new' %>
<% else %>
<%= javascript_include_tag 'cdb.js', 'templates.js', 'public_map_deps', 'new_public_table', 'public_table.js' %>
<%= editor_javascript_include_tag 'cdb.js', 'templates.js', 'public_map_deps', 'new_public_table', 'public_table.js' %>
<% end %>

<script>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/visualizations/public_map.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<%= content_for(:body_class) do %> PublicMap <% end %>
<%= content_for(:css) do %>
<%= stylesheet_link_tag 'cartodb', 'common', 'public_map' %>
<%= editor_stylesheet_link_tag 'cartodb', 'common', 'public_map' %>
<% end %>
<%= content_for(:content) do %>
Expand Down Expand Up @@ -399,7 +399,7 @@

</script>

<%= javascript_include_tag 'cdb.js', 'templates.js', 'public_map_deps', 'public_map' %>
<%= editor_javascript_include_tag 'cdb.js', 'templates.js', 'public_map_deps', 'public_map' %>

<script>

Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/visualizations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% end %>
<% content_for(:css) do %>
<%= stylesheet_link_tag 'old_common_without_core.css', 'common.css', 'cdb.css', 'table.css', 'editor.css', 'map.css', :media => 'all' %>
<%= 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>
Expand All @@ -20,7 +20,7 @@
<% if !@google_maps_query_string.blank? %>
<%= insert_google_maps(@google_maps_query_string) %>
<% end %>
<%= javascript_include_tag 'cdb.js','models.js', 'templates.js', 'templates_mustache.js', 'table.js', 'editor.js' %>
<%= editor_javascript_include_tag 'cdb.js','models.js', 'templates.js', 'templates_mustache.js', 'table.js', 'editor.js' %>
<% end %>

<div class="panes"></div>
2 changes: 1 addition & 1 deletion app/views/carto/builder/public/embeds/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<%= javascript_include_tag 'common', 'common_vendor', 'builder_embed' %>
<% if Cartodb.get_config(:graphite_public, 'host') %>
<%= javascript_include_tag "statsc.js" %>
<%= editor_javascript_include_tag "statsc.js" %>
<% end %>
<script>
(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Protected map — CARTO</title>
<%= stylesheet_link_tag 'password_protected.css' %>
<%= editor_stylesheet_link_tag 'password_protected.css' %>
</head>

<body class='PublicPage-body PublicPage-background--navyBlue'>
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<head>
<meta charset='utf-8' />
<title><%= yield :page_title -%>CARTO</title>
<%= favicon_link_tag "/favicons/favicon.ico" -%>
<%= favicon_link_tag "favicons/favicon.ico" %>
<% if current_user.builder_enabled? %>
<%= stylesheet_link_tag 'common_new.css', :media => 'all' %>
<% else %>
<%= stylesheet_link_tag 'cartodb.css', 'common.css', :media => 'all' %>
<%= editor_stylesheet_link_tag 'cartodb.css', 'common.css', :media => 'all' %>
<% end %>
<%= yield :css -%>
<%= csrf_meta_tag -%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application_builder.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset='utf-8' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= yield :page_title -%>CARTO</title>
<%= favicon_link_tag "/favicons/favicon.ico" -%>
<%= favicon_link_tag "favicons/favicon.ico" -%>
<%= stylesheet_link_tag 'common_editor3', 'editor3', 'deep_insights_new', :media => 'all' %>
<%= csrf_meta_tag -%>
<%= insert_google_tag_manager('primary') %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application_password_layout.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title><%= yield :title %> | CARTO</title>
<%= favicon_link_tag "/favicons/favicon.ico" %>
<%= stylesheet_link_tag 'password_protected.css' %>
<%= favicon_link_tag "favicons/favicon.ico" %>
<%= editor_stylesheet_link_tag 'password_protected.css' %>
<%= insert_google_tag_manager('embeds') %>
</head>

Expand Down

0 comments on commit dfc02ec

Please sign in to comment.