Skip to content

Commit

Permalink
Merge pull request silverstripe#1940 from chillu/pulls/uploadfield-fo…
Browse files Browse the repository at this point in the history
…lder-label

Added "saves into..." label to UploadField template
  • Loading branch information
chillu committed May 14, 2013
2 parents 2beb351 + 842dc98 commit 1e5d404
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions forms/UploadField.php
Expand Up @@ -93,6 +93,11 @@ class UploadField extends FileField {
* String values are interpreted as permission codes.
*/
'canAttachExisting' => "CMS_ACCESS_AssetAdmin",
/**
* @var boolean Shows the target folder for new uploads in the field UI.
* Disable to keep the internal filesystem structure hidden from users.
*/
'canPreviewFolder' => true,
/**
* @var boolean If a second file is uploaded, should it replace the existing one rather than throwing an errror?
* This only applies for has_one relationships, and only replaces the association
Expand Down
13 changes: 8 additions & 5 deletions templates/UploadField.ss
Expand Up @@ -44,13 +44,16 @@
</div>
<% end_if %>
<div class="ss-uploadfield-item-info">
<label class="ss-uploadfield-item-name"><b>
<label class="ss-uploadfield-item-name">
<% if $multiple %>
<% _t('UploadField.ATTACHFILES', 'Attach files') %>
<b><% _t('UploadField.ATTACHFILES', 'Attach files') %></b>
<% else %>
<% _t('UploadField.ATTACHFILE', 'Attach a file') %>
<b><% _t('UploadField.ATTACHFILE', 'Attach a file') %></b>
<% end_if %>
</b></label>
<% if getConfig('canPreviewFolder') %>
<small>(<%t UploadField.UPLOADSINTO 'saves into /{path}' path=$FolderName %>)</small>
<% end_if %>
</label>
<% if canUpload %>
<label class="ss-uploadfield-fromcomputer ss-ui-button ui-corner-all" title="<% _t('UploadField.FROMCOMPUTERINFO', 'Upload from your computer') %>" data-icon="drive-upload">
<% _t('UploadField.FROMCOMPUTER', 'From your computer') %>
Expand All @@ -71,4 +74,4 @@
<div class="clear"><!-- --></div>
</div>
<% end_if %>
<% if Description %><span class="description">$Description</span><% end_if %>
<% if Description %><span class="description">$Description</span><% end_if %>

0 comments on commit 1e5d404

Please sign in to comment.