summaryrefslogtreecommitdiff
path: root/fossee_manim
diff options
context:
space:
mode:
Diffstat (limited to 'fossee_manim')
-rw-r--r--fossee_manim/models.py4
-rw-r--r--fossee_manim/static/css/sticky-footer.css18
-rw-r--r--fossee_manim/templates/fossee_manim/categorical_list.html7
-rw-r--r--fossee_manim/templates/fossee_manim/edit_proposal.html2
-rw-r--r--fossee_manim/templates/fossee_manim/search_results.html11
-rw-r--r--fossee_manim/templates/fossee_manim/video.html5
-rw-r--r--fossee_manim/views.py63
7 files changed, 79 insertions, 31 deletions
diff --git a/fossee_manim/models.py b/fossee_manim/models.py
index 240ec1b..9a85c4d 100644
--- a/fossee_manim/models.py
+++ b/fossee_manim/models.py
@@ -197,8 +197,6 @@ class AnimationStats(models.Model):
video_path = models.FileField(null=True, blank=True, upload_to=attachments)
def _create_thumbnail(self):
- # anime = AnimationStats.objects.get(
- # animation=proposal)
video_path = self.video_path.path
img_output = path.join(
tempfile.mkdtemp(), "{0}.jpg".format(self.animation.title)
@@ -211,4 +209,4 @@ class AnimationStats(models.Model):
# Converting to Python file object with
# some Django-specific additions
django_file = File(que_file)
- self.thumbnail.save(file_name, django_file, save=True)
+ self.thumbnail.save(file_name, django_file, save=True) \ No newline at end of file
diff --git a/fossee_manim/static/css/sticky-footer.css b/fossee_manim/static/css/sticky-footer.css
index d0054bd..4bcbcc5 100644
--- a/fossee_manim/static/css/sticky-footer.css
+++ b/fossee_manim/static/css/sticky-footer.css
@@ -70,3 +70,21 @@
margin-left: .1rem;
margin-right: .1rem;
}
+
+
+/* video-thumbnail over image */
+#play-btn
+{
+ position: absolute;
+ top: 40%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ -ms-transform: translate(-50%, -50%);
+ background-color: #555;
+ color: white;
+ font-size: 16px;
+ padding: 10px 20px;
+ border: none;
+ cursor: pointer;
+ border-radius: 5px;
+} \ No newline at end of file
diff --git a/fossee_manim/templates/fossee_manim/categorical_list.html b/fossee_manim/templates/fossee_manim/categorical_list.html
index c3bfacd..0084b83 100644
--- a/fossee_manim/templates/fossee_manim/categorical_list.html
+++ b/fossee_manim/templates/fossee_manim/categorical_list.html
@@ -18,8 +18,11 @@
{% for video in categorial_list %}
<div class="row">
- <div class="col-md-4" >
- <a href="{% url 'video' video.id %}" ><img height="90%" width="100%" src="{{ video.thumbnail.url }}"></a>
+ <div class="col-md-4">
+ <a href="{% url 'video' video.id %}" >
+ <span class="fa fa-play fa-4x" id="play-btn"></span>
+ <img height="90%" width="100%" src="{{ video.thumbnail.url }}">
+ </a>
</div>
<div class="col-md-4">
<p style="color:#26A669; font-size: 300%;"> {{ video.animation.title }} </p>
diff --git a/fossee_manim/templates/fossee_manim/edit_proposal.html b/fossee_manim/templates/fossee_manim/edit_proposal.html
index 4ca98cd..e42a358 100644
--- a/fossee_manim/templates/fossee_manim/edit_proposal.html
+++ b/fossee_manim/templates/fossee_manim/edit_proposal.html
@@ -23,7 +23,7 @@
</form>
<br>
- {% if proposal_form.instance.status == 'changes' and request.user.profile.position == 'coordinator' %}
+ {% if proposal_form.instance.status == 'changes' and request.user.profile.position == 'contributor' %}
<form method="POST" action="{% url 'upload_animation' proposal_form.instance.id %}" enctype="multipart/form-data">
{% csrf_token %}
<label class="btn btn-info">
diff --git a/fossee_manim/templates/fossee_manim/search_results.html b/fossee_manim/templates/fossee_manim/search_results.html
index 5ade6d2..744f953 100644
--- a/fossee_manim/templates/fossee_manim/search_results.html
+++ b/fossee_manim/templates/fossee_manim/search_results.html
@@ -14,12 +14,15 @@
{% for anime in s_result %}
<div class="row">
<div class="col-md-4" >
- <a href="{% url 'video' anime.id %}" ><img height="90%" width="100%" src="{{ anime.thumbnail.url }}"></a>
+ <a href="{% url 'video' anime.id %}" >
+ <span class="fa fa-play fa-4x" id="play-btn"></span>
+ <img height="90%" width="100%" src="{{ anime.thumbnail.url }}">
+ </a>
</div>
<div class="col-md-4">
- <p style="color:#26A669; font-size: 300%;"> {{ anime.title }} </p>
- <p style="color:#26A669; font-size: 100%;"> {{ anime.description | truncatewords:5}} </p>
- <a target="_blank" href="{{ anime.animation.github }}"><p style="font-size: 70%;"> {{ anime.github }} </p></a>
+ <p style="color:#26A669; font-size: 300%;"> {{ anime.animation.title }} </p>
+ <p style="color:#26A669; font-size: 100%;"> {{ anime.animation.description | truncatewords:5}} </p>
+ <a target="_blank" href="{{ anime.animation.github }}"><p style="font-size: 70%;"> {{ anime.animation.github }} </p></a>
</div>
</div>
<hr>
diff --git a/fossee_manim/templates/fossee_manim/video.html b/fossee_manim/templates/fossee_manim/video.html
index 4ffcb47..fa09010 100644
--- a/fossee_manim/templates/fossee_manim/video.html
+++ b/fossee_manim/templates/fossee_manim/video.html
@@ -9,7 +9,7 @@
<div class="row" >
<div class="col-md-12" >
<br>
- <video width="100%" height="90%" controls >
+ <video width="100%" height="90%" controls>
<source src="{{video.0.video_path.url}}" type="video/mp4">
</video>
<div class="row">
@@ -20,11 +20,14 @@
<a target="_blank" href="{{ video.animation.github }}"><p style="font-size: 70%; float: right;"> {{ video.0.animation.github }} </p></a>
</div>
</div>
+ <br>
</div>
</div>
<div class="row">
<div class="col-md-10">
+ <hr>
+ <br>
<p style="color:#26A669; font-size: 100%; float: left;">
{{ video.0.animation.description }}
</p>
diff --git a/fossee_manim/views.py b/fossee_manim/views.py
index b274e63..93a1763 100644
--- a/fossee_manim/views.py
+++ b/fossee_manim/views.py
@@ -19,7 +19,6 @@ from django.utils import timezone
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.files.uploadhandler import FileUploadHandler
-from django.contrib import messages
from django.db.models import F, Subquery, OuterRef, Q
from zipfile import ZipFile
from textwrap import dedent
@@ -84,8 +83,10 @@ def index(request):
if user.groups.filter(name='reviewer').exists():
return redirect('/proposal_status/')
return redirect('/view_profile/')
-
- return render(request, "fossee_manim/index.html", {"form": form})
+ anime = AnimationStats.objects.filter(animation__status='released').order_by('-id')[:5]
+ return render(request, "fossee_manim/index.html", {"form": form,
+ "anime" : anime
+ })
def is_reviewer(user):
@@ -96,6 +97,7 @@ def is_reviewer(user):
def user_login(request):
'''User Login'''
user = request.user
+ categories = Category.objects.all()
if is_superuser(user):
return redirect('/admin')
if user.is_authenticated():
@@ -115,7 +117,8 @@ def user_login(request):
return render(request, 'fossee_manim/login.html', {"form": form})
else:
form = UserLoginForm()
- return render(request, 'fossee_manim/login.html', {"form": form})
+ return render(request, 'fossee_manim/login.html', {"form": form,
+ 'categories': categories })
def user_logout(request):
@@ -344,7 +347,7 @@ def edit_proposal(request, proposal_id=None):
form_data = comment_form.save(commit=False)
form_data.commentor = user
form_data.animation = proposal
- form_data.animation__status = proposal.status
+ form_data.animation_status = proposal.status
if user.profile.position == 'reviewer':
proposal.status = 'changes'
proposal.save()
@@ -389,9 +392,10 @@ def search(request):
categories = Category.objects.all()
if request.method == 'POST':
word = request.POST.get('sbox')
- anime_list = Animation.objects.filter(
- Q(title__contains=word) | Q(description__contains=word))
-
+ anime_list = AnimationStats.objects.filter(
+ Q(animation__title__contains=word) | Q(animation__description__contains=word)
+ | Q(animation__category__name__contains=word), animation__status='released')
+
return render(request, 'fossee_manim/search_results.html',
{'s_result': anime_list, 'categories': categories})
@@ -421,24 +425,43 @@ def upload_animation(request, proposal_id=None):
anobj = AnimationStats.objects.create(
animation=proposal, video_path=request.FILES['video_path'])
anobj._create_thumbnail()
+
return render(request, 'fossee_manim/upload_success.html')
else:
return redirect('/view_profile/')
def video(request, aid=None):
- video = AnimationStats.objects.filter(id=aid)
- comment_form = CommentForm()
- # if views crosses limit comment the line below
- video.update(views=F('views')+1)
- video.update(like=F('like')+1)
- anim_list = AnimationStats.objects.filter(animation__status="released")
- suggestion_list = [x for x in anim_list if (
- x.animation.category == video[0].animation.category)]
- reviewer_id = video[0].animation.reviewer.id
- comment_list = Comment.objects.filter(animation=video[0].animation)
- comments = [x for x in comment_list if x.animation.status !=
- ('pending' or 'changes')]
+ user = request.user
+ video = AnimationStats.objects.filter(id=aid, animation__status="released")
+ if len(video):
+ comment_form = CommentForm()
+ # if views crosses limit comment the line below
+ video.update(views=F('views')+1)
+ video.update(like=F('like')+1)
+ anim_list = AnimationStats.objects.filter(animation__status="released")
+ suggestion_list = [x for x in anim_list if (
+ x.animation.category == video[0].animation.category)]
+ reviewer_id = video[0].animation.reviewer.id
+ comment_list = Comment.objects.filter(animation=video[0].animation)
+ comments = [x for x in comment_list if x.animation.status !=
+ ('pending' or 'changes')]
+ if request.method == 'POST':
+ if is_email_checked(user):
+ comment_form = CommentForm(request.POST)
+ form_data = comment_form.save(commit=False)
+ form_data.commentor = user
+ form_data.animation = video[0].animation
+ form_data.animation_status = video[0].animation.status
+ form_data.save()
+ return redirect('/video/{}'.format(aid))
+ else:
+ return redirect('/login/')
+ else:
+ return redirect('/view_profile/')
+
+
+
categories = Category.objects.all()
return render(request, 'fossee_manim/video.html',
{'video': video, 'categories': categories,