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 4 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
60 changes: 52 additions & 8 deletions website/static/css/activity.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,74 @@
.activity-strip-section >img{
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we are refactoring the code base, It would be great if you could replace the tabs with spaces and follow the styling rule similar to website/static/css/main.css.

width: auto;
height: 100px;
}
width: auto;
height: 100px;
}

.activity-screenshot img{
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){


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


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
}
}

50 changes: 50 additions & 0 deletions website/static/js/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
$(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){
console.log(ele)

var text = $(ele).siblings('.small').text().trim() //.substring(0, 30).split(" ").slice(0, -1).join(" ") + "...";
console.log(text)
var actor = /^[^\s]+/.exec(text)
console.log(actor[0])
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;
}
// console.log($(this))
// console.log($('.open'))

close_panel()


$(this).html("<a>See less</a>")
$(this).parent().animate({'height':'400px'})
$(this).parent().parent().animate({'height': '400px'})
$(this).parent().parent().parent().animate({'height': '400px'})
$(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':'200px'})
$('.open').parent().parent().animate({'height': '200px'})
$('.open').parent().parent().parent().animate({'height': '200px'})
$('.open').siblings('.small').hide()
$('.open').siblings('.text-trunc').show()
$('.open').removeClass('open')

}


})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a line ending here.

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
2 changes: 1 addition & 1 deletion 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 Down