Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Commit

Permalink
Allow setting false for an attribute to be sure it's removed. Also ad…
Browse files Browse the repository at this point in the history
…d better wrap classes around files as well as images. Also add data-id attribute to files/images.
  • Loading branch information
jtsternberg committed Feb 15, 2015
1 parent 31bcc11 commit d22e921
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion includes/CMB2_Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ public function file_list() {
$id_input = $this->input( array(
'type' => 'hidden',
'value' => $fullurl,
'name' => $name . '[' . $id . ']' ,
'name' => $name . '[' . $id . ']',
'id' => 'filelist-' . $id,
'data-id' => $id,
'desc' => '',
Expand Down
41 changes: 16 additions & 25 deletions languages/cmb2.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: CMB2 2.0.2\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/cmb2\n"
"POT-Creation-Date: 2015-02-15 01:52:24+00:00\n"
"POT-Creation-Date: 2015-02-15 01:52:34+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -301,7 +301,7 @@ msgstr ""
msgid "Please Try Again"
msgstr ""

#: includes/CMB2_Ajax.php:133 tests/test-cmb-types.php:763
#: includes/CMB2_Ajax.php:133
msgid "Remove Embed"
msgstr ""

Expand Down Expand Up @@ -329,40 +329,19 @@ msgstr ""
msgid "Add Row"
msgstr ""

#: includes/CMB2_Types.php:351 includes/CMB2_Types.php:821
#: includes/CMB2_Types.php:900 includes/CMB2_hookup.php:179
#: includes/CMB2_Types.php:351 includes/CMB2_hookup.php:179
#: tests/test-cmb-types.php:147 tests/test-cmb-types.php:155
#: tests/test-cmb-types.php:712 tests/test-cmb-types.php:737
msgid "Remove"
msgstr ""

#: includes/CMB2_Types.php:697 includes/CMB2_Types.php:745
msgid "No terms"
msgstr ""

#: includes/CMB2_Types.php:789 includes/CMB2_Types.php:847
#: tests/test-cmb-types.php:688 tests/test-cmb-types.php:714
#: tests/test-cmb-types.php:724 tests/test-cmb-types.php:739
#: includes/CMB2_Types.php:789 tests/test-cmb-types.php:688
msgid "Add or Upload File"
msgstr ""

#: includes/CMB2_Types.php:812 includes/CMB2_Types.php:895
#: includes/CMB2_hookup.php:178
msgid "Remove Image"
msgstr ""

#: includes/CMB2_Types.php:821 includes/CMB2_Types.php:900
#: includes/CMB2_hookup.php:180 tests/test-cmb-types.php:713
#: tests/test-cmb-types.php:738
msgid "File:"
msgstr ""

#: includes/CMB2_Types.php:821 includes/CMB2_Types.php:900
#: includes/CMB2_hookup.php:181 tests/test-cmb-types.php:711
#: tests/test-cmb-types.php:736
msgid "Download"
msgstr ""

#: includes/CMB2_hookup.php:129 includes/CMB2_hookup.php:166
msgid "Clear"
msgstr ""
Expand Down Expand Up @@ -425,6 +404,18 @@ msgstr ""
msgid "Use this file"
msgstr ""

#: includes/CMB2_hookup.php:178
msgid "Remove Image"
msgstr ""

#: includes/CMB2_hookup.php:180
msgid "File:"
msgstr ""

#: includes/CMB2_hookup.php:181
msgid "Download"
msgstr ""

#: includes/CMB2_hookup.php:182
msgid "Select / Deselect All"
msgstr ""
Expand Down
9 changes: 8 additions & 1 deletion tests/test-cmb-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,14 @@ public function test_file_list_field_after_value_update() {
) );

$this->assertHTMLstringsAreEqual(
sprintf( '<input type="hidden" class="cmb2-upload-file cmb2-upload-list" name="field_test_field" id="field_test_field" value="" size="45" data-previewsize=\'[50,50]\'/><input type="button" class="cmb2-upload-button button cmb2-upload-list" name="" id="" value="%7$s"/><p class="cmb2-metabox-description">This is a description</p><ul id="field_test_field-status" class="cmb2-media-status cmb-attach-list"><li class="file-status"><span>%6$s <strong>?attachment_id=%1$d</strong></span>&nbsp;&nbsp; (<a href="%3$s/?attachment_id=%1$d" target="_blank" rel="external">%4$s</a> / <a href="#" class="cmb2-remove-file-button">%5$s</a>)<input type="hidden" name="field_test_field[%1$d]" id="filelist-%1$d" value="%3$s/?attachment_id=%1$d" data-id=\'%1$d\'/></li><li class="file-status"><span>%6$s <strong>?attachment_id=%2$d</strong></span>&nbsp;&nbsp; (<a href="%3$s/?attachment_id=%2$d" target="_blank" rel="external">%4$s</a> / <a href="#" class="cmb2-remove-file-button">%5$s</a>)<input type="hidden" name="field_test_field[%2$d]" id="filelist-%2$d" value="%3$s/?attachment_id=%2$d" data-id=\'%2$d\'/></li></ul>',
sprintf( '
<input type="hidden" class="cmb2-upload-file cmb2-upload-list" name="field_test_field" id="field_test_field" value="" size="45" data-previewsize=\'[50,50]\'/>
<input type="button" class="cmb2-upload-button button cmb2-upload-list" name="" id="" value="%7$s"/>
<p class="cmb2-metabox-description">This is a description</p>
<ul id="field_test_field-status" class="cmb2-media-status cmb-attach-list">
<li class="file-status"><span>%6$s <strong>?attachment_id=%1$d</strong></span>&nbsp;&nbsp; (<a href="%3$s/?attachment_id=%1$d" target="_blank" rel="external">%4$s</a> / <a href="#" class="cmb2-remove-file-button">%5$s</a>)<input type="hidden" name="field_test_field[%1$d]" id="filelist-%1$d" value="%3$s/?attachment_id=%1$d" data-id=\'%1$d\'/></li>
<li class="file-status"><span>%6$s <strong>?attachment_id=%2$d</strong></span>&nbsp;&nbsp; (<a href="%3$s/?attachment_id=%2$d" target="_blank" rel="external">%4$s</a> / <a href="#" class="cmb2-remove-file-button">%5$s</a>)<input type="hidden" name="field_test_field[%2$d]" id="filelist-%2$d" value="%3$s/?attachment_id=%2$d" data-id=\'%2$d\'/></li>
</ul>',
$this->attachment_id,
$this->attachment_id2,
site_url(),
Expand Down

0 comments on commit d22e921

Please sign in to comment.