Skip to content

Commit

Permalink
Add link target config (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
baijunyao committed Dec 25, 2019
1 parent 64cfaff commit 0a87bee
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 18 deletions.
1 change: 1 addition & 0 deletions config/bjyblog.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
'weibo' => '',
'upyun' => '',
],
'link_target' => '',
];
8 changes: 8 additions & 0 deletions database/seeds/ConfigsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,14 @@ public function run()
'updated_at' => '2019-12-22 23:55:00',
'deleted_at' => null,
],
[
'id' => 193,
'name' => 'bjyblog.link_target',
'value' => '_blank',
'created_at' => '2019-12-25 23:06:00',
'updated_at' => '2019-12-25 23:06:00',
'deleted_at' => null,
],
]);
}
}
3 changes: 3 additions & 0 deletions resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
"Admin Email": "Email Administrateur",
"Notification Email": "Email Notification",
"CDN Domain": "CDN Domaine",
"Link Target": "Lien cible",
"New Tab": "Nouvel onglet",
"Current Tab": "Onglet actuel",

"Store Success": "Création réussie",
"Update Success": "Mise à jour réussie",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
"Admin Email": "Email администратора",
"Notification Email": "Email уведомлений",
"CDN Domain": "CDN домен",
"Link Target": "Цель ссылки",
"New Tab": "новая вкладка",
"Current Tab": "Текущая вкладка",

"Store Success": "Успешно сохранено",
"Update Success": "Успешно обновлено",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
"Admin Email": "站长邮箱",
"Notification Email": "用于接收通知的邮箱",
"CDN Domain": "CDN 域名",
"Link Target": "链接打开方式",
"New Tab": "新标签",
"Current Tab": "当前标签",

