Skip to content

Commit

Permalink
Added version numbers to JS files
Browse files Browse the repository at this point in the history
Updates #264
  • Loading branch information
inghamn committed Aug 12, 2019
1 parent 8dd9151 commit 8f7f1bd
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 18 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ data/applicantFiles
data/meetingFiles
data/legislationFiles
data/reports
data/Themes/Kirkwood/public/fn1
data/user
*.mo
.config
.cache
screen-*.css*
*-*.js
build
vendor
node_modules
gulpfile.js
.ftppass
.gulp-build
package.json
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ APPNAME := onboard
SASS := $(shell command -v sassc 2> /dev/null)
MSGFMT := $(shell command -v msgfmt 2> /dev/null)
LANGUAGES := $(wildcard language/*/LC_MESSAGES)
JAVASCRIPT := $(shell find public -name '*.js' ! -name '*-*.js')

VERSION := $(shell cat VERSION | tr -d "[:space:]")

Expand All @@ -22,12 +23,14 @@ clean:

rm -Rf public/css/.sass-cache
rm -Rf data/Themes/Kirkwood/public/css/.sass-cache
for f in $(shell find data/Themes -name 'screen-*.css*' ); do rm $$f; done
for f in $(shell find public/css -name 'screen-*.css*' ); do rm $$f; done
for f in $(shell find data/Themes -name 'screen-*.css*'); do rm $$f; done
for f in $(shell find public/css -name 'screen-*.css*'); do rm $$f; done
for f in $(shell find public/js -name '*-*.js' ); do rm $$f; done

compile: deps $(LANGUAGES)
cd public/css && sassc -t compact -m screen.scss screen-${VERSION}.css
cd data/Themes/Kirkwood/public/css && sassc -t compact -m screen.scss screen-${VERSION}.css
for f in ${JAVASCRIPT}; do cp $$f $${f%.js}-${VERSION}.js; done

package:
[[ -d build ]] || mkdir build
Expand Down
6 changes: 3 additions & 3 deletions blocks/html/committees/history.inc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* @copyright 2017-2018 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @copyright 2017-2019 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE
* @param array $this->history An array of CommitteeHistory objects
*/
use Blossom\Classes\Block;

$this->template->addToAsset('scripts', BASE_URI.'/js/changeLog.js');
$this->template->addToAsset('scripts', BASE_URI.'/js/changeLog-'.VERSION.'.js');
?>
<section>
<header><h2><?= $this->_('committeeHistory'); ?></h2></header>
Expand Down
6 changes: 3 additions & 3 deletions blocks/html/people/list.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @copyright 2009-2017 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @copyright 2009-2019 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE
* @param Zend\Paginator $this->people
*/
use Application\Models\Person;
Expand All @@ -24,7 +24,7 @@ use Blossom\Classes\Url;
$button = $helper->buttonLink($url, $this->_('person_choose'), 'choosePerson');
}
elseif (isset($_REQUEST['callback'])) {
$this->template->addToAsset('scripts', BASE_URI.'/js/people/chooser.js');
$this->template->addToAsset('scripts', BASE_URI.'/js/people/chooser-'.VERSION.'.js');

$callback = preg_replace('/[^a-zA-Z_\.]/', '', $_REQUEST['callback']);
$url = "javascript:self.opener.$callback('{$person->getId()}');";
Expand Down
2 changes: 1 addition & 1 deletion data/Themes/Kirkwood/templates/html/partials/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h2><a href="<?= BASE_URI; ?>">City of Bloomington, Indiana &ndash; John Hamilton, Mayor</a></h2>
<div class="utilityBar">
<?php
$this->addToAsset('scripts', BASE_URI.'/js/menus.js');
$this->addToAsset('scripts', BASE_URI.'/js/menus-'.VERSION.'.js');

$this->_include('/partials/panel-widgets/user_menu.inc');
$this->_include('/partials/panel-widgets/admin_menu.inc');
Expand Down
2 changes: 1 addition & 1 deletion templates/html/helpers/PersonChooser.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(Template $template)
*/
public function personChooser($fieldname, $fieldId, Person $person=null)
{
$this->template->addToAsset('scripts', BASE_URI.'/js/people/chooser.js');
$this->template->addToAsset('scripts', BASE_URI.'/js/people/chooser-'.VERSION.'.js');

$id = '';
$name = '';
Expand Down
2 changes: 1 addition & 1 deletion templates/html/partials/head.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php $this->_include('partials/stylesheets.inc'); ?>
<title><?= isset($this->title) ? self::escape($this->title) : APPLICATION_NAME; ?></title>
<script type="text/javascript" src="<?= BASE_URI; ?>/js/onboard.js">
<script type="text/javascript" src="<?= BASE_URI; ?>/js/onboard-<?= VERSION; ?>.js">
</script>
<script type="text/javascript">
ONBOARD.BASE_URL = '<?= BASE_URL; ?>';
Expand Down
2 changes: 1 addition & 1 deletion templates/html/partials/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1><a href="<?php echo BASE_URI; ?>"><?php echo self::escape(APPLICATION_NAME); ?></a></h1>
<div class="utilityBar">
<?php
$this->addToAsset('scripts', BASE_URI.'/js/menus.js');
$this->addToAsset('scripts', BASE_URI.'/js/menus-'.VERSION.'.js');

$this->_include('/partials/panel-widgets/user_menu.inc');
$this->_include('/partials/panel-widgets/admin_menu.inc');
Expand Down

0 comments on commit 8f7f1bd

Please sign in to comment.