Skip to content

Commit

Permalink
Update main (#506)
Browse files Browse the repository at this point in the history
* Node version fixed

* Remove package-lock.json

* package-lock.json removed

* Google ads conversion tracking second iteration.

* Preview param bug fix

* Ignore engines

* Removed comments.

---------

Co-authored-by: Alan Soto <[email protected]>
  • Loading branch information
JosueMagnus12 and AlanSoto31 authored Jan 22, 2024
1 parent e55f875 commit 4e10ab9
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 23,973 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
bin/rails db:prepare
- name: Install Node packages
run: |
bin/yarn install
bin/yarn install --ignore-engines
- name: Run tests
run: |
bundle exec rspec --fail-fast -exclude-pattern ./spec/system/admin_organization_system_spec.rb
Expand Down
1 change: 0 additions & 1 deletion app/components/navbar/component.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ nav id="main-navbar" data-controller="navbar--component" class="#{non_sticky_pat
= inline_svg_tag 'logo.svg', size:'130*32'
.navbar.navbar--desktop
ul class="flex items-center"
/ - raise
= link_to root_path
= inline_svg_tag 'logo.svg', size:'130*32', class:'mr-2 mid:mr-7 lg:mr-11'
div class="flex w-full"
Expand Down
27 changes: 10 additions & 17 deletions app/controllers/searches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,28 @@ class SearchesController < ApplicationController
skip_before_action :authenticate_user!

def show
if params['not_preview'].present?
set_search_pills_data
@search = params['search'].present? ? Search.new(create_params) : Search.new
@search.save
@pagy, @results = pagy(@search.results)
puts @search.errors.full_messages if @search.results.any?
else
unless request.referrer&.include? search_url
@search = Search.new
render '_preview', locals: { src: set_turbo_frame_src }
render '_preview'
end

set_search_pills_data
@search = params['search'].present? ? Search.new(create_params) : Search.new
@search.save
@pagy, @results = pagy(@search.results)
puts @search.errors.full_messages if @search.results.any?

authorize @search
end

def create_params
params.require(:search).permit(:distance, :city, :state, :lat, :lon,
:open_now, :open_weekends, :keyword, :not_preview,
:open_now, :open_weekends, :keyword,
:zipcode, causes: [], services: {}, beneficiary_groups: {})
end

private

def set_turbo_frame_src
if params['search'].present?
search_path(search: create_params, not_preview: true)
else
search_path(not_preview: true)
end
end

def set_search_pills_data
set_causes
set_services
Expand Down
12 changes: 12 additions & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ window.initMap = function (...args) {
event.args = args
window.dispatchEvent(event)
}

document.addEventListener("turbo:load", function (event) {
window.dataLayer = window.dataLayer || [];

function gtag() {
dataLayer.push(arguments);
}

gtag('js', new Date());
gtag('config', 'AW-11382454124');
gtag('event', 'conversion', { 'send_to': 'AW-11382454124/o0V1CIzO2O8YEOzuybMq' });
}, false);
5 changes: 0 additions & 5 deletions app/views/home/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
- content_for :head do
// Event snippet for Website traffic conversion page
javascript:
gtag('event', 'conversion', {'send_to': 'AW-11382454124/o0V1CIzO2O8YEOzuybMq'});
main
section class="relative bg-electric-teal hidden" data-controller="banner" data-banner-target="banner"
div class="flex max-w-3xl mx-auto py-7 md:py-8"
Expand Down
5 changes: 1 addition & 4 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
</script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-11382454124"></script>
<script>
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-11382454124');
</script>
<script src="https://www.googletagmanager.com/gtag/js?id=AW-11382454124" data-turbo-track="reload" async></script>
</head>

<body class="bg-gray-9">
Expand Down
4 changes: 2 additions & 2 deletions app/views/searches/_preview.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
controller: 'search modal', \
'search-target': 'form'}) do |f|
= render SearchBar::Component.new(form: f, search: @search)
= turbo_frame_tag "search-pills", src: local_assigns[:src] do
= turbo_frame_tag "search-pills", src: search_path() do
div class="w-full bg-gray-9"
div
div data-tabs-active-tab=("border-b-4 border-blue-medium")
Expand All @@ -33,7 +33,7 @@
| Advanced Filters
span class="relative hidden w-2 h-2 rounded-full bg-salmon ml-1 mb-2" id="appliedIcon"

= turbo_frame_tag "search-locations", src: local_assigns[:src] do
= turbo_frame_tag "search-locations", src: search_path() do
div class="md:flex w-full md:h-85vh" data-controller="tabs" data-tabs-active-tab="border-blue-dark bg-blue-dark text-white" data-tabs-inactive-tab="border-gray-6 bg-transparent text-gray-3"
div class="w-full md:border-r max-w-sm border-gray-7"
div class="fixed inset-0 flex items-center justify-center hidden min-h-screen overflow-y-auto animated fadeIn" data-action="click->modal#closeBackground keyup@window->modal#closeWithKeyboard" data-modal-target="container" style=("z-index: 9999;")
Expand Down
1 change: 0 additions & 1 deletion app/views/searches/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
= turbo_frame_tag "search-pills" do
= render SearchPills::Component.new(causes: @top_10_causes, services: @top_10_services, beneficiary_subcategories: @top_10_beneficiary_subcategories, params: params)
= turbo_frame_tag "search-locations" do
= hidden_field :not_preview, nil, value: true
div class="flex flex-row justify-center w-full md:h-85vh" data-controller="tabs" data-tabs-active-tab="border-blue-dark bg-blue-dark text-white" data-tabs-inactive-tab="border-gray-6 bg-transparent text-gray-3"
div class="flex flex-row justify-center w-full min-h-full"
div class="flex flex-col w-full md:border-r max-w-sm border-gray-7"
Expand Down
Loading

0 comments on commit 4e10ab9

Please sign in to comment.