Skip to content

Commit

Permalink
🦄 fix page layout
Browse files Browse the repository at this point in the history
  • Loading branch information
hellokaton committed Mar 9, 2017
1 parent 847faaf commit e63c19a
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 54 deletions.
28 changes: 13 additions & 15 deletions src/main/java/com/tale/controller/admin/PageController.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.tale.dto.LogActions;
import com.tale.dto.Types;
import com.tale.exception.TipException;
import com.tale.ext.Commons;
import com.tale.init.TaleConst;
import com.tale.model.Contents;
import com.tale.model.Users;
Expand Down Expand Up @@ -50,35 +51,35 @@ public String index(Request request) {

@Route(value = "new", method = HttpMethod.GET)
public String newPage(Request request) {
request.attribute(Types.ATTACH_URL, Commons.site_option(Types.ATTACH_URL, Commons.site_url()));
return "admin/page_edit";
}

@Route(value = "/:cid", method = HttpMethod.GET)
public String editPage(@PathParam String cid, Request request) {
Contents contents = contentsService.getContents(cid);
request.attribute("contents", contents);
request.attribute(Types.ATTACH_URL, Commons.site_option(Types.ATTACH_URL, Commons.site_url()));
return "admin/page_edit";
}

@Route(value = "publish", method = HttpMethod.POST)
@JSON
public RestResponse publishPage(@QueryParam String title, @QueryParam String content,
@QueryParam String status, @QueryParam String slug,
@QueryParam Integer allow_comment, @QueryParam Integer allow_ping) {
@QueryParam String fmt_type,
@QueryParam Boolean allow_comment) {

Users users = this.user();
Contents contents = new Contents();
contents.setTitle(title);
contents.setContent(content);
contents.setStatus(status);
contents.setSlug(slug);
contents.setFmt_type(fmt_type);
contents.setType(Types.PAGE);
if (null != allow_comment) {
contents.setAllow_comment(allow_comment == 1);
}
if (null != allow_ping) {
contents.setAllow_ping(allow_ping == 1);
}
contents.setAllow_comment(allow_comment);
contents.setAllow_ping(true);
contents.setAuthor_id(users.getUid());

try {
Expand All @@ -99,24 +100,21 @@ public RestResponse publishPage(@QueryParam String title, @QueryParam String con
@Route(value = "modify", method = HttpMethod.POST)
@JSON
public RestResponse modifyArticle(@QueryParam Integer cid, @QueryParam String title,
@QueryParam String content,
@QueryParam String content,@QueryParam String fmt_type,
@QueryParam String status, @QueryParam String slug,
@QueryParam Integer allow_comment, @QueryParam Integer allow_ping) {
@QueryParam Boolean allow_comment) {

Users users = this.user();
Contents contents = new Contents();
contents.setCid(cid);
contents.setTitle(title);
contents.setContent(content);
contents.setStatus(status);
contents.setFmt_type(fmt_type);
contents.setSlug(slug);
contents.setType(Types.PAGE);
if (null != allow_comment) {
contents.setAllow_comment(allow_comment == 1);
}
if (null != allow_ping) {
contents.setAllow_ping(allow_ping == 1);
}
contents.setAllow_comment(allow_comment);
contents.setAllow_ping(true);
contents.setAuthor_id(users.getUid());
try {
contentsService.updateArticle(contents);
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/templates/admin/article_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

<link href="//cdn.bootcss.com/multi-select/0.9.12/css/multi-select.css" rel="stylesheet"/>
<link href="//cdn.bootcss.com/select2/3.4.8/select2.min.css" rel="stylesheet"/>
<link href="http://mditor.com/demo/css/mokit.min.css" rel="stylesheet"/>
<link href="//unpkg.com/[email protected]/dist/css/mditor.min.css" rel="stylesheet"/>

<link href="//cdn.bootcss.com/summernote/0.8.2/summernote.css" rel="stylesheet">
<link href="//cdn.bootcss.com/dropzone/4.3.0/min/dropzone.min.css" rel="stylesheet">

Expand Down Expand Up @@ -198,7 +199,7 @@ <h4 class="page-title">
<script src="/static/admin/plugins/tagsinput/jquery.tagsinput.min.js"></script>
<script src="/static/admin/plugins/jquery-multi-select/jquery.quicksearch.js"></script>

<script src="http://mditor.com/demo/js/mditor.min.js"></script>
<script src="//unpkg.com/[email protected]/dist/js/mditor.min.js"></script>
<script src="//cdn.bootcss.com/wysihtml5/0.3.0/wysihtml5.min.js"></script>
<script src="//cdn.bootcss.com/summernote/0.8.2/summernote.min.js"></script>
<script src="//cdn.bootcss.com/summernote/0.8.2/lang/summernote-zh-CN.min.js"></script>
Expand Down
Loading

0 comments on commit e63c19a

Please sign in to comment.