Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
刘俊涛 committed Mar 1, 2017
1 parent b8f624b commit 4a8d68c
Show file tree
Hide file tree
Showing 16 changed files with 147 additions and 181 deletions.
6 changes: 3 additions & 3 deletions backend/modules/rbac/views/route/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@

<div class="box box-primary">
<div class="box-body">
<div class="col-md-5">
<div class="col-xs-5">
<?= Yii::t('rbac', 'Avaliable') ?>:
<input id="search-avaliable">
<a href="#" id="btn-refresh"><span class="glyphicon glyphicon-refresh"></span></a><br><br>
<select id="list-avaliable" multiple size="20" style="width: 100%">
</select>
</div>
<div class="col-md-1">
<div class="col-xs-1">
<br><br>
<a href="#" id="btn-add" class="btn btn-success btn-flat">&gt;&gt;</a><br>
<a href="#" id="btn-remove" class="btn btn-danger">&lt;&lt;</a>
</div>
<div class="col-md-5">
<div class="col-xs-5">
<?= Yii::t('rbac', 'Assigned') ?>:
<input id="search-assigned"><br><br>
<select id="list-assigned" multiple size="20" style="width: 100%">
Expand Down
4 changes: 2 additions & 2 deletions backend/views/comment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
return $model->user->username;
}
],
'type',
'type_id',
'entity',
'entity_id',
[
'attribute' => 'content',
'options' => ['width' => '40%'],
Expand Down
1 change: 0 additions & 1 deletion common/models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function behaviors()
TimestampBehavior::className(),
[
'class' => MetaBehavior::className(),
'type' => 'page'
],
[
'class' => CommentBehavior::className()
Expand Down
13 changes: 7 additions & 6 deletions common/models/behaviors/CommentBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ public function afterInsert($event)
{
$this->sendNotify($event);
}
// TODO 这块不好
public function sendNotify($event)
{
$fromUid = $event->sender->user_id;
// 如果是回复,发站内信,通知什么的
if ($event->sender->parent_id > 0) {
$toUid = $event->sender->reply_uid ?: $event->sender->parent->user_id;
$extra = ['comment' => $this->generateMsgContent($event->sender->content)];
switch ($event->sender->type) {
case 'article':
switch ($event->sender->entity) {
case 'common\models\Article':
$category = 'reply';
$link = Url::to(['/article/view', 'id' => $event->sender->type_id, '#' => 'comment-' . $event->sender->id]);
break;
Expand All @@ -51,24 +52,24 @@ public function sendNotify($event)
break;
}
} else {
switch ($event->sender->type) {
case 'article':
switch ($event->sender->entity) {
case 'common\models\Article':
$category = 'comment';
$article = Article::find()->where(['id' => $event->sender->entity_id])->one();
$toUid = $article->user_id;
$extra = [
'comment' => $this->generateMsgContent($event->sender->content),
'article_title' => Html::a($article->title, ['/article/view', 'id' => $article->id])
];
$link = Url::to(['/article/view', 'id' => $event->sender->type_id, '#' => 'comment-' . $event->sender->id]);
$link = Url::to(['/article/view', 'id' => $event->sender->entity_id, '#' => 'comment-' . $event->sender->id]);
break;
case 'suggest':
$category = 'suggest';
$toUid = 1; // 先写死
$extra = [
'comment' => $this->generateMsgContent($event->sender->content),
];
$link = Url::to(['/suggest', 'id' => $event->sender->type_id, '#' => 'comment-' . $event->sender->id]);
$link = Url::to(['/suggest', 'id' => $event->sender->entity_id, '#' => 'comment-' . $event->sender->id]);
break;
default:
return;
Expand Down
2 changes: 1 addition & 1 deletion common/models/behaviors/FavouriteBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function events()
ActiveRecord::EVENT_AFTER_INSERT => 'sendNotify'
];
}

//TODO
public function sendNotify($event)
{
$category = 'favourite';
Expand Down
2 changes: 1 addition & 1 deletion common/models/behaviors/VoteBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function events()
ActiveRecord::EVENT_AFTER_INSERT => 'sendNotify'
];
}

// TODO 通知处理的不好
public function sendNotify($event)
{
// 赞才发通知
Expand Down
60 changes: 29 additions & 31 deletions common/modules/attachment/static/attachment-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,36 @@ $(document).ready(function() {
height: 130
});
this.ui.preview = thumbnail;
jcrop_api.newSelection();

var bound = getRandom();
jcrop_api.setSelect(bound);

$('#crop-x').val(bound[0]);
$('#crop-y').val(bound[1]);
$('#crop-w').val(bound[2]);
$('#crop-h').val(bound[3]);

if (is_init == false) {

is_init = true;
jcrop_api.container.on('cropmove cropend', function(e, s, c) {
$('#crop-x').val(c.x);
$('#crop-y').val(c.y);
$('#crop-w').val(c.w);
$('#crop-h').val(c.h);
});

$('#text-inputs').on('change', 'input', function(e) {
jcrop_api.animateTo([
parseInt($('#crop-x').val()),
parseInt($('#crop-y').val()),
parseInt($('#crop-w').val()),
parseInt($('#crop-h').val())
]);
});
}
});

jcrop_api.newSelection();

var bound = getRandom();
jcrop_api.setSelect(bound);

$('#crop-x').val(bound[0]);
$('#crop-y').val(bound[1]);
$('#crop-w').val(bound[2]);
$('#crop-h').val(bound[3]);

if (is_init == false) {

is_init = true;
jcrop_api.container.on('cropmove cropend', function(e, s, c) {
$('#crop-x').val(c.x);
$('#crop-y').val(c.y);
$('#crop-w').val(c.w);
$('#crop-h').val(c.h);
});

$('#text-inputs').on('change', 'input', function(e) {
jcrop_api.animateTo([
parseInt($('#crop-x').val()),
parseInt($('#crop-y').val()),
parseInt($('#crop-w').val()),
parseInt($('#crop-h').val())
]);
});
}

return false;

});
Expand Down
29 changes: 0 additions & 29 deletions common/modules/attachment/static/jquery.Jcrop.min.css

This file was deleted.

Loading

0 comments on commit 4a8d68c

Please sign in to comment.