Changeset 1908890
- Timestamp:
- 07/13/2018 05:00:12 PM (8 years ago)
- Location:
- slider-matches-results/trunk
- Files:
-
- 9 edited
-
assets/css/smr-admin.css (modified) (2 diffs)
-
assets/js/smr-admin-teams.js (modified) (1 diff)
-
assets/js/smr-admin-translation.js (modified) (3 diffs)
-
inc/ajax/teams.php (modified) (1 diff)
-
languages/slider-matches-results-fr_FR.mo (modified) (previous)
-
languages/slider-matches-results-fr_FR.po (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
-
slider-matches-results.php (modified) (3 diffs)
-
templates/teams.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
slider-matches-results/trunk/assets/css/smr-admin.css
r1877617 r1908890 1 1 table.dataTable thead .sorting:before, table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_asc_disabled:before, table.dataTable thead .sorting_desc_disabled:before { 2 2 right: 1.2em; 3 } 4 5 .cursor-not-allowed{ 6 cursor : not-allowed; 7 } 8 9 .cursor-grab{ 10 cursor : grab; 3 11 } 4 12 … … 11 19 } 12 20 13 #smr input[type="number"], #smr-create-team input[type="number"], #smr-update-team input[type="number"] {21 #smr input[type="number"], #smr-create-team input[type="number"], #smr-update-team input[type="number"], #smr-update-teams input[type="number"] { 14 22 height: auto; 15 23 } -
slider-matches-results/trunk/assets/js/smr-admin-teams.js
r1880323 r1908890 336 336 } 337 337 }); 338 339 340 $(document).on("click", "#smr-button-update-teams", function () { 341 342 var teams = smrTeamsTable.rows().data(); 343 344 345 for (let index = 0; index < teams.length; index++) { 346 347 var html = ''; 348 349 var id = teams[index][0]; 350 var name = teams[index][1]; 351 var position = teams[index][2]; 352 var points = teams[index][3]; 353 354 html = ' \ 355 <div id="smr-update-teams-' + id + '" class="input-group mb-3 smr-update-teams-row"> \ 356 <input id="smr-update-teams-id-input" type="hidden" name="smr-update-teams-id-input" value="' + id + '" readonly> \ 357 <input id="smr-update-teams-name-input" class="form-control" type="text" name="smr-update-teams-name-input" placeholder="' + translation['name'] + '" aria-label="Name" aria-describedby="smr-update-teams-name-label" value="' + name + '" readonly> \ 358 <input id="smr-update-teams-position-input" class="form-control" type="number" name="smr-update-teams-position-input" placeholder="' + translation['position'] + '" aria-label="Position" aria-describedby="smr-update-teams-position-label" value="' + position + '"> \ 359 <input id="smr-update-teams-points-input" class="form-control" type="number" name="smr-update-teams-points-input" placeholder="' + translation['points'] + '" aria-label="Points" aria-describedby="smr-update-teams-points-label" value="' + points + '"> \ 360 </div>'; 361 362 $('#smr-update-teams #smr-form-update-teams .modal-body').append( html ); 363 364 }; 365 366 367 368 }); 369 370 $("#smr-form-update-teams").submit(function(e){ 371 372 e.preventDefault(); 373 374 var idArray = []; 375 var positionArray = []; 376 var pointsArray = []; 377 378 $('input[name="smr-update-teams-id-input"]').each( function(){ 379 idArray.push( $(this).val() ); 380 }); 381 382 $('input[name="smr-update-teams-position-input"]').each( function(){ 383 positionArray.push( $(this).val() ); 384 }); 385 386 $('input[name="smr-update-teams-points-input"]').each( function(){ 387 pointsArray.push( $(this).val() ); 388 }); 389 390 jQuery.post( smr_ajax_teams.ajax_url, { 391 action : smr_ajax_teams.update_teams, 392 idArray : idArray, 393 positionArray : positionArray, 394 pointsArray : pointsArray 395 }, function(response) { 396 397 398 console.log(response); 399 400 var nbRowsInPage = $('.smr-row').length; 401 402 for (let index = 0; index < nbRowsInPage ; index++) { 403 404 var id = idArray[index]; 405 var name = smrTeamsTable.rows(index).data()[0][1]; 406 var logo = smrTeamsTable.rows(index).data()[0][4]; 407 var btnUpdate = smrTeamsTable.rows(index).data()[0][5]; 408 var btnDelete = smrTeamsTable.rows(index).data()[0][6]; 409 var checkbox = smrTeamsTable.rows(index).data()[0][7]; 410 411 smrTeamsTable.row($('#smr-row-'+id)).data( [ 412 id, 413 name, 414 positionArray[index], 415 pointsArray[index], 416 logo, 417 btnUpdate, 418 btnDelete, 419 checkbox 420 ] ).draw( false ); 421 422 } 423 424 $('#smr-update-teams').modal('toggle'); 425 426 swal({ 427 title: translation['Updated !'], 428 html: translation['Your teams has been updated.\nThe page will be refreshed.'], 429 type: 'success' 430 }).then((result) => { 431 location.reload(); 432 }); 433 }) 434 .fail(function(response) { 435 swal({ 436 title: translation['Not Updated !'], 437 text: translation['Your teams hasn\'t been updated.'], 438 type: 'error' 439 }) 440 }); 441 }); 338 442 } 339 443 }); -
slider-matches-results/trunk/assets/js/smr-admin-translation.js
r1877617 r1908890 40 40 'Your team has been updated.':'Your team has been updated.', 41 41 'Your team hasn\'t been updated.':'Your team hasn\'t been updated.', 42 'Upload image':'Upload image' 42 'Your teams hasn\'t been updated.':'Your teams hasn\'t been updated.', 43 'Your teams has been updated.\nThe page will be refreshed.':'Your teams has been updated.<br><br>The page will be refreshed.', 44 'Upload image':'Upload image', 45 'name':'Name', 46 'position':'Position', 47 'points':'Points' 43 48 }, 44 49 'fr' : { … … 61 66 'Updated !' : 'Mise à jour !', 62 67 'Update' : 'Mettre à jour', 63 'Not updated !' : 'N\'a pas été mise à jour !',68 'Not updated !' : 'N\'a pas été mise à jour !', 64 69 'Your match has been deleted.' : 'Votre match a été supprimé.', 65 70 'Your matches have been deleted.' : 'Vos matchs ont été supprimées.', … … 82 87 'Your team has been updated.':'Votre équipe a été mise à jour.', 83 88 'Your team hasn\'t been updated.':'Votre équipe n\'a pas été mise à jour.', 84 'Upload image':'Importer une image' 89 'Your teams hasn\'t been updated.':'Vos équipes n\'ont pas été mises à jour.', 90 'Your teams has been updated.\nThe page will be refreshed.':'Vos équipes ont été mises à jour.<br><br>La page va être rafraîchie.', 91 'Upload image':'Importer une image', 92 'name':'Nom', 93 'position':'Position', 94 'points':'Points' 85 95 } 86 96 } -
slider-matches-results/trunk/inc/ajax/teams.php
r1881529 r1908890 50 50 } 51 51 52 wp_die(); 53 } 54 55 /** 56 * Ajax - Update Team. 57 * 58 * @since 1.0.3 59 * 60 */ 61 add_action( 'wp_ajax_smr_update_teams', 'smr_update_teams' ); 62 function smr_update_teams() { 63 64 global $wpdb; 65 66 $t_id = $_POST['idArray']; 67 $t_position = $_POST['positionArray']; 68 $t_points = $_POST['pointsArray']; 69 70 for($index = 0; $index < count( $t_id ); $index++) { 71 if( !empty( $t_id[$index] ) ){ 72 $sql = "UPDATE ".$wpdb->prefix."smr_teams SET position = %d, points = %d WHERE id = %d"; 73 $wpdb->get_results( $wpdb->prepare( $sql,array( $t_position[$index], $t_points[$index], $t_id[$index] ) ) ); 74 } 75 } 76 52 77 wp_die(); 53 78 } -
slider-matches-results/trunk/languages/slider-matches-results-fr_FR.po
r1877617 r1908890 2 2 msgstr "" 3 3 "Project-Id-Version: Slider Matches Results\n" 4 "POT-Creation-Date: 2018-0 5-12 11:44+0200\n"5 "PO-Revision-Date: 2018-0 5-12 11:45+0200\n"4 "POT-Creation-Date: 2018-06-19 23:40+0200\n" 5 "PO-Revision-Date: 2018-06-20 00:00+0200\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 2.0. 7\n"12 "X-Generator: Poedit 2.0.8\n" 13 13 "X-Poedit-Basepath: ..\n" 14 14 "Plural-Forms: nplurals=2; plural=(n > 1);\n" … … 26 26 msgstr "journée" 27 27 28 #: slider-matches-results.php: 793 templates/sliders.php:1128 #: slider-matches-results.php:803 templates/sliders.php:11 29 29 msgid "Sliders" 30 30 msgstr "Curseurs" 31 31 32 #: slider-matches-results.php: 796 templates/settings.php:1232 #: slider-matches-results.php:806 templates/settings.php:12 33 33 #: templates/settings.php:458 templates/teams.php:11 34 34 msgid "Teams" 35 35 msgstr "Equipes" 36 36 37 #: slider-matches-results.php: 797 templates/matches.php:1437 #: slider-matches-results.php:807 templates/matches.php:14 38 38 #: templates/settings.php:13 templates/settings.php:515 39 39 msgid "Matches" 40 40 msgstr "Matchs" 41 41 42 #: slider-matches-results.php: 798 templates/settings.php:442 #: slider-matches-results.php:808 templates/settings.php:4 43 43 #: templates/settings.php:21 templates/settings.php:329 44 44 #: templates/settings.php:458 templates/settings.php:515 … … 79 79 msgstr "Curseur" 80 80 81 #: templates/create_slider.php:30 templates/teams.php:28 templates/teams.php:83 82 #: templates/teams.php:133 templates/update_slider.php:30 81 #: templates/create_slider.php:30 templates/teams.php:29 templates/teams.php:77 82 #: templates/teams.php:108 templates/teams.php:158 83 #: templates/update_slider.php:30 83 84 msgid "Name" 84 85 msgstr "Nom" … … 248 249 249 250 #: templates/matches.php:53 templates/matches.php:130 templates/sliders.php:42 250 #: templates/teams.php:5 0 templates/teams.php:109251 #: templates/teams.php:51 templates/teams.php:83 templates/teams.php:134 251 252 msgid "Update" 252 253 msgstr "Mettre à jour" 253 254 254 #: templates/matches.php:56 templates/sliders.php:45 templates/teams.php:5 3255 #: templates/matches.php:56 templates/sliders.php:45 templates/teams.php:54 255 256 msgid "Delete" 256 257 msgstr "Supprimer" … … 261 262 262 263 #: templates/matches.php:74 templates/matches.php:131 templates/matches.php:143 263 #: templates/matches.php:199 templates/teams.php:71 templates/teams.php:110 264 #: templates/teams.php:122 templates/teams.php:157 264 #: templates/matches.php:199 templates/teams.php:72 templates/teams.php:84 265 #: templates/teams.php:96 templates/teams.php:135 templates/teams.php:147 266 #: templates/teams.php:182 265 267 msgid "Close" 266 268 msgstr "Fermer" … … 283 285 "et ces champs ne doivent pas être égaux pour valider l’ajout de votre match." 284 286 285 #: templates/matches.php:198 templates/teams.php:1 56287 #: templates/matches.php:198 templates/teams.php:181 286 288 msgid "Create" 287 289 msgstr "Créer" … … 386 388 msgstr "Nom du curseur" 387 389 388 #: templates/teams.php:17 390 #: templates/teams.php:17 templates/teams.php:146 389 391 msgid "Add Team" 390 392 msgstr "Ajouter une équipe" … … 394 396 msgstr "Supprimer les équipes" 395 397 396 #: templates/teams.php:29 templates/teams.php:89 templates/teams.php:139 398 #: templates/teams.php:19 templates/teams.php:71 399 msgid "Update Teams" 400 msgstr "Mettre à jour vos équipes" 401 402 #: templates/teams.php:30 templates/teams.php:78 templates/teams.php:114 403 #: templates/teams.php:164 397 404 msgid "Position" 398 405 msgstr "Position" 399 406 400 #: templates/teams.php:30 templates/teams.php:95 templates/teams.php:145 407 #: templates/teams.php:31 templates/teams.php:79 templates/teams.php:120 408 #: templates/teams.php:170 401 409 msgid "Points" 402 410 msgstr "Points" 403 411 404 #: templates/teams.php:3 1412 #: templates/teams.php:32 405 413 msgid "Logo" 406 414 msgstr "Logo" 407 415 408 #: templates/teams.php: 70409 msgid "Update team"410 msgstr "Mettre à jour l’équipe"411 412 #: templates/teams.php: 76413 msgid "" 414 "You must fill in the \"Name\" field to validate the updating of your team ."416 #: templates/teams.php:95 417 msgid "Update Team" 418 msgstr "Mettre à jour votre équipe" 419 420 #: templates/teams.php:101 421 msgid "" 422 "You must fill in the \"Name\" field to validate the updating of your team" 415 423 msgstr "" 416 424 "Vous devez remplir les champs « Équipe à domicile » et « Équipe extérieure » " 417 "et ces champs ne doivent pas être égaux pour valider l’ajout de votre équipe ."418 419 #: templates/teams.php:1 01 templates/teams.php:151425 "et ces champs ne doivent pas être égaux pour valider l’ajout de votre équipe" 426 427 #: templates/teams.php:126 templates/teams.php:176 420 428 msgid "Url" 421 429 msgstr "Url" 422 430 423 #: templates/teams.php:121 424 msgid "Add team" 425 msgstr "Ajouter un équipe" 426 427 #: templates/teams.php:127 431 #: templates/teams.php:152 428 432 msgid "" 429 433 "You must fill in the \"Name\" field to validate the addition of your team." … … 468 472 msgid "https://www.cedricchevillard.fr" 469 473 msgstr "" 474 475 #~ msgid "Add team" 476 #~ msgstr "Ajouter un équipe" -
slider-matches-results/trunk/readme.txt
r1881075 r1908890 3 3 Tags: Slider, Matches, Results, Club 4 4 Requires at least: 3.6 5 Tested up to: 4.9. 65 Tested up to: 4.9.7 6 6 Requires PHP: 5.4 7 7 License: GPL2 … … 61 61 == changelog == 62 62 63 - Adjust CSS of slider / ranking64 - Correction - Topic : "Errors" 63 - Correction - Ajax request 64 - Correction - Topic : "Errors" (second) 65 65 66 66 == Screenshots == -
slider-matches-results/trunk/slider-matches-results.php
r1881529 r1908890 4 4 Plugin URI: 5 5 Description: Allows you to create specific sliders for your sports team (Football, Handball ...) 6 Version: 1.0. 26 Version: 1.0.3 7 7 Author: Cédric Chevillard 8 8 Author URI: https://www.cedricchevillard.fr … … 17 17 class Slider_Matches_Results 18 18 { 19 const VERSION = '1.0. 2';19 const VERSION = '1.0.3'; 20 20 const SMR_DB_VERSION = '1.0'; 21 21 const OPTION_NAME = 'smr_options_settings'; … … 734 734 $settings_teams_json = $this->get_option_settings_teams(); 735 735 736 wp_localize_script( 'smr_admin_script', 'smr_ajax_teams',array( 'ajax_url' => admin_url( 'admin-ajax.php'), 'language' => $this->get_language(), 'dataTableLanguage' => plugins_url( 'languages/js/datatables/'.$this->get_language().'.json', __FILE__ ), 'create_team' => 'smr_create_team', 'delete_team' => 'smr_delete_team', 'update_team ' => 'smr_update_team','delete_teams' => 'smr_delete_teams', 'table_order_by' => $settings_teams_json->order_by, 'table_nb_elements' => $settings_teams_json->nb_elements ) );736 wp_localize_script( 'smr_admin_script', 'smr_ajax_teams',array( 'ajax_url' => admin_url( 'admin-ajax.php'), 'language' => $this->get_language(), 'dataTableLanguage' => plugins_url( 'languages/js/datatables/'.$this->get_language().'.json', __FILE__ ), 'create_team' => 'smr_create_team', 'delete_team' => 'smr_delete_team', 'update_teams' => 'smr_update_teams', 'update_team' => 'smr_update_team','delete_teams' => 'smr_delete_teams', 'table_order_by' => $settings_teams_json->order_by, 'table_nb_elements' => $settings_teams_json->nb_elements ) ); 737 737 738 738 }elseif( $page_admin == 'smr_plugin_matches' ){ -
slider-matches-results/trunk/templates/teams.php
r1877617 r1908890 17 17 <button id="smr-button-create-team" class="btn btn-primary" type="button" data-toggle="modal" data-target="#smr-create-team"><?php _e( 'Add Team', 'slider-matches-results' ); ?></button> 18 18 <button id='smr-button-delete-multiple' class="btn btn-danger" type="button" disabled><?php _e( 'Delete Teams', 'slider-matches-results' ); ?></button> 19 <button id="smr-button-update-teams" class="btn btn-success" type="button" data-toggle="modal" data-target="#smr-update-teams"><?php _e( 'Update Teams', 'slider-matches-results' ); ?></button> 19 20 </div> 20 21 </div> … … 37 38 <tbody> 38 39 <?php foreach( $teams as $team ) { ?> 39 <tr id="smr-row-<?php echo $team->get_id(); ?>" >40 <tr id="smr-row-<?php echo $team->get_id(); ?>" class="smr-row"> 40 41 <td class="smr-cell-id"><?php echo $team->get_id(); ?></td> 41 42 <td class="smr-cell-name"><?php echo stripslashes( $team->get_name() ); ?></td> … … 64 65 </div> 65 66 67 <div class="modal fade" id="smr-update-teams" tabindex="-1" role="dialog" aria-hidden="true"> 68 <div class="modal-dialog modal-dialog-centered" role="document"> 69 <div class="modal-content"> 70 <div class="modal-header"> 71 <h4 class="modal-title"><?php _e( 'Update Teams', 'slider-matches-results' ); ?></h4> 72 <button class="close" type="button" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only"><?php _e( 'Close', 'slider-matches-results' ); ?></span></button> 73 </div> 74 <form id="smr-form-update-teams" role="form"> 75 <div class="modal-body"> 76 <div id="smr-update-teams-<?php echo $team->get_id(); ?>" class="input-group mb-3"> 77 <label class="form-control text-center cursor-grab"> <?php _e( 'Name', 'slider-matches-results' ); ?> </label> 78 <label class="form-control text-center cursor-grab"> <?php _e( 'Position', 'slider-matches-results' ); ?> </label> 79 <label class="form-control text-center cursor-grab"> <?php _e( 'Points', 'slider-matches-results' ); ?> </label> 80 </div> 81 </div> 82 <div class="modal-footer"> 83 <button class="btn btn-success" type="submit" name="smr-update-teams" formmethod="post" ><?php _e( 'Update', 'slider-matches-results' ); ?></button> 84 <button class="btn btn-danger" type="button" data-dismiss="modal"><?php _e( 'Close', 'slider-matches-results' ); ?></button> 85 </div> 86 </form> 87 </div> 88 </div> 89 </div> 90 66 91 <div class="modal fade" id="smr-update-team" tabindex="-1" role="dialog" aria-hidden="true"> 67 92 <div class="modal-dialog modal-dialog-centered" role="document"> 68 93 <div class="modal-content"> 69 94 <div class="modal-header"> 70 <h4 class="modal-title"><?php _e( 'Update team', 'slider-matches-results' ); ?></h4>95 <h4 class="modal-title"><?php _e( 'Update Team', 'slider-matches-results' ); ?></h4> 71 96 <button class="close" type="button" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only"><?php _e( 'Close', 'slider-matches-results' ); ?></span></button> 72 97 </div> … … 74 99 <div class="modal-body"> 75 100 <div class="alert alert-info "> 76 <p> <?php _e( 'You must fill in the "Name" field to validate the updating of your team . ', 'slider-matches-results' ); ?></p>101 <p> <?php _e( 'You must fill in the "Name" field to validate the updating of your team', 'slider-matches-results' ); ?>.</p> 77 102 </div> 78 103 <input id="smr-update-team-id-input" type="hidden" name="smr-update-team-id-input"> … … 119 144 <div class="modal-content"> 120 145 <div class="modal-header"> 121 <h4 class="modal-title"><?php _e( 'Add team', 'slider-matches-results' ); ?></h4>146 <h4 class="modal-title"><?php _e( 'Add Team', 'slider-matches-results' ); ?></h4> 122 147 <button class="close" type="button" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only"><?php _e( 'Close', 'slider-matches-results' ); ?></span></button> 123 148 </div>
Note: See TracChangeset
for help on using the changeset viewer.