diff --git a/app/Item.php b/app/Item.php index 2910f9ef..cb247f45 100644 --- a/app/Item.php +++ b/app/Item.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 . '"'; } } diff --git a/database/seeds/SettingsSeeder.php b/database/seeds/SettingsSeeder.php index 272ccbd9..70db7070 100644 --- a/database/seeds/SettingsSeeder.php +++ b/database/seeds/SettingsSeeder.php @@ -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(); + } } } diff --git a/resources/lang/en/app.php b/resources/lang/en/app.php index 3893c2c4..39b86ff7 100644 --- a/resources/lang/en/app.php +++ b/resources/lang/en/app.php @@ -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',