add show_notice? helper

This commit is contained in:
Andrew Brown 2021-04-25 17:28:49 -07:00
parent 6221ec2dea
commit f69a200b00
12 changed files with 20 additions and 18 deletions

View File

@ -40,4 +40,8 @@ module ApplicationHelper
html.gsub!(/\<a href=["'](.*?)["']\>(.*?)\<\/a\>/mi, '<a href="\1" rel="nofollow">\2</a>')
html.html_safe
end
def show_notice?(id: nil)
user_signed_in? && current_user.notice_dismissals.where(notice_id: id).none?
end
end

View File

@ -1,4 +1,4 @@
<% unless user_signed_in? && current_user.notice_dismissals.where(notice_id: 2).any? %>
<% unless show_notice?(id: 2) %>
<div class="col s12 m6 l4">
<div class="card sticky-action" style="max-height: 480px">
<div class="card-image waves-effect waves-block waves-light">

View File

@ -1,5 +1,5 @@
<% if PromoService.active?(:promo_bogo) %>
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 6).none? %>
<% if show_notice?(id: 6) %>
<div class="col s12">
<div class="hoverable card-panel orange lighten-5">
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 6), class: 'blue-text right', style: 'padding: 0 10px;' %>

View File

@ -1,11 +1,9 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 7).none? %>
<div class="col s12">
<div class="card-panel blue lighten-5">
<i class="material-icons grey-text left">help</i>
These associations are automatically created whenever you mention this page from another page.
Only you can see this message.
<% if show_notice?(id: 7) %>
<div class="card-panel blue lighten-5">
<i class="material-icons grey-text left">help</i>
These associations are automatically created whenever you mention this page from another page.
Only you can see this message.
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 7), class: 'blue-text' %>
</div>
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 7), class: 'blue-text' %>
</div>
<% end %>

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 8).none? && false %>
<% if show_notice?(id: 8) && false %>
<div class="col s12">
<div class="hoverable card-panel blue lighten-5">
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 8), class: 'blue-text right', style: 'padding: 0 10px;' %>

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 9).none? %>
<% if show_notice?(id: 9) %>
<div class="card-panel blue lighten-5">
<i class="left material-icons grey-text">help</i>
Links will automatically appear here whenever you add this page to a public collection.<br />

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 10).none? %>
<% if show_notice?(id: 10) %>
<div class="card-panel blue lighten-5">
<i class="left material-icons grey-text">help</i>
Documents will automatically appear here whenever you add this page to a document.<br />

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 11).none? %>
<% if show_notice?(id: 11) %>
<div class="card-panel blue lighten-5">
<i class="left material-icons grey-text">help</i>
Links will automatically appear here whenever you share this page to your followers.<br />

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 12).none? %>
<% if show_notice?(id: 12) %>
<div class="card-panel <%= ContentPageShare.color %> lighten-5 black-text">
You can now share your notebook pages to your <strong>Stream</strong>!<br /><br />

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 13).none? %>
<% if show_notice?(id: 13) %>
<%
example_character_name = @current_user_content.fetch('Character', []).sample.try(:name) || 'Alice'
%>

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 14).none? %>
<% if show_notice?(id: 14) %>
<div class="card-panel blue lighten-5">
<i class="left material-icons grey-text">help</i>
Timelines will automatically appear here whenever you link this page to those timelines in Notebook.ai.

View File

@ -1,4 +1,4 @@
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 15).none? %>
<% if show_notice?(id: 15) %>
<div class="card-panel <%= PageCollection.color %> lighten-5">
<p>
Collections on Notebook.ai are a brand new feature and I'd love to get your feedback on how you would like to use them.