diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fb3f248..9097d83 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,10 +13,3 @@ //= require jquery //= require jquery_ujs //= require_tree . - -$(document).ready(function(){ - $('#c_nav li').click(function() { - $(this).siblings('li').removeClass('active'); - $(this).addClass('active'); - }); -}); \ No newline at end of file diff --git a/app/assets/javascripts/pages.js b/app/assets/javascripts/pages.js new file mode 100644 index 0000000..c499c2a --- /dev/null +++ b/app/assets/javascripts/pages.js @@ -0,0 +1,17 @@ +$(document).ready(function(){ + + $(".country-area").click(function(e) { + var top = e.pageY + "px"; + var left = e.pageX + "px"; + $("#country-info").css({top: top, left: left}); + }); + +}); + +function show_country(name) { + $.ajax({ + url: "/country", + data: "name=" + name, + dataType: 'script' + }); +} diff --git a/app/assets/javascripts/pages.js.coffee b/app/assets/javascripts/pages.js.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/pages.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/main.css.sass b/app/assets/stylesheets/main.css.sass new file mode 100644 index 0000000..f91cec6 --- /dev/null +++ b/app/assets/stylesheets/main.css.sass @@ -0,0 +1,6 @@ +#country-info + position: absolute + z-index: 99 + width: 200px + height: 100px + background-color: white \ No newline at end of file diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 051b83e..5bacec4 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -3,26 +3,27 @@ def home end def country + @country = Country.where(name: params[:name]).first end def about end - + def north_america end - + def south_america end - + def europe end - + def africa end - + def asia end - + def australia end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..f596bf8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,12 @@ module ApplicationHelper + + def nav_link text, action + s = <<-HTML +
  • + #{link_to text, send("pages_#{action}_path")} +
  • + HTML + s.html_safe + end + end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb index 2c057fd..1591363 100644 --- a/app/helpers/pages_helper.rb +++ b/app/helpers/pages_helper.rb @@ -1,2 +1,15 @@ module PagesHelper + + def map_area country + ret = <<-HTML + + HTML + ret.html_safe + end + + def shape coords + coords.split(",").size == 4 ? "rect" : "poly" + end + end diff --git a/app/views/layouts/_continents_navbar.html.erb b/app/views/layouts/_continents_navbar.html.erb index bd4467e..3607f72 100644 --- a/app/views/layouts/_continents_navbar.html.erb +++ b/app/views/layouts/_continents_navbar.html.erb @@ -1,15 +1,15 @@ -