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'> <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 <p><b><a href='/'>DiaryDig.org</a></b> is an independently produced website
which provides an easy way to search through the 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>
<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> <p>From here, you can <a href='{% url afg.search %}'>browse through all of the
on 25th July 2010. The documents are a set of over 76,000 reports (with more documents</a> that have been released, organized by type, category, date,
coming in the future) which cover the war in Afghanistan from 2004 to 2009. number of casualties, and many other properties. From any
</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 <a href='{% url afg.show_entry 1026228 %}'>document page</a>, clicking on the
<span class='links numlinks9' style='cursor: auto'>green underlined</span> text <span class='links numlinks9' style='cursor: auto'>green underlined</span> text
will open a popup that links to other documents that contain those phrases, 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 making it possible to see important search terms and connections that you might
not otherwise notice.</p> not otherwise notice.</p>

<p>Our hope is that this tool will be helpful to reporters and researchers who <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 sense of this important database. If you wish to support this work, we
encourage you to make a 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> </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 <p>Source code for this website is freely available on
<a href='http://github.com/yourcelf/afgexplorer'>github</a> &ndash; we welcome <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> <p style='font-size: larger; margin-left: 2em'><a href='{% url afg.search %}'>On to the documents.</a></p>
<br /> <br />
<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> </p>
</div> </div>
2 changes: 1 addition & 1 deletion afg/templates/afg/_logo.html
@@ -1,5 +1,5 @@
<div class='logo'> <div class='logo'>
<h1 class='logo'><a href='{% url afg.about %}'>Diary Dig</a></h1> <h1 class='logo'><a href='{% url afg.about %}'>Diary Dig</a></h1>
<h2>Afghan War Diaries Explorer</h2> <h2>War Log Explorer</h2>
<hr> <hr>
</div> </div>
3 changes: 2 additions & 1 deletion afg/templates/afg/entry.html
Expand Up @@ -169,7 +169,7 @@
{% endif %} {% endif %}
</div> </div>
<div class='main'> <div class='main'>
<h1>{{ entry.title }}</h1> <h1 class='entry-title'>{{ entry.title }}</h1>
<div style='clear: both;'> <div style='clear: both;'>
{{ entry.date }} {{ entry.date }}
<div style='float: right;' class='toggle-acronyms'> <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 %}", "{% url afg.entry_popup %}",
"<img src='{{ MEDIA_URL }}img/spinner.gif' alt='loading ...' />" "<img src='{{ MEDIA_URL }}img/spinner.gif' alt='loading ...' />"
); );
$("h1.entry-title").html(acronyms($("h1.entry-title").html()));
</script> </script>
</div> </div>
10 changes: 8 additions & 2 deletions afg/templates/afg/entry_table.html
Expand Up @@ -2,12 +2,18 @@
<ul> <ul>
{% for entry, stub in entries %} {% for entry, stub in entries %}
<li class='searchresult'> <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='date'>{{ entry.date }}</span><br />
<span class='release'>{{ entry.release }}:</span>
<span class='category'>{{ entry.category }}</span>, <span class='category'>{{ entry.category }}</span>,
<span class='region'>{{ entry.region }}</span>, <span class='region'>{{ entry.region }}</span>,
<span class='casualties' title='{{ entry|casualty_summary }}'>{{ entry.total_casualties }} casualties</span> <span class='casualties' title='{{ entry|casualty_summary }}'>{{ entry.total_casualties }} casualties</span>
<p>{{ stub }}</p> <p class='searchresult-stub'>{{ stub }}</p>
</li> </li>
{% endfor %} {% endfor %}
</ul> </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 style='clear: both;'></div>
</div> </div>
<div class='results'> <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 %} {% if about %}
{% include "about.html" %} {% include "about.html" %}
{% else %}{% if entries %} {% else %}{% if entries %}
Expand Down Expand Up @@ -196,5 +204,8 @@ <h2>{{ choice_opts.title }}</h2>
}); });
}); });
})(); })();
if ($("acronym").length == 0) {
$(".toggle-acronyms").hide();
}
</script> </script>
{% endblock %} {% endblock %}
2 changes: 1 addition & 1 deletion afg/templates/base.html
Expand Up @@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="{{MEDIA_URL}}css/cupertino/jquery-ui-1.8.4.custom.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> <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): def random_entry(request):
count = DiaryEntry.objects.count() 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) return utils.redirect_to("afg.show_entry", report_key)


def _excerpt(text, needles): def _excerpt(text, needles):
Expand Down Expand Up @@ -157,6 +158,8 @@ def search(request, about=False, api=False):
date_fields[facet] = field date_fields[facet] = field
else: else:
sqs = sqs.facet(facet) 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 # Narrow query set by given facets
for key,val in request.GET.iteritems(): 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, 'num_results': page.paginator.count,
}, },
'entries': [{ 'entries': [{
'title': e.title,
'date': e.date.isoformat(),
'release': e.release,
'region': e.region,
'report_key': e.report_key, 'report_key': e.report_key,
'excerpt': x 'excerpt': x,
'total_casualties': e.total_casualties,
} for (e,x) in entries], } for (e,x) in entries],
'choices': remapped_choices, 'choices': remapped_choices,
'sort': params['sort'], '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 text-align: left
width: 950px 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 h1, h2, h3, h4, h5, h6
font-family: cambria, georgia, times, "times new roman", serif font-family: cambria, georgia, times, "times new roman", serif
//font-family: "Courier New",Courier,monospace
font-size: 1.8em font-size: 1.8em
margin-top: 0.5em margin-top: 0.5em
margin-bottom: 0.5em margin-bottom: 0.5em
Expand Down Expand Up @@ -50,7 +56,7 @@ li.searchresult
table table
border-collapse: collapse border-collapse: collapse
acronym, .toggle-acronyms acronym, .toggle-acronyms
color: #800 color: #500
//border-top: 1px dotted #800 //border-top: 1px dotted #800
.logo .logo
Expand Down Expand Up @@ -112,8 +118,8 @@ acronym, .toggle-acronyms


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


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


h1.entry-title
font-size: 1.4em

.main .main
+column(16, true) +column(16, true)


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


.sparkline .sparkline
margin-bottom: -7px margin-bottom: -7px

0 comments on commit 53df5c3

Please sign in to comment.