#11: URL aliases used by albums are now updated when the parent is changed. Added a warning to the Edit page that this may break links.
This commit is contained in:
parent
89d9c31ba8
commit
2f1cbfc16c
@ -200,6 +200,7 @@ class Album extends Model
|
||||
if (is_null($this->url_path))
|
||||
{
|
||||
$this->generateUrlPath();
|
||||
$this->save();
|
||||
}
|
||||
|
||||
return route('viewAlbum', $this->url_path);
|
||||
|
@ -408,6 +408,7 @@ class AlbumController extends Controller
|
||||
$album->user_id = Auth::user()->id;
|
||||
|
||||
$album->generateAlias();
|
||||
$album->generateUrlPath();
|
||||
$album->save();
|
||||
|
||||
// Link all default permissions to anonymous users (if a public album)
|
||||
@ -440,6 +441,8 @@ class AlbumController extends Controller
|
||||
$this->authorizeAccessToAdminPanel('admin:manage-albums');
|
||||
|
||||
$album = $this->loadAlbum($id);
|
||||
$currentParentID = $album->parent_album_id;
|
||||
|
||||
$album->fill($request->only(['name', 'description', 'parent_album_id']));
|
||||
|
||||
if (strlen($album->parent_album_id) == 0)
|
||||
@ -456,6 +459,12 @@ class AlbumController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// Re-generate the URL path to ensure it's correct if the parent has changed
|
||||
if ($currentParentID != $album->parent_album_id)
|
||||
{
|
||||
$album->generateUrlPath();
|
||||
}
|
||||
|
||||
$album->save();
|
||||
$request->session()->flash('success', trans('admin.album_saved_successfully', ['name' => $album->name]));
|
||||
|
||||
|
@ -75,6 +75,7 @@ return [
|
||||
'delete_user_warning' => 'This is a permanent action that cannot be reversed!',
|
||||
'edit_album' => 'Edit photo album: :album_name',
|
||||
'edit_album_action' => 'Edit album details',
|
||||
'edit_album_change_parent_warning' => 'Changing this album\'s parent will change the address used to access this album. This may break any bookmarks or links used by your visitors or search engines.',
|
||||
'edit_album_intro' => 'Photo albums contain individual photographs in the same way as a physical photo album or memory book.',
|
||||
'edit_album_intro2' => 'Complete the form below to edit the properties of the album: :album_name.',
|
||||
'edit_group_intro' => 'You can use the form below to edit the above group. Changes take effect immediately.',
|
||||
|
@ -54,6 +54,10 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
@lang('admin.edit_album_change_parent_warning')
|
||||
</div>
|
||||
|
||||
<div class="text-right">
|
||||
<a href="{{ route('albums.show', ['id' => $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>
|
||||
|
Loading…
Reference in New Issue
Block a user