Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add More Imagery to Dashboard #9708

Merged
merged 7 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 73 additions & 19 deletions app/views/dashboard_v2/_topicCard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,40 @@
<%# Follower count %>
<p style="display: inline-block; color: #808080;"><a style="text-decoration: underline; color: #808080;" href="/tag/<%= tag_name %>"><%= Tag.follower_count(tag_name) %> <%= translation('tag.show.following') %></a></p>
</div>
<div class="card-body" style="padding:0.8em;">
<%# First 3 notes in the Topic %>
<div class="card-body pr-0">

<!-- First 3 notes in the Topic -->
<div class="node-list">
<div class="node-body">
<% notes.each do |node| %>
<% shown_nids << node.id %>
<% if node.main_image %>
<img class="rounded-circle pull-left" id="profile-photo" style="width:20px; height:20px; margin-right:8px; display: inline-block;" src="<%= node.main_image.path(:default) %>" />
<% elsif node.scraped_image %>
<img class="rounded-circle pull-left" id="profile-photo" style="width:20px; height:20px; margin-right:8px; display: inline-block;" src="<%= node.scraped_image %>" />
<% else %>
<div class="circle"></div>
<% end %>
<div style="margin-left: 10px; display: grid;">
<p>
<a style="color: inherit;" <% if @widget %>target="_blank"<% end %> href="<%= node.path %>"><%= (node.type == 'note') ? node.title : node.latest.title %></a>
<span style="color: #808080;"><%= translation('tag.show.by') %> <a <% if @widget %>target="_blank"<% end %> href="/profile/<%= node.author.name %>">@<%= node.author.name %></a></span>
</p>
<div class="row no-gutters">
<% notes.each do |node| %>
<% shown_nids << node.id %>
<div class="col-md-4 card-responsive mb-2 pr-2">
<div class="card">
<% if node.main_image %>
<img class="card-img-top" style="margin-bottom: 10px;" aria-hidden="true" src="<%= node.main_image.path(:default) %>" />
<% elsif node.scraped_image %>
<img class="card-img-top" style="margin-bottom: 10px;" aria-hidden="true" src="<%= node.scraped_image %>" />
<% else %>
<a class="imgg" style="background: #aaa; margin-bottom: 10px;">
<i class="fa fa-picture-o image-block" aria-hidden="true" style="color: #ccc; font-size: 6em; padding: 1.5rem;"></i>
</a>
<% end %>
<div class="card-body">
<h5 style="margin-bottom: 0px;" class="text-truncate"><a style="color: inherit; text-decoration: none;" <% if @widget %>target="_blank"<% end %> href="<%= node.path %>" style="color: black"><%= (node.type == 'note') ? node.title : node.latest.title %></a></h5>
<div style="font-size:1.0em;color:darkgray;">
<p>
<%= translation('tag.show.by') %>
<a <% if @widget %>target="_blank"<% end %> href="/profile/<%= node.author.name %>" style="color: #303030">@<%= node.author.name %></a>
</p>
</div>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
</div>

</div>
<div class="card-footer" style="background-color: inherit; border:none;">
<% note_count = post_count(tag_name, 'note') %>
<% wiki_count = post_count(tag_name, 'page') %>
Expand Down Expand Up @@ -81,6 +91,7 @@

.node-list {
display: grid;
margin-right: 12px;
}

.circle {
Expand All @@ -93,8 +104,51 @@
border-radius: 100%;
}

.card-view .card-body p {
margin-bottom: 10px;
}

.card-view .card-body h5 {
font-size: 1.2em;
}
.card-view .card-body {
font-size: 0.85em;
}

.card-view a {
display: revert;
}

.imgg,
.card-img-top {
height: 9rem;
object-fit: cover;
}

.image-block {
justify-content: center;
display: flex;
}

/* Small devices */
@media (min-width: 280px) and (max-device-width : 720px) {
.card-responsive {
margin-bottom: 21px;
}
}

/* Tablets */
@media (min-width: 768px) and (max-device-width : 1024px) {
.card-responsive {
margin-bottom: 21px;
margin-right: 48px;
}
}

/* Iphone 5 Responsiveness */
@media (min-width: 320px) and (max-width: 568px) {
.card-responsive {
margin-bottom: 8px;
}
}
</style>
2 changes: 1 addition & 1 deletion app/views/notes/_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a class="card-img-top img" style="overflow: hidden; height:10em;" href="<%= node.path %>"><%= image_tag(node.scraped_image, style:'width:100%;') %></a>
<% else %>
<a class="imgg" style="height:10em; margin-bottom: 10px;padding: 1rem;">
<i class="fa fa-picture-o note-not aria-hidden="true" style="color: #ccc; font-size: 6em;"></i>
<i class="fa fa-picture-o note-not" aria-hidden="true" style="color: #ccc; font-size: 6em;"></i>
</a>
<% end %>

Expand Down
3 changes: 2 additions & 1 deletion test/unit/tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def setup
@start = (Date.today - 1.year).to_time
@fin = Date.today.to_time
end

test 'create a tag' do
tag = Tag.new(name: 'stick-mapping')
assert tag.save!
Expand Down Expand Up @@ -190,7 +191,7 @@ def setup
tag = tags(:test)
# including current date
contributors = Tag.contributors(tag.name, start: Time.now-1.month, finish: Time.now)
assert_equal [1, 2, 5, 6], contributors.pluck(:id)
assert_equal [1, 2], contributors.pluck(:id)
# during presumably mostly empty time period
contributors2 = Tag.contributors(tag.name, start: Time.now-10.years, finish: Time.now-9.years)
assert_equal [2], contributors2.pluck(:id)
Expand Down