Browse Source
I'm finishing up at the studio. So, just checking in the changes mades so far.. so I can carry-on at home.master
Craig Oates
2 years ago
16 changed files with 533 additions and 45 deletions
@ -0,0 +1,17 @@ |
|||||||
|
{% extends "layouts/app.html" %} |
||||||
|
{% block title %}{% lisp (title! "Edit article") %}{% endblock %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<h1>{% lisp (title!) %}</h1> |
||||||
|
|
||||||
|
<p><a href="/articles/{{article.id}}">Go back article</a></p> |
||||||
|
|
||||||
|
<form class="edit-article" id="edit-article" action="/articles/{{article.id}}" method="post"> |
||||||
|
<input type="hidden" name="AUTHENTICITY-TOKEN" value="{{token}}" /> |
||||||
|
<input type="hidden" name="METHOD" value="post"> |
||||||
|
{% include "articles/form.html" %} |
||||||
|
|
||||||
|
<div><input type="submit" name="commit" value="Commit"></div> |
||||||
|
</form> |
||||||
|
|
||||||
|
{% endblock %} |
@ -0,0 +1,117 @@ |
|||||||
|
{% include "shared/errors.html" %} |
||||||
|
|
||||||
|
<table class="attr"> |
||||||
|
<tr> |
||||||
|
<th><label for="title">Title</label></th> |
||||||
|
<td><input name="TITLE" id="title" type="text" value="{{article.title}}"/></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th><label for="body">Body</label></th> |
||||||
|
<td><textarea rows="10" cols="45" name="BODY" id="body">{{article.body}}</textarea></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th><label for="released-year">Date released</label></th> |
||||||
|
<td> |
||||||
|
<!-- NOTE TAKEN FROM CHAPTER 9: |
||||||
|
Regarding the above template, the above code |
||||||
|
article.date-releasedstarts from a variable reference such |
||||||
|
as , for example. For unknown reasons, if you use this |
||||||
|
origin variable as article a code that receives the object |
||||||
|
itself, the last SAFEfilter will not work for some reason. |
||||||
|
I'm wondering if it's a bug on the DJULA side, but I'm not |
||||||
|
confident. --> |
||||||
|
<select id="released-year" name="RELEASED-YEAR"> |
||||||
|
{{ article.date-released |
||||||
|
| lisp: (lambda(timestamp) |
||||||
|
(let((year(local-time:timestamp-year(local-time:now)))) |
||||||
|
(date-options :start 2000 :end (1+ year) |
||||||
|
:target (local-time:timestamp-year timestamp)))) |
||||||
|
| safe |
||||||
|
}} |
||||||
|
</select> |
||||||
|
<select id="released-month" name="RELEASED-MONTH"> |
||||||
|
{{ article.date-released |
||||||
|
| lisp: (lambda(timestamp) |
||||||
|
(date-options :start 1 :end 12 |
||||||
|
:target (local-time:timestamp-month timestamp))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
<select id="released-day" name="RELEASED-DAY"> |
||||||
|
{{ article.date-released |
||||||
|
| lisp: (lambda(timestamp) |
||||||
|
(date-options :start 1 :end 31 |
||||||
|
:target (local-time:timestamp-day timestamp))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
- |
||||||
|
<select id="released-hour" name="RELEASED-HOUR"> |
||||||
|
{{ article.date-released |
||||||
|
| lisp: (lambda(timestamp) |
||||||
|
(date-options :end 59 :target (local-time:timestamp-hour timestamp))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
<select id="released-min" name="RELEASED-MIN"> |
||||||
|
{{ article.date-released |
||||||
|
| lisp: (lambda(timestamp) |
||||||
|
(date-options :end 59 :target (local-time:timestamp-minute timestamp))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr> |
||||||
|
<th><label for="expired-year">Date expired</label></th> |
||||||
|
<td> |
||||||
|
<select id="expired-year" name="EXPIRED-YEAR"> |
||||||
|
{{ article.date-expired |
||||||
|
| lisp: (lambda(arg) |
||||||
|
(let((year(local-time:timestamp-year(local-time:now))) |
||||||
|
(timestamp(or arg (local-time:now)))) |
||||||
|
(date-options :start 2000 :end (1+ year) |
||||||
|
:target (local-time:timestamp-year timestamp)))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
<select id="expired-month" name="EXPIRED-MONTH"> |
||||||
|
{{ article.date-expired |
||||||
|
| lisp: (lambda(arg) |
||||||
|
(date-options :start 1 :end 12 |
||||||
|
:target (local-time:timestamp-month (or arg |
||||||
|
(local-time:now))))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
<select id="expired-day" name="EXPIRED-DAY"> |
||||||
|
{{ article.date-expired |
||||||
|
| lisp: (lambda(arg) |
||||||
|
(let((timestamp(or arg (local-time:now)))) |
||||||
|
(date-options :start 1 :end 31 |
||||||
|
:target (local-time:timestamp-day timestamp)))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
- |
||||||
|
<select id="expired-hour" name="EXPIRED-HOUR"> |
||||||
|
{{ article.date-expired |
||||||
|
| lisp: (lambda(arg) |
||||||
|
(let((timestamp(or arg (local-time:now)))) |
||||||
|
(date-options :end 59 |
||||||
|
:target (local-time:timestamp-hour timestamp)))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
<select id="expired-min" name="EXPIRED-MIN"> |
||||||
|
{{ article.date-expired |
||||||
|
| lisp: (lambda(arg) |
||||||
|
(let((timestamp(or arg (local-time:now)))) |
||||||
|
(date-options :end 59 |
||||||
|
:target (local-time:timestamp-minute timestamp)))) |
||||||
|
| safe }} |
||||||
|
</select> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th>Member only</th> |
||||||
|
<td> |
||||||
|
<label for="member-only">Member only</label> |
||||||
|
<!-- <input name="MEMBER-ONLY" type="hidden" value="0"> --> |
||||||
|
<input type="checkbox" id="member-only" name="MEMBER-ONLY" value="1" {% if article.member-only %}checked{% endif %} /> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
@ -0,0 +1,40 @@ |
|||||||
|
{% extends "layouts/app.html" %} |
||||||
|
{% block title %}{% lisp (title! "List of articles") %}{% endblock %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<h1>{% lisp (title!) %}</h1> |
||||||
|
|
||||||
|
<div class="toolbar"><a href="/articles/new">Write new article</a></div> |
||||||
|
|
||||||
|
{% if articles %} |
||||||
|
<table class="list"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>title</th> |
||||||
|
<th>date</th> |
||||||
|
<th>operation</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
{% for article in articles %} |
||||||
|
<tr> |
||||||
|
<td><a href="/articles/{{article.id}}">{{article.title}}</a></td> |
||||||
|
<td>{{ article.date-released |
||||||
|
| date: ((:year 4)"/"(:month 2)"/"(:day 2)" "(:hour 2)":"(:min 2)) |
||||||
|
}}</td> |
||||||
|
<td> |
||||||
|
<a href="/articles/{{article.id}}/edit">Edit</a>| |
||||||
|
<form action="/articles/{{article.id}}/delete" method="post"> |
||||||
|
<input type="hidden" name="AUTHENTICITY-TOKEN" value="{{token}}"> |
||||||
|
<input type="hidden" name="METHOD" value="delete"> |
||||||
|
<input type="submit" value="Delete"> |
||||||
|
</form> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
{% endfor %} |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
{% else %} |
||||||
|
<p>No articles</p> |
||||||
|
{% endif %} |
||||||
|
{% endblock %} |
@ -0,0 +1,14 @@ |
|||||||
|
{% extends "layouts/app.html" %} |
||||||
|
{% block title %} {% lisp (title! "Making new article") %} {% endblock %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<h1>{% lisp (title!) %}</h1> |
||||||
|
|
||||||
|
<form class="new-article" id="new-article" action="/articles" method="post"> |
||||||
|
<input type="hidden" name="AUTHENTICITY-TOKEN" value="{{token}}" /> |
||||||
|
<input type="hidden" name="METHOD" value="put"> |
||||||
|
{% include "articles/form.html" %} |
||||||
|
|
||||||
|
<div><input type="submit" name="commit" value="Commit"></div> |
||||||
|
</form> |
||||||
|
{% endblock %} |
@ -0,0 +1,37 @@ |
|||||||
|
{% extends "layouts/app.html" %} |
||||||
|
{% block title %}{{article.title}} - {% lisp (title!) %}{% endblock %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<h1>{{article.title}}</h1> |
||||||
|
|
||||||
|
{% if logged-in %} |
||||||
|
<div class="toolbar"><a href="/articles/{{article.id}}/edit">Edit</a></div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
<table class="attr"> |
||||||
|
<tr> |
||||||
|
<th width="100">Title</th> |
||||||
|
<td>{{article.title}}</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th>Article</th> |
||||||
|
<td>{{ article.body | simple-format | safe }}</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th>Released at</th> |
||||||
|
<td>{{ article.date-released | date: ((:year 4)"/"(:month 2)"/"(:day 2)" "(:hour 2)":"(:min 2)) }}</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th>Expired at</th> |
||||||
|
<td> |
||||||
|
{% if article.date-expired %} |
||||||
|
{{ article.date-expired | date: ((:year 4)"/"(:month 2)"/"(:day 2)" "(:hour 2)":"(:min 2)) }} |
||||||
|
{% endif %} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<th>Member only</th> |
||||||
|
<td>{% if article.member-only-p %}Is a member{% else %}Is not a member{% endif %}</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
{% endblock %} |
Loading…
Reference in new issue