Skip to content

Commit

Permalink
Remove likes and add favorites (#14618)
Browse files Browse the repository at this point in the history
Related #14619

This PR contains two important changes:

    * Deprecation of the "likes" feature where the users were able to like a map/table.

    * Add a new feature logic for the new dashboard called favorites
  • Loading branch information
ethervoid authored Feb 6, 2019
1 parent 87becae commit e0186a4
Show file tree
Hide file tree
Showing 149 changed files with 311 additions and 2,687 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Development
- None yet

### Features
- None yet
- Remove support for likes in favor of having favorites [#14618](https://github.com/CartoDB/cartodb/pull/14618))

### Bug fixes / enhancements
- Add base URL to lockout redirection in static pages ([#14617](https://github.com/CartoDB/cartodb/pull/14617))
Expand Down
4 changes: 0 additions & 4 deletions app/assets/stylesheets/common/dataset-card.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,4 @@ $sEditButtonSize: 50px;
.DatasetCard-contentFooter > *:not(:last-child) {
margin-right: 10px;
}

.DatasetCard-contentFooter .LikesIndicator-label {
display: none;
}
}
81 changes: 0 additions & 81 deletions app/assets/stylesheets/common/likes-indicator.css.scss

This file was deleted.

4 changes: 0 additions & 4 deletions app/assets/stylesheets/common/map-card.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,6 @@ $sEditButtonSize: 50px;
margin-right: 10px !important;
}

.MapCard-contentFooter .LikesIndicator-label {
display: none !important;
}

.MapCardIcon-label {
display: none;
}
Expand Down
5 changes: 0 additions & 5 deletions app/assets/stylesheets/common/navmenu.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
top: 3px;
}

.Navmenu-item.Navmenu-item--like {
position: relative;
top: 2px;
}

.Navmenu-item.Navmenu-item--withsep {
position: relative;
}
Expand Down
8 changes: 0 additions & 8 deletions app/assets/stylesheets/embed/embed_map.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ html, body, #app, #map, .embed-full-height {height: 100%; padding: 0; margin: 0;
.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 }
/* 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:image-url("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:image-url("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); } }
.cartodb-text .like .icon.is-pulsating { -webkit-animation-name: pulse; -ms-animation-name: pulse; animation-name: pulse; }

/* 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;}
Expand Down
7 changes: 1 addition & 6 deletions app/assets/stylesheets/explore/explore.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@
.FeedItem--card .FeedItem-avatar {
display: none;
}

.LikesIndicator-label {
display: none;
}
}

@media only screen and (max-width: 544px) {
Expand Down Expand Up @@ -119,8 +115,7 @@
display: block !important;
}

.FeedItem--card .FeedItem-avatar,
.LikesIndicator-label {
.FeedItem--card .FeedItem-avatar {
display: none;
}
}
116 changes: 0 additions & 116 deletions app/assets/stylesheets/public/public_map_info.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,122 +77,6 @@
}
}

.user-options .button.grey.like {
display: inline-block;
position: relative;
padding: 0 9px;
font-family: 'Arial';
font-size: 11px;
letter-spacing: 0;
line-height: 27px;
text-shadow: none;
text-transform: uppercase;
vertical-align: top;
}

.user-options .button.grey.like .icon {
display: inline-block;
position: relative;
top: -1px;
width: 14px;
height: 14px;
-webkit-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
background: image-url("layout/heart.png") no-repeat;
background-size: 14px 14px;
vertical-align: top;
}

.user-options .button.grey.like.is-highlighted .icon {
-webkit-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
background: image-url("layout/heart_highlighted.png") no-repeat;
background-size: 14px 14px;
}

.user-options .button.grey.like .icon.is-animated {
-ms-animation-duration: 400ms;
-webkit-animation-duration: 400ms;
animation-duration: 400ms;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-fill-mode: both;
-ms-animation-fill-mode: both;
animation-fill-mode: both;
}

@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
}

25% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}

50% {
-webkit-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
}

75% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}

100% {
-webkit-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
}
}

@keyframes pulse {
0% {
-webkit-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
}

25% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}

50% {
-webkit-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
}

75% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}

100% {
-webkit-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
}
}

.user-options .button.grey.like .icon.is-pulsating {
-webkit-animation-name: pulse;
-ms-animation-name: pulse;
animation-name: pulse;
}

// User info

.cartodb-info .inner .user {
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ def vis_item(vis)
tags: vis.tags,
updated_at: vis.updated_at,
owner: vis.user,
likes_count: vis.likes.count,
map_zoom: vis.map.zoom
}
end
Expand Down
10 changes: 0 additions & 10 deletions app/controllers/admin/visualizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ def public_table
@user_domain = user_domain_variable(request)

@visualization_id = @visualization.id
@is_liked = is_liked(@visualization)
@likes_count = @visualization.likes.count

@disqus_shortname = @visualization.user.disqus_shortname.presence || 'cartodb'
@public_tables_count = @visualization.user.public_table_count
Expand Down Expand Up @@ -275,9 +273,6 @@ def public_map
@public_tables_count = @visualization.user.public_table_count
@nonpublic_tables_count = @related_tables.select{|t| !t.public? }.count

@is_liked = is_liked(@visualization)
@likes_count = @visualization.likes.count

# We need to know if visualization logo is visible or not
@hide_logo = is_logo_hidden(@visualization, params)

Expand Down Expand Up @@ -590,11 +585,6 @@ def data_for(table, type, extension)
}
end

def is_liked(vis)
return false unless current_user.present?
vis.liked_by?(current_user.id)
end

def render_pretty_404
render(file: "public/404.html", layout: false, status: 404)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VisualizationPublicMapAdapter
}

delegate [
:type_slide?, :derived?, :organization, :organization?, :id, :likes,
:type_slide?, :derived?, :organization, :organization?, :id,
:password_protected?, :varnish_key, :related_tables, :password_valid?, :get_auth_tokens, :table, :name,
:overlays, :created_at, :updated_at, :description, :mapviews, :geometry_types, :privacy, :tags,
:surrogate_key, :has_password?, :total_mapviews, :is_viewable_by_user?, :is_accesible_by_user?,
Expand Down
9 changes: 3 additions & 6 deletions app/controllers/carto/api/visualization_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class VisualizationPresenter

def initialize(visualization, current_viewer, context,
related: true, related_canonical_visualizations: false, show_user: false,
show_stats: true, show_likes: true, show_liked: true, show_table: true,
show_stats: true, show_table: true, show_liked: true,
show_permission: true, show_synchronization: true, show_uses_builder_features: true,
show_table_size_and_row_count: true, show_auth_tokens: true, show_user_basemaps: false,
password: nil, with_dependent_visualizations: 0)
Expand All @@ -20,7 +20,6 @@ def initialize(visualization, current_viewer, context,
@load_related_canonical_visualizations = related_canonical_visualizations
@show_user = show_user
@show_stats = show_stats
@show_likes = show_likes
@show_liked = show_liked
@show_table = show_table
@show_permission = show_permission
Expand Down Expand Up @@ -62,7 +61,7 @@ def to_poro
end
end

poro[:liked] = @current_viewer ? @visualization.liked_by?(@current_viewer.id) : false if show_liked
poro[:liked] = @current_viewer ? @visualization.liked_by?(@current_viewer) : false if show_liked
poro[:permission] = permission if show_permission
poro[:stats] = show_stats ? @visualization.stats : {}

Expand Down Expand Up @@ -111,7 +110,6 @@ def to_private_poro
}

poro[:related_tables] = related_tables if related
poro[:likes] = @visualization.likes_count if show_likes
poro[:synchronization] = synchronization if show_synchronization
poro[:uses_builder_features] = @visualization.uses_builder_features? if show_uses_builder_features

Expand All @@ -134,7 +132,6 @@ def to_public_poro
title: @visualization.title,
kind: @visualization.kind,
privacy: @visualization.privacy.upcase,
likes: @visualization.likes_count
}
end

Expand Down Expand Up @@ -179,7 +176,7 @@ def qualified_visualization_id(schema = nil)
private

attr_reader :related, :load_related_canonical_visualizations, :show_user,
:show_stats, :show_likes, :show_liked, :show_table,
:show_stats, :show_table, :show_liked,
:show_permission, :show_synchronization, :show_uses_builder_features,
:show_table_size_and_row_count, :show_auth_tokens,
:show_user_basemaps, :with_dependent_visualizations
Expand Down
Loading

0 comments on commit e0186a4

Please sign in to comment.