"Store Success": "添加成功",
"Update Success": "修改成功",
Expand Down
7 changes: 7 additions & 0 deletions resources/views/admin/config/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
<input class="form-control" type="text" name="185" value="{{ $config['session.domain'] }}" >
</td>
</tr>
<tr>
<th>Link Target:</th>
<td>
{{ __('New Tab') }} <input class="bjy-icheck" type="radio" name="193" value="true" @if($config['bjyblog.link_target'] === '_blank') checked @endif> &emsp;&emsp;
{{ __('Current Tab') }} <input class="bjy-icheck" type="radio" name="193" value="false" @if($config['bjyblog.link_target'] === '_self') checked @endif>
</td>
</tr>
<tr>
<th></th>
<td>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/home/index/article.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
@section('js')
<script>
$('pre').addClass('line-numbers');
$('.js-content a').attr('target', '_blank')
$('.js-content a').attr('target', "{{ config('bjyblog.link_target') }}")
translate = {
pleaseLoginToComment: "{{ __('Please login to comment') }}",
pleaseLoginToReply: "{{ __('Please login to reply') }}",
Expand Down
4 changes: 2 additions & 2 deletions resources/views/home/index/git.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<script src="{{ asset('statics/js/jquery.githubRepoWidget.min.js') }}"></script>
<script type="text/javascript">
$(function(){
$('.osc_git_box a,.github-widget a').attr('target','_blank');
$('.osc_git_box a,.github-widget a').attr('target', "{{ config('bjyblog.link_target') }}");
})
</script>
@endsection
@endsection
12 changes: 6 additions & 6 deletions resources/views/home/index/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@foreach($articles as $k => $v)
<div class="row b-one-article">
<h3 class="col-xs-12 col-md-12 col-lg-12">
<a class="b-oa-title" href="{{ $v->url }}" target="_blank">{{ $v->title }}</a>
<a class="b-oa-title" href="{{ $v->url }}" target="{{ config('bjyblog.link_target') }}">{{ $v->title }}</a>
</h3>
<div class="col-xs-12 col-md-12 col-lg-12 b-date">
<ul class="row">
Expand All @@ -38,11 +38,11 @@
<i class="fa fa-calendar"></i> {{ $v->created_at }}
</li>
<li class="col-xs-5 col-md-2 col-lg-2">
<i class="fa fa-list-alt"></i> <a href="{{ $v->category->url }}" target="_blank">{{ $v->category->name }}</a>
<i class="fa fa-list-alt"></i> <a href="{{ $v->category->url }}" target="{{ config('bjyblog.link_target') }}">{{ $v->category->name }}</a>
</li>
<li class="col-xs-7 col-md-5 col-lg-4 "><i class="fa fa-tags"></i>
@foreach($v->tags as $n)
<a class="b-tag-name" href="{{ $n->url }}" target="_blank">{{ $n->name }}</a>
<a class="b-tag-name" href="{{ $n->url }}" target="{{ config('bjyblog.link_target') }}">{{ $n->name }}</a>
@endforeach
</li>
</ul>
Expand All @@ -52,11 +52,11 @@
<!-- 文章封面图片开始 -->
<div class="col-sm-6 col-md-6 col-lg-4 hidden-xs b-oa-thumbnail">
<figure class="b-oa-pic b-style1">
<a href="{{ $v->url }}" target="_blank">
<a href="{{ $v->url }}" target="{{ config('bjyblog.link_target') }}">
<img class="bjy-lazyload" src="{{ cdn_url('/images/home/loading.gif') }}" data-src="{{ cdn_url($v->cover) }}" alt="{{ config('bjyblog.alt_word') }}" title="{{ config('bjyblog.alt_word') }}">
</a>
<figcaption>
<a href="{{ url('article', [$v->id]) }}" target="_blank"></a>
<a href="{{ url('article', [$v->id]) }}" target="{{ config('bjyblog.link_target') }}"></a>
</figcaption>
</figure>
@if(1 == $v->is_top)
Expand All @@ -72,7 +72,7 @@
<!-- 文章描述结束 -->
</div>
</div>
<a class=" b-readall" href="{{ $v->url }}" target="_blank">{{ __('Read More') }}</a>
<a class=" b-readall" href="{{ $v->url }}" target="{{ config('bjyblog.link_target') }}">{{ __('Read More') }}</a>
</div>
@endforeach
<!-- 循环文章列表结束 -->
Expand Down
16 changes: 8 additions & 8 deletions resources/views/layouts/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</p>
<p class="b-qun-article">
@if(!empty($qqQunArticle['id']))
<a href="{{ url('article', [$qqQunArticle['id']]) }}" target="_blank">{{ $qqQunArticle['title'] }}</a>
<a href="{{ url('article', [$qqQunArticle['id']]) }}" target="{{ config('bjyblog.link_target') }}">{{ $qqQunArticle['title'] }}</a>
@endif
</p>
</li>
Expand All @@ -128,7 +128,7 @@
<h4 class="b-title">{{ __('Top Articles') }}</h4>
<p class="b-recommend-p">
@foreach($topArticle as $v)
<a class="b-recommend-a" href="{{ $v->url }}" target="_blank"><span class="fa fa-th-list b-black"></span> {{ $v->title }}</a>
<a class="b-recommend-a" href="{{ $v->url }}" target="{{ config('bjyblog.link_target') }}"><span class="fa fa-th-list b-black"></span> {{ $v->title }}</a>
@endforeach
</p>
</div>
Expand All @@ -142,7 +142,7 @@
{{ $comment->socialiteUser->name }}<span>{{ $comment->created_at->diffForHumans() }}</span>
</li>
<li class="b-nc-article">
{{ __('Comment') }}<a href="{{ $comment->article->url }}#comment-{{ $comment->id }}" target="_blank">{{ $comment->article->sub_title }}</a>
{{ __('Comment') }}<a href="{{ $comment->article->url }}#comment-{{ $comment->id }}" target="{{ config('bjyblog.link_target') }}">{{ $comment->article->sub_title }}</a>
</li>
<li class="b-content">
{!! $comment->sub_content !!}
Expand All @@ -155,7 +155,7 @@
<h4 class="b-title">{{ __('Links') }}</h4>
<p>
@foreach($friendshipLink as $v)
<a class="b-link-a" href="{{ $v->url }}" target="_blank"><span class="fa fa-link b-black"></span> {{ $v->name }}</a>
<a class="b-link-a" href="{{ $v->url }}" target="{{ config('bjyblog.link_target') }}"><span class="fa fa-link b-black"></span> {{ $v->name }}</a>
@endforeach
<a class="b-link-a" href="{{ url('site') }}"><span class="fa fa-link b-black"></span> {{ __('More') }} </a>
</p>
Expand All @@ -181,9 +181,9 @@

<dl class="col-xs-12 col-sm-6 col-md-{{ $homeFootColNumber }} col-lg-{{ $homeFootColNumber }}">
<dt>{{ __('Structure') }}</dt>
<dd>{{ __('Project Name') }}:<a rel="nofollow" href="https://github.com/baijunyao/laravel-bjyblog" target="_blank">laravel-bjyblog</a></dd>
<dd>{{ __('Blog Version') }}:<a rel="nofollow" href="https://github.com/baijunyao/laravel-bjyblog" target="_blank">{{ config('bjyblog.version') }}-{{ config('bjyblog.branch') }}</a></dd>
<dd>{{ __('Framework Version') }}:<a rel="nofollow" href="https://github.com/laravel/framework" target="_blank">laravel-v{{ \Illuminate\Foundation\Application::VERSION }}</a></dd>
<dd>{{ __('Project Name') }}:<a rel="nofollow" href="https://github.com/baijunyao/laravel-bjyblog" target="{{ config('bjyblog.link_target') }}">laravel-bjyblog</a></dd>
<dd>{{ __('Blog Version') }}:<a rel="nofollow" href="https://github.com/baijunyao/laravel-bjyblog" target="{{ config('bjyblog.link_target') }}">{{ config('bjyblog.version') }}-{{ config('bjyblog.branch') }}</a></dd>
<dd>{{ __('Framework Version') }}:<a rel="nofollow" href="https://github.com/laravel/framework" target="{{ config('bjyblog.link_target') }}">laravel-v{{ \Illuminate\Foundation\Application::VERSION }}</a></dd>
<dd>{{ __('Project Author') }}:<a href="https://baijunyao.com">{{ __('Junyao Bai') }}</a></dd>
<dd>{{ __('Theme Name') }}:<a rel="nofollow" href="https://github.com/baijunyao/blog-theme-blueberry">blog-theme-blueberry</a></dd>
<dd>{{ __('Theme Author') }}:<a href="https://baijunyao.com">{{ __('Junyao Bai') }}</a></dd>
Expand All @@ -203,7 +203,7 @@
<dd class="b-small-logo">
@foreach(config('bjyblog.social_links') as $name => $link)
@if($link !== '')
<a href="{{ $link }}" target="_blank"><img src="{{ url("images/home/social-$name.png") }}" alt="{{ $name }}"></a>
<a href="{{ $link }}" target="{{ config('bjyblog.link_target') }}"><img src="{{ url("images/home/social-$name.png") }}" alt="{{ $name }}"></a>
@endif
@endforeach
</dd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"path": "http:\/\/laravel-bjyblog.test\/api\/configs",
"per_page": 15,
"to": 15,
"total": 62
"total": 63
}
}
}

0 comments on commit 0a87bee

Please sign in to comment.