Skip to content

Commit a3a421d

Browse files
author
Liu Jie
authored
Merge pull request #3 from Jaggle/dev
code renaming
2 parents 14423d3 + 78a95a7 commit a3a421d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+389
-318
lines changed

app/config/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ parameters:
1111
assetic:
1212
debug: '%kernel.debug%'
1313
use_controller: '%kernel.debug%'
14+
node: '%node_path%'
1415
filters:
1516
cssrewrite: ~
1617
uglifyjs2:

app/config/parameters.yml.dist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ parameters:
1818
# A secret key that's used to generate certain security-related tokens
1919
secret: ThisTokenIsNotSoSecretChangeIt
2020

21+
node_path: /usr/local/bin/node
22+
uglifyjs2_path: /usr/local/bin/uglifyjs
2123

22-
uglifyjs2_path: ~
2324
redis-dsn: ~
2425
assets_base_url: 'https://static.yeskn.com/vmoex/'
2526
assets_version: v0.
27+
2628
socket_host: http://localhost:2120
2729
socket_push_host: http://localhost:2121

src/Yeskn/AdminBundle/Controller/CategoryController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Created by PhpStorm.
3+
* This file is part of project vmoex.
44
* User: Jake
55
* Date: 2016/6/23
66
* Time: 12:07
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
<?php
22
/**
3-
* Created by PhpStorm.
3+
* This file is part of project vmoex.
44
* User: Jake
55
* Date: 2016/6/23
66
* Time: 12:35
77
*/
88

99
namespace Yeskn\AdminBundle\Controller;
1010

11-
1211
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
13-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12+
use Symfony\Component\HttpFoundation\Request;
13+
use Yeskn\CommonBundle\Controller\BaseController;
1414

1515
/**
1616
* Class CommentController
1717
* @package Yeskn\AdminBundle\Controller
1818
*
1919
* @Route("/admin/comment")
2020
*/
21-
class CommentController extends Controller
21+
class CommentController extends BaseController
2222
{
2323
/**
2424
* @Route("", name="admin_comment_index")
2525
*/
26-
public function indexAction()
26+
public function indexAction(Request $request)
2727
{
28-
$comments = $this->getDoctrine()->getRepository('YesknBlogBundle:Comment')->findAll();
28+
$pageData = $this->getDoctrine()->getRepository('YesknBlogBundle:Comment')
29+
->getPageData($request->get('page'));
2930
return $this->render('@YesknAdmin/Comment/list.html.twig', [
30-
'comments' => $comments
31+
'paginator' => $this->getPaginator($pageData->count),
32+
'comments' => $pageData->data
3133
]);
3234
}
3335
}

src/Yeskn/AdminBundle/Controller/PostController.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
66
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
77
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
8-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
98
use Symfony\Component\HttpFoundation\Request;
109
use Symfony\Component\HttpFoundation\Response;
1110
use Yeskn\BlogBundle\Entity\Post;
12-
use Yeskn\BlogBundle\Entity\Tag;
11+
use Yeskn\CommonBundle\Controller\BaseController;
1312

1413
/**
1514
* Class PostController
1615
* @Route("/admin/post")
1716
* @Security("has_role('ROLE_ADMIN')")
1817
*/
19-
class PostController extends Controller
18+
class PostController extends BaseController
2019
{
2120
/**
2221
* @Route("/create")
@@ -102,28 +101,17 @@ public function deleteAction($id)
102101
}
103102
}
104103

105-
/**
106-
* @Route("/preview")
107-
*/
108-
public function previewAction()
109-
{
110-
111-
}
112-
113104
/**
114105
* @Route("/list")
115-
* @Route("/index")
116-
* @Route("/")
117106
*/
118-
public function listAction()
107+
public function listAction(Request $request)
119108
{
120-
/**
121-
* @var Post[] $posts
122-
*/
123-
$posts = $this->getDoctrine()->getRepository('YesknBlogBundle:Post')->findBy([], ['updatedAt' => 'DESC']);
109+
$pageData = $this->getDoctrine()->getRepository(
110+
'YesknBlogBundle:Post')->getPageData($request->get('page'));
124111

125112
return $this->render('@YesknAdmin/Post/index.html.twig', array(
126-
'posts' => $posts
113+
'paginator' => $this->getPaginator($pageData->count),
114+
'posts' => $pageData->data
127115
));
128116
}
129117
}

