Skip to content

Commit

Permalink
Fix kartik-v#29: Better validation for graceful downgrade for older b…
Browse files Browse the repository at this point in the history
…rowsers
  • Loading branch information
kartik-v committed May 3, 2015
1 parent 505c429 commit c786373
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version 1.0.2

- (enh #23): Add Chinese translations.
- (enh kartik-v/yii2-krajee-base#34, kartik-v/yii2-krajee-base#35): Enhance i18n translation locales.
- (enh #29): Better validation for graceful downgrade for older browsers.

version 1.0.1
=============
Expand Down
6 changes: 3 additions & 3 deletions FileInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public function init()
Html::addCssClass($this->options, 'file-loading');
}
$input = $this->getInput('fileInput');
$id = 'jQuery("#' . $this->options['id'] . '")';
$script = 'document.getElementById("' . $this->options['id'] . '").className.replace(/\bfile-loading\b/,"");';
if ($this->showMessage) {
$validation = ArrayHelper::getValue($this->pluginOptions, 'showPreview', true) ? 'file preview and multiple file upload' : 'multiple file upload';
$message = '<strong>' . Yii::t('fileinput', 'Note:') . '</strong> ' . Yii::t('fileinput', 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.', ['validation' => $validation]);
$content = Html::tag('div', $message, $this->messageOptions) . "<script>{$id}.removeClass('file-loading');</script>";
$content = Html::tag('div', $message, $this->messageOptions) . "<script>{$script};</script>";
$input .= "\n" . $this->validateIE($content);
}
echo $input;
Expand Down Expand Up @@ -101,4 +101,4 @@ public function registerAssets()
$this->registerAssetBundle();
$this->registerPlugin('fileinput');
}
}
}

0 comments on commit c786373

Please sign in to comment.