Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENHANCEMENT Indicate which file extensions are allowed to be uploaded #78

Merged
merged 2 commits into from
Mar 27, 2012
Merged

ENHANCEMENT Indicate which file extensions are allowed to be uploaded #78

merged 2 commits into from
Mar 27, 2012

Conversation

halkyon
Copy link
Contributor

@halkyon halkyon commented Mar 26, 2012

When uploading a file to a folder, show which file extensions are permitted to be uploaded through UploadField->getValidator()->getAllowedExtensions()

This is for http://open.silverstripe.org/ticket/6905

@sminnee
Copy link
Member

sminnee commented Mar 26, 2012

Seems reasonable to me; does the UI look okay, though?

@halkyon
Copy link
Contributor Author

halkyon commented Mar 26, 2012

There's quite a few extensions in the text, what do you think? http://postimage.org/image/87cw9ns6b/

@chillu
Copy link
Member

chillu commented Mar 26, 2012

Hmm, can we order them by most common, and provide a "..." after the first ~10 exensions? That'd be the icing on the cake though...

At the least they should be ordered alphabetically though, otherwise the list is actually quite useless hehe.

'getEditForm',
new FieldList(
$uploadField,
new LiteralField('AllowedExtensions', sprintf('<p>Allowed extensions: %s</p>', implode('</em>, <em>', $uploadField->getValidator()->getAllowedExtensions()))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move the HTML out of the _t() call? I know we tend to do that in core, but its not a great habit as it leaves too much room for error for translators.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chillu Woops, that's a good point. I'll update the commit.

On Tue, Mar 27, 2012 at 12:14 PM, Ingo Schommer <
reply@reply.github.com

wrote:

@@ -73,9 +73,13 @@ public function getEditForm($id = null, $fields =
null) {
}

          $form = new Form(
  •                 $this,
    
  •                 'getEditForm',
    
  •                 new FieldList($uploadField, new HiddenField('ID')),
    
  •                 $this,
    
  •                 'getEditForm',
    
  •                 new FieldList(
    
  •                         $uploadField,
    
  •                         new LiteralField('AllowedExtensions',
    
    sprintf('

    Allowed extensions: %s

    ', implode(', ',
    $uploadField->getValidator()->getAllowedExtensions()))),

Can we move the HTML out of the _t() call? I know we tend to do that in
core, but its not a great habit as it leaves too much room for error for
translators.


Reply to this email directly or view it on GitHub:
https://github.com/silverstripe/silverstripe-cms/pull/78/files#r606365

…ontroller::getEditForm()

ENHANCEMENT Ensure _t() used for "Allowed extensions" english text.
@halkyon
Copy link
Contributor Author

halkyon commented Mar 27, 2012

I've added the correct _t() call to this now, and sorted the extensions alphabetically. The text "Allowed extensions" is now translatable independent of the formatting of the extension list.

@chillu chillu closed this Mar 27, 2012
@chillu chillu reopened this Mar 27, 2012
chillu added a commit that referenced this pull request Mar 27, 2012
ENHANCEMENT Indicate which file extensions are allowed to be uploaded
@chillu chillu merged commit 1c2ccae into silverstripe:master Mar 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants