Skip to content

Commit

Permalink
Codes updated
Browse files Browse the repository at this point in the history
  • Loading branch information
aunindadf committed Apr 27, 2016
1 parent 718fb73 commit aae2893
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 196 deletions.
4 changes: 2 additions & 2 deletions data/countries.json
Original file line number Diff line number Diff line change
Expand Up @@ -2421,8 +2421,8 @@
},
{
"code":"TZ",
"name":"Tanzania",
"description":"Tanzania is politically stable, and is looking ahead to its fifth multi-party election in 2015. The country has experienced more than 10 years of 6–7% growth, and made strong progress in access to basic services. However, 30 million people (over two thirds of the population) live below $1.25 a day. If Tanzania is to achieve its goal of reaching middle income status by 2025, it needs to further accelerate its growth rate while also shifting to more equitable broad-based growth to ensure it also delivers a reduction in poverty.\n\n## Top priorities\n* scaling up wealth creation programmes to support a shift to a greater economic development focus in DFID’s programme\n* delivering the MDGs and improving the effectiveness, quality and equity of service delivery in water, education and health\n* getting government to work better and helping Tanzanians hold their government to account\n\n## Further resources\n[DFID Operational Plan for Tanzania](https://www.gov.uk/government/publications/dfid-tanzania-operational-plan-2014)\n\n[Tanzania page on GOV.UK website](https://www.gov.uk/government/world/tanzania)",
"name":"Tanzania",
"description":"Tanzania has made major progress over the last 15 years: it remains politically stable; the economy has grown by 7% a year on average; almost all children are now enrolled in primary school; and infant mortality and deaths from malaria have halved. But despite this progress, acute challenges remain: 21 million people (43% of the population) live below the international poverty line; and the country ranks 159 on the Human Development Index. \n\n## Top priorities\n* **Economic development:** Tanzania to take significant steps both to realise the potential its youth through job creation, and to manage the growth of its cities. Renewables, including off-grid household solar, to become a major source of energy.\n* **Manifesto results:** to dramatically reduce the number of Tanzanians in extreme poverty, see a step-change in the quality of primary education, and help girls and women have more voice, choice and control over their lives.\n* **Golden thread:** democracy in Tanzania to be further entrenched through a strengthened parliament, civil society and media. Government systems to be more able to deliver against priorities, including tackling corruption. And Tanzania’s partnership with Her Majesty’s Revenue and Customs (HMRC) to continue to drive increases in domestic revenue. \n\n## Further resources\n[DFID Operational Plan for Tanzania](https://www.gov.uk/government/publications/dfid-tanzania-operational-plan-2014)\n\n[Tanzania page on GOV.UK website](https://www.gov.uk/government/world/tanzania)",
"population":44973000,
"lifeExpectancy":58,
"incomeLevel":"Low income",
Expand Down
3 changes: 2 additions & 1 deletion devtracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@
countryAllProjectFilters = get_static_filter_list()
region = {}
#Region code can't be left empty. So we are passing an empty string instead. Same goes with the 'region name'.
region[:code] = "NS,ZZ"
#region[:code] = "NS,ZZ"
region[:code] = "998"
region[:name] = "All"
getRegionProjects = get_region_projects(region[:code])
settings.devtracker_page_title = 'Global All Projects Page'
Expand Down
20 changes: 12 additions & 8 deletions helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def generate_searched_data(query)
searchedData['highLevelSectorList'] = high_level_sector_list_filter( sectorValuesJSON) # Returns the high level sector data with name and codes
# Initiating the actual start date and the planned end date.
searchedData['actualStartDate'] = '1990-01-01T00:00:00'
searchedData['plannedEndDate'] = '2000-01-01T00:00:00'
searchedData['plannedEndDate'] = '2100-01-01T00:00:00'
# Pulling json data with an order by on actual start date to get the starting bound for the LHS date range slider.
searchedData['actualStartDate'] = RestClient.get settings.oipa_api_url + "activities/?format=json&page_size=1&fields=activity_dates&hierarchy=1&q=#{query}&ordering=actual_start_date&start_date_gte=1900-01-02"
searchedData['actualStartDate'] = JSON.parse(searchedData['actualStartDate'])
Expand All @@ -135,13 +135,17 @@ def generate_searched_data(query)
# Pulling json data with an order by on planned end date (DSC) to get the ending bound for the LHS date range slider.
searchedData['plannedEndDate'] = RestClient.get settings.oipa_api_url + "activities/?format=json&page_size=1&fields=activity_dates&hierarchy=1&q=#{query}&ordering=-planned_end_date&end_date_isnull=False"
searchedData['plannedEndDate'] = JSON.parse(searchedData['plannedEndDate'])
#puts searchedData['plannedEndDate']
tempEndDate = searchedData['plannedEndDate']['results'][0]['activity_dates'].select{|activityDate| activityDate['type']['code'] == '3'}.first
if (tempEndDate.nil?)
tempEndDate = searchedData['plannedEndDate']['results'][0]['activity_dates'].select{|activityDate| activityDate['type']['code'] == '4'}.first
end
searchedData['plannedEndDate'] = tempEndDate
searchedData['plannedEndDate'] = searchedData['plannedEndDate']['iso_date']
puts "activities/?format=json&page_size=1&fields=activity_dates&hierarchy=1&q=#{query}&ordering=-planned_end_date&end_date_isnull=False"
if(searchedData['plannedEndDate']['count'] > 0)
tempEndDate = searchedData['plannedEndDate']['results'][0]['activity_dates'].select{|activityDate| activityDate['type']['code'] == '3'}.first
if (tempEndDate.nil?)
tempEndDate = searchedData['plannedEndDate']['results'][0]['activity_dates'].select{|activityDate| activityDate['type']['code'] == '4'}.first
end
searchedData['plannedEndDate'] = tempEndDate
searchedData['plannedEndDate'] = searchedData['plannedEndDate']['iso_date']
else
searchedData['plannedEndDate'] = '2100-01-01T00:00:00'
end
#unless searchedData['plannedEndDate']['results'][0].nil?
# if !searchedData['plannedEndDate']['results'][0]['activity_dates'][2].nil?
# searchedData['plannedEndDate'] = searchedData['plannedEndDate']['results'][0]['activity_dates'][2]['iso_date']
Expand Down
Binary file added public/images/down-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/up-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 47 additions & 9 deletions public/javascripts/searchPageFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,36 +360,74 @@ $(document).ready(function() {
function attachFilterExpColClickEvent(){
$('.proj-filter-exp-collapse-sign').click(function(){

if($(this).text() == '+'){
/*if($(this).text() == '+'){
$(this).text('-');
$(this).parent().find("div[name=countries]").show('slow');
$(this).parent().find("div[name=regions]").show('slow');
$(this).parent().find("ul").show('slow');
$(this).parent().find("div[name=countries]").show();
$(this).parent().find("div[name=regions]").show();
$(this).parent().find("ul").show();
$(this).parent().find(".mContent").show();
}
else{
$(this).text('+');
$(this).parent().find("div[name=countries]").hide('slow');
$(this).parent().find("div[name=regions]").hide('slow');
$(this).parent().find("ul").hide('slow');
$(this).parent().find("div[name=countries]").hide();
$(this).parent().find("div[name=regions]").hide();
$(this).parent().find("ul").hide();
$(this).parent().find(".mContent").hide();
}*/

if($(this).hasClass('proj-filter-exp-collapse-sign-down')){
$(this).removeClass('proj-filter-exp-collapse-sign-down').addClass('proj-filter-exp-collapse-sign-up');
//$(this).text('-');
$(this).parent().find("div[name=countries]").show();
$(this).parent().find("div[name=regions]").show();
$(this).parent().find("ul").show();
$(this).parent().find(".mContent").show();
}
else{
$(this).removeClass('proj-filter-exp-collapse-sign-up').addClass('proj-filter-exp-collapse-sign-down');
//$(this).text('+');
$(this).parent().find("div[name=countries]").hide();
$(this).parent().find("div[name=regions]").hide();
$(this).parent().find("ul").hide();
$(this).parent().find(".mContent").hide();
}
});

$('.proj-filter-exp-collapse-text').click(function(){

$(this).parent().find('.proj-filter-exp-collapse-sign').each(function(){

if($(this).text() == '+'){
/*if($(this).text() == '+'){
$(this).text('-');
$(this).parent().find("div[name=countries]").show('slow');
$(this).parent().find("div[name=regions]").show('slow');
$(this).parent().find("ul").show('slow');
$(this).parent().find(".mContent").show('slow');
}
else{
$(this).text('+');
$(this).parent().find("div[name=countries]").hide('slow');
$(this).parent().find("div[name=regions]").hide('slow');
$(this).parent().find("ul").hide('slow');
}
$(this).parent().find(".mContent").hide('slow');
}*/

if($(this).hasClass('proj-filter-exp-collapse-sign-down')){
$(this).removeClass('proj-filter-exp-collapse-sign-down').addClass('proj-filter-exp-collapse-sign-up');
//$(this).text('-');
$(this).parent().find("div[name=countries]").show();
$(this).parent().find("div[name=regions]").show();
$(this).parent().find("ul").show();
$(this).parent().find(".mContent").show();
}
else{
$(this).removeClass('proj-filter-exp-collapse-sign-up').addClass('proj-filter-exp-collapse-sign-down');
//$(this).text('+');
$(this).parent().find("div[name=countries]").hide();
$(this).parent().find("div[name=regions]").hide();
$(this).parent().find("ul").hide();
$(this).parent().find(".mContent").hide();
}
});
});
}
Expand Down
44 changes: 40 additions & 4 deletions public/stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,24 @@ span.language {
}

.proj-filter-exp-collapse-sign{
width:20px;
height:20px;;
width:22px;
height:22px;;
text-align: left;
vertical-align:top;
font-size:1.5em;
margin: 0px 2px 2px 2px;
border: none;
float:left;
float:right;
cursor:pointer;
color: #f4f4f4;
}

.proj-filter-exp-collapse-sign-down {
background-image: url(/images/down-arrow.png);
}

.proj-filter-exp-collapse-sign-up {
background-image: url(/images/up-arrow.png);
}

a.documentTitleLink{
Expand Down Expand Up @@ -624,4 +633,31 @@ g.c3-axis-y > g:last-child {
width: 300px;
height: auto;
padding-top: 33px;
}
}

.mContent {
display: none;
margin-bottom: 15px;
overflow-x: hidden;
overflow-y: scroll;
min-height: 10px;
max-height: 200px;
width: 100%;
}

.mContent ul li {
border-bottom: 1px solid #DEDEDE;
}

#filter h3,
#filter h4 {
margin-bottom: 1px;
}

#filter h4 {
margin-top: 1px;
}

.filter-header {
margin-bottom: 10px;
}
4 changes: 2 additions & 2 deletions views/layouts/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
});
//This stores the base url inside a global variable so that we can make the oipa calls through the varnish
var tempGetUrl = window.location;
//window.baseUrl = tempGetUrl.protocol + "//" + tempGetUrl.host + "/" + "api/";
window.baseUrl = 'http://staging-dfid.oipa.nl/api/';
window.baseUrl = tempGetUrl.protocol + "//" + tempGetUrl.host + "/" + "api/";
//window.baseUrl = 'http://staging-dfid.oipa.nl/api/';
$('#search').submit(function(){
$('.modal_free_text_search').show();
setTimeout(patience,10000);
Expand Down
4 changes: 2 additions & 2 deletions views/layouts/layout_forms.erb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
});
//This stores the base url inside a global variable so that we can make the oipa calls through the varnish
var tempGetUrl = window.location;
//window.baseUrl = tempGetUrl.protocol + "//" + tempGetUrl.host + "/" + "api/";
window.baseUrl = 'http://staging-dfid.oipa.nl/api/';
window.baseUrl = tempGetUrl.protocol + "//" + tempGetUrl.host + "/" + "api/";
//window.baseUrl = 'http://staging-dfid.oipa.nl/api/';
$('#search').submit(function(){
$('.modal_free_text_search').show();
setTimeout(patience,10000);
Expand Down
Loading

0 comments on commit aae2893

Please sign in to comment.