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

Feature 217 view issue threads without logging in #1505

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions project/accounts/templates/accounts/register/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
</div>
</div>
</div>
<input type="hidden" name="next" value="{% if next %}{{ next }}{% else %}/{% endif %}" />
<div class="notice-text">
Forgot your username or password?
<a class="link-lato" href="{% url 'accounts_password_reset' %}">Click Here</a>
Expand Down
1 change: 0 additions & 1 deletion project/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@

# Login Logout URLS
LOGIN_URL = "login/"
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/"

AUTH_PASSWORD_VALIDATORS = [
Expand Down
4 changes: 2 additions & 2 deletions project/core/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load static %}
{% load i18n %}
{% block extra_css %}
<link type="text/css" rel="stylesheet/less" href="{% static " less/about.less" %}" />
<link type="text/css" rel="stylesheet/less" href="{% static "less/about.less" %}" />
{% endblock extra_css %}

{% block page_title %}{% trans "About Us" %}{% endblock page_title %}
Expand Down Expand Up @@ -186,7 +186,7 @@ <h3 class="title">{% trans "Sponsors" %} </h3>

{% include "static_nav.html" %}
<div id="about"></div>
<script src="{% static " js/static/about_view.js" %}" type="text/javascript"></script>
<script src="{% static "js/static/about_view.js" %}" type="text/javascript"></script>
<script type="text/javascript">
var aboutView = new cw.AboutView();
</script>
Expand Down
2 changes: 1 addition & 1 deletion project/core/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

{% include "global_nav.html" %}

{% include "static_footer.html" %}
{%block content%}{%endblock content%}
{% include "static_footer.html" %}
{% block extra_js %}{% endblock extra_js %}

