Skip to content

Commit

Permalink
✨ Chest content can be copied as a text (issue #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarceauKa committed Nov 11, 2019
1 parent 26e892b commit 0783270
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- New search strategy using classic SQL search (issue #33 #52)
- Ability to choose search strategy in settings
- Chest content can be copied as a text (issue #4)

## Fixed

Expand Down
2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=328efcd318afdd0b387d",
"/js/app.js": "/js/app.js?id=241139594bcb93e112f1",
"/css/app.css": "/css/app.css?id=aefcc4bc23ee04d56b9e",
"/js/manifest.js": "/js/manifest.js?id=3c768977c2574a34506e",
"/js/vendor.js": "/js/vendor.js?id=d01e65db03bef4cabb61"
Expand Down
21 changes: 21 additions & 0 deletions resources/js/components/ChestCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" :href="chest.permalink"><i class="fas fa-link fa-fw mr-1"></i> {{ __('Permalink') }}</a>
<button type="button" class="dropdown-item" @click="copyAll"><i class="fas fa-copy fa-fw mr-1"></i> {{ __('Copy all') }}</button>

<h6 class="dropdown-header" v-if="chest.editable">{{ __('Manage') }}</h6>

Expand All @@ -44,7 +45,13 @@
</template>

<script>
import copyToClipboard from '../mixins/copyToClipboard';
export default {
mixins: [
copyToClipboard,
],
props: {
single: {
type: Boolean,
Expand Down Expand Up @@ -79,6 +86,20 @@ export default {
.catch(error => {
this.$toasted.error(this.__("Unable to delete chest"));
})
},
copyAll($event) {
let content = "";
this.chest.content.forEach(item => {
if (item.name) {
content += `${item.name}: `;
}
content += item.type === 'code' ? `\n${item.value}\n` : `${item.value}\n`;
});
this.copyToClipboard($event, content);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"Move": "Verschieben",
"Show": "Zeigen",
"Hide": "Verstecken",
"Copy all": "Copy all",
"Copy": "Kopieren",
"Copied": "Kopiert",
"Choose": "Auswählen",
Expand Down
1 change: 1 addition & 0 deletions resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"Move": "Déplacer",
"Show": "Afficher",
"Hide": "Cacher",
"Copy all": "Tout copier",
"Copy": "Copier",
"Copied": "Copié",
"Choose": "Choisir",
Expand Down
1 change: 1 addition & 0 deletions resources/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"Move": "移動",
"Show": "示す",
"Hide": "隠す",
"Copy all": "Copy all",
"Copy": "コピー",
"Copied": "コピーされました",
"Choose": "選ぶ",
Expand Down

0 comments on commit 0783270

Please sign in to comment.