Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions nginx/ams/weko-frontend/components/search/Conditions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,16 @@
</div>
</div>
</div>
<!-- トースト -->
<Alert v-if="isToast" :alert="toastData" @click-close="isToast = !isToast" />
</div>
</template>

<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import Alert from '~/components/common/Alert.vue';
/* ///////////////////////////////////
// props
/////////////////////////////////// */
Expand Down Expand Up @@ -158,6 +164,15 @@ const perPage = ref(props.conditions.perPage ?? '20');
const sort = ref(props.conditions.sort ?? 'wtl');
const order = ref(props.conditions.order ?? 'asc');
let copyURL = '';
const { t } = useI18n();
const isToast = ref(false);
const toastData = ref({
msgid: '',
msgstr: '',
position: '',
width: 'w-full',
loglevel: 'info'
});
/* ///////////////////////////////////
// function
Expand Down Expand Up @@ -185,15 +200,18 @@ function copySearchCondition() {
const hereURL = window.location.href.split('?')[0];
copyURL = hereURL + '?' + urlSearchParam;
// クリップボードに貼り付け
// クリップボードにコピー
navigator.clipboard.writeText(copyURL).then(
() => {
alert('Copy successful');
toastData.value.loglevel = 'success';
toastData.value.msgstr = t('message.copySearch.copySuccess');
},
() => {
alert('Copy failed');
toastData.value.loglevel = 'error';
toastData.value.msgstr = t('message.copySearch.copyFailed');
}
);
isToast.value = true;
}
</script>

Expand Down
6 changes: 5 additions & 1 deletion nginx/ams/weko-frontend/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@
"loginFailed": "Failed to Login. Please contact server administrator.",
"noUserInformation": "There is no user information.",
"oauthError": "Login is required to view items. You will be automatically redirected to the login screen in {time} seconds. Login screen:"
},
"copySearch": {
"copySuccess": "URL copied to clipboard.",
"copyFailed": "Copy failed."
}
},
"overview": "Overview",
Expand Down Expand Up @@ -301,4 +305,4 @@
"identifierType": "identifier type",
"Institutional Login for institutions in Japan.": "Institutional Login for institutions in Japan.",
"needToLogin": "This item requires login."
}
}
6 changes: 5 additions & 1 deletion nginx/ams/weko-frontend/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
"loginFailed": "ログインに失敗しました。管理者に連絡してください。",
"noUserInformation": "ユーザ情報がありません。",
"oauthError": "アイテム閲覧にはログインが必要です。{time} 秒後にログイン画面に遷移します。ログイン画面:"
},
"copySearch": {
"copySuccess": "URLをクリップボードにコピーしました。",
"copyFailed": "コピーに失敗しました。"
}
},
"overview": "概要",
Expand Down Expand Up @@ -302,4 +306,4 @@
"identifierType": "識別子タイプ",
"Institutional Login for institutions in Japan.": "所属機関のIdPでログインする方",
"needToLogin": "ログインが必要なアイテムです。"
}
}
Loading