Skip to content

Commit

Permalink
Add more styles
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhusar committed Sep 19, 2020
1 parent 6e69e42 commit 5098ce6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
14 changes: 12 additions & 2 deletions app/assets/stylesheets/application.css
Expand Up @@ -126,12 +126,18 @@
}

.active-topic {
background-color: #e4e9f0;
background-color: #F3F2F1;
padding: 20px 0;
font-size: 1rem;
}

.active-topic p {
.active-topic p ,
.active-topic h1,
.active-topic h2,
.active-topic h3,
.active-topic h4,
.active-topic h5,
.active-topic h6 {
margin: 10px 0;
font-size: 1rem;
}
Expand All @@ -148,3 +154,7 @@
display: grid;
grid-template-columns: 1fr 100px;
}

.active-topic__hidden {
display: none;
}
2 changes: 1 addition & 1 deletion app/models/current_topic.rb
@@ -1,7 +1,7 @@
class CurrentTopic < ApplicationRecord

def key
updated_at.to_s
Digest::MD5.hexdigest updated_at.to_s
end

def self.active
Expand Down
10 changes: 9 additions & 1 deletion app/views/components/_active_topic.html.erb
Expand Up @@ -5,8 +5,16 @@
<%= @active_current_topic.body.html_safe %>
</div>
<div>
<a href="#" data-key="<%= @active_current_topic.key %>">Skryť správu</a>
<a href="#" class="js__active-topic-close">Skryť správu</a>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>
<script>
document.querySelector('.js__active-topic-close').addEventListener('click', function(e) {
e.preventDefault()
Cookies.set('current_topic', '<%= @active_current_topic.key %>', { expires: 365 });
document.querySelector('.active-topic').classList.add('active-topic__hidden');
});
</script>

0 comments on commit 5098ce6

Please sign in to comment.