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

Add a product logo next to the heading #2218 #2219

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/admin-global.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions assets/css/scss/admin-global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,46 @@
}
}

.post-type-gravityview {
#wpcontent {
position: relative;
}

h1.wp-heading-inline {
margin-bottom: 24px;

&:before {
content: "";
display: inline-block;
width: 36px;
height: 36px;
margin-right: 8px;
position: relative;
top: 9px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml,%3Csvg fill='none' height='80' viewBox='0 0 80 80' width='80' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3CclipPath id='a'%3E%3Cpath d='m16 18h48v44h-48z'/%3E%3C/clipPath%3E%3Crect fill='%23ff1b67' height='80' rx='8' width='80'/%3E%3Cg clip-path='url(%23a)'%3E%3Cpath clip-rule='evenodd' d='m58.4105 54.6666h-5.5281v1.8333c0 3.0376-2.4922 5.5-5.528 5.5h-14.741c-3.0759 0-5.5281-2.4624-5.5281-5.5v-27.4999h-5.5281c-1.0428 0-1.8424.8207-1.8424 1.8333v18.3333c0 1.0126.7996 1.8334 1.8424 1.8334h.9216c.4841 0 .9209.4104.9209.9167v1.8333c0 .5062-.4368.9166-.9209.9166h-.9216c-3.0786 0-5.528-2.4624-5.528-5.5v-18.3333c0-3.0376 2.4494-5.5 5.528-5.5h5.5281v-1.8333c0-3.0376 2.4522-5.5 5.5281-5.5h14.741c3.0358 0 5.528 2.4624 5.528 5.5v27.5h5.5281c1.0027 0 1.8424-.8208 1.8424-1.8334v-18.3333c0-1.0126-.8397-1.8333-1.8424-1.8333h-.9216c-.5242 0-.9216-.4104-.9216-.9167v-1.8334c0-.5062.3974-.9166.9216-.9166h.9216c3.0385 0 5.5273 2.4624 5.5273 5.5v18.3333c0 3.0376-2.4888 5.5-5.5273 5.5zm-9.2137-31.1666c0-1.0126-.8424-1.8333-1.8424-1.8333h-14.741c-1.0401 0-1.8425.8207-1.8425 1.8333v32.9999c0 1.0126.8024 1.8334 1.8425 1.8334h14.741c1 0 1.8424-.8208 1.8424-1.8334z' fill='%23fff' fill-rule='evenodd'/%3E%3C/g%3E%3C/svg%3E");
}

&:after {
content: "";
position: absolute;
display: block;
left: -20px; // Adjust for the left padding applied to #wpcontent.
right: 0;
height: 84px;
background: white;
top: 0;
z-index: -1;

@media (max-width: 782px) {
height: 136px;
}
}
}
}

// Form Toolbar for connected views
#wpwrap .gv_connected_forms {

Expand Down
19 changes: 12 additions & 7 deletions future/includes/class-gv-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
*/
class View implements \ArrayAccess {

/**
* @var string GravityView custom post type.
* */
const POST_TYPE = 'gravityview';

/**
* @var \WP_Post The backing post instance.
*/
Expand Down Expand Up @@ -130,7 +135,7 @@ public function __construct() {
*/
public static function register_post_type() {
/** Register only once */
if ( post_type_exists( 'gravityview' ) ) {
if ( post_type_exists( self::POST_TYPE ) ) {
return;
}

Expand Down Expand Up @@ -243,7 +248,7 @@ public static function register_post_type() {
'map_meta_cap' => true,
);

register_post_type( 'gravityview', $args );
register_post_type( self::POST_TYPE, $args );
}

/**
Expand Down Expand Up @@ -576,7 +581,7 @@ public static function get_joins( $post ) {
return $joins;
}

if ( ! $post || 'gravityview' !== get_post_type( $post ) ) {
if ( ! $post || self::POST_TYPE !== get_post_type( $post ) ) {
gravityview()->log->error( 'Only "gravityview" post types can be \GV\View instances.' );
return $joins;
}
Expand Down Expand Up @@ -672,7 +677,7 @@ public static function get_joined_forms( $post_id ) {
public static function get_unions( $post ) {
$unions = array();

if ( ! $post || 'gravityview' !== get_post_type( $post ) ) {
if ( ! $post || self::POST_TYPE !== get_post_type( $post ) ) {
gravityview()->log->error( 'Only "gravityview" post types can be \GV\View instances.' );
return $unions;
}
Expand Down Expand Up @@ -726,7 +731,7 @@ public static function get_unions( $post ) {
*/
public static function from_post( $post ) {

if ( ! $post || 'gravityview' !== get_post_type( $post ) ) {
if ( ! $post || self::POST_TYPE !== get_post_type( $post ) ) {
gravityview()->log->error( 'Only gravityview post types can be \GV\View instances.' );
return null;
}
Expand Down Expand Up @@ -883,7 +888,7 @@ public static function by_id( $post_id ) {
* @return bool Whether the post exists or not.
*/
public static function exists( $view ) {
return 'gravityview' == get_post_type( $view );
return self::POST_TYPE == get_post_type( $view );
}

/**
Expand Down Expand Up @@ -1778,7 +1783,7 @@ public static function restrict( $caps, $cap, $user_id, $args ) {

return $caps;
case 'edit_post':
if ( 'gravityview' === get_post_type( array_pop( $args ) ) ) {
if ( self::POST_TYPE === get_post_type( array_pop( $args ) ) ) {
return self::restrict( $caps, 'edit_gravityview', $user_id, $args );
}
endswitch;
Expand Down
Loading