Skip to content

Commit

Permalink
Merge pull request #25 from michelegiorgi/development
Browse files Browse the repository at this point in the history
release v1.3.2
  • Loading branch information
michelegiorgi authored May 25, 2021
2 parents 70a436a + e4a54a2 commit f162d6a
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 358 deletions.
4 changes: 2 additions & 2 deletions admin/class-formality-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function welcome_notice() {
<?php $samplelink = !$templates ? '#TB_inline?&width=380&height=210&inlineId=formality-sample-thick" class="thickbox' : $plugin_tools->generate_sample_link_url(); ?>
<a class="button button-primary button-hero" href="<?php echo admin_url('post-new.php?post_type=formality_form'); ?>"><?php _e('Create your first form', 'formality'); ?></a>
<p><?php /* translators: %s: generate sample forms link */ echo sprintf( __('or <a href="%s">generate a couple of sample forms</a> to practice with', 'formality'), $samplelink); ?> <span class="badge"></span></p>
<p><?php /* translators: %s: import form link */ echo sprintf( __('or <a href="%s">import your forms</a> with Wordpress import tool', 'formality'), admin_url('admin.php?import=wordpress')); ?></p>
<p><?php /* translators: %s: import form link */ echo sprintf( __('or <a href="%s">import your forms</a> with the WordPress import tool', 'formality'), admin_url('admin.php?import=wordpress')); ?></p>
<?php if(!$templates) {?>
<?php add_thickbox(); ?>
<div id="formality-sample-thick" style="display:none;">
Expand All @@ -135,7 +135,7 @@ public function welcome_notice() {
</div>
<div class="welcome-panel-column welcome-panel-last">
<h3><?php _e('Support us', 'formality'); ?></h3>
<p><?php /* translators: %s: donate link + 5 stars review link */ echo sprintf(__('If you enjoy using Formality, please consider <a href="%1$s">making a donation</a>, or rate this plugin with a <a href="%2$s">5 stars review</a> on Wordpress directory. You can also subscribe to our newsletter (max once a month).', 'formality'), 'https://www.paypal.me/michelegiorgi/" target="_blank', 'https://wordpress.org/support/plugin/formality/reviews/?filter=5#new-post" target="_blank'); ?></p>
<p><?php /* translators: %s: donate link + 5 stars review link */ echo sprintf(__('If you enjoy using Formality, please consider <a href="%1$s">making a donation</a>, or rate this plugin with a <a href="%2$s">5 stars review</a> on the WordPress plugin directory. You can also subscribe to our newsletter (max once a month).', 'formality'), 'https://www.paypal.me/michelegiorgi/" target="_blank', 'https://wordpress.org/support/plugin/formality/reviews/?filter=5#new-post" target="_blank'); ?></p>
<form class="formality-newsletter" novalidate>
<input placeholder="<?php _e('Your email address', 'formality'); ?>" type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
<input type="submit" value="<?php _e('Subscribe', 'formality'); ?>" name="subscribe" id="mc-embedded-subscribe" class="button">
Expand Down
21 changes: 4 additions & 17 deletions admin/class-formality-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ public function block_categories($categories, $post) {
}

public function filter_blocks($allowed_block_types, $post) {
$formality_blocks = $this->get_allowed('blocks');
if ( $post->post_type !== 'formality_form' ) {
return $allowed_block_types;
if( !is_object($post) ) { $post = get_post(); }
if ( $post->post_type == 'formality_form' ) {
return $this->get_allowed('blocks');
}
return $formality_blocks;
return $allowed_block_types;
}

public function register_metas() {
Expand Down Expand Up @@ -257,19 +257,6 @@ public function unsplash_disable_ssl($ssl_verify, $url) {
return true;
}

public function gutenberg_version_class($classes) {
$ver = 0;
if(defined('GUTENBERG_VERSION')) {
if(version_compare( GUTENBERG_VERSION, '8.0', '<' )){
$ver = 7;
}
} else if ( version_compare( $GLOBALS['wp_version'], '5.5', '<' ) ) {
$ver = 7;
}
if($ver) { $classes .= ' formality--gutenberg--' . $ver . ' '; }
return $classes;
}

public function prevent_classic_editor($can_edit, $post) {
if ('formality_form' === $post) return true;
return $can_edit;
Expand Down
10 changes: 5 additions & 5 deletions assets/scripts/editor/blocks/rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ registerBlockType( blockName, {
let iconSvg = ""
for (let radiovalue = 1; radiovalue <= value_max; radiovalue++) { arrayrating.push(radiovalue) }
switch(icon) {
case 'heart' : iconSvg = glyphHeart; break;
case 'star' : iconSvg = glyphStar; break;
case 'rhombus' : iconSvg = glyphRhombus; break;
case 'heart' : iconSvg = glyphHeart(uid); break;
case 'star' : iconSvg = glyphStar(uid); break;
case 'rhombus' : iconSvg = glyphRhombus(uid); break;
}

return ([
Expand Down Expand Up @@ -147,8 +147,8 @@ registerBlockType( blockName, {
>
<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>{ iconSvg }</defs>
<use href="#main" className="border" x="0" y="0"/>
<use href="#main" className="fill" x="0" y="0"/>
<use href={ '#glyph_' + uid } className="border" x="0" y="0"/>
<use href={ '#glyph_' + uid } className="fill" x="0" y="0"/>
</svg>
{ singlerating }
</label>
Expand Down
12 changes: 6 additions & 6 deletions assets/scripts/editor/utility/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ const iconPlay = (
</svg>
)

const glyphStar = (
<path id="main" d="M13.0544771,12.9863905 L17.6180178,3.74071968 L18.5147516,5.55736935 L22.1816172,12.9858961 L32.3850081,14.4686292 L30.9341159,15.8829352 L25.0018304,21.6656272 L26.7445065,31.8279604 L24.9511102,30.8851353 L17.6182868,27.0301201 L8.49097086,31.8278906 L8.83353892,29.8309254 L10.2342519,21.6656174 L2.85097924,14.4685241 L4.85625116,14.1772434 L13.0544771,12.9863905 Z"></path>
const glyphStar = (uid) => (
<path id={ 'glyph_' + uid } d="M13.0544771,12.9863905 L17.6180178,3.74071968 L18.5147516,5.55736935 L22.1816172,12.9858961 L32.3850081,14.4686292 L30.9341159,15.8829352 L25.0018304,21.6656272 L26.7445065,31.8279604 L24.9511102,30.8851353 L17.6182868,27.0301201 L8.49097086,31.8278906 L8.83353892,29.8309254 L10.2342519,21.6656174 L2.85097924,14.4685241 L4.85625116,14.1772434 L13.0544771,12.9863905 Z"></path>
)

const glyphRhombus = (
<polygon id="main" points="18.1999422 5 7.2 17.9205212 18.1999422 30.8410424 29.2 17.9205212"></polygon>
const glyphRhombus = (uid) => (
<polygon id={ 'glyph_' + uid } points="18.1999422 5 7.2 17.9205212 18.1999422 30.8410424 29.2 17.9205212"></polygon>
)

const glyphHeart = (
<path id="main" d="M32.0986828,15.8148901 C31.5106966,18.3076928 30.1504164,20.5749448 28.1682144,22.3705128 L18.1089854,31.3452349 L17.4426481,30.7405168 L8.21654492,22.3675927 C6.23737493,20.5743969 4.87721216,18.3079698 4.2885129,15.8145146 C4.02009809,14.6783011 3.95884311,13.7499203 4.02040361,13.0541562 C4.02888654,12.9582811 4.03856491,12.883729 4.04387212,12.8532568 L4.04518984,12.8561723 C4.44604138,8.34258388 7.64314976,5 11.6840824,5 C14.3711363,5 16.7648309,6.48146822 18.1140301,8.89689812 C19.4736879,6.50616597 21.9695846,5.00054977 24.7036219,5.00054977 C28.7515265,5.00054977 31.9420839,8.35121088 32.3458597,12.8733768 C32.3486736,12.8864297 32.3580683,12.9583798 32.3663732,13.0515773 C32.4284391,13.7480763 32.3673452,14.6775602 32.0986828,15.8148901 Z"></path>
const glyphHeart = (uid) => (
<path id={ 'glyph_' + uid } d="M32.0986828,15.8148901 C31.5106966,18.3076928 30.1504164,20.5749448 28.1682144,22.3705128 L18.1089854,31.3452349 L17.4426481,30.7405168 L8.21654492,22.3675927 C6.23737493,20.5743969 4.87721216,18.3079698 4.2885129,15.8145146 C4.02009809,14.6783011 3.95884311,13.7499203 4.02040361,13.0541562 C4.02888654,12.9582811 4.03856491,12.883729 4.04387212,12.8532568 L4.04518984,12.8561723 C4.44604138,8.34258388 7.64314976,5 11.6840824,5 C14.3711363,5 16.7648309,6.48146822 18.1140301,8.89689812 C19.4736879,6.50616597 21.9695846,5.00054977 24.7036219,5.00054977 C28.7515265,5.00054977 31.9420839,8.35121088 32.3458597,12.8733768 C32.3486736,12.8864297 32.3580683,12.9583798 32.3663732,13.0515773 C32.4284391,13.7480763 32.3673452,14.6775602 32.0986828,15.8148901 Z"></path>
)


Expand Down
2 changes: 1 addition & 1 deletion assets/styles/admin/editor_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
font-size: var(--formality_fontsize);
position: relative;
z-index: 1;
padding-top: 50px;
padding-top: 50px !important;
&:before {
content: "";
width: 100%;
Expand Down
12 changes: 6 additions & 6 deletions assets/styles/admin/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
margin-bottom: 0;
}
.components-base-control__field {
margin-bottom: 0;
margin-bottom: 0;
}
> span {
margin-left: 10px;
flex-grow: 0;
flex-shrink: 0;
}
}
}
.formality_panelrow {
justify-content: flex-start;
&--hidden {
Expand Down Expand Up @@ -104,7 +104,7 @@
transform: scale(1.5);
}
.components-base-control__field {
margin-bottom: 9px;
margin-bottom: 9px;
}
}
.formality_optionsgrid {
Expand Down Expand Up @@ -171,7 +171,7 @@
border: 2px solid white;
border-radius: 3px;
background-size: cover;
z-index: 1;
z-index: 0;
padding-bottom: 2em;
&:before {
content: "";
Expand Down Expand Up @@ -334,7 +334,7 @@
display: none;
}
&:last-child {
margin: 0 .2em 0 0;
margin: 0 .2em 0 0;
}
.components-base-control__field {
margin-bottom: 2px;
Expand Down Expand Up @@ -378,4 +378,4 @@
}
}
}
}
}
3 changes: 2 additions & 1 deletion assets/styles/public/common/_utility.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
html.html-formality {
margin: 0 !important;
font-size: var(--formality_fontsize) !important;
body.body-formality {
#wpadminbar {
display:none !important;
}
}
}
}
12 changes: 12 additions & 0 deletions assets/styles/public/components/_fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@
font-size: 1.1em;
content: "keyboard_arrow_down";
font-family: 'Material Icons';
white-space: nowrap;
position: absolute;
z-index: 2;
line-height: 1.2;
Expand Down Expand Up @@ -530,6 +531,11 @@
height: 100%;
display: block;
overflow-y: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
li {
z-index: 1;
position: relative;
Expand Down Expand Up @@ -570,6 +576,7 @@
&:after {
content: "check";
font-family: 'Material Icons';
white-space: nowrap;
}
}
}
Expand Down Expand Up @@ -615,6 +622,7 @@
line-height: 0.8;
&:before {
font-family: 'Material Icons';
white-space: nowrap;
}
&:first-child:before { content: "arrow_drop_up"; }
&:last-child:before { content: "arrow_drop_down"; }
Expand Down Expand Up @@ -864,6 +872,7 @@
border-radius: 1em;
content: "check";
font-family: 'Material Icons';
white-space: nowrap;
text-align: left;
font-size: 0.6em;
padding: 0 0.3em;
Expand All @@ -884,6 +893,7 @@
background: none;
content: "check";
font-family: 'Material Icons';
white-space: nowrap;
position: absolute;
padding: 0;
line-height: 1em;
Expand Down Expand Up @@ -1007,6 +1017,7 @@
border-bottom: 3px solid var(--formality_col1);
animation: spin 0.8s linear infinite;
text-align: center;
white-space: nowrap;
}
}
i {
Expand Down Expand Up @@ -1039,6 +1050,7 @@
transform: translate(-50%, -50%);
position: absolute;
font-size: 1.6rem;
white-space: nowrap;
}
&[style] {
&:before,
Expand Down
Loading

0 comments on commit f162d6a

Please sign in to comment.