Skip to content

Commit

Permalink
change percentage to 20
Browse files Browse the repository at this point in the history
  • Loading branch information
naveed-ahmad committed Oct 17, 2021
1 parent 2db3b5b commit a90b462
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/javascript/controllers/percentage_show_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Controller} from "stimulus";

export default class extends Controller {
connect() {
if (this.shuffle()) {
if (this.shouldShow()) {
this.show()
} else{
this.hide()
Expand All @@ -30,7 +30,11 @@ export default class extends Controller {
let percentage = Number(this.element.dataset.percentage)
let draw = Math.round(Math.random(100) * 100);

console.log("draw", draw, "percentage", percentage)
console.log("draw ", draw, draw <= percentage);
return draw <= percentage;
}

shouldShow(){
return window.locale == 'en' && this.shuffle()
}
}
4 changes: 2 additions & 2 deletions app/views/shared/_site_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</div>

<div class="site-menu__items">
<div class="menu-item d-none" data-controller="percentage-show" data-percentage="2">
<%= link_to "https://next.quran.com", class: 'menu-item__link', data: {controller: 'track', name: 'Clicked', action: 'Clicked', category: 'next.quran.com'} do %>
<div class="menu-item d-none" data-controller="percentage-show" data-percentage="20" data-locale="en">
<%= link_to "https://beta.quran.com", class: 'menu-item__link', data: {controller: 'track', name: 'Clicked', action: 'Clicked', category: 'next.quran.com'} do %>
<span class="">
<%= image_tag "sparkle.svg", width: 22 %>
</span>
Expand Down

0 comments on commit a90b462

Please sign in to comment.