allow dismissing associations banner

This commit is contained in:
Andrew Brown 2020-03-28 20:21:19 -05:00
parent a44b5825e2
commit 2d5cdddfe9
3 changed files with 16 additions and 8 deletions

View File

@ -12,8 +12,8 @@ class UsersController < ApplicationController
@content = @user.public_content.select { |type, list| list.any? }
@tabs = @content.keys
@accent_color = @user.favorite_page_type_color
@accent_icon = @user.favorite_page_type_icon
@accent_color = @user.favorite_page_type_color
@accent_icon = @user.favorite_page_type_icon
@favorite_content = @user.favorite_page_type? ? @user.send(@user.favorite_page_type.downcase.pluralize).is_public : []
# todo this is really bad and needs redone/improved

View File

@ -123,7 +123,7 @@ module HasContent
.first(limit)
@user_recent_content_list = recently_changed_attributes.map do |entity_type, entity_id|
entity_type.constantize.find_by(id: entity_id)
entity_type.constantize.find_by(id: entity_id) rescue nil
end.compact
end

View File

@ -12,11 +12,19 @@
<div id="associations_panel" class="row panel">
<div class="row">
<div class="col s12 m10 offset-m1">
<div class="card-panel blue lighten-5">
<i class="left material-icons grey-text">help</i>
These associations are automatically created whenever you add another page to this universe.<br />
Only you can see this message. <%= link_to 'Dismiss this message', '#' %>.
</div>
<% if current_user.notice_dismissals.where(notice_id: 7).none? %>
<div class="col s12">
<div class="hoverable card-panel blue lighten-5">
<%= link_to prepay_path, class: 'black-text' do %>
<i class="material-icons grey-text left">help</i>
These associations are automatically created whenever you add another page to this universe.
Only you can see this message.
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 7), class: 'blue-text' %>
<% end %>
</div>
</div>
<% end %>
<% relations.each do |name, params| %>
<%