Skip to content

Commit

Permalink
Merge pull request #82 from xwp/fix/no-results
Browse files Browse the repository at this point in the history
Restyle no results
  • Loading branch information
pierlon committed Apr 24, 2020
2 parents d8583fc + cc1fc29 commit 89bc4bc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
Binary file removed assets/images/no-results.png
Binary file not shown.
9 changes: 6 additions & 3 deletions assets/src/media-selector/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
right: 300px;
text-align: center;
left: 0;
top: 35px;
top: 34%;
}

.media-frame-content[data-columns="2"] .unsplash-attachment:nth-child(even) .thumbnail,
Expand Down Expand Up @@ -124,8 +124,11 @@
0 0 0 3px #0073aa;
}

.media-frame .unsplash-browser .no-media img {
width: 400px;
.media-frame .unsplash-browser .no-media h2 {
font-size: 20px;
line-height: 1.4;
font-weight: 400;
margin: 0;
}

.wp-core-ui .unsplash-browser .unsplash-attachment img {
Expand Down
5 changes: 1 addition & 4 deletions assets/src/media-selector/views/images_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ const ImagesBrowser = wp.media.view.AttachmentsBrowser.extend( {
} );

this.attachmentsNoResults.$el.addClass( 'hidden no-media' );
this.attachmentsNoResults.$el.html(
`<img src="${ noResults.image }" alt="${ noResults.noMedia }"/>`
);
this.attachmentsNoResults.$el.append( `<p>${ noResults.noMedia }</p>` );
this.attachmentsNoResults.$el.append( `<h2>${ noResults.noMedia }</h2>` );

this.views.add( this.attachmentsNoResults );

Expand Down
3 changes: 1 addition & 2 deletions php/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public function enqueue_media_scripts() {
],
],
'noResults' => [
'noMedia' => __( 'No results found', 'unsplash' ),
'image' => $this->asset_url( 'assets/images/no-results.png' ),
'noMedia' => __( 'No items found.', 'unsplash' ),
],

]
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/php/class-test-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ public function test_register_meta() {
$this->assertArrayHasKey( 'unsplash_exif', $keys );
}

/**
* Test for register_taxonomy() method.
*
* @see Plugin::register_taxonomy()
*/
public function test_register_taxonomy() {
$plugin = get_plugin_instance();
$plugin->register_taxonomy();

$this->assertTrue( taxonomy_exists( 'media_tag' ) );
$this->assertTrue( taxonomy_exists( 'media_source' ) );
$this->assertTrue( taxonomy_exists( 'unsplash_user' ) );
}

/**
* Test for enqueue_media_scripts() method.
*
Expand Down

0 comments on commit 89bc4bc

Please sign in to comment.