Skip to content

Commit

Permalink
add version to footer and version check feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mylxsw committed Sep 10, 2019
1 parent 40f7e5e commit 47c7ad5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ LDAP_LOGIN_FALLBACK=true
# LDAP 信息中,用哪个字段作为用户的名称,比如 displayname, cn 等
LDAP_SYNC_NAME_ATTR=cn
# LDAP 限制只允许属于该成员的用户登录
WIZARD_LDAP_ONLY_MEMBER_OF=
WIZARD_LDAP_ONLY_MEMBER_OF=

# 版本检查
WIZARD_VERSION_CHECK=true
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ LDAP_LOGIN_FALLBACK=true
# LDAP 信息中,用哪个字段作为用户的名称,比如 displayname, cn 等
LDAP_SYNC_NAME_ATTR=cn
# LDAP 限制只允许属于该成员的用户登录
WIZARD_LDAP_ONLY_MEMBER_OF=
WIZARD_LDAP_ONLY_MEMBER_OF=

# 版本检查
WIZARD_VERSION_CHECK=true
10 changes: 9 additions & 1 deletion config/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
*/

return [
/**
* 当前版本
*/
'version' => '1.0.6',
/**
* 版本检查
*/
'version-check' => env('WIZARD_VERSION_CHECK', true),
/**
* 新注册账号是否需要邮箱激活
*/
Expand All @@ -33,7 +41,7 @@
* 是否启用ldap
*/
'enabled' => env('WIZARD_USE_LDAP', false),

/**
* 允许登录的成员,为空则不限制
* 比如: 'CN=technology-products,CN=Users,DC=example,DC=com'
Expand Down
31 changes: 24 additions & 7 deletions resources/views/layouts/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

{{--<link href="/assets/vendor/animate.css" rel="stylesheet">--}}

<!-- Custom styles for this template -->
<!-- Custom styles for this template -->
<link href="/assets/css/style.css?{{ resourceVersion() }}" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
Expand All @@ -45,7 +45,8 @@
@unless($hideGlobalAlert ?? false)
@if(Auth::user() && !Auth::user()->isActivated())
<div class="alert alert-danger" style="border-radius: 0; margin-bottom: 0;">
<form action="{{ wzRoute('user:activate:send') }}" method="post" id="form-send-activate-email">{{ csrf_field() }}</form>
<form action="{{ wzRoute('user:activate:send') }}" method="post"
id="form-send-activate-email">{{ csrf_field() }}</form>
您尚未激活帐号,请先激活帐号后再进行操作<a href="#" data-form="#form-send-activate-email" wz-form-submit>【重新发送激活邮件】</a> 。
</div>
@endif
Expand All @@ -63,7 +64,8 @@
<div class="@yield('container-style')">
<p>
&copy; {{ date('Y') }} {{ config('wizard.copyright', 'AICODE.CC') }}
<a class="fa fa-github" target="_blank" href="https://github.com/mylxsw/wizard"></a>
<a class="fa fa-github wz-version" target="_blank" href="https://github.com/mylxsw/wizard">
v{{ config('wizard.version', '1') }}</a>
{!! statistics() !!}
</p>
</div>
Expand Down Expand Up @@ -94,11 +96,11 @@
$(function () {
{{-- 页面提示消息(上一个页面操作的结果) --}}
@if (session('alert.message.info'))
$.wz.message("{{ session('alert.message') }}");
$.wz.message("{{ session('alert.message') }}");
@elseif (session('alert.message.success'))
$.wz.message_success("{{ session('alert.message.success') }}");
$.wz.message_success("{{ session('alert.message.success') }}");
@elseif (session('alert.message.error'))
$.wz.message_failed("{{ session('alert.message.error') }}");
$.wz.message_failed("{{ session('alert.message.error') }}");
@endif
// 功能开发中提示消息
Expand Down Expand Up @@ -150,7 +152,7 @@
// 鼠标经过提示
$('[data-toggle="tooltip"]').tooltip({
delay: { "show": 500, "hide": 100 }
delay: {"show": 500, "hide": 100}
});
}, 500);
Expand Down Expand Up @@ -180,5 +182,20 @@
</script>
@show

@if(config('wizard.version-check'))
<script>
$(function () {
var version = '{{ config('wizard.version', '1') }}';
$.getJSON('https://aicode.cc/wizard-update/version?callback=?', function (data) {
if (data.tag_name !== version) {
return;
}
$('.wz-version').append('<a href="' + data.html_url + '" target="_blank"><sup style="padding-left: 5px; color: red; font-weight: bold;" title="有新版本,请及时更新!' + data.body + '" >✱</sup></a>');
});
});
</script>
@endif

</body>
</html>

0 comments on commit 47c7ad5

Please sign in to comment.