blue-twilight/resources/views/themes/base/admin/edit_album.blade.php

109 lines
5.6 KiB
PHP
Raw Permalink Normal View History

@extends(Theme::viewName('layout'))
@section('title', 'Gallery Admin')
@section('breadcrumb')
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li class="breadcrumb-item"><a href="{{ route('albums.index') }}">@lang('navigation.breadcrumb.albums')</a></li>
@include(Theme::viewName('partials.admin_album_breadcrumb'), ['show_current_link' => true])
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.edit_album')</li>
@endsection
@section('content')
<div class="container" id="edit-album-app">
<div class="row">
<div class="col">
<h1>@lang('admin.edit_album', ['album_name' => $album->name])</h1>
<p>@lang('admin.edit_album_intro')</p>
<p>@lang('admin.edit_album_intro2', ['album_name' => $album->name])</p>
<hr/>
<form method="post" action="{{ route('albums.update', [$album->id]) }}">
{{ csrf_field() }}
{{ method_field('PUT') }}
<div class="form-group">
<label for="album-name" class="control-label">@lang('forms.name_label')</label>
<input type="text" id="album-name" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" />
@if ($errors->has('name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('name') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label for="album-description" class="control-label" name="name">@lang('forms.description_label')</label>
<textarea class="form-control{{ $errors->has('description') ? ' is-invalid' : '' }}" id="album-description" rows="5" name="description">{{ old('description') }}</textarea>
@if ($errors->has('description'))
<div class="invalid-feedback">
<strong>{{ $errors->first('description') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="parent-album">@lang('forms.parent_album_label')</label>
<select class="form-control" name="parent_album_id" id="parent-album" v-model="parent_id">
<option value="">@lang('forms.parent_album_placeholder')</option>
@foreach ($parent_albums as $key => $value)
<option value="{{ $key }}"{{ $key == $album->id || $value->isChildOf($album) ? ' disabled="disabled"' : '' }}>{{ $value->display_name }}{{ $key == old('parent_album_id') ? ' ' . trans('forms.select_current_text') : '' }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<div class="mt-3 form-check">
<input type="checkbox" class="form-check-input" id="inherit-permissions" name="is_permissions_inherited"{{ $album->is_permissions_inherited ? ' checked="checked"' : '' }}>
<label class="form-check-label" for="inherit-permissions">
<strong>@lang('forms.inherit_album_permissions')</strong>
</label>
</div>
</div>
<div id="change-parent-warning" class="alert alert-warning" style="display: none;">
@lang('admin.edit_album_change_parent_warning')
<div class="mt-3 form-check">
<input type="checkbox" class="form-check-input" id="preserve-url-redirect" name="preserve_url_redirect" checked="checked">
<label class="form-check-label" for="preserve-url-redirect">
<strong>@lang('admin.edit_album_change_parent_add_alias')</strong>
</label>
</div>
</div>
<div class="text-right">
<a href="{{ route('albums.show', ['album' => $album->id]) }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
var editAlbumViewModel = new EditAlbumViewModel();
editAlbumViewModel.data.parent_id = '{{ old('parent_album_id', $album->parent_album_id) }}';
$(document).ready(function() {
var app = new Vue(editAlbumViewModel);
// Show the change parent warning
var current_parent_id = '{{ $album->parent_album_id }}';
$('#parent-album').change(function() {
if ($('#parent-album').val() != current_parent_id)
{
$('#change-parent-warning').show();
}
else
{
$('#change-parent-warning').hide();
}
});
});
</script>
@endpush