Skip to content
Open
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
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
10 changes: 5 additions & 5 deletions project/accounts/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LoginViewTests(BaseTestCase):
"""A class to test login view"""

def setUp(self) -> None:
super(LoginViewTests, self).setUp()
super().setUp()
url = reverse("accounts_login")
self.response = self.client.get(url)

Expand Down Expand Up @@ -48,7 +48,7 @@ def test_login_view_redirects_on_success(self):

response = self.client.post(
reverse("accounts_login"),
{"username": "newuser", "password": "password123"},
{"username": "newuser", "password": "password123", "next": reverse("base")},
)
self.assertRedirects(
response,
Expand Down Expand Up @@ -117,7 +117,7 @@ class SettingsViewTests(BaseTestCase):
"""A class to test settings view"""

def setUp(self) -> None:
super(SettingsViewTests, self).setUp()
super().setUp()
self.user.profile.first_name = "Gorkem"
self.user.profile.last_name = "Arslan"
self.user.profile.save()
Expand Down Expand Up @@ -202,7 +202,7 @@ class UserProfileView(BaseTestCase):
"""A class to test user profile view"""

def setUp(self) -> None:
super(UserProfileView, self).setUp()
super().setUp()
self.user.profile.first_name = "First"
self.user.profile.last_name = "Last"
self.user.profile.about_me = "About"
Expand All @@ -222,7 +222,7 @@ class UserProfileCivis(BaseTestCase):
"""A class to test user profiles following view"""

def setUp(self) -> None:
super(UserProfileCivis, self).setUp()
super().setUp()

self.user2 = get_user_model().objects.create_user(
username="newuser2", email="[email protected]", password="password123"
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
9 changes: 9 additions & 0 deletions project/core/templates/global_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
</div>
</div>
</nav>
<div id="messages-container">
{% if messages %}
{% for message in messages %}
<div id="messages" class="{% if message.tags == 'error'%}card card-panel red lighten-1 dark-white-text {% endif %}bold-text">
{{message}}
</div>
{% endfor %}
{% endif %}
</div>
<div class="notifications">
<div id="modal1" class="modal notifications-modal bottom-sheet">
<div class="modal-content">
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" %}" />
{% 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
9 changes: 9 additions & 0 deletions project/core/templates/static/less/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ body {
color: @text !important;
}

#messages-container {
margin-right: 0.5%;
margin-left: 0.5%;
}

.errorlist {
margin: unset;
}

// Custom Input Colors
.white-background-input-field input:focus, .white-background-input-field textarea:focus {
border-bottom: 1px solid @purple !important;
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;
opacity: 1;
}

.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>
{% 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