Transpile ES6 to ES5 for filemanager. Closes #224

This commit is contained in:
Dane Everitt 2017-01-03 17:32:23 -05:00
parent aa6e733ba5
commit 130aa6cc8a
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 39 additions and 7 deletions

8
.babelrc Normal file
View file

@ -0,0 +1,8 @@
{
"presets": ["es2015"],
"compact": true,
"minified": true,
"only": "public/js/files/*.js",
"sourceMaps": "inline",
"comments": false
}

1
.gitignore vendored
View file

@ -10,4 +10,3 @@ Vagrantfile
Vagrantfile Vagrantfile
node_modules node_modules
.babelrc

View file

@ -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 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 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. * 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) ## v0.5.5 (Bodacious Boreopterus)
### Added ### Added

View file

@ -27,7 +27,7 @@
"dingo/api": "1.0.0-beta6", "dingo/api": "1.0.0-beta6",
"aws/aws-sdk-php": "3.19.20", "aws/aws-sdk-php": "3.19.20",
"predis/predis": "1.1.1", "predis/predis": "1.1.1",
"laracasts/utilities": "^2.1" "laracasts/utilities": "2.1.0"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",

11
package.json Normal file
View file

@ -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
public/js/filemanager.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -62,7 +62,7 @@ class ContextMenuClass {
if (Pterodactyl.permissions.createFiles) { if (Pterodactyl.permissions.createFiles) {
buildMenu += '<li class="divider"></li> \ 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>'; <li data-action="folder"><a tabindex="-1" href="#"><i class="fa fa-fw fa-folder"></i> New Folder</a></li>';
} }

View file

@ -58,9 +58,13 @@
</div> </div>
</div> </div>
</div> </div>
@if(App::environment('production'))
{!! Theme::js('js/filemanager.min.js') !!}
@else
{!! Theme::js('js/files/index.js') !!} {!! Theme::js('js/files/index.js') !!}
{!! Theme::js('js/files/contextmenu.js') !!} {!! Theme::js('js/files/contextmenu.js') !!}
{!! Theme::js('js/files/actions.js') !!} {!! Theme::js('js/files/actions.js') !!}
@endif
<script> <script>
$(window).load(function () { $(window).load(function () {
$('.server-files').addClass('active'); $('.server-files').addClass('active');