Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
17 changes: 17 additions & 0 deletions app/assets/javascripts/pages.js
Original file line number Diff line number Diff line change
@@ -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'
});
}
3 changes: 0 additions & 3 deletions app/assets/javascripts/pages.js.coffee

This file was deleted.

6 changes: 6 additions & 0 deletions app/assets/stylesheets/main.css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#country-info
position: absolute
z-index: 99
width: 200px
height: 100px
background-color: white
13 changes: 7 additions & 6 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
module ApplicationHelper

def nav_link text, action
s = <<-HTML
<li class='#{"active" if action_name == action}'>
#{link_to text, send("pages_#{action}_path")}
</li>
HTML
s.html_safe
end

end
13 changes: 13 additions & 0 deletions app/helpers/pages_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
module PagesHelper

def map_area country
ret = <<-HTML
<area shape="#{shape country.coordinates}" coords="#{country.coordinates}" href="#"
class="country-area" onclick="show_country('#{country.name}')"/>
HTML
ret.html_safe
end

def shape coords
coords.split(",").size == 4 ? "rect" : "poly"
end

end
24 changes: 12 additions & 12 deletions app/views/layouts/_continents_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<navbar class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container">
<ul class="nav nav-pills" id="c_nav">
<li class="active"><%= link_to "World", pages_home_path %></li>
<li><%= link_to "North America", pages_north_america_path %></li>
<li><%= link_to "South America", pages_south_america_path %></li>
<li><%= link_to "Europe", pages_europe_path %></li>
<li><%= link_to "Africa", pages_africa_path %></li>
<li><%= link_to "Asia", pages_asia_path %></li>
<li><%= link_to "Australia", pages_australia_path %></li>
</ul>
</div>
<div class="navbar-inner">
<div class="container">
<ul class="nav nav-pills" id="c_nav">
<%= nav_link "World", "home" %>
<%= nav_link "North America", "north_america" %>
<%= nav_link "South America", "south_america" %>
<%= nav_link "Europe", "europe" %>
<%= nav_link "Africa", "africa" %>
<%= nav_link "Asia", "asia" %>
<%= nav_link "Australia", "australia" %>
</ul>
</div>
</div>
</navbar>
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title><%= (yield(:title)) %></title>
<title><%= action_name.split("_").map {|x| x.capitalize}.join(" ") %></title>
<%= stylesheet_link_tag "application", media: "all",
"data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/pages/_country.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= @country.name %><br/>
<%= link_to "close", "#", onclick: "$('#country-info').hide();return false" %>
11 changes: 1 addition & 10 deletions app/views/pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
<% provide(:title, 'About') %>
<!DOCTYPE html>
<html>
<head>
<title>World | <%= yield(:title) %></title>
</head>
<body>
<h1>World</h1>
</body>
</html>
about omg, nie doctype, to uz mas v layouts/application.html nadefinovane
12 changes: 1 addition & 11 deletions app/views/pages/africa.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
<% provide(:title, 'Home') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
WTF, PRECO JE VSADE TO ISTE OMG!!!!
12 changes: 1 addition & 11 deletions app/views/pages/asia.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
<% provide(:title, 'Home') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
WTF, PRECO JE VSADE TO ISTE OMG!!!!
12 changes: 1 addition & 11 deletions app/views/pages/australia.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
<% provide(:title, 'Home') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
WTF, PRECO JE VSADE TO ISTE OMG!!!!
2 changes: 0 additions & 2 deletions app/views/pages/country.html.erb

This file was deleted.

2 changes: 2 additions & 0 deletions app/views/pages/country.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$("#country-info").html('<%= escape_javascript(render "country") %>');
$("#country-info").show();
12 changes: 1 addition & 11 deletions app/views/pages/europe.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
<% provide(:title, 'Europe') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
WTF, PRECO JE VSADE TO ISTE OMG!!!!
17 changes: 8 additions & 9 deletions app/views/pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<% provide(:title, 'Home') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>

<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
<% @countries.each do |country| %>
<%= map_area country %>
<% end %>
</map>

<div id="country-info" style="display:none">
</div>
12 changes: 1 addition & 11 deletions app/views/pages/north_america.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
<% provide(:title, 'Home') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
WTF, PRECO JE VSADE TO ISTE OMG!!!!
12 changes: 1 addition & 11 deletions app/views/pages/south_america.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
<% provide(:title, 'Home') %>
<%= image_tag("Misc_Map_400645.jpg", :usemap => "#map") %>
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:prales -->
<area shape="poly" coords="545,114,576,114,574,105,594,100,616,104,646,119,638,138,610,143,596,141,572,132,568,145,557,137,562,133,559,129,552,129,541,122,543,116,544,116" href="http://localhost:3000/pages/country" />
<area shape="rect" coords="298,25,376,46" href="http://www.google.com" />
</map>
WTF, PRECO JE VSADE TO ISTE OMG!!!!