New button table layout
This commit is contained in:
parent
a8c6a477a9
commit
87dbdebb1f
|
@ -38,11 +38,12 @@ class LinkTypeViewController extends Controller
|
||||||
|
|
||||||
if (!empty($linkType) && $linkType->typename === 'predefined') {
|
if (!empty($linkType) && $linkType->typename === 'predefined') {
|
||||||
// get buttons list if showing predefined form
|
// get buttons list if showing predefined form
|
||||||
$buttons = Button::select('name')->orderBy('name', 'asc')->get();
|
$buttons = Button::select()->orderBy('name', 'asc')->get();
|
||||||
foreach ($buttons as $btn) {
|
foreach ($buttons as $btn) {
|
||||||
$data['buttons'][] = [
|
$data['buttons'][] = [
|
||||||
'name' => $btn->name,
|
'name' => $btn->name,
|
||||||
'title' => ucwords($btn->name),
|
'title' => $btn->alt,
|
||||||
|
'exclude' => $btn->exclude,
|
||||||
'selected' => (is_object($data['params']) && $data['params']->button === $btn->name)
|
'selected' => (is_object($data['params']) && $data['params']->button === $btn->name)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ class UserController extends Controller
|
||||||
$button = Button::where('name', $request->button)->first();
|
$button = Button::where('name', $request->button)->first();
|
||||||
|
|
||||||
if ($button && empty($LinkTitle))
|
if ($button && empty($LinkTitle))
|
||||||
$LinkTitle = ucwords($button->name);
|
$LinkTitle = $button->alt;
|
||||||
|
|
||||||
if ($linkType->typename == 'video' && empty($LinkTitle)) {
|
if ($linkType->typename == 'video' && empty($LinkTitle)) {
|
||||||
$embed = OEmbed::get($LinkURL);
|
$embed = OEmbed::get($LinkURL);
|
||||||
|
@ -789,7 +789,6 @@ class UserController extends Controller
|
||||||
$name = $request->name;
|
$name = $request->name;
|
||||||
$checkmark = $request->checkmark;
|
$checkmark = $request->checkmark;
|
||||||
$sharebtn = $request->sharebtn;
|
$sharebtn = $request->sharebtn;
|
||||||
$tablinks = $request->tablinks;
|
|
||||||
|
|
||||||
if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){
|
if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){
|
||||||
EnvEditor::editKey('HOME_URL', $pageName);
|
EnvEditor::editKey('HOME_URL', $pageName);
|
||||||
|
@ -817,12 +816,6 @@ class UserController extends Controller
|
||||||
} else {
|
} else {
|
||||||
UserData::saveData($userId, 'disable-sharebtn', true);
|
UserData::saveData($userId, 'disable-sharebtn', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tablinks == "on") {
|
|
||||||
UserData::saveData($userId, 'links-new-tab', true);
|
|
||||||
} else {
|
|
||||||
UserData::saveData($userId, 'links-new-tab', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Redirect('/studio/page');
|
return Redirect('/studio/page');
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@ class CreateButtonsTable extends Migration
|
||||||
Schema::create('buttons', function (Blueprint $table) {
|
Schema::create('buttons', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('alt')->nullable();
|
||||||
|
$table->boolean('exclude')->default(false);
|
||||||
|
$table->string('group')->nullable();
|
||||||
|
$table->boolean('mb')->default(false);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -151,19 +151,23 @@ use App\Models\Page;
|
||||||
|
|
||||||
/* Updates button database entries */
|
/* Updates button database entries */
|
||||||
Schema::disableForeignKeyConstraints();
|
Schema::disableForeignKeyConstraints();
|
||||||
|
$existingMigration = '2021_03_17_044922_create_buttons_table';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (DB::table('migrations')->where('migration', $existingMigration)->exists()) {
|
||||||
|
DB::table('migrations')->where('migration', $existingMigration)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
Schema::dropIfExists('buttons');
|
||||||
|
|
||||||
$migrator = app('migrator');
|
$migrator = app('migrator');
|
||||||
$migrator->run(database_path('migrations'), ['--force' => true]);
|
$migrator->run(database_path('migrations'));
|
||||||
} catch (exception $e) {}
|
|
||||||
try {DB::table('buttons')->delete();} catch (exception $e) {}
|
$seeder = new ButtonSeeder();
|
||||||
try {DB::table('buttons')->truncate();} catch (exception $e) {}
|
$seeder->run();
|
||||||
try {
|
|
||||||
$seeder = new ButtonSeeder();
|
|
||||||
$seeder->run();
|
|
||||||
} catch (exception $e) {}
|
} catch (exception $e) {}
|
||||||
Schema::enableForeignKeyConstraints();
|
Schema::enableForeignKeyConstraints();
|
||||||
|
|
||||||
// Adds new column to the users table
|
|
||||||
if (!Schema::hasColumn('users', 'auth_as')) {
|
if (!Schema::hasColumn('users', 'auth_as')) {
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->unsignedInteger('auth_as')->nullable();
|
$table->unsignedInteger('auth_as')->nullable();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<select name='button' class='form-control'>
|
<select name='button' class='form-control'>
|
||||||
@if($buttonName != 0)<option value='{{$buttonName}}'>{{ucfirst($buttonName)}}</option>@endif
|
@if($buttonName != 0)<option value='{{$buttonName}}'>{{ucfirst($buttonName)}}</option>@endif
|
||||||
@foreach ($buttons as $b)
|
@foreach ($buttons as $b)
|
||||||
@if(!in_array($b["name"], ["custom_website", "custom", "custom", "heading", "space", "text", "icon", $buttonName]))
|
@if($b["exclude"] != true)
|
||||||
<option class='button button-{{$b["name"]}}' value='{{$b["name"]}}' {{ $b["selected"] == true ? "selected" : ""}}>{{$b["title"]}}</option>
|
<option class='button button-{{$b["name"]}}' value='{{$b["name"]}}' {{ $b["selected"] == true ? "selected" : ""}}>{{$b["title"]}}</option>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
Loading…
Reference in New Issue