Skip to content

Commit

Permalink
Updates for new data
Browse files Browse the repository at this point in the history
  • Loading branch information
yourcelf committed Oct 31, 2010
1 parent 9da371f commit 53df5c3
Show file tree
Hide file tree
Showing 13 changed files with 181 additions and 129 deletions.
26 changes: 11 additions & 15 deletions afg/templates/about.html
@@ -1,27 +1,24 @@
<div class='about'>
<p style='font-size: 14px; background-color: #ddffff; padding: 0.5em; border: 1px solid #aaaaff;'><b>2010-10-15:</b> This is the beta version for an update to DiaryDig. If you encounter bugs, please <a href='http://github.com/yourcelf/afgexplorer/issues'>file an issue</a> on GitHub. Thanks for trying it out!</p>
<p><b>New:</b> Search Iraq and Afghanistan war logs together!</p>

<p><b><a href='/'>DiaryDig.org</a></b> is an independently produced website
which provides an easy way to search through the
<a href='http://wikileaks.org/wiki/Afghan_War_Diary,_2004-2010'>Afghan War Diaries</a>,
which were made public by <a href='http://wikileaks.org/'>Wikileaks</a>
on 25th July 2010. The documents are a set of over 76,000 reports (with more
coming in the future) which cover the war in Afghanistan from 2004 to 2009.
</p>
<p>From here, you can <a href='{% url afg.search %}'>browse through all of the documents</a>
that have been released, organized by type, category, date, number of
casualties, and many other properties. From any
which provides an easy way to search through the war logs released by <a href='http://wikileaks.org'>Wikileaks</a>, including the <a href='http://wikileaks.org/wiki/Afghan_War_Diary,_2004-2010'>Afghan War Diary</a> and the <a href='http://warlogs.wikileaks.org/'>Iraq War Logs</a>.</p>

<p>From here, you can <a href='{% url afg.search %}'>browse through all of the
documents</a> that have been released, organized by type, category, date,
number of casualties, and many other properties. From any
<a href='{% url afg.show_entry 1026228 %}'>document page</a>, clicking on the
<span class='links numlinks9' style='cursor: auto'>green underlined</span> text
will open a popup that links to other documents that contain those phrases,
making it possible to see important search terms and connections that you might
not otherwise notice.</p>

<p>Our hope is that this tool will be helpful to reporters and researchers who
are interested in learning more about the US's war in Afghanistan and making
are interested in learning more about the US's ongoing wars, and making
sense of this important database. If you wish to support this work, we
encourage you to make a
<a href='http://wikileaks.org/wiki/WikiLeaks:Donate'>donation to wikileaks</a> or the <a href='http://www.bradleymanning.org/'>Bradley Manning legal defense fund</a>.
<a href='http://warlogs.wikileaks.org/media/support.html'>donation to wikileaks</a> or the <a href='http://www.bradleymanning.org/'>Bradley Manning legal defense fund</a>.
</p>
<a href="http://github.com/yourcelf/afgexplorer"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub" /></a>

<p>Source code for this website is freely available on
<a href='http://github.com/yourcelf/afgexplorer'>github</a> &ndash; we welcome
Expand All @@ -30,8 +27,7 @@
<p style='font-size: larger; margin-left: 2em'><a href='{% url afg.search %}'>On to the documents.</a></p>
<br />
<br />
<p><b>New: Acronyms</b>. Many acronyms are now highlighted, and can be expanded by mousing over them. The acronyms are taken from <a href='http://www.guardian.co.uk/world/datablog/2010/jul/25/wikileaks-afghanistan-war-logs-glossary'>guardian.co.uk's glossary</a>. Do you know of more acronyms that could be included? Please leave a comment at the <a href='http://github.com/yourcelf/afgexplorer'>github project</a>.</p>

