Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.0.0 #733

Merged
merged 2 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ AllCops:
Exclude:
# All Instagram-related code is deprecated and will be removed
- /**/**/instagram*
# All Search Consumer code is deprecated and will be removed
- app/api/search_consumer/**/*
- app/controllers/sites/templated_font_and_colors_controller.rb
- app/controllers/sites/templates_controller.rb

Style/LambdaCall:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ group :development, :test do
gem 'faker', '~> 1.8'
gem 'pry-rails', '~> 0.3.6'
gem 'awesome_print'
gem 'puma', '~> 3.12'
gem 'puma', '~> 5.3'
end

group :test do
Expand Down
9 changes: 5 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ GEM
bcrypt (3.1.16)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
bindata (2.4.9)
bindata (2.4.10)
buftok (0.2.0)
builder (3.2.4)
byebug (11.1.3)
Expand Down Expand Up @@ -496,7 +496,7 @@ GEM
net-http-persistent (2.9.4)
newrelic_rpm (5.0.0.342)
nio4r (2.5.7)
nokogiri (1.11.3)
nokogiri (1.11.5)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
omniauth (1.4.3)
Expand Down Expand Up @@ -529,7 +529,8 @@ GEM
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (3.1.1)
puma (3.12.6)
puma (5.3.1)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.5.2)
rack (2.2.3)
Expand Down Expand Up @@ -880,7 +881,7 @@ DEPENDENCIES
poltergeist (~> 1.18.1)
pry-byebug (~> 3.5)
pry-rails (~> 0.3.6)
puma (~> 3.12)
puma (~> 5.3)
rack-contrib (~> 2.1.0)
rack-cors (~> 1.1.0)
rails (~> 5.2.0)
Expand Down
46 changes: 0 additions & 46 deletions app/assets/javascripts/sites/edit_font_and_colors_form.js.coffee
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
isShowBoxShadow = () ->
$('#site_css_property_hash_show_content_box_shadow').prop 'checked'

setBoxShadow = (selector, shadow) ->
$selector = $(selector)
$selector.css '-webkit-box-shadow', shadow
$selector.css '-moz-box-shadow', shadow
$selector.css 'box-shadow', shadow

changeBoxShadow = (e) ->
$this = $(e.target)
targetSelector = $this.attr 'data-target-selector'

if isShowBoxShadow()
shadow = "0 0 5px #{e.color.toHex()}"
else
shadow = '0 0 0'

setBoxShadow targetSelector, shadow

changeColor = (e) ->
$this = $(this)
$colorInputField = $this.find('input[type="text"]')[0]
if $colorInputField.id == 'site_css_property_hash_content_box_shadow_color'
changeBoxShadow e
return
targetSelector = $this.attr 'data-target-selector'
targetCssProperties = $this.attr('data-target-css-properties').split /,\s+/
$(targetSelector).css targetCssProperty, e.color.toHex() for targetCssProperty in targetCssProperties
Expand Down Expand Up @@ -83,26 +60,3 @@ $(document).on 'change', '#site_css_property_hash_font_family', (e) ->
fontFamilyName = $(this).val()
fontFamilyName = $('.font-colors-wrapper').data('defaultFontFamily') if fontFamilyName == 'Default'
changeCssProperty e, fontFamilyName

showOrHideContentBorder = (e, isShowContentBorder) ->
targetSelector = $(e.target).attr 'data-target-selector'
if isShowContentBorder
$(targetSelector).addClass 'serp-content-show-border'
else
$(targetSelector).removeClass 'serp-content-show-border'

$(document).on 'change', '#site_css_property_hash_show_content_border', (e) ->
isShowContentBorder = $(this).prop('checked')
showOrHideContentBorder e, isShowContentBorder

showOrHideBoxShadow = () ->
$colorInputField = $('#site_css_property_hash_content_box_shadow_color')
color = $colorInputField.val()
contentSelector = '#legacy-preview-font-colors .serp-content'
if isShowBoxShadow() and isValidColor(color)
setBoxShadow contentSelector, "0 0 5px #{color}"
else if !isShowBoxShadow()
setBoxShadow contentSelector, '0 0 0'

$(document).on 'change', '#site_css_property_hash_show_content_box_shadow', showOrHideBoxShadow

68 changes: 0 additions & 68 deletions app/assets/stylesheets/sites/_display.less
Original file line number Diff line number Diff line change
Expand Up @@ -91,70 +91,6 @@
}
}

#legacy-preview-font-colors {
margin-bottom: 10px;

.serp-content {
.border-top-radius(@baseBorderRadius);
.clearfix();
border-style: solid;
border-width: 0;
margin: 0 15px;
padding: 10px;
position: relative;

&.serp-content-show-border {
border-width: 1px;
margin: 10px 15px 0;
}
}

.serp-search-box input[type='text'] {
width: 153px;
}

.serp-sidebar {
float: left;
line-height: 1.3;
margin-right: 10px;
}

.serp-sidebar-item-active {
font-weight: bold;
}

.serp-results {
float: left;
}

.serp-result {
margin-bottom: 10px;
}

.serp-result-title {
text-decoration: underline;
line-height: 1.1;
}

