|
| 1 | +{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}} |
| 2 | + |
| 3 | +{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}} |
| 4 | +{{-- of this software and associated documentation files (the "Software"), to deal --}} |
| 5 | +{{-- in the Software without restriction, including without limitation the rights --}} |
| 6 | +{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}} |
| 7 | +{{-- copies of the Software, and to permit persons to whom the Software is --}} |
| 8 | +{{-- furnished to do so, subject to the following conditions: --}} |
| 9 | + |
| 10 | +{{-- The above copyright notice and this permission notice shall be included in all --}} |
| 11 | +{{-- copies or substantial portions of the Software. --}} |
| 12 | + |
| 13 | +{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}} |
| 14 | +{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}} |
| 15 | +{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}} |
| 16 | +{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}} |
| 17 | +{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}} |
| 18 | +{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}} |
| 19 | +{{-- SOFTWARE. --}} |
| 20 | +@extends('layouts.admin') |
| 21 | + |
| 22 | +@section('title') |
| 23 | + Services → Option: {{ $option->name }} → Scripts |
| 24 | +@endsection |
| 25 | + |
| 26 | +@section('content-header') |
| 27 | + <h1>{{ $option->name }}<small>Manage install and upgrade scripts for this service option.</small></h1> |
| 28 | + <ol class="breadcrumb"> |
| 29 | + <li><a href="{{ route('admin.index') }}">Admin</a></li> |
| 30 | + <li><a href="{{ route('admin.services') }}">Services</a></li> |
| 31 | + <li><a href="{{ route('admin.services.view', $option->service->id) }}">{{ $option->service->name }}</a></li> |
| 32 | + <li class="active">{{ $option->name }}</li> |
| 33 | + </ol> |
| 34 | +@endsection |
| 35 | + |
| 36 | +@section('content') |
| 37 | +<div class="row"> |
| 38 | + <div class="col-xs-12"> |
| 39 | + <div class="nav-tabs-custom nav-tabs-floating"> |
| 40 | + <ul class="nav nav-tabs"> |
| 41 | + <li><a href="{{ route('admin.services.option.view', $option->id) }}">Configuration</a></li> |
| 42 | + <li><a href="{{ route('admin.services.option.variables', $option->id) }}">Variables</a></li> |
| 43 | + <li class="active"><a href="{{ route('admin.services.option.scripts', $option->id) }}">Scripts</a></li> |
| 44 | + </ul> |
| 45 | + </div> |
| 46 | + </div> |
| 47 | +</div> |
| 48 | +<form action="{{ route('admin.services.option.scripts', $option->id) }}" method="POST"> |
| 49 | + <div class="row"> |
| 50 | + <div class="col-xs-12"> |
| 51 | + <div class="box"> |
| 52 | + <div class="box-header with-border"> |
| 53 | + <h3 class="box-title">Install Script</h3> |
| 54 | + </div> |
| 55 | + <div class="box-body no-padding"> |
| 56 | + <div id="editor_install"style="height:300px">{{ $option->script_install }}</div> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + <div class="col-xs-12"> |
| 61 | + <div class="box"> |
| 62 | + <div class="box-header with-border"> |
| 63 | + <h3 class="box-title">Upgrade Script</h3> |
| 64 | + </div> |
| 65 | + <div class="box-body no-padding"> |
| 66 | + <div id="editor_upgrade"style="height:300px">{{ $option->script_upgrade }}</div> |
| 67 | + </div> |
| 68 | + <div class="box-footer"> |
| 69 | + {!! csrf_field() !!} |
| 70 | + <textarea name="script_install" class="hidden"></textarea> |
| 71 | + <textarea name="script_upgrade" class="hidden"></textarea> |
| 72 | + <button type="submit" class="btn btn-primary btn-sm pull-right">Save Scripts</button> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | +</form> |
| 78 | +@endsection |
| 79 | + |
| 80 | +@section('footer-scripts') |
| 81 | + @parent |
| 82 | + {!! Theme::js('js/vendor/ace/ace.js') !!} |
| 83 | + {!! Theme::js('js/vendor/ace/ext-modelist.js') !!} |
| 84 | + <script> |
| 85 | + $(document).ready(function () { |
| 86 | + const InstallEditor = ace.edit('editor_install'); |
| 87 | + const UpgradeEditor = ace.edit('editor_upgrade'); |
| 88 | +
|
| 89 | + const Modelist = ace.require('ace/ext/modelist') |
| 90 | +
|
| 91 | + InstallEditor.setTheme('ace/theme/chrome'); |
| 92 | + InstallEditor.getSession().setMode('ace/mode/sh'); |
| 93 | + InstallEditor.getSession().setUseWrapMode(true); |
| 94 | + InstallEditor.setShowPrintMargin(false); |
| 95 | +
|
| 96 | + UpgradeEditor.setTheme('ace/theme/chrome'); |
| 97 | + UpgradeEditor.getSession().setMode('ace/mode/sh'); |
| 98 | + UpgradeEditor.getSession().setUseWrapMode(true); |
| 99 | + UpgradeEditor.setShowPrintMargin(false); |
| 100 | +
|
| 101 | + $('form').on('submit', function (e) { |
| 102 | + $('textarea[name="script_install"]').val(InstallEditor.getValue()); |
| 103 | + $('textarea[name="script_upgrade"]').val(UpgradeEditor.getValue()); |
| 104 | + }); |
| 105 | + }); |
| 106 | + </script> |
| 107 | +@endsection |
0 commit comments