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

Disable auto activation on merge #249

Merged
merged 6 commits into from
Sep 7, 2023
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
19 changes: 7 additions & 12 deletions .github/workflows/latest-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Automated Latest Release

env:
CHANNEL: 'latest'
PRERELEASE: 'true'
PRERELEASE: 'false'

on:
pull_request:
types: [closed]
branches:
- main
# on:
# pull_request:
# types: [closed]
# branches:
# - main

# Only cancel in-progress jobs or runs for the current workflow run
# Cancel in-progress jobs or runs for the current workflow run
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -24,11 +24,6 @@ jobs:
uses: actions/checkout@v3
with:
ref: main
- name: Get Lables
run: |
echo "LABELS: ${{ github.event.pull_request.labels }}"
x=${{ toJson(github.event.pull_request.labels.*.name) }}
echo "Labels 2 is $x"
- name: Get Configuration
id: configuration
uses: rgarcia-phi/json-to-variables@9835d537368468c4e4de5254dc3efeadda183793
Expand Down
69 changes: 12 additions & 57 deletions includes/widgets/rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,53 +113,6 @@ private function add_style_tab() {
]
);

$this->add_responsive_control(
'icon_gap',
[
'label' => esc_html__( 'Spacing', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'em' => [
'min' => 0,
'max' => 10,
'step' => 0.1,
],
'rem' => [
'min' => 0,
'max' => 10,
'step' => 0.1,
],
],
'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ],
'selectors' => [
'{{WRAPPER}}' => '--e-rating-gap: {{SIZE}}{{UNIT}}',
],
]
);

$this->add_control(
'icon_color',
[
'label' => esc_html__( 'Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--e-rating-star-marked-color: {{VALUE}}',
],
'separator' => 'before',
]
);

$this->add_control(
'icon_unmasked_color',
[
'label' => esc_html__( 'Unmarked Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--e-rating-star-color: {{VALUE}}',
],
]
);

$this->end_controls_section();
}

Expand Down Expand Up @@ -197,9 +150,8 @@ protected function register_controls() {
[
'label' => esc_html__( 'Rating', 'elementor' ),
'type' => Controls_Manager::NUMBER,
'placeholder' => 5,
'min' => 0,
'step' => 0.01,
'step' => 0.5,
'dynamic' => [
'active' => true,
],
Expand Down Expand Up @@ -264,26 +216,29 @@ protected function register_controls() {
}

protected function get_rating_value(): float {
return floatval( $this->get_settings_for_display( 'rating_value' ) );
$initial_value = $this->get_rating_scale();
$rating_value = $this->get_settings_for_display( 'rating_value' );

if ( '' === $rating_value ) {
$rating_value = $initial_value;
}

$rating_value = floatval( $rating_value );

return round( $rating_value, 2 );
}

protected function get_rating_scale(): int {
return intval( $this->get_settings_for_display( 'rating_scale' )['size'] );
}

protected function get_icon_marked_width( $icon_index ): string {
$initial_value = $this->get_rating_scale();
$rating_value = $this->get_rating_value();

if ( empty( $rating_value ) ) {
$rating_value = $initial_value;
}

$width = '0%';

if ( $rating_value >= $icon_index ) {
$width = '100%';

} elseif ( intval( ceil( $rating_value ) ) === $icon_index ) {
$width = ( $rating_value - ( $icon_index - 1 ) ) * 100 . '%';
}
Expand Down Expand Up @@ -334,7 +289,7 @@ protected function render() {

$this->add_render_attribute( 'widget_wrapper', [
'class' => 'e-rating-wrapper',
'itemprop' => 'reviewValue',
'itemprop' => 'ratingValue',
'content' => $this->get_rating_value(),
'role' => 'img',
'aria-label' => sprintf( esc_html__( 'Rated %1$s out of %2$s', 'elementor' ),
Expand Down
Loading