Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1903 コンテンツ一覧(表)コピーの際にコピー先のタイトルに「のコピー」とつかない #2779

Merged
merged 4 commits into from
Oct 9, 2023
2 changes: 1 addition & 1 deletion plugins/baser-core/src/Model/Table/ContentFoldersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function copy(int $id, $newParentId, $newTitle, $newAuthorId, $newSiteId)
$entity->content = new Content([
'name' => $entity->content->name,
'parent_id' => $newParentId,
'title' => $newTitle,
'title' => $newTitle ?? $oldEntity->title . '_copy',
'author_id' => $newAuthorId,
'site_id' => $newSiteId,
'description' => $entity->content->description,
Expand Down
2 changes: 1 addition & 1 deletion plugins/baser-core/src/Model/Table/PagesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function copy($id, $newParentId, $newTitle, $newAuthorId, $newSiteId = nu
$page->content = new Content([
'name' => $page->content->name,
'parent_id' => $newParentId,
'title' => $newTitle,
'title' => $newTitle ?? $oldPage->title . '_copy',
'author_id' => $newAuthorId,
'site_id' => $newSiteId,
'description' => $page->content->description,
Expand Down
2 changes: 0 additions & 2 deletions plugins/bc-admin-third/src/js/admin/_lib/jquery.bcTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,6 @@
*/
copyContent: function (parent, node) {
var data = $.extend(true, {}, node.data.jstree);
data.contentTitle = bcI18n.bcTreeCopyTitle.sprintf(data.contentTitle);
data.status = false;
$.bcToken.check(function () {
return $.ajax({
Expand All @@ -1013,7 +1012,6 @@
data: {
content_id: data.contentId,
entity_id: data.contentEntityId,
title: data.contentTitle,
parent_id: data.contentParentId,
site_id: data.contentSiteId,
_csrfToken: $.bcToken.key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ class="bca-btn-icon"
]) ?>
<?php endif ?>

<!-- コピーのみ使うフォーム -->
<form>
<input type="hidden" name="id" value="<?= $content->id ?>">
<input type="hidden" name="type" value="<?= $content->type ?>">
<input type="hidden" name="entity_id" value="<?= $content->entity_id ?>">
<input type="hidden" name="parent_id" value="<?= $content->parent_id ?>">
<input type="hidden" name="title" value="<?= h($content->title) ?>">
<input type="hidden" name="site_id" value="<?= $content->site_id ?>">
<input type="hidden" name="status" value="<?= $toStatus ?>">
<input type="hidden" name="alias_id" value="<?= (bool)$content->alias_id ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'bcTreeAlertMessage6' => __d('baser_core', '追加に失敗しました。'),
'bcTreeInfoMessage1' => __d('baser_core', 'ゴミ箱は空です'),
'bcTreeInfoMessage2' => __d('baser_core', 'ゴミ箱より戻しました。一覧に遷移しますのでしばらくお待ち下さい。'),
'bcTreeCopyTitle' => __d('baser_core', '%s のコピー'),
'bcTreeCopyTitle' => __d('baser_core', '%s'),
Copy link
Collaborator

@ryuring ryuring Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HungDV2022 この行はどこでも使われていないのであれば削除してください。というか意味がないですよね。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HungDV2022 javascript側も調整お願いします。

Copy link
Collaborator Author

@HungDV2022 HungDV2022 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryuring この行を削除しました。
JS側はこちらに調整しました。
plugins/bc-admin-third/src/js/admin/_lib/jquery.bcTree.js
確認お願いします。

'bcTreeAliasTitle' => __d('baser_core', '%s のエイリアス'),
'bcTreeUnNamedTitle' => __d('baser_core', '名称未設定'),
'bcTreeNewTitle' => __d('baser_core', '新しい %s'),
Expand Down
2 changes: 1 addition & 1 deletion plugins/bc-blog/src/Model/Table/BlogContentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function copy(
$data->content = new Content([
'name' => $name,
'parent_id' => $newParentId,
'title' => $newTitle,
'title' => $newTitle ?? $oldData->title . '_copy',
'author_id' => $newAuthorId,
'site_id' => $newSiteId,
'exclude_search' => false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function copy(int $id, $newParentId, $newTitle, $newAuthorId, $newSiteId)
$entity->content = new Content([
'name' => $entity->content->name,
'parent_id' => $newParentId,
'title' => $newTitle,
'title' => $newTitle ?? $oldEntity->title . '_copy',
'author_id' => $newAuthorId,
'site_id' => $newSiteId,
'description' => $entity->content->description,
Expand Down
2 changes: 1 addition & 1 deletion plugins/bc-mail/src/Model/Table/MailContentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function copy(
$data->content = new Content([
'name' => $name,
'parent_id' => $newParentId,
'title' => $newTitle,
'title' => $newTitle ?? $oldData->title . '_copy',
'author_id' => $newAuthorId,
'site_id' => $newSiteId,
'exclude_search' => false,
Expand Down