-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1277 from internetee/comma-issue
Comma issue
- Loading branch information
Showing
26 changed files
with
220 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,29 @@ | ||
module Common | ||
module Footer | ||
class Component < ApplicationViewComponent; end | ||
class Component < ApplicationViewComponent | ||
def footer_link(key) = if I18n.locale == :et | ||
et_footer_links[key] | ||
else | ||
en_footer_links[key] | ||
end | ||
|
||
def et_footer_links | ||
{ | ||
dispute_committee: 'https://www.internet.ee/domeenivaidlused/domeenivaidluste-komisjon', | ||
list_of_accredited_registrars: 'https://www.internet.ee/registripidaja/akrediteeritud-registripidajad', | ||
terms_and_conditions_for_registrars: 'https://www.internet.ee/registripidaja/kuidas-saada-ee-akrediteeritud-registripidajaks', | ||
partner_programme: 'https://www.internet.ee/registripidaja/kuidas-saada-ee-elite-partneriks' | ||
} | ||
end | ||
|
||
def en_footer_links | ||
{ | ||
dispute_committee: 'https://www.internet.ee/domain-disputes/domain-disputes-committee', | ||
list_of_accredited_registrars: 'https://www.internet.ee/registrar-portal/accredited-registrars', | ||
terms_and_conditions_for_registrars: 'https://www.internet.ee/registrar-portal/terms-and-conditions-for-becoming-a-registrar', | ||
partner_programme: 'https://www.internet.ee/registrar-portal/become-a-ee-elite-partner' | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
</div> | ||
</div> | ||
<% end %> | ||
|
||
<%= banned_banner %> | ||
<%= invalid_data_banner %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
module Common | ||
module StaticNotice | ||
class Component < ViewComponent::Base | ||
attr_accessor :current_user | ||
|
||
def initialize(current_user:) | ||
super | ||
|
||
@current_user = current_user | ||
end | ||
|
||
def banned_banner | ||
return unless current_user&.current_bans | ||
|
||
domains, valid_until = current_user&.current_bans | ||
message = ban_error_message(domains, valid_until) | ||
return unless message | ||
|
||
content_tag(:div, class: 'c-toast js-toast c-toast--error') do | ||
content_tag(:div, class: 'c-toast__content') do | ||
concat(content_tag(:p, message)) | ||
concat(content_tag(:p, violation_message(domains.size))) if eligible_violations_present?(domains:) | ||
end | ||
end | ||
end | ||
|
||
def invalid_data_banner | ||
return unless session['user.invalid_user_data'] | ||
|
||
if current_user.not_phone_number_confirmed_unique? | ||
content_tag(:div, class: 'c-toast js-toast c-toast--error') do | ||
content_tag(:div, t('already_confirmed'), class: 'c-toast__content') | ||
end | ||
else | ||
content_tag(:div, class: 'c-toast js-toast c-toast--error') do | ||
content_tag(:div, t('users.invalid_user_data'), class: 'c-toast__content') | ||
end | ||
end | ||
end | ||
|
||
def start_of_procedure = Rails.configuration.customization[:start_of_procedure] | ||
|
||
def end_of_procdure = Rails.configuration.customization[:end_of_procedure] | ||
|
||
private | ||
|
||
def ban_error_message(domains, valid_until) | ||
if current_user&.completely_banned? | ||
t('auctions.banned_completely', valid_until: valid_until.to_date, | ||
ban_number_of_strikes: Setting.find_by( | ||
code: 'ban_number_of_strikes' | ||
).retrieve) | ||
else | ||
I18n.t('auctions.banned', domain_names: domains.join(', ')) | ||
end | ||
end | ||
|
||
def violation_message(domains_count) | ||
link = Setting.find_by(code: 'violations_count_regulations_link').retrieve | ||
t('auctions.violation_message_html', violations_count_regulations_link: link, | ||
violations_count: domains_count, | ||
ban_number_of_strikes: Setting.find_by( | ||
code: 'ban_number_of_strikes' | ||
).retrieve) | ||
end | ||
|
||
def eligible_violations_present?(domains: nil) | ||
num_of_strikes = Setting.find_by(code: 'ban_number_of_strikes').retrieve | ||
return true if domains && domains.size < num_of_strikes | ||
|
||
false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.