From bd8d7c3d0f1bb831f26a75a6107e34a85a1bc804 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Jul 2019 06:56:13 +0900 Subject: [PATCH] Improve Page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ページをピン留めできるように * デッキでカラム内でページを見れるように --- locales/ja-JP.yml | 4 + migration/1562444565093-PinnedPage.ts | 17 ++++ .../1562448332510-PageTitleHideOption.ts | 13 +++ .../{pages => components}/page/page.block.vue | 0 .../page/page.button.vue | 2 +- .../page/page.counter.vue | 0 .../{pages => components}/page/page.if.vue | 0 .../{pages => components}/page/page.image.vue | 0 .../page/page.number-input.vue | 0 .../{pages => components}/page/page.post.vue | 0 .../page/page.section.vue | 0 .../page/page.switch.vue | 0 .../page/page.text-input.vue | 0 .../{pages => components}/page/page.text.vue | 0 .../page/page.textarea-input.vue | 0 .../page/page.textarea.vue | 0 .../views/{pages => components}/page/page.vue | 88 +++++++++---------- .../common/views/deck/deck.page-column.vue | 69 +++++++++++++++ .../views/deck/deck.user-column.home.vue | 7 ++ .../views/pages/page-editor/page-editor.vue | 6 ++ src/client/app/common/views/pages/page.vue | 63 +++++++++++++ src/client/app/desktop/script.ts | 4 +- .../app/desktop/views/home/user/user.home.vue | 5 +- src/client/app/mobile/script.ts | 3 +- .../app/mobile/views/pages/user/home.vue | 8 ++ src/models/entities/page.ts | 5 ++ src/models/entities/user-profile.ts | 13 +++ src/models/repositories/page.ts | 1 + src/models/repositories/user.ts | 4 +- src/server/api/endpoints/i/update.ts | 27 +++++- src/server/api/endpoints/pages/create.ts | 6 ++ src/server/api/endpoints/pages/update.ts | 5 ++ 32 files changed, 295 insertions(+), 55 deletions(-) create mode 100644 migration/1562444565093-PinnedPage.ts create mode 100644 migration/1562448332510-PageTitleHideOption.ts rename src/client/app/common/views/{pages => components}/page/page.block.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.button.vue (98%) rename src/client/app/common/views/{pages => components}/page/page.counter.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.if.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.image.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.number-input.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.post.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.section.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.switch.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.text-input.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.text.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.textarea-input.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.textarea.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.vue (72%) create mode 100644 src/client/app/common/views/deck/deck.page-column.vue create mode 100644 src/client/app/common/views/pages/page.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d29b96af1..32a7fad39 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1907,6 +1907,7 @@ deck/deck.user-column.vue: activity: "アクティビティ" timeline: "タイムライン" pinned-notes: "ピン留めされた投稿" + pinned-page: "ピン留めされたページ" docs: edit-this-page-on-github: "間違いや改善点を見つけましたか?" @@ -1946,6 +1947,8 @@ pages: are-you-sure-delete: "このページを削除しますか?" page-deleted: "ページを削除しました" edit-this-page: "このページを編集" + pin-this-page: "ピン留め" + unpin-this-page: "ピン留め解除" view-source: "ソースを表示" view-page: "ページを見る" like: "いいね" @@ -1964,6 +1967,7 @@ pages: url: "ページURL" summary: "ページの要約" align-center: "中央寄せ" + hide-title-when-pinned: "ピン留めされているときにタイトルを非表示" font: "フォント" fontSerif: "セリフ" fontSansSerif: "サンセリフ" diff --git a/migration/1562444565093-PinnedPage.ts b/migration/1562444565093-PinnedPage.ts new file mode 100644 index 000000000..4bdee2274 --- /dev/null +++ b/migration/1562444565093-PinnedPage.ts @@ -0,0 +1,17 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class PinnedPage1562444565093 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" ADD "pinnedPageId" character varying(32)`); + await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27" UNIQUE ("pinnedPageId")`); + await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27" FOREIGN KEY ("pinnedPageId") REFERENCES "page"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27"`); + await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27"`); + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "pinnedPageId"`); + } + +} diff --git a/migration/1562448332510-PageTitleHideOption.ts b/migration/1562448332510-PageTitleHideOption.ts new file mode 100644 index 000000000..acc9b7e26 --- /dev/null +++ b/migration/1562448332510-PageTitleHideOption.ts @@ -0,0 +1,13 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class PageTitleHideOption1562448332510 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "page" ADD "hideTitleWhenPinned" boolean NOT NULL DEFAULT false`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "hideTitleWhenPinned"`); + } + +} diff --git a/src/client/app/common/views/pages/page/page.block.vue b/src/client/app/common/views/components/page/page.block.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.block.vue rename to src/client/app/common/views/components/page/page.block.vue diff --git a/src/client/app/common/views/pages/page/page.button.vue b/src/client/app/common/views/components/page/page.button.vue similarity index 98% rename from src/client/app/common/views/pages/page/page.button.vue rename to src/client/app/common/views/components/page/page.button.vue index 4dc657001..87112aca0 100644 --- a/src/client/app/common/views/pages/page/page.button.vue +++ b/src/client/app/common/views/components/page/page.button.vue @@ -49,7 +49,7 @@ export default Vue.extend({ diff --git a/src/client/app/common/views/pages/page/page.counter.vue b/src/client/app/common/views/components/page/page.counter.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.counter.vue rename to src/client/app/common/views/components/page/page.counter.vue diff --git a/src/client/app/common/views/pages/page/page.if.vue b/src/client/app/common/views/components/page/page.if.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.if.vue rename to src/client/app/common/views/components/page/page.if.vue diff --git a/src/client/app/common/views/pages/page/page.image.vue b/src/client/app/common/views/components/page/page.image.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.image.vue rename to src/client/app/common/views/components/page/page.image.vue diff --git a/src/client/app/common/views/pages/page/page.number-input.vue b/src/client/app/common/views/components/page/page.number-input.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.number-input.vue rename to src/client/app/common/views/components/page/page.number-input.vue diff --git a/src/client/app/common/views/pages/page/page.post.vue b/src/client/app/common/views/components/page/page.post.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.post.vue rename to src/client/app/common/views/components/page/page.post.vue diff --git a/src/client/app/common/views/pages/page/page.section.vue b/src/client/app/common/views/components/page/page.section.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.section.vue rename to src/client/app/common/views/components/page/page.section.vue diff --git a/src/client/app/common/views/pages/page/page.switch.vue b/src/client/app/common/views/components/page/page.switch.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.switch.vue rename to src/client/app/common/views/components/page/page.switch.vue diff --git a/src/client/app/common/views/pages/page/page.text-input.vue b/src/client/app/common/views/components/page/page.text-input.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.text-input.vue rename to src/client/app/common/views/components/page/page.text-input.vue diff --git a/src/client/app/common/views/pages/page/page.text.vue b/src/client/app/common/views/components/page/page.text.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.text.vue rename to src/client/app/common/views/components/page/page.text.vue diff --git a/src/client/app/common/views/pages/page/page.textarea-input.vue b/src/client/app/common/views/components/page/page.textarea-input.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.textarea-input.vue rename to src/client/app/common/views/components/page/page.textarea-input.vue diff --git a/src/client/app/common/views/pages/page/page.textarea.vue b/src/client/app/common/views/components/page/page.textarea.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.textarea.vue rename to src/client/app/common/views/components/page/page.textarea.vue diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/components/page/page.vue similarity index 72% rename from src/client/app/common/views/pages/page/page.vue rename to src/client/app/common/views/components/page/page.vue index a93d5316d..99e627fd8 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/components/page/page.vue @@ -1,6 +1,6 @@