#3: Implemented the select all/select none links and added missing files from previous check-in
This commit is contained in:
parent
78e5d0e3c0
commit
d33de03ceb
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('permissions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('section');
|
||||
$table->string('description');
|
||||
$table->boolean('is_default');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAlbumGroupPermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('album_group_permissions', function ($table) {
|
||||
$table->unsignedInteger('album_id');
|
||||
$table->unsignedInteger('group_id');
|
||||
$table->unsignedInteger('permission_id');
|
||||
|
||||
$table->foreign('album_id')
|
||||
->references('id')->on('albums')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('group_id')
|
||||
->references('id')->on('groups')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('permission_id')
|
||||
->references('id')->on('permissions')
|
||||
->onDelete('no action');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('album_group_permissions');
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAlbumUserPermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('album_user_permissions', function ($table) {
|
||||
$table->unsignedInteger('album_id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('permission_id');
|
||||
|
||||
$table->foreign('album_id')
|
||||
->references('id')->on('albums')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('permission_id')
|
||||
->references('id')->on('permissions')
|
||||
->onDelete('no action');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('album_user_permissions');
|
||||
}
|
||||
}
|
28
database/seeds/PermissionsSeeder.php
Normal file
28
database/seeds/PermissionsSeeder.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PermissionsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// album:list-gallery = controls if the album is visible in the gallery
|
||||
DatabaseSeeder::createOrUpdate('permissions', [
|
||||
'section' => 'album',
|
||||
'description' => 'list-gallery',
|
||||
'is_default' => true
|
||||
]);
|
||||
|
||||
// album:view = controls if the album can be viewed
|
||||
DatabaseSeeder::createOrUpdate('permissions', [
|
||||
'section' => 'album',
|
||||
'description' => 'view',
|
||||
'is_default' => true
|
||||
]);
|
||||
}
|
||||
}
|
@ -190,7 +190,7 @@
|
||||
</div>
|
||||
<div id="collapse-{{ $group->id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-{{ $group->id }}">
|
||||
<div class="panel-body">
|
||||
<p style="margin-bottom: 20px;"><a href="">Select All</a> · <a href="">Select None</a></p>
|
||||
<p style="margin-bottom: 20px;"><a class="select-all" href="#">Select All</a> · <a class="select-none" href="">Select None</a></p>
|
||||
|
||||
@foreach ($all_permissions as $permission)
|
||||
<div class="checkbox">
|
||||
@ -405,6 +405,16 @@
|
||||
});
|
||||
}
|
||||
|
||||
{{-- Select All/None links on the permissions tab --}}
|
||||
$('a.select-all').click(function() {
|
||||
$('input:checkbox', $(this).closest('.panel-body')).prop('checked', true);
|
||||
return false;
|
||||
});
|
||||
$('a.select-none').click(function() {
|
||||
$('input:checkbox', $(this).closest('.panel-body')).prop('checked', false);
|
||||
return false;
|
||||
});
|
||||
|
||||
// Bind the view models to the relevant tab
|
||||
ko.applyBindings(editViewModel, document.getElementById('photos-tab'));
|
||||
ko.applyBindings(viewModel, document.getElementById('upload-tab'));
|
||||
|
Loading…
Reference in New Issue
Block a user