.serp-result-description, .serp-result-url {
font-size: (@baseFontSize * 0.8);
line-height: 1.2;
}

.serp-footer-button {
height: 15px;
padding: 5px;
position: absolute;
right: -10px;
bottom: 0;
width: 15px;

.caret {
border-width: 8px;
}
}
}

#preview-font-colors {
border: 1px solid @siteNavBorderColor;
clear: both;
Expand Down Expand Up @@ -267,7 +203,3 @@
.off-screen-text();
}
}

#validator-form {
.hide();
}
4 changes: 0 additions & 4 deletions app/controllers/sites/font_and_colors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def site_params
{
css_property_hash: %i[
content_background_color
content_border_color
content_box_shadow_color
description_text_color
font_family
footer_background_color
Expand All @@ -37,8 +35,6 @@ def site_params
page_background_color
search_button_background_color
search_button_text_color
show_content_border
show_content_box_shadow
title_link_color
url_link_color
visited_title_link_color
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# deprecated - Search Consumer
class Sites::TemplatedFontAndColorsController < Sites::SetupSiteController
def edit

Expand Down
1 change: 1 addition & 0 deletions app/controllers/sites/templates_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# deprecated - Search Consumer
class Sites::TemplatesController < Sites::SetupSiteController
def edit
end
Expand Down
64 changes: 4 additions & 60 deletions app/helpers/css_properties_helper.rb
Original file line number Diff line number Diff line change
@@ -1,70 +1,14 @@
module CssPropertiesHelper
def preview_page_css_hash(css_property_hash)
internal_name_css_hash = { page_background_color: 'background-color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_content_class_hash(site)
site.show_content_border? ? { class: 'serp-content-show-border' } : {}
end

def preview_content_css_hash(site)
internal_name_css_hash = { content_background_color: 'background-color',
content_border_color: 'border-color' }
hash = style_hash(site.css_property_hash, internal_name_css_hash)
if site.show_content_box_shadow?
hash[:style] << box_shadow_css_style(
site_css_property(site.css_property_hash, :content_box_shadow_color))
end
hash
end

def box_shadow_css_style(color)
shadow = "0 0 5px #{color}"
style = "-webkit-box-shadow: #{shadow};"
style << "-moz-box-shadow: #{shadow};"
style << "box-shadow: #{shadow};"
style
end
# frozen_string_literal: true

module CssPropertiesHelper
def preview_search_button_css_hash(css_property_hash)
internal_name_css_hash = { search_button_background_color: %w(background-color border-color),
internal_name_css_hash = { search_button_background_color: %w[background-color border-color],
search_button_text_color: 'color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_results_css_hash(css_property_hash)
internal_name_css_hash = { font_family: 'font-family' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_active_sidebar_item_css_hash(css_property_hash)
internal_name_css_hash = { left_tab_text_color: 'color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_result_title_css_hash(css_property_hash)
internal_name_css_hash = { title_link_color: 'color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_visited_result_title_css_hash(css_property_hash)
internal_name_css_hash = { visited_title_link_color: 'color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_result_url_css_hash(css_property_hash)
internal_name_css_hash = { url_link_color: 'color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def preview_description_css_hash(css_property_hash)
internal_name_css_hash = { description_text_color: 'color' }
style_hash(css_property_hash, internal_name_css_hash)
end

def style_hash(css_property_hash, internal_name_css_hash)
style = ''
style = +''
internal_name_css_hash.each do |internal_name, css_properties|
css_value = site_css_property(css_property_hash, internal_name)
css_properties = [css_properties] unless css_properties.respond_to?(:each)
Expand Down
14 changes: 1 addition & 13 deletions app/models/affiliate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ def make_unavailable(template_ids)
THEMES = ActiveSupport::OrderedHash.new
THEMES[:default] = {
content_background_color: '#FFFFFF',
content_border_color: '#CACACA',
content_box_shadow_color: '#555555',
description_text_color: '#000000',
footer_background_color: '#DFDFDF',
footer_links_text_color: '#000000',
Expand All @@ -240,9 +238,7 @@ def make_unavailable(template_ids)
header_tagline_font_family: HeaderTaglineFontFamily::DEFAULT,
header_tagline_font_size: '1.3em',
header_tagline_font_style: 'italic',
logo_alignment: LogoAlignment::DEFAULT,
show_content_border: '0',
show_content_box_shadow: '0'
logo_alignment: LogoAlignment::DEFAULT
}.merge(THEMES[:default])

CUSTOM_INDEXING_LANGUAGES = %w(en es)
Expand Down Expand Up @@ -360,14 +356,6 @@ def normalize_site_domains
all_site_domains.each { |domain| domain.destroy unless domain.valid? }
end

def show_content_border?
css_property_hash[:show_content_border] == '1'
end

def show_content_box_shadow?
css_property_hash[:show_content_box_shadow] == '1'
end

def refresh_indexed_documents(scope)
indexed_documents.select(:id).send(scope.to_sym).find_in_batches(:batch_size => batch_size(scope)) do |batch|
Resque.enqueue_with_priority(:low, AffiliateIndexedDocumentFetcher, id, batch.first.id, batch.last.id, scope)
Expand Down
Loading