Skip to content

Commit

Permalink
Merge pull request #59 from s-nakajima/master
Browse files Browse the repository at this point in the history
編集画面の作成者や更新者、作成日時、更新日時などもう少しコンパクトにしたい
  • Loading branch information
s-nakajima committed Jun 18, 2016
2 parents fe1e41c + 198fd44 commit d683ad1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 34 deletions.
11 changes: 11 additions & 0 deletions Locale/jpn/LC_MESSAGES/blocks.po
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,14 @@ msgstr "%sハイライト%sされている%sが現在表示されています。

msgid "When you newly created, %s, please click."
msgstr "新しく作成するときは、%sをクリックしてください。"

#
#: ブロック設定
#

msgid "Created:"
msgstr "作成:"

msgid "Modified:"
msgstr "更新:"

2 changes: 2 additions & 0 deletions Model/Behavior/BlockBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ private function __saveBlock(Model $model, $frame) {
$model->data['Block']['room_id'] = $frame['Frame']['room_id'];
$model->data['Block']['language_id'] = $frame['Frame']['language_id'];

$model->data['Block'] = Hash::insert($model->data['Block'], 'modified', null);

if (Hash::get($model->data, 'Block.name')) {
//値があれば、何もしない
} elseif (isset($this->settings['name'])) {
Expand Down
57 changes: 23 additions & 34 deletions View/Elements/modifed_info.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,31 @@ if (! isset($displayModified)) {
?>

<?php if ($this->params['action'] === 'edit' && $displayModified) : ?>
<hr>
<div class="text-right clearfix small text-muted">
<?php
echo '<label>' . __d('blocks', 'Created:') . '</label> ';
echo $this->NetCommonsHtml->handleLink($this->request->data, ['avatar' => true], [], 'TrackableCreator');
echo '<div class="pull-right block-created">' .
'(' . $this->NetCommonsHtml->dateFormat(Hash::get($this->request->data, 'Block.created')) . ')' .
'</div>';

<div class="row form-group">
<div class="col-sm-6 col-xs-12">
<?php echo $this->NetCommonsForm->input('TrackableCreator', array(
'type' => 'handle',
'label' => __d('net_commons', 'Created user'),
'error' => false,
'div' => false,
)); ?>
</div>
<div class="col-sm-6 col-xs-12">
<?php echo $this->NetCommonsForm->input('Block.created', array(
'type' => 'label',
'label' => __d('net_commons', 'Created datetime'),
'error' => false,
'div' => false,
)); ?>
</div>
echo $this->NetCommonsForm->hidden('Block.created');
echo $this->NetCommonsForm->hidden('TrackableCreator.id');
echo $this->NetCommonsForm->hidden('TrackableCreator.handlename');
?>
</div>

<div class="row form-group">
<div class="col-sm-6 col-xs-12">
<?php echo $this->NetCommonsForm->input('TrackableUpdater', array(
'type' => 'handle',
'label' => __d('net_commons', 'Modified user'),
'error' => false,
'div' => false,
)); ?>
</div>
<div class="col-sm-6 col-xs-12">
<?php echo $this->NetCommonsForm->input('Block.modified', array(
'type' => 'label',
'label' => __d('net_commons', 'Modified datetime'),
'error' => false,
)); ?>
</div>
<div class="text-right clearfix small text-muted">
<?php
echo '<label>' . __d('blocks', 'Modified:') . '</label> ';
echo $this->NetCommonsHtml->handleLink($this->request->data, ['avatar' => true], [], 'TrackableUpdater');
echo '<div class="pull-right block-modified">' .
'(' . $this->NetCommonsHtml->dateFormat(Hash::get($this->request->data, 'Block.modified')) . ')' .
'</div>';

echo $this->NetCommonsForm->hidden('Block.modified');
echo $this->NetCommonsForm->hidden('TrackableUpdater.id');
echo $this->NetCommonsForm->hidden('TrackableUpdater.handlename');
?>
</div>
<?php endif;
3 changes: 3 additions & 0 deletions View/Helper/BlockIndexHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public function startTableRow($blockId, $fieldName = 'Frame.block_id') {
public function tableHeader($fieldName, $title = '', $options = array()) {
if ($fieldName === 'Frame.block_id') {
$html = '<th></th>';
} elseif ($fieldName === 'Block.public_type') {
$options['type'] = 'center';
$html = $this->TableList->tableHeader($fieldName, $title, $options);
} else {
$html = $this->TableList->tableHeader($fieldName, $title, $options);
}
Expand Down
8 changes: 8 additions & 0 deletions webroot/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@
font-size: 0.8em;
vertical-align: text-top;
}

/**
* ブロック設定
*/
.block-created,
.block-modified {
margin-left: 5px;
}

0 comments on commit d683ad1

Please sign in to comment.