Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Moved scoreboard.php to ScoreboardModalController.php, removed unused…
Browse files Browse the repository at this point in the history
… modals, updated Gruntfile
  • Loading branch information
gsingh93 committed May 7, 2016
1 parent 4cfbf30 commit 0e4fdb6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 236 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Expand Up @@ -81,6 +81,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-run');

grunt.registerTask('check', ['force:eslint', 'run:flow']);
grunt.registerTask('default', ['check', 'browserify', 'copy:browserify', 'sass']);
grunt.registerTask('build', ['browserify', 'copy:browserify', 'sass']);
grunt.registerTask('default', ['check', 'build']);
grunt.registerTask('release', ['env:release', 'eslint', 'run:flow', 'browserify', 'uglify', 'sass']);
};
2 changes: 2 additions & 0 deletions src/Router.php
Expand Up @@ -31,6 +31,8 @@ class Router {
return await (new TutorialModalController())->genRender($modal);
case 'country':
return await (new CountryModalController())->genRender($modal);
case 'scoreboard':
return await (new ScoreboardModalController())->genRender($modal);
default:
throw new NotFoundRedirectException();
}
Expand Down
@@ -1,14 +1,9 @@
<?hh // strict

require_once($_SERVER['DOCUMENT_ROOT'] . '/../vendor/autoload.php');

/* HH_IGNORE_ERROR[1002] */
SessionUtils::sessionStart();
SessionUtils::enforceLogin();

class ScoreboardController {
class ScoreboardModalController extends ModalController {
public async function genGenerateIndicator(): Awaitable<:xhp> {
$indicator = <div class="indicator game-progress-indicator"></div>;

$game = await Configuration::gen('game');
if ($game->getValue() === '1') {
$start_ts = await Configuration::gen('start_ts');
Expand All @@ -22,26 +17,23 @@ class ScoreboardController {
$current_s = intval($now) - intval($start_ts);
$current = intval($current_s/$s_each);

for ($i=0; $i<10; $i++) {
for ($i = 0; $i < 10; $i++) {
$indicator_classes = 'indicator-cell ';
if ($current >= $i) {
$indicator_classes .= 'active ';
}
$indicator->appendChild(
<span class={$indicator_classes}></span>
);
$indicator->appendChild(<span class={$indicator_classes}></span>);
}
} else {
for ($i=0; $i<10; $i++) {
$indicator->appendChild(
<span class="indicator-cell"></span>
);
for ($i = 0; $i < 10; $i++) {
$indicator->appendChild(<span class="indicator-cell"></span>);
}
}
return $indicator;
}

public async function genRender(): Awaitable<:xhp> {
<<__Override>>
public async function genRender(string $_): Awaitable<:xhp> {
$scoreboard_tbody = <tbody></tbody>;

// If refresing is enabled, do the needful
Expand Down Expand Up @@ -83,7 +75,6 @@ class ScoreboardController {
<a href="#" class="js-close-modal">
<svg class="icon icon--close">
<use href="#icon--close"/>
</svg>
</a>
</div>
Expand Down Expand Up @@ -118,6 +109,3 @@ class ScoreboardController {
</div>;
}
}

$scoreboard_generated = new ScoreboardController();
echo \HH\Asio\join($scoreboard_generated->genRender());
32 changes: 0 additions & 32 deletions src/inc/modals/forgot-login-password.php

This file was deleted.

152 changes: 0 additions & 152 deletions src/inc/modals/scoreboard-final.php

This file was deleted.

5 changes: 5 additions & 0 deletions src/static/js/fb-ctf.js
Expand Up @@ -1767,6 +1767,11 @@ function setupInputListeners() {
function init() {
// init the jquery object variables
$gameboard = $('#fb-gameboard');
console.log('1');
$gameboard.find('[data-modal=scoreboard]').on('click', function() {
console.log('2');
Modal.loadController('index.php?p=scoreboard&modal=scoreboard');
});

setInterval(Clock.clockRunning, 10);

Expand Down
31 changes: 0 additions & 31 deletions src/static/js/modal.js
Expand Up @@ -22,28 +22,7 @@ module.exports = (function() {
$modalContainer = $('#fb-main-content');
$countryHover = $('#fb-country-popup');

//
// trigger the launch of a modal
//
$body.on('click', '.js-launch-modal', function(event) {
event.preventDefault();
var modal = $(this).data('modal'),
cb;

//
// if we're launching the login modal, add the active
// class to the nav item
//
if (modal === 'login') {
$('.fb-main-nav a').removeClass('active');
$(this).addClass('active');
}
load(modal, cb);
});

//
// close the modal
//
$body.on('click', '.js-close-modal', close);
}

Expand All @@ -60,16 +39,6 @@ module.exports = (function() {
}

$('div[id^="fb-modal"]').removeClass(ACTIVE_CLASS);

//
// @NOTICE
// this is here to re-enable the active state on the nav
// in case it was altered when the modal was launched.
//
// TODO:
//if (_BUILDKIT !== undefined) {
// _BUILDKIT.enableNavActiveState();
//}
}

/**
Expand Down

0 comments on commit 0e4fdb6

Please sign in to comment.