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

Fix #272: Added See More button in activity panel #279

Merged
merged 6 commits into from
Jun 11, 2017
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
85 changes: 64 additions & 21 deletions website/static/css/activity.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,73 @@
.activity-strip-section >img{
width: auto;
height: 100px;
}
.activity-strip-section > img{
width: auto;
height: 100px;
}

.activity-screenshot img{
height:auto;
height: auto;
}

.activity-strip-section > div > .small{
position: relative;
top: 10px;
}

.more_info{
display: none;
cursor: pointer;
}

.text-trunc{
display: none;
}

@media only screen and (max-width: 450px){
.activity-strip .activity-strip-section{
width: 95%;
height: auto;
}

.activity-strip{
height: 160px;
}

.activity-screenshot{
position: absolute;
top: 100px;
}

.activity-strip .activity-strip-section{
width: 95%;
height: auto;


}

.activity-strip{
height:auto;
overflow: auto;
}
.activity-screenshot{
position: absolute;
top:100px;
}
}
.bug-type{
right: 0;
}

.activity-strip-section > div{
overflow: auto;
}

.more_info{
display: block;
margin: 10px 0;
cursor: pointer;
color: #999;
}

.activity-strip-section > div > .small{
display: none;
}

.text-trunc{
display: block;
margin-top: 10px;
}

.text-trunc:first-letter{
text-transform: uppercase;
}
}

@media only screen and (min-width: 400px){
.bug-type{
position: relative;
right: 0
}
}
33 changes: 33 additions & 0 deletions website/static/js/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$(document).ready(function(){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove the unnecessary lines in the file ?

$('.text-trunc').each(function(index, ele){
var text = $(ele).siblings('.small').text().trim()
var actor = /^[^\s]+/.exec(text)
var rest = text.slice(actor[0].length).trim().substring(0, 20).split(" ").slice(0, -1).join(" ") + "...";
$(ele).text(actor[0]+ ' '+rest);
})

$('.more_info').click(function(){
if($(this)[0]==$('.open')[0]){
close_panel()
return;
}
close_panel()
$(this).html("<a>See less</a>")
$(this).parent().animate({'height':'200px'})
$(this).parent().parent().animate({'height': '200px'})
$(this).parent().parent().parent().animate({'height': '200px'})
$(this).siblings('.text-trunc').hide()
$(this).siblings('.small').show()
$(this).addClass('open')
})

function close_panel(){
$('.open').html('<a>See more</a>')
$('.open').parent().animate({'height':'160px'})
$('.open').parent().parent().animate({'height': '160px'})
$('.open').parent().parent().parent().animate({'height': '160px'})
$('.open').siblings('.small').hide()
$('.open').siblings('.text-trunc').show()
$('.open').removeClass('open')
}
})
5 changes: 3 additions & 2 deletions website/templates/_activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img src="{% gravatar_url activity.actor.email 100 %}" width="100" class="img-responsive img-rounded">
{% endif %}

<div>
<div class="info">
{% if activity.action_object %}
{% if activity.action_object.get_absolute_url %}
<a href="{{ activity.action_object.get_absolute_url }}">{{ activity.action_object }}</a>
Expand All @@ -34,7 +34,7 @@
<span class="label label-danger text-capitalize">{{activity.target.status}}</span>
{% endif %}
{% endif %}

<div class="text-trunc"></div>
<div class="small">
{% if activity.actor.get_absolute_url %}
<a href="{{ activity.actor.get_absolute_url }}" class="text-capitalize">
Expand All @@ -47,6 +47,7 @@
<a href="//{{ activity.target.domain_name }}">{{ activity.target.domain_name }}</a>
<span class="label label-info bug-type">{{activity.target.get_label_display}}</span>
</div>
<div class="more_info"><a>See More </a></div>
</div>
</div>

Expand Down
3 changes: 1 addition & 2 deletions website/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{% block content %}
<script src="{% static "js/jquery.validate.js" %}"></script>

<script src="{% static 'js/activity.js' %}"></script>
<section class="hero">
<div class="heading">
<h1 class="page-header">Find Bugs, Win Points and Prizes</h1>
Expand All @@ -22,7 +22,6 @@ <h1 class="page-header">Find Bugs, Win Points and Prizes</h1>
</ul>
</div>
</section>

<div class="row icon-row">
<div class="col-sm-4">
<div class="mega-block no-shadow">
Expand Down