File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -244,14 +244,34 @@ Template.mfTrans.events({
244
244
var unsavedDest ;
245
245
Template . mfTransLang . events ( {
246
246
'click #mfTransLang tr' : function ( event ) {
247
- changeKey ( this . key ) ;
247
+ var tr = $ ( event . target ) . parents ( 'tr' ) ;
248
+ var key = tr . data ( 'key' ) ;
249
+ if ( key ) changeKey ( key ) ;
250
+ } ,
251
+ 'click #translationShowKey' : function ( event ) {
252
+ Session . set ( 'translationShowKey' , event . currentTarget . checked ) ;
253
+ } ,
254
+ 'click .translationSort' : function ( event ) {
255
+ Session . set ( 'translationSortField' , event . currentTarget . attributes [ 'data-sortField' ] . value ) ;
248
256
} ,
249
257
'keyup #mfTransDest' : function ( event ) {
250
258
unsavedDest = event . target . value ;
251
259
}
252
260
} ) ;
253
261
254
262
Template . mfTransLang . helpers ( {
263
+ sortedStrings : function ( ) {
264
+ var sortField = Session . get ( 'translationSortField' ) ;
265
+ if ( ! sortField ) {
266
+ Session . set ( 'translationSortField' , 'orig' ) ;
267
+ }
268
+ return this . strings . sort ( function ( a , b ) {
269
+ return a [ sortField ] > b [ sortField ] ? 1 : ( a [ sortField ] < b [ sortField ] ? - 1 : 0 ) ;
270
+ } ) ;
271
+ } ,
272
+ showKey : function ( ) {
273
+ return Session . get ( 'translationShowKey' ) ;
274
+ } ,
255
275
stateClass : function ( ) {
256
276
if ( this . fuzzy )
257
277
return 'fuzzy' ;
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ div.mfTransGraph.untrans { background: #800; border-right: 1px solid black; }
49
49
# mfTransPreview table { width : 100% ; table-layout : fixed; border-collapse : separate; background : white; }
50
50
# mfTransPreview table thead tr { background : # ede9e3 ; }
51
51
# mfTransPreview table thead th { width : 50% ; padding : 4px 8px 4px 8px ; }
52
+ # mfTransPreview table thead th {
53
+ border-left : 1px solid black; border-top : 1px solid black; border-bottom : 1px solid black;
54
+ }
52
55
# mfTransPreview table thead th : first-child {
53
56
border-left : 1px solid black; border-top : 1px solid black; border-bottom : 1px solid black;
54
57
border-top-left-radius : 5px ;
Original file line number Diff line number Diff line change @@ -66,22 +66,29 @@ <h2>{{mf 'mf_site_translations' 'Site Translations'}}</h2>
66
66
</ template >
67
67
68
68
< template name ="mfTransLang ">
69
+ {{ debug }}
69
70
< div class ="container " id ="mfTransLang ">
70
71
71
72
< div id ="mfTransPreview ">
72
73
< table >
73
74
< thead >
74
75
< tr >
75
- < th > Original String ({{origLang}})</ th >
76
- < th > Translation ({{destLang}})</ th >
76
+ {{#if showKey}}
77
+ < th > < a href ="# " class ="translationSort " data-sortField ="key "> Key</ a > </ th >
78
+ {{/if}}
79
+ < th > < a href ="# " class ="translationSort " data-sortField ="orig "> Original String ({{orig}})</ a > </ th >
80
+ < th > Translation ({{trans}})</ th >
77
81
</ tr >
78
82
</ thead >
79
83
</ table >
80
84
< div class ="tbodyScroll ">
81
85
< table >
82
86
< tbody >
83
- {{#each strings }}
87
+ {{#each sortedStrings }}
84
88
< tr data-key ="{{key}} " class ="{{stateClass}} {{isCurrent}} ">
89
+ {{#if showKey}}
90
+ < td > {{key}}</ td >
91
+ {{/if}}
85
92
< td > {{orig}}</ td >
86
93
< td > {{trans}}</ td >
87
94
</ tr >
@@ -90,7 +97,7 @@ <h2>{{mf 'mf_site_translations' 'Site Translations'}}</h2>
90
97
</ table >
91
98
</ div >
92
99
</ div >
93
- < p > Use ctrl-up and ctrl-down to quickly change keys</ p >
100
+ < p > < input type =" checkbox " id =" translationShowKey " > Show key, Use ctrl-up and ctrl-down to quickly change keys</ p >
94
101
< span > < b > {{keyInfo.key}}</ b > in {{keyInfo.file}}:{{keyInfo.line
95
102
}}{{#if keyInfo.template}} (template
96
103
{{#if keyInfo.routeUrl}}
@@ -117,4 +124,4 @@ <h2>{{mf 'mf_site_translations' 'Site Translations'}}</h2>
117
124
< h1 > {{mf 'access_denied' 'Access Denied'}}</ h1 >
118
125
< p > {{mf 'login_and_access' 'Please ensure you are logged in and have the relevant access to add/edit translations.'}}</ p >
119
126
</ div >
120
- </ template >
127
+ </ template >
You can’t perform that action at this time.
0 commit comments