Add comment join CTA

This commit is contained in:
Ben Halpern 2018-04-02 14:41:03 -07:00
parent b4695151a8
commit 05255d7566
4 changed files with 35 additions and 28 deletions

View file

@ -33,7 +33,6 @@ function callInitalizers(){
initNotifications();
initializeSplitTestTracking();
initializeNavSearchListener();
initializePreloads();
initializeStylesheetAppend();
initializeAnalytics();
initializeCommentDropdown();

View file

@ -1,27 +0,0 @@
function initializePreloads() {
if (document.getElementById("index-container")) {
setTimeout(function(){
var articleLinks = document.getElementsByClassName("index-article-link");
var hrefs = [];
for(var i=0; i < articleLinks.length; i++) {
var href = articleLinks[i].href;
if (instantClick && i < 7 && hrefs.indexOf(href) == -1 ) {
InstantClick.preload(articleLinks[i].href, "force");
hrefs.push(href);
}
}
},750);
}
else {
setTimeout(function(){
if (instantClick) {
InstantClick.preload(document.getElementById("logo-link").href, "force");
}
},2000)
}
setTimeout(function(){
if (instantClick && checkUserLoggedIn()) {
InstantClick.preload(document.getElementById("notifications-link").href, "force");
}
},501)
}

View file

@ -168,6 +168,9 @@
commentable: @article,
commentable_type: "Article" %>
<div class="comment-trees" id="comment-trees-container">
<% cache "comment_root_#{user_signed_in?}", expires_in: 1.hours do %>
<%= render "comments/login_cta_comment" %>
<% end %>
<% Comment.rooted_on(@article.id,"Article").order("score DESC").limit(@comments_to_show_count).each do |comment| %>
<% cache ["comment_root_#{user_signed_in?}", comment] do %>
<%= render("/comments/comment",

View file

@ -0,0 +1,32 @@
<% unless user_signed_in? %>
<div class="comment-hash-marker" id="cta-comment-marker"></div>
<div class="single-comment-node root comment-deep-0"
id="cta-comment-register-now-node">
<div class="inner-comment" style="box-shadow: 5px 5px 0px #4e57ef;border:1px solid #4e57ef;">
<div class="details">
<img class="profile-pic" src="<%= ProfileImage.new(User.first).get(50)%>" />
<span class="comment-username">
<span class="comment-username-inner">
<%= User.first.name %>
</span>
</span>
<span class="op-marker">FOUNDER</span>
</div>
<div class="body">
<p>
Dear <b>lurker</b>, this message is for <b><em>you</em></b>.
</p>
<p>
Please consider creating an account on <a href="https://dev.to">dev.to</a>. It literally takes a few seconds and <b><em>we'd appreciate the support so much</em></b>. ❤️
</p>
<button class="reaction-button" title="heart">
<%= image_tag "favorite-heart-outline-button.svg" %>
<span class="reactions-count">1,337</span>
</button>
</div>
<div class="actions">
<a href="/enter" id="cta-comment-register-now-link" rel="nofollow">REGISTER NOW</a>
</div>
</div>
</div>
<% end %>