Skip to content

Commit

Permalink
Transpile ES6 to ES5 for filemanager. Closes pterodactyl#224
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed Jan 3, 2017
1 parent aa6e733 commit 130aa6c
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["es2015"],
"compact": true,
"minified": true,
"only": "public/js/files/*.js",
"sourceMaps": "inline",
"comments": false
}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ Homestead.yaml
Vagrantfile
Vagrantfile

node_modules
.babelrc
node_modules
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
* Fixes bug that would allow adding the owner of a server as a subuser for that same server.
* Fixes bug that would allow creating multiple subusers with the same email address.
* Fixes bug where Sponge servers were improperly tagged as a spigot server in the daemon causing issues when booting or modifying configuration files.
* Use transpiled ES6 -> ES5 filemanager code in browsers.

### Changed
* Filemanager and EULA checking javascript is now written in pure ES6 code rather than as a blade-syntax template. This allows the use of babel to transpile into ES5 as a minified version.

## v0.5.5 (Bodacious Boreopterus)
### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dingo/api": "1.0.0-beta6",
"aws/aws-sdk-php": "3.19.20",
"predis/predis": "1.1.1",
"laracasts/utilities": "^2.1"
"laracasts/utilities": "2.1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "pterodactyl-panel",
"devDependencies": {
"babel-cli": "6.18.0",
"babel-plugin-transform-strict-mode": "^6.18.0",
"babel-preset-es2015": "6.18.0"
},
"scripts": {
"build": "./node_modules/babel-cli/bin/babel.js public/js/files --source-maps --out-file public/js/filemanager.min.js"
}
}
5 changes: 5 additions & 0 deletions public/js/filemanager.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/js/filemanager.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/files/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ContextMenuClass {

if (Pterodactyl.permissions.createFiles) {
buildMenu += '<li class="divider"></li> \
<li data-action="file"><a href="/server/{{ $server->uuidShort }}/files/add/?dir=' + newFilePath + '" class="text-muted"><i class="fa fa-fw fa-plus"></i> New File</a></li> \
<li data-action="file"><a href="/server/'+ Pterodactyl.server.uuidShort +'/files/add/?dir=' + newFilePath + '" class="text-muted"><i class="fa fa-fw fa-plus"></i> New File</a></li> \
<li data-action="folder"><a tabindex="-1" href="#"><i class="fa fa-fw fa-folder"></i> New Folder</a></li>';
}

Expand Down
10 changes: 7 additions & 3 deletions resources/views/server/files/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@
</div>
</div>
</div>
{!! Theme::js('js/files/index.js') !!}
{!! Theme::js('js/files/contextmenu.js') !!}
{!! Theme::js('js/files/actions.js') !!}
@if(App::environment('production'))
{!! Theme::js('js/filemanager.min.js') !!}
@else
{!! Theme::js('js/files/index.js') !!}
{!! Theme::js('js/files/contextmenu.js') !!}
{!! Theme::js('js/files/actions.js') !!}
@endif
<script>
$(window).load(function () {
$('.server-files').addClass('active');
Expand Down

0 comments on commit 130aa6c

Please sign in to comment.