This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into star-angular
Conflicts: src/kawaz/templates/base.html
- Loading branch information
Showing
12 changed files
with
192 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
$ -> | ||
# ログインユーザーはMace Editorを使える | ||
$('.comment-form.authenticated-form').find('#id_comment').addClass('mace-editor') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
@import "common/define"; | ||
@import "common/vendor-prefixes"; | ||
|
||
.comment-form { | ||
margin: 20px; | ||
&.authenticated-form { | ||
// ログインフォームではname, email, urlを隠す | ||
.disable-field(name); | ||
.disable-field(email); | ||
.disable-field(url); | ||
} | ||
.disable-field(honeypot); | ||
} | ||
// 指定したフィールド名のフィールドを消し去るお便利mixin | ||
.disable-field(@field_name) { | ||
[for="id_@{field_name}"] { | ||
display: none; | ||
& ~ div { | ||
display: none; | ||
} | ||
} | ||
} | ||
.comment-list { | ||
margin: 20px 0 30px; | ||
} | ||
.comment-item { | ||
@border-radius: 5px; | ||
background-color: white; | ||
border: solid 1px @gray-lighter; | ||
.border-radius(@border-radius); | ||
margin: 20px; | ||
.comment-avatar { | ||
height: 100%; | ||
img { | ||
border: solid 1px @gray-lighter; | ||
background-color: @gray-lighter; | ||
} | ||
} | ||
.comment-info { | ||
.comment-avatar { | ||
top: -@avatar-size-small / 2; | ||
left: -@avatar-size-small / 2; | ||
position: absolute; | ||
} | ||
background-color: @brand-primary; | ||
border-radius: @border-radius @border-radius 0 0; | ||
-webkit-border-radius: @border-radius @border-radius 0 0; | ||
-moz-border-radius: @border-radius @border-radius 0 0; | ||
margin: 0; | ||
padding: 5px @avatar-size-small + 16px; | ||
.comment-index { | ||
font-weight: bold; | ||
} | ||
.username { | ||
font-size: 12px; | ||
color: @gray-light; | ||
a { | ||
color: @gray-light; | ||
} | ||
} | ||
} | ||
.comment-body { | ||
width: 100%; | ||
height: 100%; | ||
padding: 15px 20px; | ||
min-height: 40px; | ||
} | ||
.comment-date { | ||
time { | ||
float: right; | ||
} | ||
padding-bottom: 3px; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
{{ object }} | ||
{% include "blogs/components/entry_detail.html" %} | ||
{% include "comments/components/comment_items.html" %} | ||
{% include "comments/components/comment_form.html" %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
{% for object in object_list %} | ||
{{ object }} | ||
<a href="{{ object.get_absolute_url }}">{{ object }}</a> | ||
{% endfor %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% load comments %} | ||
{% load bootstrap %} | ||
{% get_comment_form for object as comment_form %} | ||
<h2>コメントの投稿</h2> | ||
<div class="comment-form{% if request.user.is_authenticated %} authenticated-form{% endif %}"> | ||
<form class="form-horizontal" method="POST" action="{% comment_form_target %}">{% csrf_token %} | ||
<div class="row"> | ||
{{ comment_form | bootstrap_horizontal }} | ||
<div class="form-group col col-lg-12"> | ||
<input type="submit" class="btn btn-primary" value="投稿"> | ||
</div> | ||
</div> | ||
</form> | ||
</div> |
42 changes: 42 additions & 0 deletions
42
src/kawaz/templates/comments/components/comment_items.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{% load comments %} | ||
{% get_comment_list for object as comments %} | ||
<div class="comment-list"> | ||
<h2>コメント</h2> | ||
{% for comment in comments %} | ||
<article class="comment-item row" id="c{{ comment.pk }}"> | ||
<header class="col col-lg-12 comment-info"> | ||
<div class="comment-avatar"> | ||
{% if comment.user.is_authenticated %} | ||
{# ログインユーザーはuserのavatar #} | ||
<img src="{{ MEDIA_URL }}{{ comment.user.avatar.middle }}" class="avatar avatar-middle" alt="@{{ comment.user.username }}"> | ||
{% else %} | ||
{# 非ログインユーザーはデフォルトのアイコン #} | ||
<img src="{{ MEDIA_URL }}" class="avatar avatar-middle"> | ||
{% endif %} | ||
</div> | ||
<span class="comment-index">{{ forloop.counter }}</span> | ||
{% if comment.user.is_authenticated %} | ||
<span class="nickname">{{ comment.user.nickname }}さん</span> | ||
<span class="username">(<a href="{{ comment.user.profile.get_absolute_url }}">@{{ comment.user.username }}</a>)</span> | ||
{% else %} | ||
<span>{{ comment.name }}さん</span> | ||
{% endif %} | ||
</header> | ||
<div class="comment-body col col-lg-12 comment-body"> | ||
{% if comment.user.is_authenticated %} | ||
{# ログインユーザーはmarkdownを使える #} | ||
<div class="markdown"> | ||
{{ comment.comment | markdown }} | ||
</div> | ||
{% else %} | ||
{# 非ログインユーザーは改行のみ変換される #} | ||
{{ comment.comment | linebreaksbr }} | ||
{% endif %} | ||
</div> | ||
|
||
<footer class="col col-lg-12 comment-date"> | ||
<time><a href="{{ comment.get_absolute_url }}">{{ comment.submit_date|date:"Y/m/d H:i" }}</a></time> | ||
</footer> | ||
</article> | ||
{% endfor %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters