Added band drop down on the gridsquare band view.

这个提交包含在:
Peter Goodhall 2019-06-28 18:17:54 +01:00
父节点 80ee410d23
当前提交 8b3d5cf1bb
共有 3 个文件被更改,包括 39 次插入2 次删除

查看文件

@ -10,7 +10,6 @@ class Gridsquares extends CI_Controller {
/*
* TODO List
* - Show squares that have been worked and confirmed in green
* - Create index page
* - Band page provide a band dropdown list
* - Find somewhere in the main menu to add a button to it
@ -255,7 +254,7 @@ class Gridsquares extends CI_Controller {
$data['grid_2char'] = js_array($array_grid_2char);
$data['grid_4char'] = js_array($array_grid_4char);
$data['bands_available'] = js_array($this->config->item('bands_available'));
$this->load->view('interface_assets/header', $data);
$this->load->view('gridsquares/index.php');

查看文件

@ -4,6 +4,14 @@
<h2><?php echo $page_title; ?></h2>
<?php if ($this->uri->segment(1) == "gridsquares" && $this->uri->segment(2) == "band") { ?>
<form class="form-inline">
<label class="my-1 mr-2" for="gridsquare_bands">Band Selection</label>
<select class="custom-select my-1 mr-sm-2" id="gridsquare_bands"></select>
</form>
<?php } ?>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">

查看文件

@ -550,6 +550,36 @@ $(document).ready(function(){
var maidenhead = L.maidenhead().addTo(map);
<?php if ($this->uri->segment(1) == "gridsquares" && $this->uri->segment(2) == "band") { ?>
var bands_available = <?php echo $bands_available; ?>;
$.each(bands_available, function(key, value) {
$('#gridsquare_bands')
.append($("<option></option>")
.attr("value",value)
.text(value));
});
var num = "<?php echo $this->uri->segment(3);?>";
$("#gridsquare_bands option").each(function(){
if($(this).val()==num){ // EDITED THIS LINE
$(this).attr("selected","selected");
}
});
$(function(){
// bind change event to select
$('#gridsquare_bands').on('change', function () {
var url = $(this).val(); // get selected value
if (url) { // require a URL
window.location = "<?php echo site_url('gridsquares/band/');?>" + url
}
return false;
});
});
<?php } ?>
</script>
<?php } ?>