<p><b>New: API</b>. Developers wishing to leverage this website for their own applications can now use Diary Dig to return JSON data. See <a href='{% url afg.api %}'>API</a> for details.
<p><b>API:</b> Developers wishing to leverage this website for their own applications can use Diary Dig to return JSON data. See <a href='{% url afg.api %}'>API</a> for details.
</p>
</div>
2 changes: 1 addition & 1 deletion afg/templates/afg/_logo.html
@@ -1,5 +1,5 @@
<div class='logo'>
<h1 class='logo'><a href='{% url afg.about %}'>Diary Dig</a></h1>
<h2>Afghan War Diaries Explorer</h2>
<h2>War Log Explorer</h2>
<hr>
</div>
3 changes: 2 additions & 1 deletion afg/templates/afg/entry.html
Expand Up @@ -169,7 +169,7 @@
{% endif %}
</div>
<div class='main'>
<h1>{{ entry.title }}</h1>
<h1 class='entry-title'>{{ entry.title }}</h1>
<div style='clear: both;'>
{{ entry.date }}
<div style='float: right;' class='toggle-acronyms'>
Expand Down Expand Up @@ -219,5 +219,6 @@ <h3>Limited script-free view:</h3>
"{% url afg.entry_popup %}",
"<img src='{{ MEDIA_URL }}img/spinner.gif' alt='loading ...' />"
);
$("h1.entry-title").html(acronyms($("h1.entry-title").html()));
</script>
</div>
10 changes: 8 additions & 2 deletions afg/templates/afg/entry_table.html
Expand Up @@ -2,12 +2,18 @@
<ul>
{% for entry, stub in entries %}
<li class='searchresult'>
<a href='{% url afg.show_entry entry.report_key %}'>{{ entry.title }}</a>
<a class='searchresult-title' href='{% url afg.show_entry entry.report_key %}'>{{ entry.title }}</a>
<span class='date'>{{ entry.date }}</span><br />
<span class='release'>{{ entry.release }}:</span>
<span class='category'>{{ entry.category }}</span>,
<span class='region'>{{ entry.region }}</span>,
<span class='casualties' title='{{ entry|casualty_summary }}'>{{ entry.total_casualties }} casualties</span>
<p>{{ stub }}</p>
<p class='searchresult-stub'>{{ stub }}</p>
</li>
{% endfor %}
</ul>
<script type='text/javascript'>
$(".searchresult-title, .searchresult-stub").each(function(index, el) {
$(this).html(acronyms($(this).html()));
});
</script>
11 changes: 11 additions & 0 deletions afg/templates/afg/search.html
Expand Up @@ -143,6 +143,14 @@ <h2>{{ choice_opts.title }}</h2>
<div style='clear: both;'></div>
</div>
<div class='results'>
<div style='float: right;' class='toggle-acronyms'>
<label for='toggleAcronyms'>Expand acronyms:
<input id='toggleAcronyms' type='checkbox' onclick='toggleAcronyms();' />
</label>
<span class='acronyms-expanded' style='display: none;'>
Take care; definitions may be wrong.
</span>
</div>
{% if about %}
{% include "about.html" %}
{% else %}{% if entries %}
Expand Down Expand Up @@ -196,5 +204,8 @@ <h2>{{ choice_opts.title }}</h2>
});
});
})();
if ($("acronym").length == 0) {
$(".toggle-acronyms").hide();
}
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion afg/templates/base.html
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}{% endblock %} -- Afghan War Diaries explorer</title>
<title>{% block title %}{% endblock %} -- War Log Explorer</title>
<link rel="stylesheet" type="text/css" media="all" href="{{MEDIA_URL}}css/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="{{MEDIA_URL}}css/cupertino/jquery-ui-1.8.4.custom.css" />
<script type='text/javascript' src='{{MEDIA_URL}}js/jquery.min.js'></script>
Expand Down
12 changes: 10 additions & 2 deletions afg/views.py
Expand Up @@ -60,7 +60,8 @@ def entry_popup(request):

def random_entry(request):
count = DiaryEntry.objects.count()
report_key = DiaryEntry.objects.all()[random.randint(0, count)].report_key
report_key = DiaryEntry.objects.all().values(
'report_key').order_by()[random.randint(0, count)]['report_key']
return utils.redirect_to("afg.show_entry", report_key)

def _excerpt(text, needles):
Expand Down Expand Up @@ -157,6 +158,8 @@ def search(request, about=False, api=False):
date_fields[facet] = field
else:
sqs = sqs.facet(facet)
# XXX: Set field-specific range limit for total casualties
sqs = sqs.raw_params(**{'f.total_casualties_exact.facet.limit': 200})

# Narrow query set by given facets
for key,val in request.GET.iteritems():
Expand Down Expand Up @@ -398,8 +401,13 @@ def search(request, about=False, api=False):
'num_results': page.paginator.count,
},
'entries': [{
'title': e.title,
'date': e.date.isoformat(),
'release': e.release,
'region': e.region,
'report_key': e.report_key,
'excerpt': x
'excerpt': x,
'total_casualties': e.total_casualties,
} for (e,x) in entries],
'choices': remapped_choices,
'sort': params['sort'],
Expand Down
20 changes: 15 additions & 5 deletions media/css/sass/style.sass
Expand Up @@ -10,8 +10,14 @@ body
text-align: left
width: 950px

.summary
font-family: "helvetica neue", arial, helvetica, sans-serif
//font-family: Consolas, "Lucida Console", Monaco, monospace
//font-family: "Courier New",Courier,monospace
h1, h2, h3, h4, h5, h6
font-family: cambria, georgia, times, "times new roman", serif
//font-family: "Courier New",Courier,monospace
font-size: 1.8em
margin-top: 0.5em
margin-bottom: 0.5em
Expand Down Expand Up @@ -50,7 +56,7 @@ li.searchresult
table
border-collapse: collapse
acronym, .toggle-acronyms
color: #800
color: #500
//border-top: 1px dotted #800
.logo
Expand Down Expand Up @@ -112,8 +118,8 @@ acronym, .toggle-acronyms

.date
color: #555
.category, .region, .casualties
color: #500
.release, .category, .region, .casualties
color: #050

.summary
line-height: 2em
Expand Down Expand Up @@ -147,6 +153,9 @@ acronym, .toggle-acronyms
.about
margin-top: 3em

h1.entry-title
font-size: 1.4em

.main
+column(16, true)

Expand All @@ -155,12 +164,12 @@ acronym, .toggle-acronyms
padding: 1em
.constraint
margin-bottom: 0.1em
+border-radius(5px, 5px)
+border-radius(5px)
background-color: #fa3
padding: 0.2em
margin-right: 1em
a, a:visited
+border-radius(15px, 15px)
+border-radius(15px)
text-decoration: none
padding: 0.2em
.sort
Expand All @@ -177,3 +186,4 @@ acronym, .toggle-acronyms

.sparkline
margin-bottom: -7px

0 comments on commit 53df5c3

Please sign in to comment.