Skip to content

Commit b2efa10

Browse files
committed
update
1 parent 9ef1ad4 commit b2efa10

File tree

6 files changed

+110
-44
lines changed

6 files changed

+110
-44
lines changed

backend/views/question/view.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,13 @@
2828
'label' => Yii::t('question', 'Manage Question'),
2929
'url' => ['index'],
3030
],
31-
[
32-
'label' => Yii::t('question', 'Create Question'),
33-
'url' => ['create'],
34-
],
35-
[
36-
'label' => Yii::t('question', 'Update Question'),
37-
'url' => ['update', 'id' => $model->id],
38-
'options' => ['class' => 'btn btn-primary btn-sm']
39-
],
4031
[
4132
'label' => Yii::t('question', 'Delete Question'),
4233
'url' => ['delete', 'id' => $model->id],
4334
'options' => [
4435
'class' => 'btn btn-danger btn-sm',
4536
'data' => [
46-
'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
37+
'confirm' => Yii::t('question', 'Are you sure you want to delete this item?'),
4738
'method' => 'post',
4839
],
4940
]

frontend/views/space/answer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
$this->context->layout = '@yuncms/user/frontend/views/layouts/space';
1010
$this->params['user'] = $user;
1111
if (!Yii::$app->user->isGuest && Yii::$app->user->id == $user->id) {//Me
12-
$this->title = Yii::t('article', 'My Answers');
12+
$this->title = Yii::t('question', 'My Answers');
1313
} else {
14-
$this->title = Yii::t('article', 'His Answers');
14+
$this->title = Yii::t('question', 'His Answers');
1515
}
1616
?>
1717

frontend/views/space/question.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
$this->context->layout = '@yuncms/user/frontend/views/layouts/space';
1010
$this->params['user'] = $user;
1111
if (!Yii::$app->user->isGuest && Yii::$app->user->id == $user->id) {//Me
12-
$this->title = Yii::t('article', 'My Questions');
12+
$this->title = Yii::t('question', 'My Questions');
1313
} else {
14-
$this->title = Yii::t('article', 'His Questions');
14+
$this->title = Yii::t('question', 'His Questions');
1515
}
1616
?>
1717

messages/zh-CN/question.php

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,69 @@
1717
* NOTE: this file must be saved in UTF-8 encoding.
1818
*/
1919
return [
20+
'His Answers' => '他的回答',
21+
'His Questions' => '他的提问',
22+
'ID' => '',
23+
'My Answers' => '我的回答',
24+
'Delete' => '@@删除@@',
25+
'Markdown powered content' => '@@支持 Markdown 语法@@',
26+
'Popular tags' => '@@热门话题@@',
27+
'Publish' => '@@发布@@',
28+
'Question' => '@@问题@@',
29+
'Tag' => '@@标签@@',
30+
'Update' => '@@更新@@',
31+
'User' => '@@用户@@',
32+
'What\'s your question? Be specific.' => '@@你的问题是什么?@@',
33+
'Add details to get a more accurate answer.' => '补充细节,以得到更准确的答案',
34+
'Adopte failed. Please try again later.' => '操作失败,请重试!',
2035
'Alias' => '别名',
2136
'Answer' => '回答',
22-
'My Questions' => '我的提问',
23-
'Collection of questions' => '我的收藏',
24-
'Answer failed. Please try again later.' => '回答失败。请稍后再试。',
2537
'Answer to adopt success.' => '采纳回答成功',
2638
'Answers' => '回答',
39+
'Are you sure you want to delete this item?' => '你确定要删除该项目?',
2740
'Ask a Question' => '提问',
41+
'Batch Deletion' => '批量删除',
42+
'Best answer' => '最佳答案',
43+
'Collections' => '收藏',
44+
'Comments' => '评论',
45+
'Confirm Changes' => '确认修改',
2846
'Content' => '内容',
2947
'Created At' => '创建时间',
30-
'Delete' => '删除',
31-
'Best answer' => '最佳答案',
32-
'{n, plural, =0{No comment} =1{One comment} other{# reviews}}' => '{n, plural, =0{暂无评论} =1{1 条评论} other{# 条评论}}',
33-
'Add details to get a more accurate answer.' => '补充细节,以得到更准确的答案',
34-
'Operation completed.' => '操作完成。',
48+
'Default Sort' => '默认排序',
49+
'Delete Question' => '删除问题',
3550
'Edit' => '修改',
36-
'No introduction' => '暂无介绍',
37-
'Question & Answer' => '问答',
3851
'Edit Answer' => '编辑回答',
39-
'Submit Question' => '提交问题',
40-
'Hot question' => '热门问题',
41-
'ID' => '',
42-
'Update Question' => '编辑问题',
43-
'Reward' => '悬赏',
44-
'My Answer' => '我的回答',
45-
'Confirm Changes' => '确认修改',
52+
'Followers' => '关注',
4653
'Hide' => '匿名',
47-
'Point' => '积分',
54+
'Hot question' => '热门问题',
4855
'Insufficient points, please recharge.' => '积分不足,请先充值。',
49-
'Please enter the correct points.' => '请输入正确的积分。',
50-
'Markdown powered content' => '支持 Markdown 语法',
56+
'Manage Question' => '问题管理',
57+
'My Answer' => '我的回答',
58+
'My Questions' => '我的提问',
5159
'New question' => '最新的',
52-
'No popular questions' => '',
60+
'No introduction' => '暂无介绍',
61+
'No popular questions' => '暂无热门问题',
62+
'Operation' => '操作',
63+
'Operation completed.' => '操作完成。',
64+
'Please enter the correct points.' => '请输入正确的积分。',
65+
'Point' => '积分',
5366
'Popular Questions' => '热门问题',
54-
'Popular tags' => '热门话题',
55-
'Publish' => '发布',
56-
'Question' => '问题',
67+
'Question & Answer' => '问答',
5768
'Questions' => '问题',
58-
'Default Sort' => '默认排序',
59-
'Time Sort' => '时间排序',
6069
'Remove' => '删除',
70+
'Reward' => '悬赏',
6171
'Reward question' => '悬赏的',
6272
'Status' => '状态',
73+
'Submit Question' => '提交问题',
6374
'Sure?' => '你确定?',
64-
'Tag' => '标签',
6575
'Tags' => '标签',
76+
'Time Sort' => '时间排序',
6677
'Title' => '问题',
6778
'Unanswered question' => '未回答的',
68-
'Update' => '更新',
69-
'User' => '用户',
79+
'Update Question' => '编辑问题',
80+
'Updated At' => '更新时间',
7081
'Views' => '查看',
71-
'What\'s your question? Be specific.' => '你的问题是什么?',
82+
'You can not take your own answer.' => '你不能自问自答。',
7283
'{n, plural, =0{No answers yet} =1{One answer} other{# answers}}' => '{n, plural, =0{0 个回答} =1{1 个回答} other{# 个回答}}',
84+
'{n, plural, =0{No comment} =1{One comment} other{# reviews}}' => '{n, plural, =0{暂无评论} =1{1 条评论} other{# 条评论}}',
7385
];
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
namespace yuncms\question\migrations;
4+
5+
use yii\db\Migration;
6+
7+
/**
8+
* Class M170811075933Add_backend_menu
9+
*/
10+
class M170811075933Add_backend_menu extends Migration
11+
{
12+
/**
13+
* @inheritdoc
14+
*/
15+
public function safeUp()
16+
{
17+
$this->insert('{{%admin_menu}}', [
18+
'name' => '问答管理',
19+
'parent' => 8,
20+
'route' => '/question/question/index',
21+
'icon' => 'fa-question',
22+
'sort' => NULL,
23+
'data' => NULL
24+
]);
25+
26+
$id = (new \yii\db\Query())->select(['id'])->from('{{%admin_menu}}')->where(['name' => '问答管理', 'parent' => 8,])->scalar($this->getDb());
27+
$this->batchInsert('{{%admin_menu}}', ['name', 'parent', 'route', 'visible', 'sort'], [
28+
['问题查看', $id, '/question/question/view', 0, NULL],
29+
]);
30+
}
31+
32+
/**
33+
* @inheritdoc
34+
*/
35+
public function safeDown()
36+
{
37+
$id = (new \yii\db\Query())->select(['id'])->from('{{%admin_menu}}')->where(['name' => '问答管理', 'parent' => 8,])->scalar($this->getDb());
38+
$this->delete('{{%admin_menu}}', ['parent' => $id]);
39+
$this->delete('{{%admin_menu}}', ['id' => $id]);
40+
}
41+
42+
/*
43+
// Use up()/down() to run migration code without a transaction.
44+
public function up()
45+
{
46+
47+
}
48+
49+
public function down()
50+
{
51+
echo "M170811075933Add_backend_menu cannot be reverted.\n";
52+
53+
return false;
54+
}
55+
*/
56+
}

models/Question.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ public function attributeLabels()
139139
'content' => Yii::t('question', 'Content'),
140140
'tagValues' => Yii::t('question', 'Tags'),
141141
'status' => Yii::t('question', 'Status'),
142+
'views' => Yii::t('question', 'Views'),
143+
'answers' => Yii::t('question', 'Answers'),
144+
'followers' => Yii::t('question', 'Followers'),
145+
'collections' => Yii::t('question', 'Collections'),
146+
'comments' => Yii::t('question', 'Comments'),
147+
'created_at' => Yii::t('question', 'Created At'),
148+
'updated_at'=> Yii::t('question', 'Updated At'),
142149
];
143150
}
144151

0 commit comments

Comments
 (0)