Skip to content

Commit

Permalink
后台"增加板块"功能
Browse files Browse the repository at this point in the history
  • Loading branch information
时雨 committed May 18, 2015
1 parent f754e04 commit 6f61d34
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
15 changes: 15 additions & 0 deletions controller/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,21 @@ def sort_action(self, *args, **kwargs):
else:
self.redirect("/manage/sortdetail/%s" % id)

@tornado.web.asynchronous
@gen.coroutine
def newsort_action(self, *args, **kwargs):
sort = dict(
name = self.get_body_argument("name"),
intro = self.get_body_argument("intro",default=None),
show = True if intval(self.get_body_argument("show", default=None)) else False,
article = 0
)
model = SortModel()
if not model(sort):
self.custom_error(model.error_msg)
sort = yield self.db.sort.insert(sort)
self.redirect("/manage/sort")

@tornado.web.asynchronous
@gen.coroutine
def setting_action(self, *args, **kwargs):
Expand Down
5 changes: 5 additions & 0 deletions controller/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def _view_sortdetail(self, arg):
self.custom_error("不存在这个板块")
self.render("sortdetail.htm", sort = sort)

@tornado.web.asynchronous
@gen.coroutine
def _view_newsort(self, arg):
self.render("newsort.htm")

@tornado.web.asynchronous
@gen.coroutine
def _view_setting(self, arg):
Expand Down
3 changes: 3 additions & 0 deletions templates/admin/sort.htm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

<div class="am-g">
<div class="am-u-sm-12">
<div class="am-input-group am-input-group-sm am-fr">
<a href="/manage/newsort" class="am-btn am-btn-default am-btn-sm" name="expire">&nbsp;添加&nbsp;</a>
</div>
<table class="am-table am-table-bd am-table-striped admin-content-table">
<thead>
<tr>
Expand Down
22 changes: 3 additions & 19 deletions templates/admin/sortdetail.htm
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,11 @@
<div class="am-panel-bd">
<div class="am-g">
<div class="am-u-lg-12">
<p class="am-text-sm">用户头像</p>
<p><strong>板块详情</strong></p>
</div>
</div>
</div>
</div>

<div class="am-panel am-panel-default">
<div class="am-panel-bd">
<div class="user-info">
<p>等级信息</p>
<div class="am-progress am-progress-sm">
<div class="am-progress-bar"></div>
</div>
<p class="user-info-order">当前等级:<strong>LV8</strong> 活跃天数:<strong>587</strong> 距离下一级别:<strong>160</strong></p>
</div>
<div class="user-info">
<p>信用信息</p>
<div class="am-progress am-progress-sm">
<div class="am-progress-bar am-progress-bar-success"></div>
<div class="am-u-lg-12">
<p class="am-text-sm">帖子数量:{{ sort['article'] }}</p>
</div>
<p class="user-info-order">信用等级:正常当前 信用积分:<strong>80</strong></p>
</div>
</div>
</div>
Expand Down

0 comments on commit 6f61d34

Please sign in to comment.