Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert user navigation to a dropdown menu #447

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Vendorfile
Expand Up @@ -5,6 +5,7 @@ folder 'vendor/assets' do

folder 'bootstrap' do
file 'bootstrap.tooltip.js', 'https://raw.github.com/twbs/bootstrap/v2.3.2/js/bootstrap-tooltip.js'
file 'bootstrap.dropdown.js', 'https://raw.github.com/twbs/bootstrap/v2.3.2/js/bootstrap-dropdown.js'
end

folder 'leaflet' do
Expand Down
39 changes: 19 additions & 20 deletions app/assets/javascripts/application.js
Expand Up @@ -4,6 +4,7 @@
//= require jquery.cookie
//= require jquery.throttle-debounce
//= require bootstrap.tooltip
//= require bootstrap.dropdown
//= require augment
//= require osm
//= require leaflet
Expand All @@ -16,7 +17,6 @@
//= require oauth
//= require piwik
//= require map
//= require menu
//= require sidebar
//= require richtext
//= require geocoder
Expand Down Expand Up @@ -95,26 +95,25 @@ function updatelinks(loc, zoom, layers, bounds, object) {
}

link.href = href;

var minzoom = $(link).data("minzoom");
if (minzoom) {
var name = link.id.replace(/anchor$/, "");
$(link).off("click.minzoom");
if (zoom >= minzoom) {
$(link)
.attr("title", I18n.t("javascripts.site." + name + "_tooltip"))
.removeClass("disabled");
} else {
$(link)
.attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"))
.addClass("disabled")
.on("click.minzoom", function () {
alert(I18n.t("javascripts.site." + name + "_zoom_alert"));
return false;
});
}
}
});

var editDisabled = zoom < 13;
$('#edit_tab')
.tooltip({placement: 'bottom'})
.off('click.minzoom')
.on('click.minzoom', function() { return !editDisabled; })
.toggleClass('disabled', editDisabled)
.attr('data-original-title', editDisabled ?
I18n.t('javascripts.site.edit_disabled_tooltip') : '');

var historyDisabled = zoom < 11;
$('#history_tab')
.tooltip({placement: 'bottom'})
.off('click.minzoom')
.on('click.minzoom', function() { return !historyDisabled; })
.toggleClass('disabled', historyDisabled)
.attr('data-original-title', historyDisabled ?
I18n.t('javascripts.site.history_disabled_tooltip') : '');
}

// generate a cookie-safe string of map state
Expand Down
9 changes: 3 additions & 6 deletions app/assets/javascripts/browse.js
Expand Up @@ -23,7 +23,7 @@ $(document).ready(function () {
}).addTo(map);

$("#loading").hide();
$("#browse_map .geolink").show();
$("#browse_map .secondary-actions").show();

$("a[data-editor=remote]").click(function () {
return remoteEditHandler(bbox);
Expand All @@ -41,7 +41,7 @@ $(document).ready(function () {
bbox = map.getBounds();

$("#loading").hide();
$("#browse_map .geolink").show();
$("#browse_map .secondary-actions").show();

$("a[data-editor=remote]").click(function () {
return remoteEditHandler(bbox);
Expand All @@ -61,7 +61,7 @@ $(document).ready(function () {
zoom: true,
callback: function(extent) {
$("#loading").hide();
$("#browse_map .geolink").show();
$("#browse_map .secondary-actions").show();

if (extent) {
$("a.bbox[data-editor=remote]").click(function () {
Expand All @@ -82,7 +82,4 @@ $(document).ready(function () {
}
});
}

createMenu("area_edit", "area_edit_menu", "right");
createMenu("object_edit", "object_edit_menu", "right");
});
49 changes: 0 additions & 49 deletions app/assets/javascripts/menu.js

This file was deleted.