</body>
Expand Down
4 changes: 2 additions & 2 deletions project/core/templates/how_it_works.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!-- How it Works -->
{% block extra_css %}
<link type="text/css" rel="stylesheet/less" href="{% static " less/how_it_works.less" %}" />
<link type="text/css" rel="stylesheet/less" href="{% static "less/how_it_works.less" %}" />
ashfaq1934 marked this conversation as resolved.
Show resolved Hide resolved
{% endblock extra_css %}
{%block content%}
<script id="howitworks-template" type="text/template">
Expand Down Expand Up @@ -40,7 +40,7 @@ <h4 class="dark-purple">{% trans "Still not sure about something in CiviWiki?" %

{% include "static_nav.html" %}
<div id="howitworks"></div>
<script src="{% static " js/static/how_it_works_view.js" %}" type="text/javascript"></script>
<script src="{% static "js/static/how_it_works_view.js" %}" type="text/javascript"></script>
<script type="text/javascript">
var howitworksView = new cw.HowItWorksView();
</script>
Expand Down
1 change: 1 addition & 0 deletions project/core/templates/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ <h1>
<a href="/howitworks/" class="nav-items">How OpenCiviWiki Works</a>
<a href="/about/" class="nav-items">About Us</a>
<a href="/support_us/" class="nav-items">Support Us</a>
<a href="{% url 'feeds' %}" class="nav-items">Visit The Discussion</a>
<a href="/login/" class="">
<button class="ripple">Login/SignUp</button>
</a>
Expand Down
7 changes: 3 additions & 4 deletions project/core/templates/static/less/feed.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@import 'base';

html {
overflow: hidden;
}
body {
background-color: #f7f6f8;

Expand Down Expand Up @@ -163,6 +159,9 @@ body {
.col {
padding-top: 8px;
}
.stats .col {
padding-top: unset;
}
}
.issue-item {
box-shadow: 0 1px 0px 1px rgba(0, 0, 0, 0.02);
Expand Down
13 changes: 9 additions & 4 deletions project/core/templates/static/less/thread.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ body {
}

#thread {
[type="radio"]:not(:checked), [type="radio"]:checked {
position: relative;
ashfaq1934 marked this conversation as resolved.
Show resolved Hide resolved
opacity: 1;
ashfaq1934 marked this conversation as resolved.
Show resolved Hide resolved
}

.thread-wiki-holder {
display: none;
}
Expand Down Expand Up @@ -200,7 +205,7 @@ body {
}
}
.civi-type-button {
background-color: @dark-white !important;
background-color: @dark-white;
color: @purple;
margin-right: 4px;
padding: 0 1rem;
Expand Down Expand Up @@ -406,9 +411,9 @@ body {
margin-left: auto !important;
margin-right: auto !important;

.btn {
background-color: @purple;
}
// .btn {
// background-color: @purple;
// }

.body-banner {
display: inline-block;
Expand Down
4 changes: 4 additions & 0 deletions project/core/templates/static/less/utils.less
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@

@box-shadow-z1: 0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.2);

.nowrap{
white-space: nowrap;
}

.dropdown-menu-wrapper{
display: block;
margin-top: -12px;
Expand Down
15 changes: 15 additions & 0 deletions project/threads/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django import forms

from .models import Civi


class CiviForm(forms.ModelForm):
class Meta:
model = Civi
fields = ["author", "thread", "title", "body", "c_type"]
widgets = {
"body": forms.Textarea(
attrs={"class": "materialize-textarea", "length": "1000"}
),
"c_type": forms.HiddenInput(),
}
5 changes: 3 additions & 2 deletions project/threads/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def serialize(self, civi, filter=None):
return json.dumps(data, cls=DjangoJSONEncoder)

def serialize_s(self, civi, filter=None):

data = {
"type": civi.c_type,
"title": civi.title,
Expand Down Expand Up @@ -231,7 +230,9 @@ class Civi(models.Model):

tags = TaggableManager()

linked_civis = models.ManyToManyField("self", related_name="links", symmetrical=False, blank=True)
linked_civis = models.ManyToManyField(
"self", related_name="links", symmetrical=False, blank=True
)

title = models.CharField(max_length=255, blank=False, null=False)
body = models.CharField(max_length=1023, blank=False, null=False)
Expand Down
62 changes: 44 additions & 18 deletions project/threads/templates/threads/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@
</nav>
<div class="content">
<div class="row">
<div class="col s12 m3 l2 push-l1">
<div class="col s2 offset-s1">
<div class="row center">
<div class="col s6 m12">
<div class="new-thread-wrapper center-block">
<div class="prompt">Can't find the issue that you're interested in?</div>
{% if user.is_authenticated %}
<button class="new-thread btn waves-effect modal-trigger"><i class="material-icons left">note_add</i>New Thread</button>
ashfaq1934 marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
<a class="new-thread btn waves-effect" href="{% url 'accounts_login' %}"><i class="material-icons left">note_add</i>New Thread</a>
{% endif %}
</div>
</div>
<div class="col s6 m12">
Expand All @@ -56,35 +60,57 @@
</div>
<div class="divider"></div>
<div class="list">
{% for thread in trending_issues %}
<div class="list-item left-align"><a class="list-text" href="thread/{{thread.id}}">{{thread.title}}</a></div>
{% for thread in trending %}
<div class="list-item left-align">
<a class="list-text" href="{% url 'thread-detail' thread.id %}?next={% url 'feeds' %}">{{thread.title}}</a>
</div>
{% endfor %}
</div>
</div>
</div>
</div>

<div id="feed-list">
{% if threads %}
{% for thread in threads %}
<div>THREAD CARD PLACEHOLDER</div>
{% endfor %}
{% else %}
<div class="section no-state">
<div class="container">
<div class="section">
<div class="center title-lato grey-text">NO THREADS</div>
<div class="section center">
<div class="subtitle-lato grey-text section">Be the first to start a discussion in this category!</div>
<button class="new-thread btn waves-effect modal-trigger"><i class="material-icons left">note_add</i>New Thread</button>
</div>
</div>
</div>
{% if threads %}
<div class="col s8">
<ul>
{% for thread in threads %}
<li>
<div class="col">
<div class="card horizontal">
<div class="card-image col s2">
<a href="{% url 'thread-detail' thread.thread.id %}"><img class="responsive-img" src="{{ thread.thread.image }}"></a>
</div>
<div class="col s8">
<div>
<span class="card-title"><a href="{% url 'thread-detail' thread.thread.id %}">{{ thread.thread.title }}</a></span>
<p>{{ thread.thread.summary }}</p>
</div>
<div class="stats gray-text">
<div class="col center-align s2">
<span class="material-icons container">remove_red_eye</span>
<span class="nowrap">{{ thread.stats.num_views }} Views</span>
</div>
<div class="col center-align s2">
<span class="material-icons container">question_answer</span>
<span class="nowrap">{{ thread.stats.num_civis }} Civis</span>
</div>
<div class="col center-align s2">
<span class="material-icons container">emoji_objects</span>
<span class="nowrap">{{ thread.stats.num_solutions }} Solutions</span>
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down
Loading