Permalink
Browse files

Merge branch 'master' of https://github.com/akariv/gov-watch into iso…

…tope
  • Loading branch information...
mushon committed May 3, 2012
2 parents 557511d + 00eae76 commit d4fc9a809f610d9c7e892680bedc6c22c0be5745
Showing with 63 additions and 46 deletions.
  1. +27 −16 src/gov-watch.iced
  2. +2 −2 src/static/html/index.html
  3. +34 −28 src/static/js/gov-watch.js
View
@@ -170,7 +170,7 @@ setup_searchbox = ->
if $(this).val() == ""
show_watermark(true)
$("#searchbar").submit -> false
-
+
source = []
for tag in all_tags
source.push({type:"tag",title:tag})
@@ -179,12 +179,12 @@ setup_searchbox = ->
$("#searchbox").typeahead
source: source
items: 20
- matcher: (item) -> ~item.title.indexOf(this.query)
+ matcher: (item) -> ~item.title.indexOf(this.query)
valueof: (item) -> item.title
- selected: (val) ->
+ selected: (val) ->
search_term = val
update_history()
- highlighter: (item) ->
+ highlighter: (item) ->
highlighted_title = item.title.replace( new RegExp('(' + this.query + ')', 'ig'), ($1, match) -> '<strong>' + match + '</strong>' )
if item.type == "subject"
return highlighted_title
@@ -241,7 +241,7 @@ process_data = ->
)
# Update the document with rendered HTML
$("#items").html(html)
-
+
$(".item").each ->
# current status
implementation_status = $(this).attr('implementation-status')
@@ -258,17 +258,28 @@ process_data = ->
timeline_items = $(this).find(".timeline .timeline-point")
timeline_items.tsort({attr:'data-duedate',order:'asc'})
timeline_items = $(this).find(".timeline .timeline-point")
- len = timeline_items.length
- if len == 1
- stops = 1
- else
- stops = 75 / (len-1)
- for i in [0..len]
- timeline_item = $(timeline_items[i])
- timeline_item.css("top",(10+i*stops)+"%")
- timeline_item.tooltip({delay: {show:0,hide:1000},placement:'bottom',title:timeline_item.html()})
- timeline_item.html('')
-
+
+ max_numeric_date = 0
+ min_numeric_date = 2100 * 372
+ timeline_items.each( ->
+ date = $(this).attr('data-duedate')
+ date = date.split('/')
+ [year,month,day] = (parseInt(d) for d in date)
+ numeric_date = (year * 372) + ((month-1) * 31) + (day-1)
+ if numeric_date == NaN
+ numeric_date = 2012 * 372
+ if numeric_date > max_numeric_date
+ max_numeric_date = numeric_date + 1
+ if numeric_date < min_numeric_date
+ min_numeric_date = numeric_date
+ $(this).attr('data-duedate-numeric',numeric_date)
+ )
+ timeline_items.each( ->
+ date = parseInt($(this).attr('data-duedate-numeric'))
+ percent = (date - min_numeric_date) / (max_numeric_date - min_numeric_date) * 75.0 + 10
+ $(this).css("top",percent+"%")
+ )
+
# Allow the DOM to sync
await setTimeout((defer _),50)
@@ -33,7 +33,7 @@
<script type="text/html" name="item">
{{#items}}
-<div class="item span" rel="{{slug}}" {{#gov}} title="{{recommendation}}" cost="{{budget_cost_millions}}" implementation-status="{{implementation_status}}">
+<div class="item span" rel="{{slug}}" {{#gov}} title="{{recommendation}}" cost="{{budget.millions}}" implementation-status="{{implementation_status}}">
<div class="item-body">
<div class="tags">
@@ -156,7 +156,7 @@ <h1>דו"ח טרכטנברג</h1>
<!-- <p><a class="btn primary large">למדו עוד &raquo;</a></p> -->
<form id="searchbar" action="#">
<fieldset id='search'>
- <input id="searchbox" class="xlarge" type="text" size="30" name="xlInput">
+ <input id="searchbox" class="xlarge" type="text" size="30" autocomplete="off" name="xlInput">
<div id="filters">
<select id="books" name="normalSelect"></select>
<!--select id="chapters" name="normalSelect"></select-->
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit d4fc9a8

Please sign in to comment.