Ticket #188: 188.diff
| File 188.diff, 10.9 KB (added by nacin, 14 months ago) |
|---|
-
css/style.css
52 52 padding: 0.25em 0.5em; 53 53 color: #444; 54 54 } 55 select { 56 font-size: 12px; 57 line-height: 14px; 58 -webkit-border-radius: 3px; 59 border-radius: 3px; 60 border: 1px solid #dfdfdf; 61 background-color: #fff; 62 padding: 2px; 63 height: 2em; 64 } 65 input.button { 66 text-decoration: none; 67 font-size: 12px; 68 line-height: 14px; 69 padding: 3px 8px; 70 cursor: pointer; 71 border: 1px solid #bbb; 72 color: #464646; 73 -webkit-border-radius: 3px; 74 border-radius: 3px; 75 -moz-box-sizing: content-box; 76 -webkit-box-sizing: content-box; 77 box-sizing: content-box; 78 background-color: #f2f2f2; /* Fallback */ 79 background-image: -ms-linear-gradient(bottom, #ededed, #fff); /* IE10 */ 80 background-image: -moz-linear-gradient(bottom, #ededed, #fff); /* Firefox */ 81 background-image: -o-linear-gradient(bottom, #ededed, #fff); /* Opera */ 82 background-image: -webkit-gradient(linear, left bottom, left top, from(#ededed), to(#fff)); /* old Webkit */ 83 background-image: -webkit-linear-gradient(bottom, #ededed, #fff); /* new Webkit */ 84 background-image: linear-gradient(bottom, #ededed, #fff); /* proposed W3C Markup */ 85 text-shadow: #fff 0 1px 0; 86 } 55 87 .breadcrumb a { 56 88 color: #3A7399; 57 89 text-decoration: none; … … 315 347 .paging .current { 316 348 font-weight: bold; 317 349 } 350 .paging .next { 351 margin-right: 1px; 352 } 318 353 .paging .disabled { 319 354 color: #999; 320 355 border-color: #eee; 321 356 } 322 form.filters-toolbar{323 float: left;357 .bulk-actions { 358 float: left; 324 359 } 360 .bulk-actions input { 361 margin-right: 8px; 362 } 363 .bulk-actions select { 364 width: 130px; 365 } 366 form.filters-toolbar > div { 367 line-height: 2em; 368 } 325 369 form.filters-toolbar ul { 326 370 list-style-type: none; 327 371 } … … 342 386 vertical-align: bottom; 343 387 } 344 388 dl.filters-expanded { 389 float: left; 345 390 font-size: 80%; 346 391 padding: 0.8em; 347 392 margin: 0 0 0.5em 0.2em; -
gp-templates/translation-row.php
10 10 ); 11 11 ?> 12 12 <tr class="preview <?php echo $parity().' '.$status_class.' '.$warning_class.' '.$priority_class ?>" id="preview-<?php echo $t->row_id ?>" row="<?php echo $t->row_id; ?>"> 13 < th scope="row" class="checkbox"><input type="checkbox" name="selected-row[]" /></th>13 <?php if ( $can_approve ) : ?><th scope="row" class="checkbox"><input type="checkbox" name="selected-row[]" /></th><?php endif; ?> 14 14 <?php /* 15 15 <td class="priority" style="background-color: <?php echo $priority_char[$t->priority][1] ?>; color: <?php echo $priority_char[$t->priority][2] ?>; text-align: center; font-size: 1.2em;" title="<?php echo esc_attr('Priority: '.gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority )); ?>"> 16 16 */ ?> … … 51 51 </td> 52 52 </tr> 53 53 <tr class="editor <?php echo $warning_class; ?>" id="editor-<?php echo $t->row_id; ?>" row="<?php echo $t->row_id; ?>"> 54 <td colspan=" 5">54 <td colspan="<?php echo $can_approve ? 5 : 4 ?>"> 55 55 <div class="strings"> 56 56 <?php if ( !$t->plural ): ?> 57 57 <p class="original"><?php echo prepare_original( esc_translation($t->singular) ); ?></p> -
gp-templates/translations.php
10 10 $editor_options = compact('can_approve', 'can_write', 'url', 'discard_warning_url', 'set_priority_url', 'set_status_url'); 11 11 $editor_options['google_translate_language'] = $locale->google_code; 12 12 wp_localize_script( 'editor', '$gp_editor_options', $editor_options ); 13 wp_localize_script( 'translations-page', '$gp_translations_options', array('action' => $bulk_action) );14 13 $parity = gp_parity_factory(); 15 14 add_action( 'gp_head', lambda( '', 'gp_preferred_sans_serif_style_tag($locale);', compact( 'locale' ) ) ); 16 15 … … 21 20 Translation of <?php echo esc_html( $project->name ); ?>: <?php echo esc_html( $translation_set->name ); ?> 22 21 <?php gp_link_set_edit( $translation_set, $project, '(edit)' ); ?> 23 22 </h2> 24 <!-- TODO: use another form for bulk actions --> 23 <?php if ( $can_approve ): ?> 24 <form id="bulk-actions-toolbar" class="filters-toolbar bulk-actions" action="<?php echo $bulk_action; ?>" method="post"> 25 <div> 26 <select name="bulk[action]"> 27 <option value="" selected="selected">Bulk Actions</option> 28 <option value="approve">Approve</option> 29 <option value="reject">Reject</option> 30 <option value="gtranslate">Translate via Google</option> 31 </select> 32 <input type="hidden" name="bulk[redirect_to]" value="<?php echo esc_attr(gp_url_current()); ?>" id="bulk[redirect_to]" /> 33 <input type="hidden" name="bulk[row-ids]" value="" id="bulk[row-ids]" /> 34 <input type="submit" class="button" value="<?php esc_attr_e( 'Apply' ); ?>" /> 35 </div> 36 </form> 37 <?php endif; ?> 38 <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?> 25 39 <form id="upper-filters-toolbar" class="filters-toolbar" action="" method="get" accept-charset="utf-8"> 26 40 <div> 27 <?php if ( $can_approve ): ?>28 <a href="#" class="revealing bulk"><?php _e('Bulk ↓'); ?></a> <strong class="separator">•</strong>29 <?php endif; ?>30 41 <a href="#" class="revealing filter"><?php _e('Filter ↓'); ?></a> <span class="separator">•</span> 31 42 <a href="#" class="revealing sort"><?php _e('Sort ↓'); ?></a> <strong class="separator">•</strong> 32 43 <?php … … 106 117 </dd> 107 118 <dd><input type="submit" value="<?php echo esc_attr(__('Sort')); ?>" name="sorts" /></dd> 108 119 </dl> 109 <dl class="hidden bulk-actions filters-expanded clearfix">110 <dd>111 <input type="hidden" name="bulk[redirect_to]" value="<?php echo esc_attr(gp_url_current()); ?>" id="bulk[redirect_to]" />112 <input type="hidden" name="bulk[row-ids]" value="" id="bulk[row-ids]" />113 <input type="submit" value="<?php echo esc_attr(__('Approve Selected')); ?>" name="approve" /><br />114 <input type="submit" value="<?php echo esc_attr(__('Reject Selected')); ?>" name="reject" />115 </dd>116 <dd class="separator"></dd>117 <dd>118 <input type="submit" value="<?php echo esc_attr(__('Translate via Google')); ?>" name="gtranslate" />119 </dd>120 </dl>121 120 </form> 122 123 <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?>124 121 <table id="translations" class="translations clear"> 125 122 <thead> 126 123 <tr> 127 < th class="checkbox"><input type="checkbox" /></th>124 <?php if ( $can_approve ) : ?><th class="checkbox"><input type="checkbox" /></th><?php endif; ?> 128 125 <th><?php /* Translators: Priority */ _e('Prio'); ?></th> 129 126 <th class="original"><?php _e('Original string'); ?></th> 130 127 <th class="translation"><?php _e('Translation'); ?></th> … … 138 135 <?php 139 136 if ( !$translations ): 140 137 ?> 141 <tr><td colspan=" 4"><?php _e('No translations were found!'); ?></td></tr>138 <tr><td colspan="<?php echo $can_approve ? 5 : 4; ?>"><?php _e('No translations were found!'); ?></td></tr> 142 139 <?php 143 140 endif; 144 141 ?> 145 142 </table> 143 <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?> 146 144 <div id="legend" class="secondary clearfix"> 147 145 <div><strong><?php _e('Legend:'); ?></strong></div> 148 146 <?php … … 156 154 <div><?php _e('with warnings'); ?></div> 157 155 158 156 </div> 159 <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?>160 157 <p class="clear actionlist secondary"> 161 158 <?php 162 159 $footer_links = array(); -
gp-includes/routes/translation.php
135 135 $bulk = gp_post('bulk'); 136 136 $bulk['row-ids'] = array_filter( explode( ',', $bulk['row-ids'] ) ); 137 137 if ( !empty( $bulk['row-ids'] ) ) { 138 if ( gp_post( 'approve' ) || gp_post( 'reject' )) {138 if ( 'approve' == $bulk['action'] || 'reject' == $bulk['action'] ) { 139 139 $this->_bulk_approve( $project, $locale, $translation_set, $bulk ); 140 140 } 141 141 142 if ( gp_post( 'gtranslate' )) {142 if ( 'gtranslate' == $bulk['action'] ) { 143 143 $this->_bulk_google_translate( $project, $locale, $translation_set, $bulk ); 144 144 } 145 145 } else { … … 155 155 156 156 function _bulk_approve( $project, $locale, $translation_set, $bulk ) { 157 157 158 $action = gp_post( 'approve' )? 'approve' : 'reject';158 $action = $bulk['action']; 159 159 160 160 $ok = $error = 0; 161 161 $new_status = 'approve' == $action? 'current' : 'rejected'; -
js/translations-page.js
9 9 hide_text: 'Filter ↑', 10 10 focus: '#filters\\[term\\]' 11 11 }); 12 $gp.showhide('#upper-filters-toolbar a.bulk', '#upper-filters-toolbar dl.bulk-actions', {13 show_text: 'Bulk ↓',14 hide_text: 'Bulk ↑',15 focus: '#filters\\[term\\]'16 });17 18 var bulk_dl = $('.filters-toolbar dl.bulk-actions');19 var submits = $('input[type=submit]', bulk_dl);20 12 21 13 var rows_checked = 0; 22 14 23 $('#upper-filters-toolbar a.bulk').click(function() { 24 rows_checked = $('input:checked', $('table#translations th.checkbox')).length; 25 change_row_checked(0); 15 $('form.filters-toolbar.bulk-actions').submit(function(e) { 16 var row_ids = $('input:checked', $('table#translations th.checkbox')).map(function() { 17 return $(this).parents('tr.preview').attr('row'); 18 }).get().join(','); 19 $('input[name="bulk[row-ids]"]', $(this)).val(row_ids); 26 20 }); 27 21 28 var change_row_checked = function(num) {29 rows_checked += num;30 submits.prop('disabled', ! rows_checked);31 }32 33 $(':checkbox', $('table#translations th.checkbox')).each(function() {34 $(this).change(function() {35 this.checked? change_row_checked(+1) : change_row_checked(-1);36 });37 });38 39 40 var set_all = function (value) {41 $(':checkbox', $('table#translations th.checkbox')).each(function() {42 if ( !this.checked && value) change_row_checked(+1);43 if ( this.checked && !value) change_row_checked(-1);44 this.checked = value;45 });46 }47 48 $('.filters-toolbar dl.bulk-actions a.all').click( function() {49 set_all(true);50 });51 $('.filters-toolbar dl.bulk-actions a.none').click( function() {52 set_all(false);53 });54 55 submits.prop('disabled', true);56 57 $('form.filters-toolbar').submit(function(e) {58 if ($('input[name=approve]', bulk_dl).is(':visible')) {59 this.method = 'post';60 this.action = $gp_translations_options.action;61 var row_ids = $('input:checked', $('table#translations th.checkbox')).map(function() {62 return $(this).parents('tr.preview').attr('row');63 }).get().join(',');64 $('input[name="bulk[row-ids]"]', $(this)).val(row_ids);65 } else {66 // do not litter the GET form with the long redirect_to67 $('input[name^="bulk"]', $(this)).remove();68 }69 return true;70 });71 72 22 $('a#export').click(function() { 73 23 var format = $('#export-format').val(); 74 24 var what_to_export = $('#what-to-export').val();
