Browse Source
Merge pull request #200 from ullbergm/Add-option-to-open-links-in-current-window-or-new-tab
WIP: Add option to open links in current window or new tab
ullbergm/trianglify^2
KodeStar
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
30 additions and
3 deletions
-
app/Item.php
-
database/seeds/SettingsSeeder.php
-
resources/lang/en/app.php
|
|
@ -169,10 +169,12 @@ class Item extends Model |
|
|
|
|
|
|
|
public function getLinkTargetAttribute() |
|
|
|
{ |
|
|
|
if((int)$this->type === 1) { |
|
|
|
$target = Setting::fetch('window_target'); |
|
|
|
|
|
|
|
if((int)$this->type === 1 || $target === 'current') { |
|
|
|
return ''; |
|
|
|
} else { |
|
|
|
return ' target="heimdallapp"'; |
|
|
|
return ' target="' . $target . '"'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -138,6 +138,27 @@ class SettingsSeeder extends Seeder |
|
|
|
$setting->save(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$window_target_options = json_encode([ |
|
|
|
'current' => 'app.settings.window_target.current', |
|
|
|
'heimdall' => 'app.settings.window_target.one', |
|
|
|
'_blank' => 'app.settings.window_target.new', |
|
|
|
]); |
|
|
|
|
|
|
|
if(!$setting = Setting::find(7)) { |
|
|
|
|
|
|
|
$setting = new Setting; |
|
|
|
$setting->id = 7; |
|
|
|
$setting->group_id = 3; |
|
|
|
$setting->key = 'window_target'; |
|
|
|
$setting->type = 'select'; |
|
|
|
$setting->options = $window_target_options; |
|
|
|
$setting->label = 'app.settings.window_target'; |
|
|
|
$setting->value = 'heimdall'; |
|
|
|
$setting->save(); |
|
|
|
} else { |
|
|
|
$setting->options = $window_target_options; |
|
|
|
$setting->label = 'app.settings.window_target'; |
|
|
|
$setting->save(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -15,6 +15,10 @@ return [ |
|
|
|
|
|
|
|
'settings.version' => 'Version', |
|
|
|
'settings.background_image' => 'Background Image', |
|
|
|
'settings.window_target' => 'Link opens in', |
|
|
|
'settings.window_target.current' => 'Open in this tab', |
|
|
|
'settings.window_target.one' => 'Open in the same tab', |
|
|
|
'settings.window_target.new' => 'Open in a new tab', |
|
|
|
'settings.homepage_search' => 'Homepage Search', |
|
|
|
'settings.search_provider' => 'Search Provider', |
|
|
|
'settings.language' => 'Language', |
|
|
|