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') {
|
||||
// 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) {
|
||||
$data['buttons'][] = [
|
||||
'name' => $btn->name,
|
||||
'title' => ucwords($btn->name),
|
||||
'title' => $btn->alt,
|
||||
'exclude' => $btn->exclude,
|
||||
'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();
|
||||
|
||||
if ($button && empty($LinkTitle))
|
||||
$LinkTitle = ucwords($button->name);
|
||||
$LinkTitle = $button->alt;
|
||||
|
||||
if ($linkType->typename == 'video' && empty($LinkTitle)) {
|
||||
$embed = OEmbed::get($LinkURL);
|
||||
|
@ -789,7 +789,6 @@ class UserController extends Controller
|
|||
$name = $request->name;
|
||||
$checkmark = $request->checkmark;
|
||||
$sharebtn = $request->sharebtn;
|
||||
$tablinks = $request->tablinks;
|
||||
|
||||
if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){
|
||||
EnvEditor::editKey('HOME_URL', $pageName);
|
||||
|
@ -818,12 +817,6 @@ class UserController extends Controller
|
|||
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');
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ class CreateButtonsTable extends Migration
|
|||
Schema::create('buttons', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('alt')->nullable();
|
||||
$table->boolean('exclude')->default(false);
|
||||
$table->string('group')->nullable();
|
||||
$table->boolean('mb')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -151,19 +151,23 @@ use App\Models\Page;
|
|||
|
||||
/* Updates button database entries */
|
||||
Schema::disableForeignKeyConstraints();
|
||||
$existingMigration = '2021_03_17_044922_create_buttons_table';
|
||||
|
||||
try {
|
||||
if (DB::table('migrations')->where('migration', $existingMigration)->exists()) {
|
||||
DB::table('migrations')->where('migration', $existingMigration)->delete();
|
||||
}
|
||||
|
||||
Schema::dropIfExists('buttons');
|
||||
|
||||
$migrator = app('migrator');
|
||||
$migrator->run(database_path('migrations'), ['--force' => true]);
|
||||
} catch (exception $e) {}
|
||||
try {DB::table('buttons')->delete();} catch (exception $e) {}
|
||||
try {DB::table('buttons')->truncate();} catch (exception $e) {}
|
||||
try {
|
||||
$migrator->run(database_path('migrations'));
|
||||
|
||||
$seeder = new ButtonSeeder();
|
||||
$seeder->run();
|
||||
} catch (exception $e) {}
|
||||
Schema::enableForeignKeyConstraints();
|
||||
|
||||
// Adds new column to the users table
|
||||
if (!Schema::hasColumn('users', 'auth_as')) {
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->unsignedInteger('auth_as')->nullable();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<select name='button' class='form-control'>
|
||||
@if($buttonName != 0)<option value='{{$buttonName}}'>{{ucfirst($buttonName)}}</option>@endif
|
||||
@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>
|
||||
@endif
|
||||
@endforeach
|
||||
|
|
Loading…
Reference in New Issue