Show flags in dialog titlebars.

master
Pacman Ghost 6 years ago
parent ca30238615
commit 4192bf9654
  1. 1
      vasl_templates/webapp/static/css/main.css
  2. 1
      vasl_templates/webapp/static/simple_notes.js
  3. 25
      vasl_templates/webapp/static/utils.js
  4. 1
      vasl_templates/webapp/static/vo.js
  5. 1
      vasl_templates/webapp/static/vo2.js

@ -37,6 +37,7 @@ button.edit-template { height: 30px ; padding: 4px 10px ; }
button.edit-template img { height: 18px ; vertical-align: middle ; margin-right: 0.25em ; }
.ui-dialog-titlebar { padding: 0.2em 0.5em 0.2em 0.5em !important ; }
.ui-dialog-titlebar img.flag { height: 1em ; margin-right: 0.25em ; }
.ui-dialog-titlebar-close { margin-top: -10px !important ; }
.ui-dialog-content p { margin-bottom: 0.5em ; }
.ui-dialog-buttonpane button.ok { background: #ddd ; }

@ -42,6 +42,7 @@ function _do_edit_simple_note( $sortable2, $entry, default_width )
open: function() {
// initialize
on_dialog_open( $(this) ) ;
add_flag_to_dialog_titlebar( $(this), get_player_no_for_element($sortable2) ) ;
$caption = $(this).children( "textarea" ) ;
var $btn_pane = $(".ui-dialog.edit-simple_note .ui-dialog-buttonpane") ;
$width = $btn_pane.children( "input[name='width']" ) ;

@ -7,10 +7,18 @@ function get_nationality_display_name( nat_id )
return gTemplatePack.nationalities[ nat_id ].display_name ;
}
function get_player_nat( player_no )
{
// get the player's nationality
if ( player_no === null )
return null ;
return $( "select[name='PLAYER_" + player_no + "']" ).val() ;
}
function get_player_colors( player_no )
{
// get the colors for the specified player
var player_nat = $( "select[name='PLAYER_" + player_no + "']" ).val() ;
var player_nat = get_player_nat( player_no ) ;
return gTemplatePack.nationalities[ player_nat ].ob_colors ;
}
@ -286,6 +294,21 @@ function restrict_droplist_height( $sel )
// --------------------------------------------------------------------
function add_flag_to_dialog_titlebar( $dlg, player_no )
{
// add a flag to the dialog's titlebar
var player_nat = get_player_nat( player_no ) ;
if ( ! player_nat )
return ;
var $titlebar = $dlg.dialog( "instance" ).uiDialogTitlebar ;
var url = gImagesBaseUrl + "/flags/" + player_nat + ".png" ;
$titlebar.find( ".ui-dialog-title" ).prepend(
$( "<img src='" + url + "' class='flag'>" )
).css( { display: "flex", "align-items": "center" } ) ;
}
// --------------------------------------------------------------------
function getUrlParam( param )
{
// look for the specified URL parameter

@ -90,6 +90,7 @@ function add_vo( vo_type, player_no )
open: function() {
// initialize
on_dialog_open( $(this) ) ;
add_flag_to_dialog_titlebar( $(this), get_player_no_for_element($sortable2) ) ;
$sel.select2( "open" ) ;
// set the titlebar color
var colors = get_player_colors_for_element( $sortable2 ) ;

@ -95,6 +95,7 @@ function _do_edit_ob_vo( $entry, player_no, vo_type )
open: function() {
// initialize
on_dialog_open( $(this) ) ;
add_flag_to_dialog_titlebar( $(this), player_no ) ;
// set the titlebar color
var colors = get_player_colors( player_no ) ;
$( ".ui-dialog.edit-vo .ui-dialog-titlebar" ).css( {

Loading…
Cancel
Save