Skip to content

Commit

Permalink
Merge branch 'jqhph:2.0' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-shi authored Jul 26, 2023
2 parents ce54bbd + f8ef27c commit 36c1e8d
Show file tree
Hide file tree
Showing 117 changed files with 4,566 additions and 1,022 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
daysUntilStale: 180
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
Expand Down
48 changes: 47 additions & 1 deletion .github/workflows/dusk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
with:
php-version: '7.1'
php-version: '7.2'

- uses: actions/checkout@v2

Expand Down Expand Up @@ -190,3 +190,49 @@ jobs:

- name: Run test suite
run: cd ./laravel-tests && php artisan dusk

laravel9:
runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
with:
php-version: '8.0'

- uses: actions/checkout@v2

- name: Composer Update
run: composer self-update --2

- name: Setup MySQL
# You may pin to the exact commit or the version.
# uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248
uses: mirromutth/[email protected]
with:
# Version of MySQL to use
mysql version: 5.7
# MYSQL_ROOT_PASSWORD - root superuser password
mysql root password: 123456
# MYSQL_DATABASE - name for the default database that is created
mysql database: laravel
# MYSQL_USER - create the specified user with superuser power for created database
mysql user: root
# MYSQL_PASSWORD - specified superuser password which user is power for created database
mysql password: 123456

- name: Install Dependencies
run: |
composer create-project --prefer-dist laravel/laravel laravel-tests 9.*
sh ./tests/bin/install-dep.sh
- name: Install Admin
run: sh ./tests/bin/install-admin.sh

- name: Install Xvfb
run: sudo apt-get install xvfb

- name: Start Server
run: sh ./tests/bin/start.sh

- name: Run test suite
run: cd ./laravel-tests && php artisan dusk
23 changes: 12 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/vendor/
composer.lock
.idea
.php_cs.cache
/node_modules
package-lock.json
mix-manifest.json
/images/
pre-dist
/laravel-tests
*.bak.*
/vendor/
composer.lock
.idea
.php_cs.cache
/node_modules
package-lock.json
mix-manifest.json
/images/
pre-dist
/laravel-tests
*.bak.*
.DS_Store
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,14 @@

### 环境
- PHP >= 7.1.0
- Laravel 5.5.0 ~ 8.*
- Laravel 5.5.0 ~ 9.*
- Fileinfo PHP Extension

### 安装

> 如果安装过程中出现`composer`下载过慢或安装失败的情况,请运行命令`composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/``composer`镜像更换为阿里云镜像。
首先需要安装`laravel`框架,如已安装可以跳过此步骤。如果您是第一次使用`laravel`,请务必先阅读文档 [安装 《Laravel中文文档》](https://learnku.com/docs/laravel/8.x/installation/9354)
```bash
composer create-project --prefer-dist laravel/laravel 项目名称 7.*
composer create-project --prefer-dist laravel/laravel 项目名称 9.*
#
composer create-project --prefer-dist laravel/laravel 项目名称
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"php": ">=7.1.0",
"laravel/framework": "~5.5|~6.0|~7.0|~8.0",
"laravel/framework": "~5.5|~6.0|~7.0|~8.0|~9.0|~10.0",
"spatie/eloquent-sortable": "3.*|4.*",
"doctrine/dbal": "^2.6|^3.0"
},
Expand Down
1 change: 1 addition & 0 deletions config/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
'image' => 'images',
'file' => 'files',
],

],

/*
Expand Down
9 changes: 8 additions & 1 deletion resources/assets/dcat/js/bootstrappers/Pjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ export default class Pjax {
$(formContainer).find('[type="submit"],.submit').buttonLoading(false)
}

var $body = $('body');

// 移除遮罩层
$(".modal-backdrop").remove();
$("body").removeClass("modal-open");
$body.removeClass("modal-open");

// 刷新页面后需要重置modal弹窗设置的间隔
if ($body.css('padding-right')) {
$body.css('padding-right', '');
}
});

$d.on('pjax:loaded', () => {
Expand Down
4 changes: 2 additions & 2 deletions resources/assets/dcat/js/dcat-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ function listen(Dcat) {
new Footer(Dcat);
// data-action 动作绑定(包括删除、批量删除等操作)
new DataActions(Dcat);
// pjax初始化功能
new Pjax(Dcat);
});

// 每个请求都初始化
Expand All @@ -109,6 +107,8 @@ function listen(Dcat) {
'X-CSRF-TOKEN': Dcat.token
}
});
// pjax初始化功能
new Pjax(Dcat);
});
}

Expand Down
11 changes: 9 additions & 2 deletions resources/assets/dcat/js/extensions/Ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,17 @@ export default class Ajax {
case 403:
return Dcat.error(_msg || (Dcat.lang['403'] || 'Permission deny!'));
case 401:
if (json.login) {
return location.href = json.login;
if (json.redirect) {
return location.href = json.redirect;
}
return Dcat.error(Dcat.lang['401'] || 'Unauthorized.');
case 301:
case 302:
console.log('admin redirect', json);
if (json.redirect) {
return location.href = json.redirect;
}
return;
case 419:
return Dcat.error(Dcat.lang['419'] || 'Sorry, your page has expired.');

Expand Down
40 changes: 24 additions & 16 deletions resources/assets/dcat/js/extensions/DarkMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,48 @@ export default class DarkMode {
var storage = localStorage || {setItem:function () {}, getItem: function () {}},
darkMode = this,
key = 'dcat-admin-theme-mode',
mode = storage.getItem(key),
icon = '.dark-mode-switcher i';

function switchMode(dark) {
if (dark) {
$(icon).addClass('icon-sun').removeClass('icon-moon');
darkMode.display(true);
return;
function switchMode(theme) {
switch (theme) {
case 'dark': {
$(icon).addClass('icon-sun').removeClass('icon-moon');
darkMode.display(true);
break;
}
case 'def': {
darkMode.display(false);
$(icon).removeClass('icon-sun').addClass('icon-moon');
break;
}
default: {
break;
}
}

darkMode.display(false);
$(icon).removeClass('icon-sun').addClass('icon-moon');
}

if (mode === 'dark') {
switchMode(true);
} else if (mode === 'def') {
switchMode(false)
}
switchMode(storage.getItem(key));

$(document).off('click', selector).on('click', selector, function () {
$(icon).toggleClass('icon-sun icon-moon');

if ($(icon).hasClass('icon-moon')) {
switchMode(false);
switchMode('def');

storage.setItem(key, 'def');

} else {
storage.setItem(key, 'dark');

switchMode(true)
switchMode('dark')
}
})

window.addEventListener('storage', function (event) {
if (event.key === key) {
switchMode(event.newValue);
}
});
}

toggle() {
Expand Down
Loading

0 comments on commit 36c1e8d

Please sign in to comment.