Skip to content

Commit

Permalink
add more options for copied key format
Browse files Browse the repository at this point in the history
…

v1.2.1
  • Loading branch information
ctf0 committed Nov 12, 2017
1 parent e40f0a5 commit 3c314a7
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/7388088/31319438-bcfac926-ac63-11e7-8acc-60ac45aa465b.png">
<img src="https://user-images.githubusercontent.com/7388088/32700479-b5c32ff0-c7ce-11e7-85ca-4895e802c68a.png">
</p>

# Lingo
Expand Down
6 changes: 0 additions & 6 deletions logs/v1.2.0.txt

This file was deleted.

2 changes: 2 additions & 0 deletions logs/v1.2.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- add list of different key format
- update readme
19 changes: 17 additions & 2 deletions src/resources/assets/js/Main/container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ export default {
filesList: [],
dirsList: [],
selectedDirName: '',
selectedFileName: ''
selectedFileName: '',
selectedKeyFormat: '',
copyKeyFormat: [
'trans(\'value\')',
'__(\'value\')',
'{!! trans(\'value\') !!}',
'{!! __(\'value\') !!}',
'{{ trans(\'value\') }}',
'{{ __(\'value\') }}',
'@lang(\'value\')'
]
}
},
computed: {
Expand Down Expand Up @@ -60,6 +70,7 @@ export default {
if (ls) {
this.activeTab = ls.tab
this.selectedKeyFormat = ls.format
setTimeout(() => {
EventHub.fire('ls-dir', ls.dir)
Expand All @@ -74,7 +85,8 @@ export default {
JSON.stringify({
tab: this.activeTab,
dir: this.selectedDirName,
file: this.selectedFileName
file: this.selectedFileName,
format: this.selectedKeyFormat
})
)
}
Expand Down Expand Up @@ -182,6 +194,9 @@ export default {
},
selectedFileName(val) {
this.updateLs({file : val})
},
selectedKeyFormat(val) {
this.updateLs({format : val})
}
},
render() {}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/assets/js/Tabs/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<script>
import Ops from './ops'
import SharedContent from './../shared/content'
import SharedContent from './shared/content'
export default {
components: {SharedContent},
Expand Down
18 changes: 17 additions & 1 deletion src/resources/assets/js/Tabs/ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
}

// copy to clipboard
$(document).on('click', '.click-me', () => {
$(document).on('click', '.c2c', () => {
this.$copyText(this.keyToCopy)
})
},
Expand Down Expand Up @@ -116,6 +116,22 @@ export default {
},
failedAjax() {
this.showNotif(this.trans('ajax_fail'), 'black')
},

// copy key
getFileName() {
return this.selectedFile.replace(/(.[^.]*)$/, '')
},
getKey(key) {
let str = this.getTabName().includes('vendor')
? `${this.selectedDir}::${this.getFileName()}.${key}`
: `${this.getFileName()}.${key}`

let rep = this.$parent.selectedKeyFormat !== ''
? this.$parent.selectedKeyFormat.replace('value', str)
: `'${str}'`

return rep
}
},
watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@

<!-- tippy template -->
<div id="tippyTemplate">
<span class="click-me">{{ keyToCopy }}</span>
<span class="c2c">{{ keyToCopy }}</span>
</div>
</section>
</div>
Expand All @@ -139,7 +139,7 @@
visibility: hidden;
}
.click-me {
.c2c {
cursor: pointer;
}
</style>
Expand Down Expand Up @@ -314,18 +314,6 @@ export default{
return main
},
// copy key
getFileName() {
return this.selectedFile.replace(/(.[^.]*)$/, '')
},
getKey(key) {
let str = this.$parent.getTabName().includes('vendor')
? `{{ trans('${this.selectedDir}::${this.getFileName()}.${key}') }}`
: `{{ trans('${this.getFileName()}.${key}') }}`
return str
},
// other
nestCheck(item) {
return item.includes('.') ? 'nestedKey' : ''
Expand All @@ -336,6 +324,9 @@ export default{
trans(key) {
return this.parentMethod('trans', key)
},
getKey(key) {
return this.parentMethod('getKey', key)
},
parentMethod(method_name, args = null) {
return this.$parent[method_name](args)
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/resources/assets/js/Tabs/vendor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<script>
import Ops from './ops'
import SharedContent from './../shared/content'
import SharedContent from './shared/content'
export default {
components: {SharedContent},
Expand Down
50 changes: 39 additions & 11 deletions src/resources/views/lingo-bulma.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,50 @@
save-file-route="{{ route('lingo.save_file_data') }}">
<div>

{{-- scan for missing trans --}}
<div class="columns">
<div class="column is-2">
<h3 class="title is-4">
<span class="icon"><i class="fa fa-qrcode"></i></span>
<span>{{ trans('Lingo::messages.scan') }}</span>
</h3>
{{-- scan for missing trans --}}
<div class="column is-half is-paddingless">
<div class="columns">
<div class="column is-6">
<h3 class="title is-4">
<span class="icon"><i class="fa fa-qrcode"></i></span>
<span>{{ trans('Lingo::messages.scan') }}</span>
</h3>
</div>
<div class="column">
<button @click="scanForMissing()" class="button is-link">{{ trans('Lingo::messages.scan_btn') }}</button>
</div>
</div>
</div>
<div class="column">
<button @click="scanForMissing()" class="button is-link">{{ trans('Lingo::messages.scan_btn') }}</button>

{{-- copied key format --}}
<div class="column is-half is-paddingless">
<div class="columns">
<div class="column is-5">
<h3 class="title is-4">
<span class="icon"><i class="fa fa-keyboard-o"></i></span>
<span>{{ trans('Lingo::messages.key_format') }}</span>
</h3>
</div>
<div class="column">
<div class="control">
<div class="select" :class="{'is-loading' : !selectedKeyFormat}">
<select v-model="selectedKeyFormat">
<option value="" disabled>{{ trans('Lingo::messages.select_format') }}</option>
<option v-for="(item,index) in copyKeyFormat" :key="index">
@{{ item }}
</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>

{{-- add new vendor --}}
<div class="columns" v-if="activeTabIs('vendor-tab')">
<div class="column is-2">
<div class="column is-3">
<p class="title">
{{-- steps --}}
<transition name="slide-fade">
Expand Down Expand Up @@ -84,7 +112,7 @@

{{-- add new lang --}}
<div class="columns" v-if="localesList.length || newVendor()">
<div class="column is-2">
<div class="column is-3">
<p class="title">
{{-- steps --}}
<transition name="slide-fade">
Expand Down Expand Up @@ -115,7 +143,7 @@

{{-- add new file --}}
<div class="columns" v-if="filesList.length || newVendor()">
<div class="column is-2">
<div class="column is-3">
<p class="title">
{{-- steps --}}
<transition name="slide-fade">
Expand Down

0 comments on commit 3c314a7

Please sign in to comment.