diff --git a/data/countries.json b/data/countries.json index ebd3210e..f81f9635 100644 --- a/data/countries.json +++ b/data/countries.json @@ -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", diff --git a/devtracker.rb b/devtracker.rb index a3ad4e39..e8f8e238 100644 --- a/devtracker.rb +++ b/devtracker.rb @@ -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' diff --git a/helpers/search_helper.rb b/helpers/search_helper.rb index cc333f7a..3bda2a33 100644 --- a/helpers/search_helper.rb +++ b/helpers/search_helper.rb @@ -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']) @@ -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'] diff --git a/public/images/down-arrow.png b/public/images/down-arrow.png new file mode 100644 index 00000000..81a0d749 Binary files /dev/null and b/public/images/down-arrow.png differ diff --git a/public/images/up-arrow.png b/public/images/up-arrow.png new file mode 100644 index 00000000..82406ef0 Binary files /dev/null and b/public/images/up-arrow.png differ diff --git a/public/javascripts/searchPageFilters.js b/public/javascripts/searchPageFilters.js index b7a816d9..08c34683 100644 --- a/public/javascripts/searchPageFilters.js +++ b/public/javascripts/searchPageFilters.js @@ -360,17 +360,36 @@ $(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(); } }); @@ -378,18 +397,37 @@ $(document).ready(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(); + } }); }); } diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 4725e825..7067b2a1 100755 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -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{ @@ -624,4 +633,31 @@ g.c3-axis-y > g:last-child { width: 300px; height: auto; padding-top: 33px; -} \ No newline at end of file +} + +.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; + } \ No newline at end of file diff --git a/views/layouts/layout.erb b/views/layouts/layout.erb index d6d015cb..cd48347f 100644 --- a/views/layouts/layout.erb +++ b/views/layouts/layout.erb @@ -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); diff --git a/views/layouts/layout_forms.erb b/views/layouts/layout_forms.erb index c2c24eb8..9311db5d 100644 --- a/views/layouts/layout_forms.erb +++ b/views/layouts/layout_forms.erb @@ -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); diff --git a/views/partials/_project_list.html.erb b/views/partials/_project_list.html.erb index 25941f00..a204bdd9 100644 --- a/views/partials/_project_list.html.erb +++ b/views/partials/_project_list.html.erb @@ -1,8 +1,8 @@ + -
@@ -77,136 +77,164 @@

Results Filter

-
-
+
+
+

Status

-
    - <% countryAllProjectFilters["activity_status"].each do |statuses| %> -
  • - -
  • - <% end %> -
+
+
    + <% countryAllProjectFilters["activity_status"].each do |statuses| %> +
  • + +
  • + <% end %> +
+
<% if defined? sectorData %> -
+

Locations

-
-
+
+
+

Countries

-
    - <% locationCountryFilters['results'].each do |countryFilters| %> -
  • - -
  • - <% end %> -
+
+
    + <% locationCountryFilters['results'].each do |countryFilters| %> +
  • + +
  • + <% end %> +
+
-
-
+
+
+

Regions

-
    - <% locationRegionFilters['results'].each do |regionFilters| %> -
  • - -
  • - <% end %> -
+
+
    + <% locationRegionFilters['results'].each do |regionFilters| %> +
  • + +
  • + <% end %> +
+
<%end%> -
-
+
- -

Sectors

-
-
    - <% highLevelSectorList.each do |highLevelSectorName| %> -
  • - -
  • - <%end%> -
+ <%if highLevelSectorList.length > 0 %> +
+
+ +

Sectors

+
+
+
    + <% highLevelSectorList.each do |highLevelSectorName| %> +
  • + +
  • + <%end%> +
+
+ +
+ <%else%> -
-
-
+
+ <%end%> + -
-
+
- -

Document Type

-
-
    - <% documentTypes.each do |documentTypes| %> -
  • - -
  • - <% end %> -
+ <%if documentTypes.length > 0 %> +
+
+ +

Document Type

+
+
+
    + <% documentTypes.each do |documentTypes| %> +
  • + +
  • + <% end %> +
+
+ +
+ <%else%> -
+ <%end%> -
-
+
- -

Implementing Orgs

-
-
    - <% implementingOrgTypes.each do |implementingOrgTypes| %> -
  • - -
  • - <% end %> -
+ <%if implementingOrgTypes.length > 0 %> +
+
+ +

Organisations

+
+
+
    + <% implementingOrgTypes.each do |implementingOrgTypes| %> +
  • + +
  • + <% end %> +
+
+ +
+ <%else%> + <%end%> +
+
+

Budget Value

+ + +
+ +
-
-

Budget Value

- - -
- -
-
-

Start and end date

- - +
+
+

Start and end date

+ + +
+ +
+
- -
-