src/Yeskn/AdminBundle/Controller/TagController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Created by PhpStorm.
3+
* This file is part of project vmoex.
44
* User: Jake
55
* Date: 2016/6/22
66
* Time: 20:15

src/Yeskn/AdminBundle/Controller/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Created by PhpStorm.
3+
* This file is part of project vmoex.
44
* User: Jake
55
* Date: 2016/6/22
66
* Time: 21:36

src/Yeskn/AdminBundle/Resources/views/Comment/list.html.twig

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<h3 class="page-header">评论列表</h3>
1212
</div>
1313
</div>
14-
1514
<div class="row">
1615
<div class="col-sm-12">
1716
<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example"
@@ -70,27 +69,8 @@
7069
</div>
7170
</div>
7271
<div class="row">
73-
<div class="col-sm-6">
74-
<div class="dataTables_info" id="dataTables-example_info" role="status" aria-live="polite">
75-
共50项,显示1到10项
76-
</div>
77-
</div>
78-
<div class="col-sm-6">
79-
<div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
80-
<ul class="pagination">
81-
<li class="paginate_button previous disabled" aria-controls="dataTables-example" tabindex="0"
82-
id="dataTables-example_previous">
83-
<a href="#">上一页</a>
84-
</li>
85-
<li class="paginate_button active" aria-controls="dataTables-example" tabindex="0">
86-
<a href="#">1</a>
87-
</li>
88-
<li class="paginate_button next" aria-controls="dataTables-example" tabindex="0"
89-
id="dataTables-example_next">
90-
<a href="#">下一页</a>
91-
</li>
92-
</ul>
93-
</div>
72+
<div class="col-sm-12">
73+
{% include '@YesknCommon/pagination.html.twig' with {paginator:paginator} %}
9474
</div>
9575
</div>
9676
{% endblock %}

src/Yeskn/AdminBundle/Resources/views/Post/index.html.twig

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<th class="" tabindex="4" aria-controls="dataTables-example" rowspan="1" colspan="1"
3838
aria-label="CSS grade: activate to sort column ascending" style="width: 150px;">
3939
更新日期
40-
</th>`
40+
</th>
4141
<th class="" tabindex="5" aria-controls="dataTables-example" rowspan="1" colspan="1"
4242
aria-label="CSS grade: activate to sort column ascending" style="width: 50px;">
4343
点击
@@ -68,7 +68,7 @@
6868
<td class="center">{{ post.createdAt|ago }}</td>
6969
<td class="center">{{ post.updatedAt ? post.updatedAt|ago : '' }}</td>
7070
<td class="center">{{ post.views }}</td>
71-
<td class="center">{{ post.status }}</td>
71+
<td class="center">{{ post.status == 'published' ? '已发布' : post.status }}</td>
7272
<td class="center">
7373
<a href="{{ path('yeskn_admin_post_edit', {id:post.id}) }}">编辑</a>
7474
<a href="{{ path('yeskn_admin_post_delete',{id:post.id}) }}">删除</a>
@@ -81,27 +81,8 @@
8181
</div>
8282
</div>
8383
<div class="row">
84-
<div class="col-sm-6">
85-
<div class="dataTables_info" id="dataTables-example_info" role="status" aria-live="polite">
86-
共50项,显示1到10项
87-
</div>
88-
</div>
89-
<div class="col-sm-6">
90-
<div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
91-
<ul class="pagination">
92-
<li class="paginate_button previous disabled" aria-controls="dataTables-example" tabindex="0"
93-
id="dataTables-example_previous">
94-
<a href="#">上一页</a>
95-
</li>
96-
<li class="paginate_button active" aria-controls="dataTables-example" tabindex="0">
97-
<a href="#">1</a>
98-
</li>
99-
<li class="paginate_button next" aria-controls="dataTables-example" tabindex="0"
100-
id="dataTables-example_next">
101-
<a href="#">下一页</a>
102-
</li>
103-
</ul>
104-
</div>
84+
<div class="col-sm-12">
85+
{% include '@YesknCommon/pagination.html.twig' with {paginator:paginator} %}
10586
</div>
10687
</div>
10788
{% endblock %}

0 commit comments

Comments
 (0)