Merge pull request #1 from halo-dev/dev

Dev
pull/147/head
John Niang 2019-05-09 00:49:48 +08:00 committed by GitHub
commit 68a5481e5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 51 deletions

View File

@ -1,6 +1,6 @@
<h1>Halo</h1>
<h1 align="center"><a href="https://github.com/halo-dev" target="_blank">Halo</a></h1>
> Halo 可能是最好的 Java 博客系统。(请注意,老版本已不提供维护,当前分支为新版本,正在内测中,将于近期发布版本)
> Halo 可能是最好的 Java 博客系统。
<p align="center">
<a href="https://ryanc.cc"><img alt="Author" src="https://img.shields.io/badge/author-ruibaby-red.svg?style=flat-square"/></a>
@ -12,6 +12,10 @@
------------------------------
## 新版本说明
**老版本已不提供维护,请不要再使用老版本进行部署了,当前分支为新版本,正在内测中,将于近期发布版本**
## 简介
**Halo** [ˈheɪloʊ],意为光环。当然,你也可以当成拼音读(哈喽)。
@ -63,4 +67,36 @@
| 支付宝/微信/QQ |
| :------------: |
| <img src="https://i.loli.net/2018/12/23/5c1f68ce9b884.png" width="200"/> |
| <img src="https://i.loli.net/2018/12/23/5c1f68ce9b884.png" width="200"/> |
## 预览图
![anatole.png](https://i.loli.net/2019/05/08/5cd2fc3e478dc.png)
![casper.png](https://i.loli.net/2019/05/08/5cd2fc3e4e587.png)
![material.png](https://i.loli.net/2019/05/08/5cd2fc3e78012.png)
![admin-install.png](https://i.loli.net/2019/05/08/5cd2fcae89cae.png)
![admin-login.png](https://i.loli.net/2019/05/08/5cd2fcae6a3fa.png)
![admin-dashboard.png](https://i.loli.net/2019/05/08/5cd2fcaf1b2d2.png)
![admin-posts.png](https://i.loli.net/2019/05/08/5cd2fcaf18c37.png)
![admin-write.png](https://i.loli.net/2019/05/08/5cd2fcae9bea2.png)
![admin-write1.png](https://i.loli.net/2019/05/08/5cd2fcaf6a1ac.png)
![admin-write2.png](https://i.loli.net/2019/05/08/5cd2fcb08ea2d.png)
![admin-attachment.png](https://i.loli.net/2019/05/08/5cd2fcb1c752e.png)
![admin-themes.png](https://i.loli.net/2019/05/08/5cd2fcb21fc76.png)
![admin-theme-settings.png](https://i.loli.net/2019/05/08/5cd2fcb04f9c3.png)
![admin-profile.png](https://i.loli.net/2019/05/08/5cd2fccee89f5.png)
![admin-options.png](https://i.loli.net/2019/05/08/5cd2fccedc309.png)

View File

@ -36,9 +36,9 @@ public class ContentSheetController {
*
* @return template path: themes/{theme}/gallery.ftl
*/
@GetMapping(value = "/gallery")
public String gallery() {
return themeService.render("gallery");
@GetMapping(value = "/photos")
public String photos() {
return themeService.render("photos");
}
/**

View File

@ -23,17 +23,17 @@
</ul>
</header>
<section id="thumbnails">
<@galleryTag method="list">
<#if galleries?size gt 0>
<#list galleries as gallery>
<@photoTag method="list">
<#if photos?size gt 0>
<#list photos as photo>
<article>
<a class="thumbnail" href="${gallery.url}" data-position="left center"><img src="${gallery.thumbnail}" alt="${gallery.description}" /></a>
<h2>${gallery.name}</h2>
<p>${gallery.takeTime!}</p>
<a class="thumbnail" href="${photo.url}" data-position="left center"><img src="${photo.thumbnail}" alt="${photo.description}" /></a>
<h2>${photo.name}</h2>
<p>${photo.takeTime!}</p>
</article>
</#list>
</#if>
</@galleryTag>
</@photoTag>
</section>
<footer id="footer">
<ul class="copyright">

View File

@ -1,33 +0,0 @@
package run.halo.app.event;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.context.ApplicationListener;
import run.halo.app.event.logger.LogEvent;
import run.halo.app.event.logger.LogEventListener;
import run.halo.app.utils.ReflectionUtils;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Objects;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.*;
/**
* Log event listener test.
*
* @author johnniang
* @date 19-4-21
*/
@Slf4j
public class LogEventListenerTest {
@Test
public void getGenericTypeTest() {
ParameterizedType parameterizedType = ReflectionUtils.getParameterizedType(ApplicationListener.class, LogEventListener.class);
Type[] actualTypeArguments = Objects.requireNonNull(parameterizedType).getActualTypeArguments();
Type actualTypeArgument = actualTypeArguments[0];
assertThat(actualTypeArgument.getTypeName(), equalTo(LogEvent.class.getTypeName()));
}
}

View File

@ -1,15 +1,19 @@
package run.halo.app.service.impl;
import run.halo.app.model.entity.Option;
import run.halo.app.model.properties.QnYunProperties;
import run.halo.app.repository.OptionRepository;
import com.qiniu.common.Zone;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import run.halo.app.cache.StringCacheStore;
import run.halo.app.model.entity.Option;
import run.halo.app.model.properties.QnYunProperties;
import run.halo.app.repository.OptionRepository;
import run.halo.app.service.OptionService;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import static org.hamcrest.Matchers.equalTo;
@ -30,6 +34,9 @@ public class OptionServiceImplTest {
@Mock
private OptionRepository optionRepository;
@Mock
private StringCacheStore cacheStore;
@InjectMocks
private OptionServiceImpl optionService;
@ -76,13 +83,16 @@ public class OptionServiceImplTest {
QnYunProperties zoneProperty = QnYunProperties.ZONE;
// Given
given(optionRepository.findByKey(zoneProperty.getValue())).willReturn(Optional.ofNullable(option));
// given(optionRepository.findByKey(zoneProperty.getValue())).willReturn(Optional.ofNullable(option));
Map<String, Object> optionMap = new HashMap<>(1);
optionMap.put(zoneProperty.getValue(), Optional.ofNullable(option).map(Option::getValue).orElse(null));
given(cacheStore.getAny(OptionService.OPTIONS_KEY, Map.class)).willReturn(Optional.of(optionMap));
// When
Zone zone = optionService.getQnYunZone();
// Then
then(optionRepository).should().findByKey(zoneProperty.getValue());
then(cacheStore).should().getAny(OptionService.OPTIONS_KEY, Map.class);
assertNotNull(zone);
assertThat(zone.getRegion(), equalTo(actualZone.getRegion()));