Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesPong committed Apr 4, 2018
2 parents f2d0b08 + d6d6b0f commit f05ba93
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 30 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

## 1.2.0 - 2018-04-01
## 1.3.0 - 2018-04-04
### Added
- Mobile search ([3c3a78a](https://github.com/MilesPong/indigo/commit/3c3a78ac2caba61a649395371f5050877dd487c0))
- Chinese [README_zh.md](README_zh.md)

### Changed
- Github webhook event set to `push` ([153b1b8](https://github.com/MilesPong/indigo/commit/153b1b8ad4a53f1bf1457800f2dfbce6b4db7473))
- Localization
- Frontend table style

## 1.2.2 - 2018-04-01
### Added
- Webhook event and listener ([f5288a6](https://github.com/MilesPong/indigo/commit/f5288a6eeae7740ccf2ddf85535a79f960b3cc1e), [c95a83c](https://github.com/MilesPong/indigo/commit/c95a83cd9af096e5d6ca939000be94106c649809))
- Feature **Deployer** integration
- Migration for failed queue job

### Changed
- Update package-lock.json

### Fixed
- Some namespaces
- Missing HOME environment variable for composer in deployer submodule ([ceb7ac8](https://github.com/MilesPong/indigo/commit/ceb7ac8ce8959608a53800d6db012a81ff62e8ee))

### Removed
- Default closure in `routes/api.php`
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# Indigo

[README](README.md) | [简体中文](README_zh.md)

A blog application built with [Laravel](https://laravel.com), [Materialize](http://materializecss.com) and [Vue.js](https://vuejs.org/).

Indigo is a project I mainly learn to how to develop a Laravel application **in the right way**, include using design patterns, modern coding tricks, and other useful skills.
Expand Down
158 changes: 158 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Indigo

[README](README.md) | [简体中文](README_zh.md)

**Indigo** 是一个基于 [Laravel](https://laravel.com/)[Materialize](http://materializecss.com/)[Vue.js](https://vuejs.org/) 开发的个人博客项目。

## 预览

![screenshot](https://user-images.githubusercontent.com/5867628/37555740-48334dc4-2a27-11e8-973f-f54f96d9e912.png)

## 功能特性

- 基本的博客功能,包括文章、页面、搜索、配置、归档等
- Markdown 写作支持(编写、导出)
- 回收站功能
- 漂亮的 Material Design 风格,支持响应式
- 整合 Disqus 的评论
- 框架基于 Repository 设计模式构建
- 多驱动支持的浏览计数器
- Google Drive 文件驱动备份支持
- Mix 前后端资源分离编译
- 自动化部署 [Deployer](https://github.com/MilesPong/laravel-deployer/blob/indigo/README.md) 整合
- 本地化支持
- [Docker](https://www.docker.com/) 开发环境支持

由于当前页面可能无法及时更新,更多特性请从持续更新的[变更日志](CHANGELOG.md)中查看。

## 环境要求

目前 **Laravel** 版本为**5.6**,相关基本环境要求请参考[官方文档](https://laravel.com/docs/5.6#server-requirements)说明。

除此之外,本项目另外整合了(或需要配合)大量第三方服务,因此,你可能还需要一些额外的配置来使得这个项目更加顺利地进行,主要的服务列举如下:

- [Algolia](https://www.algolia.com/) (全文索引)
- [Google Drive](https://drive.google.com/) (网盘)
- [Google Analytics](https://analytics.google.com) (流量统计)
- [Slack](https://slack.com/) (协作通讯工具)
- [Disqus](https://disqus.com/) (评论)
- [有道翻译](http://fanyi.youdao.com/openapi)

以上服务的配置请参考**安装说明****服务配置**部分或者查看源码对应部分。

## 安装

### 使用 Docker

> **为了避免在开发中遇到环境依赖错误等问题,这里建议采用 [Docker](https://www.docker.com/) 来进行部署。相关使用 Docker 的部署说明可以从[这里](https://github.com/MilesPong/docker-lnmp/blob/indigo/README.md)查看。**
### 配置

```
$ git clone https://github.com/MilesPong/indigo.git
$ cd indigo
$ cp .env.example .env
$ composer install
$ php artisan key:generate
```

修改数据库以及其他第三方服务配置

```
# 中文翻译,用于自动slug
YOUDAO_APP_KEY=
YOUDAO_APP_SECRET=
# Google Analytics
GOOGLE_ANALYTICS_ID=
# 默认禁用访客数据
ENABLE_VISITOR_LOG=false
# 评论驱动
COMMENT_DRIVER=
DISQUS_SHORT_NAME=
# 文件驱动
FILESYSTEM_DRIVER=public
# 用于接受备份失败的邮件通知接收
ADMIN_EMAIL=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
# 全文索引服务
SCOUT_QUEUE=false
SCOUT_DRIVER=null
```

默认**日志通道**`stack`,意味默认将使用 `daily``slack` 通道,如果你没有配置 `slack`,请修改日志通道为其他,如 `single`

不要忘记还要建立 `public` 文件系统的**软链接**

```
$ php artisan storage:link
```

**任务调度**主要包括了**备份****保存计数器数据**,如果处于*生产环境*,则应该参考下面进行配置:

```
$ crontab -e
# 添加到末尾
# * * * * * php /path/to/project/artisan schedule:run >> /dev/null 2>&1
```

### 数据迁移

```
$ php artisan migrate --seed
```

创建一个**管理员**账户:

```
$ php artisan user:add
```

开发环境中,你或者还需要导入一些**测试数据**

```
$ php artisan db:seed --class=FakeDataSeeder
```

### 静态资源编译

```
$ npm install
$ npm run dev # Frontend
$ npm run admin-dev # Backend
```

**说明,如果在部署过程中遇到报错问题,请参考对应的日志尝试解决**

## 变更日志

项目的开发遵循 Git 的分支开发模式,一般 `master` 为稳定分支,`develop` 为开发分支。项目的主要功能或重大更新部分请参考每个 [`release`](https://github.com/MilesPong/indigo/releases) 的说明部分,或者你也可以在[这里](CHANGELOG.md)查看到所有的变更记录。

## 待办事项

请在这个 [Gist](https://gist.github.com/MilesPong/7529f9586fb7070a7f4c56360cdf9475) 里查看。

## 链接

- [Materialize](http://materializecss.com/)
- [Vue.js](https://vuejs.org/)
- [Laravel](https://laravel.com/)

## 贡献

欢迎在 [Issue](https://github.com/MilesPong/indigo/issues) 提出你的宝贵意见或者直接向我发起 [Pull Requests](https://github.com/MilesPong/indigo/pulls) 合并请求。

## 感谢

此项目的开发过程中参考了很多优秀开源项目,感谢这些项目的作者们,为开源社区的发展提供了贡献。

## 协议

本项目基于 [MIT License](https://opensource.org/licenses/MIT) 开源协议进行授权。
2 changes: 1 addition & 1 deletion app/Indigo/Tools/Deployer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function setUpConfig()
/**
* @return bool
*/
public function release()
public function deploy()
{
if (!$this->validSetUp()) {
return Log::error('Deployer has not been set up.');
Expand Down
35 changes: 33 additions & 2 deletions app/Listeners/GithubWebhookListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,40 @@ public function __construct()
public function handle(GithubWebhookEvent $event)
{
switch ($event->hookEvent) {
case 'release':
with(new Deployer)->release();
case 'push':
if ($this->isDeployBranch($event->payload)) {
with(new Deployer)->deploy();
}
default:
}
}

/**
* @param $payload
* @return bool
*/
protected function isDeployBranch($payload)
{
$formattedPayload = $this->formatPayload($payload);

return isset($formattedPayload['ref']) && (str_replace('refs/heads/', '',
$formattedPayload['ref']) === $this->getDeployBranch());
}

/**
* @param $payload
* @return mixed
*/
protected function formatPayload($payload): mixed
{
return json_decode($payload, true);
}

/**
* @return string
*/
protected function getDeployBranch()
{
return config('indigo.deployer.branch', 'master');
}
}
18 changes: 18 additions & 0 deletions resources/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ jQuery(document).ready(function () {
nav.addClass("z-depth-0");
}
});

// Mobile search
let toggleNavBar = function () {
$('#nav-main-bar, #nav-search-bar').toggleClass('hide');
};

$('.mobile-search, .mobile-search-close').click(e => {
e.preventDefault();
toggleNavBar();
});

$('.mobile-search').click(() => {
$('#mobile-search-input').focus();
});

$('#mobile-search-input').blur(() => {
toggleNavBar();
})
});

// Navigation bar's dropdown
Expand Down
50 changes: 28 additions & 22 deletions resources/assets/sass/modules/navbar.scss
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
nav {
.brand-logo {
font-size: 1.6rem;
}
#nav-main-bar {
.brand-logo {
font-size: 1.6rem;
}

a.sidenav-trigger {
&.menu-on-large {
position: absolute;
left: -20%;
display: block;
a.sidenav-trigger {
&.menu-on-large {
position: absolute;
left: -20%;
display: block;
}
}
}

.input-field {
input[type="search"] {
border: 1px solid white !important;
border-radius: 0.6rem;
width: 180px;
line-height: 42px;
margin-top: 11px;
.input-field {
input[type="search"] {
border: 1px solid white !important;
border-radius: 0.6rem;
width: 180px;
line-height: 42px;
margin-top: 11px;
}

label i, input[type="search"] ~ .material-icons {
line-height: 42px;
}
}

label i, input[type="search"] ~ .material-icons {
line-height: 42px;
form {
margin-right: 5px;
height: 42px;
}
}

form {
margin-right: 5px;
height: 42px;
.mobile-search {
margin: 0 18px;
}
}
}
2 changes: 1 addition & 1 deletion resources/views/categories/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@component('components.header')
<div class="center white-text">
<div class="row">
<h1>Category: {{ $category->name }}</h1>
<h1>@lang('generic.model.category'): {{ $category->name }}</h1>
<p class="flow-text">{{ $category->description }}</p>
</div>
</div>
Expand Down
21 changes: 20 additions & 1 deletion resources/views/partials/navbar.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{-- NavBar --}}
<div class="navbar-fixed">
<nav id="nav-bar" class="z-depth-0">
<div class="nav-wrapper container">
<div class="nav-wrapper container" id="nav-main-bar">
{{-- Only for large screen --}}
<a href="#" data-target="slide-out" class="sidenav-trigger hide-on-med-and-down menu-on-large"><i class="material-icons">menu</i></a>

Expand Down Expand Up @@ -33,7 +33,26 @@
<li><a class="waves-effect waves-light" href="{{ route('pages.show', 'about') }}">@lang('menus.about')</a></li>
</ul>

{{-- Mobile Search --}}
<ul class="right hide-on-large-only">
<li>
<i class="material-icons mobile-search">search</i>
</li>
</ul>

</div>

{{-- Mobile Search --}}
<div class="nav-wrapper hide" id="nav-search-bar">
<form action="{{ route('search') }}">
<div class="input-field">
<input id="mobile-search-input" type="search" name="q" required>
<label class="label-icon" for="mobile-search-input"><i class="material-icons">search</i></label>
<i class="material-icons mobile-search-close">close</i>
</div>
</form>
</div>

</nav>
</div>

Expand Down
10 changes: 10 additions & 0 deletions resources/views/posts/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,13 @@
</div>
</div>
@endsection

@push('js')
<script>
$(function () {
$('.post-content').find('table').each((idx, elem) => {
$(elem).addClass('striped centered responsive-table');
});
})
</script>
@endpush
Loading

0 comments on commit f05ba93

Please sign in to comment.