diff --git a/app/Album.php b/app/Album.php index e51259b..bbed4c9 100644 --- a/app/Album.php +++ b/app/Album.php @@ -21,7 +21,7 @@ class Album extends Model * @var array */ protected $fillable = [ - 'name', 'description', 'url_alias', 'user_id', 'storage_id', 'default_view', 'parent_album_id', 'url_path' + 'name', 'description', 'url_alias', 'user_id', 'storage_id', 'default_view', 'parent_album_id', 'url_path', 'is_permissions_inherited' ]; /** diff --git a/app/Http/Controllers/Admin/AlbumController.php b/app/Http/Controllers/Admin/AlbumController.php index 3344886..6e264f5 100644 --- a/app/Http/Controllers/Admin/AlbumController.php +++ b/app/Http/Controllers/Admin/AlbumController.php @@ -164,6 +164,7 @@ class AlbumController extends Controller $albumService = new AlbumService(); return Theme::render('admin.edit_album', [ + 'active_tab' => $request->get('tab'), 'album' => $album, 'parent_albums' => $albumService->getFlattenedAlbumTree() ]); @@ -512,6 +513,7 @@ class AlbumController extends Controller $currentParentID = $album->parent_album_id; $album->fill($request->only(['name', 'description', 'parent_album_id'])); + $album->is_permissions_inherited = $request->has('is_permissions_inherited'); if (strlen($album->parent_album_id) == 0) { diff --git a/database/migrations/2018_09_16_084200_create_album_inherit_permissions_column.php b/database/migrations/2018_09_16_084200_create_album_inherit_permissions_column.php new file mode 100644 index 0000000..2d92a5f --- /dev/null +++ b/database/migrations/2018_09_16_084200_create_album_inherit_permissions_column.php @@ -0,0 +1,34 @@ +boolean('is_permissions_inherited')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('albums', function (Blueprint $table) + { + $table->dropColumn('is_permissions_inherited'); + }); + } +} diff --git a/resources/assets/js/admin.js b/resources/assets/js/admin.js index d194f1b..962a721 100644 --- a/resources/assets/js/admin.js +++ b/resources/assets/js/admin.js @@ -46,6 +46,24 @@ function AboutViewModel(urls) { }; } +/** + * This model is used by admin/edit_album.blade.php. + * @constructor + */ +function EditAlbumViewModel() { + this.el = '#edit-album-app'; + + this.data = { + parent_id: '' + }; + + this.computed = { + isParentAlbum: function() { + return this.parent_id == ''; + } + } +} + /** * This model is used by admin/settings.blade.php. * @constructor diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 47df8e0..0631788 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -32,6 +32,8 @@ return [ 'album_cameras_heading' => 'Cameras used in this album', 'album_cameras_tab' => 'Cameras', 'album_cameras_text' => 'Blue Twilight analyses the Exif data in your photos to determine which cameras have been used. The cameras that were found are displayed below.', + 'album_inheriting_permissions_p1' => 'Permissions inherited from parent album', + 'album_inheriting_permissions_p2' => 'This album is inheriting permissions from its parent album. You can change the permissions applied to this album from the :l_parent_startparent album\'s permissions tab:l_parent_end. ', 'album_no_cameras_found_p1' => 'No cameras were found', 'album_no_cameras_found_p2' => 'Upload more photos to this album or ensure the cameras you use support Exif image tagging.', 'album_no_photos_p1' => 'No photos in this album', diff --git a/resources/lang/en/forms.php b/resources/lang/en/forms.php index b96752f..9ddf871 100644 --- a/resources/lang/en/forms.php +++ b/resources/lang/en/forms.php @@ -26,6 +26,7 @@ return [ 'edit_action' => 'Edit', 'email_label' => 'E-mail address:', 'enable_profile_page_label' => 'Allow others to see my profile page', + 'inherit_album_permissions' => 'Inherit permissions from parent album', 'labels_label' => 'Labels:', 'login_action' => 'Login', 'name_label' => 'Name:', diff --git a/resources/views/themes/base/admin/edit_album.blade.php b/resources/views/themes/base/admin/edit_album.blade.php index 1018524..d0db759 100644 --- a/resources/views/themes/base/admin/edit_album.blade.php +++ b/resources/views/themes/base/admin/edit_album.blade.php @@ -10,7 +10,7 @@ @endsection @section('content') -
+

@lang('admin.edit_album', ['album_name' => $album->name])

@@ -46,14 +46,23 @@
- @foreach ($parent_albums as $key => $value) - + @endforeach
+
+
+ is_permissions_inherited ? ' checked="checked"' : '' }}> + +
+
+