Remove unused code to track events
We forgot to remove it in commit f28a5cc49.
The generated HTML was invalid, with the error:
> Element meta is missing one or more of the following attributes:
> content, property.
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
module TracksHelper
|
||||
def track_event(data = {})
|
||||
track_data = ""
|
||||
prefix = " data-track-event-"
|
||||
data.each do |key, value|
|
||||
track_data = "#{track_data}#{prefix}#{key}=#{value} "
|
||||
end
|
||||
content_for :track_event do
|
||||
track_data
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
<meta name="tracking_data" data-track-usertype="<%= current_user ? current_user.user_type : :anonymous %>" <%= yield(:track_event) %> />
|
||||
@@ -2,7 +2,6 @@
|
||||
<html <%= "dir=rtl" if rtl? %> lang="<%= I18n.locale %>" data-current-user-id="<%= current_user&.id %>">
|
||||
<head>
|
||||
<%= render "layouts/common_head", default_title: setting["org_name"] %>
|
||||
<%= render "layouts/tracking_data" %>
|
||||
<%= render "layouts/meta_tags" %>
|
||||
<%= content_for :canonical %>
|
||||
<%= favicon_link_tag image_path_for("apple-touch-icon-200.png"),
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<%= render "layouts/tracking_data" %>
|
||||
<%= render "layouts/meta_tags" %>
|
||||
<title><%= content_for?(:title) ? yield(:title) : setting["org_name"] %></title>
|
||||
<%= content_for :canonical %>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<div class="row verify">
|
||||
<% track_event(category: "verification", action: "edit_letter") %>
|
||||
<div class="small-12 medium-9 large-6 small-centered column">
|
||||
<div class="text-center">
|
||||
<h1>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<div class="verification account row">
|
||||
<% track_event(category: "verification", action: "success_sms") %>
|
||||
<div class="small-12 column">
|
||||
|
||||
<div class="text-center">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<div class="row">
|
||||
<% track_event(category: "verification", action: "start_letter") %>
|
||||
<div class="small-12 column">
|
||||
|
||||
<%= back_link_to account_path, t("verification.back") %>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<div class="verification account row">
|
||||
<% track_event(category: "verification", action: "start_census") %>
|
||||
<div class="small-12 column">
|
||||
|
||||
<div class="text-center">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<div class="verification account row">
|
||||
<% track_event(category: "verification", action: "start_sms") %>
|
||||
<div class="small-12 column">
|
||||
<div class="text-center">
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<div class="verification account row">
|
||||
<% track_event(category: "verification", action: "success_census") %>
|
||||
<div class="small-12 column">
|
||||
<div class="text-center">
|
||||
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Tracking" do
|
||||
context "Custom variable" do
|
||||
scenario "Usertype anonymous" do
|
||||
visit proposals_path
|
||||
|
||||
expect(page.html).to include "anonymous"
|
||||
end
|
||||
|
||||
scenario "Usertype level_1_user" do
|
||||
create(:geozone)
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit proposals_path
|
||||
|
||||
expect(page.html).to include "level_1_user"
|
||||
end
|
||||
|
||||
scenario "Usertype level_2_user" do
|
||||
create(:geozone)
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
verify_residence
|
||||
|
||||
fill_in "sms_phone", with: "611111111"
|
||||
click_button "Send"
|
||||
|
||||
user = user.reload
|
||||
fill_in "sms_confirmation_code", with: user.sms_confirmation_code
|
||||
click_button "Send"
|
||||
|
||||
expect(page.html).to include "level_2_user"
|
||||
end
|
||||
end
|
||||
|
||||
context "Tracking events" do
|
||||
scenario "Verification: start census" do
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
expect(page).to have_selector "[data-track-event-category='verification']", visible: :all
|
||||
expect(page).to have_selector "[data-track-event-action='start_census']", visible: :all
|
||||
end
|
||||
|
||||
scenario "Verification: success census & start sms" do
|
||||
create(:geozone)
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
verify_residence
|
||||
|
||||
fill_in "sms_phone", with: "611111111"
|
||||
click_button "Send"
|
||||
|
||||
expect(page).to have_selector "[data-track-event-category='verification']", visible: :all
|
||||
expect(page).to have_selector "[data-track-event-action='start_sms']", visible: :all
|
||||
end
|
||||
|
||||
scenario "Verification: success sms" do
|
||||
create(:geozone)
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
verify_residence
|
||||
|
||||
fill_in "sms_phone", with: "611111111"
|
||||
click_button "Send"
|
||||
|
||||
user = user.reload
|
||||
fill_in "sms_confirmation_code", with: user.sms_confirmation_code
|
||||
click_button "Send"
|
||||
|
||||
expect(page).to have_selector "[data-track-event-category='verification']", visible: :all
|
||||
expect(page).to have_selector "[data-track-event-action='success_sms']", visible: :all
|
||||
end
|
||||
|
||||
scenario "Verification: letter" do
|
||||
create(:geozone)
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
verify_residence
|
||||
|
||||
fill_in "sms_phone", with: "611111111"
|
||||
click_button "Send"
|
||||
|
||||
user = user.reload
|
||||
fill_in "sms_confirmation_code", with: user.sms_confirmation_code
|
||||
click_button "Send"
|
||||
|
||||
click_link "Send me a letter with the code"
|
||||
|
||||
expect(page).to have_selector "[data-track-event-category='verification']", visible: :all
|
||||
expect(page).to have_selector "[data-track-event-action='start_letter']", visible: :all
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user