Skip to content

Commit

Permalink
Add functionality to make content url's private
Browse files Browse the repository at this point in the history
The content url if set to private can only be viewed by the author or
the reviewer.

Fixes #713

Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>
  • Loading branch information
palnabarun committed Jul 31, 2020
1 parent d99165e commit 928813f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions junction/proposals/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class ProposalForm(forms.Form):
required=False,
help_text="Links to your session like GitHub repo, Blog, Slideshare etc ...",
)
private_content_urls = forms.BooleanField(
help_text="Check the box if you want to make your content URLs private",
label="Make the context URLs private",
required=False
)
speaker_info = forms.CharField(
label="Speaker Information",
widget=PagedownWidget(show_preview=True),
Expand Down Expand Up @@ -163,6 +168,7 @@ def populate_form_for_update(self, proposal):
"prerequisites": proposal.prerequisites,
"video_url": proposal.video_url,
"content_urls": proposal.content_urls,
"private_content_urls": proposal.private_content_urls,
"speaker_info": proposal.speaker_info,
"speaker_links": proposal.speaker_links,
"status": proposal.status,
Expand Down
4 changes: 4 additions & 0 deletions junction/proposals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class Proposal(TimeAuditModel):
)
prerequisites = models.TextField(blank=True, default="")
content_urls = models.TextField(blank=True, default="")
private_content_urls = models.BooleanField(
default=False, help_text="Check it if you want to make your content URLs private"
)
speaker_info = models.TextField(blank=True, default="")
speaker_links = models.TextField(blank=True, default="")
status = models.PositiveSmallIntegerField(
Expand Down Expand Up @@ -253,6 +256,7 @@ def to_response(self, request):
"speaker_info": self.speaker_info,
"speaker_links": self.speaker_links,
"content_urls": self.content_urls,
"private_content_urls": self.private_content_urls,
"conference": rf_reverse(
"conference-detail", kwargs={"pk": self.conference_id}, request=request
),
Expand Down
2 changes: 2 additions & 0 deletions junction/proposals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def create_proposal(request, conference_slug):
prerequisites=form.cleaned_data["prerequisites"],
video_url=form.cleaned_data["video_url"],
content_urls=form.cleaned_data["content_urls"],
private_content_urls=form.cleaned_data["private_content_urls"],
speaker_info=form.cleaned_data["speaker_info"],
speaker_links=form.cleaned_data["speaker_links"],
status=form.cleaned_data["status"],
Expand Down Expand Up @@ -322,6 +323,7 @@ def update_proposal(request, conference_slug, slug):
proposal.prerequisites = form.cleaned_data["prerequisites"]
proposal.video_url = form.cleaned_data["video_url"]
proposal.content_urls = form.cleaned_data["content_urls"]
proposal.private_content_urls = form.cleaned_data["private_content_urls"]
proposal.speaker_info = form.cleaned_data["speaker_info"]
proposal.speaker_links = form.cleaned_data["speaker_links"]
proposal.status = form.cleaned_data["status"]
Expand Down
6 changes: 4 additions & 2 deletions junction/templates/proposals/detail/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ <h4 class='heading'><b>Video URL:</b></h4>
{% endif %}

{% if proposal.content_urls %}
{% if not proposal.private_content_urls or is_author or is_reviewer or user.is_authenticated and user.is_superuser %}
<div class="proposal-writeup--section">
<h4 class='heading'><b>Content URLs:</b></h4>
<p>{{ proposal.content_urls|markdown_safe }}</p>
<h4 class='heading'><b>Content URLs:</b> {% if proposal.private_content_urls %}<span class="label label-info">Private</span>{% endif %}</h4>
<p>{{ proposal.content_urls|markdown_safe }}</p>
</div>
{% endif %}
{% endif %}

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

0 comments on commit 928813f

Please sign in to comment.