Skip to content

Commit

Permalink
add check-all, check-none buttons to working set checkboxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsch committed Jul 24, 2015
1 parent e3e6f7c commit 9f27dcb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
'primary_locale' => 'en',

/**
* Specify the locale that is used for creating the initial translation strings. This locale is considered
* to be the driver of all other translations.
* Specify the prefix used for all cookies.
*
* @type string
*/
Expand Down
2 changes: 2 additions & 0 deletions src/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
'addsuffixes' => 'Set Suffixes',
'addsuffixes-placeholder' => 'add each key suffixed by lines entered here',
'changed' => 'Changed',
'check-all' => 'All',
'check-none' => 'None',
'choose-group' => 'Choose a translation group',
'choose-group-text' => 'Choose a group to display the group translations. If no groups are visible, contact your web-admin.',
'cleardstkeys' => 'Clear Keys',
Expand Down
2 changes: 2 additions & 0 deletions src/lang/ru/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
'addsuffixes' => 'Набор Суффиксов',
'addsuffixes-placeholder' => 'добавляй каждый ключ с суффиксом строк, указанных здесь',
'changed' => 'Измененны',
'check-all' => '<i class="glyphicon glyphicon-ok"></i>',
'check-none' => '<i class="glyphicon glyphicon-remove"></i>',
'choose-group' => 'Выберите группу переводов',
'choose-group-text' => 'Выберите группу переводов для редакции. Если нет групп в списке, контактируйте вашего веб-админа.',
'cleardstkeys' => 'Стереть Ключи',
Expand Down
32 changes: 27 additions & 5 deletions src/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,28 @@
<br>
<div class="row">
<div class=" col-sm-3">
<?= formSubmit(trans('laravel-translation-manager::messages.display-locales'), ['class' => "btn btn-sm btn-primary"]) ?>&nbsp;&nbsp;
<div class="row">
<div class=" col-sm-12">
<?= formSubmit(trans('laravel-translation-manager::messages.display-locales'), ['class' => "btn btn-sm btn-primary"]) ?>&nbsp;&nbsp;
</div>
</div>
<div class="row">
<div class=" col-sm-12">
<br>
<?= ifEditTrans('laravel-translation-manager::messages.check-all') ?>
<button id="display-locale-all" class="btn btn-sm btn-default"><?= noEditTrans('laravel-translation-manager::messages.check-all')?></button>
<?= ifEditTrans('laravel-translation-manager::messages.check-none') ?>
<button id="display-locale-none" class="btn btn-sm btn-default"><?= noEditTrans('laravel-translation-manager::messages.check-none')?></button>
</div>
</div>
</div>
<div class=" col-sm-9">
<div class="input-group-sm">
@foreach($locales as $locale)
<label>
<input name="d[]" type="checkbox" value="<?=$locale?>"
<input <?= $locale !== $primaryLocale && $locale !== $translatingLocale ? ' class="display-locale" ' : '' ?> name="d[]" type="checkbox" value="<?=$locale?>"
<?= ($locale === $primaryLocale || $locale === $translatingLocale || array_key_exists($locale, $displayLocales)) ? 'checked' : '' ?>
<?= $locale === $primaryLocale ? 'disabled="true"' : '' ?>"
<?= $locale === $primaryLocale ? 'disabled="true"' : '' ?>
><?= $locale ?>
</label>
@endforeach
Expand Down Expand Up @@ -623,8 +636,7 @@ function postDeleteKeys(event) {
var PRIMARY_LOCALE = '{{$primaryLocale}}';
var CURRENT_LOCALE = '{{$currentLocale}}';
var TRANSLATING_LOCALE = '{{$translatingLocale}}';
</script>
<script>
jQuery(document).ready(function ($) {
$('.group-select').on('change', function () {
window.location.href = '<?= action('Vsch\TranslationManager\Controller@getIndex') ?>/' + $(this).val();
Expand Down Expand Up @@ -724,6 +736,16 @@ function postDeleteKeys(event) {
$('#form-interface-locale')[0].submit();
});
$('#display-locale-all').on('click', function (e) {
e.preventDefault();
$('.display-locale').prop('checked',true);
});
$('#display-locale-none').on('click', function (e) {
e.preventDefault();
$('.display-locale').prop('checked',false);
});
function textareaTandemResize(src, dst, liveupdate) {
return function () {
var srcTimeout = {id: null},
Expand Down

0 comments on commit 9f27dcb

Please sign in to comment.