Skip to content

Commit 3fa2076

Browse files
committed
Add functionality to make content url's private
The content url if set to private can only be viewed by the author or the reviewer. Fixes #713 Signed-off-by: Nabarun Pal <[email protected]>
1 parent c968452 commit 3fa2076

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

junction/proposals/forms.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ class ProposalForm(forms.Form):
130130
required=False,
131131
help_text="Links to your session like GitHub repo, Blog, Slideshare etc ...",
132132
)
133+
private_content_urls = forms.BooleanField(
134+
help_text="Check the box if you want to make your content URLs private",
135+
label="Make the context URLs private",
136+
required=False,
137+
)
133138
speaker_info = forms.CharField(
134139
label="Speaker Information",
135140
widget=PagedownWidget(show_preview=True),
@@ -169,6 +174,7 @@ def populate_form_for_update(self, proposal):
169174
"prerequisites": proposal.prerequisites,
170175
"video_url": proposal.video_url,
171176
"content_urls": proposal.content_urls,
177+
"private_content_urls": proposal.private_content_urls,
172178
"speaker_info": proposal.speaker_info,
173179
"speaker_links": proposal.speaker_links,
174180
"is_first_time_speaker": proposal.is_first_time_speaker,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.9 on 2020-08-05 16:07
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
("proposals", "0029_auto_20200707_0844"),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name="historicalproposal",
17+
name="private_content_urls",
18+
field=models.BooleanField(
19+
default=False,
20+
help_text="Check it if you want to make your content URLs private",
21+
),
22+
),
23+
migrations.AddField(
24+
model_name="proposal",
25+
name="private_content_urls",
26+
field=models.BooleanField(
27+
default=False,
28+
help_text="Check it if you want to make your content URLs private",
29+
),
30+
),
31+
]

junction/proposals/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ class Proposal(TimeAuditModel):
105105
)
106106
prerequisites = models.TextField(blank=True, default="")
107107
content_urls = models.TextField(blank=True, default="")
108+
private_content_urls = models.BooleanField(
109+
default=False,
110+
help_text="Check it if you want to make your content URLs private",
111+
)
108112
speaker_info = models.TextField(blank=True, default="")
109113
speaker_links = models.TextField(blank=True, default="")
110114
is_first_time_speaker = models.BooleanField(blank=True, default=False)
@@ -254,6 +258,7 @@ def to_response(self, request):
254258
"speaker_info": self.speaker_info,
255259
"speaker_links": self.speaker_links,
256260
"content_urls": self.content_urls,
261+
"private_content_urls": self.private_content_urls,
257262
"conference": rf_reverse(
258263
"conference-detail", kwargs={"pk": self.conference_id}, request=request
259264
),

junction/proposals/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def create_proposal(request, conference_slug):
171171
prerequisites=form.cleaned_data["prerequisites"],
172172
video_url=form.cleaned_data["video_url"],
173173
content_urls=form.cleaned_data["content_urls"],
174+
private_content_urls=form.cleaned_data["private_content_urls"],
174175
speaker_info=form.cleaned_data["speaker_info"],
175176
speaker_links=form.cleaned_data["speaker_links"],
176177
is_first_time_speaker=form.cleaned_data["is_first_time_speaker"],
@@ -323,6 +324,7 @@ def update_proposal(request, conference_slug, slug):
323324
proposal.prerequisites = form.cleaned_data["prerequisites"]
324325
proposal.video_url = form.cleaned_data["video_url"]
325326
proposal.content_urls = form.cleaned_data["content_urls"]
327+
proposal.private_content_urls = form.cleaned_data["private_content_urls"]
326328
proposal.speaker_info = form.cleaned_data["speaker_info"]
327329
proposal.speaker_links = form.cleaned_data["speaker_links"]
328330
proposal.is_first_time_speaker = form.cleaned_data["is_first_time_speaker"]

junction/templates/proposals/detail/base.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,13 @@ <h4 class='heading'><b>Video URL:</b></h4>
149149
{% endif %}
150150

151151
{% if proposal.content_urls %}
152+
{% if not proposal.private_content_urls or is_author or is_reviewer or user.is_authenticated and user.is_superuser %}
152153
<div class="proposal-writeup--section">
153-
<h4 class='heading'><b>Content URLs:</b></h4>
154-
<p>{{ proposal.content_urls|markdown_safe }}</p>
154+
<h4 class='heading'><b>Content URLs:</b> {% if proposal.private_content_urls %}<span class="label label-info">Private</span>{% endif %}</h4>
155+
<p>{{ proposal.content_urls|markdown_safe }}</p>
155156
</div>
156157
{% endif %}
158+
{% endif %}
157159

158160
{% if is_reviewer or user.is_authenticated and user.is_superuser %}
159161
<div class="row">

0 commit comments

Comments
 (0)