Merge branch 'master' into budget
This commit is contained in:
@@ -5,7 +5,7 @@ module AdminHelper
|
||||
end
|
||||
|
||||
def official_level_options
|
||||
options = [["",0]]
|
||||
options = [["", 0]]
|
||||
(1..5).each do |i|
|
||||
options << [[t("admin.officials.level_#{i}"), setting["official_level_#{i}_name"]].compact.join(': '), i]
|
||||
end
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module BannersHelper
|
||||
|
||||
def has_banners
|
||||
@banners.count > 0
|
||||
end
|
||||
|
||||
end
|
||||
@@ -39,4 +39,5 @@ module CommentsHelper
|
||||
"" # Default not author class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,6 +1,7 @@
|
||||
module DebatesHelper
|
||||
|
||||
def has_featured?
|
||||
def has_featured?
|
||||
Debate.all.featured.count > 0
|
||||
end
|
||||
|
||||
end
|
||||
@@ -9,15 +9,15 @@ module EmbedVideosHelper
|
||||
end
|
||||
|
||||
if server == "Vimeo"
|
||||
regExp = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/
|
||||
reg_exp = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/
|
||||
src = "https://player.vimeo.com/video/"
|
||||
elsif server == "YouTube"
|
||||
regExp = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
|
||||
reg_exp = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
|
||||
src = "https://www.youtube.com/embed/"
|
||||
end
|
||||
|
||||
if regExp
|
||||
match = link.match(regExp)
|
||||
if reg_exp
|
||||
match = link.match(reg_exp)
|
||||
end
|
||||
|
||||
if match and match[2]
|
||||
|
||||
@@ -26,4 +26,4 @@ module FlagsHelper
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
8
app/helpers/locales_helper.rb
Normal file
8
app/helpers/locales_helper.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
module LocalesHelper
|
||||
|
||||
def name_for_locale(locale)
|
||||
default = I18n.t("locale", locale: locale)
|
||||
I18n.backend.translate(locale, "i18n.language.name", default: default)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,2 @@
|
||||
module NotificationsHelper
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -2,19 +2,19 @@ module ProposalsHelper
|
||||
|
||||
def progress_bar_percentage(proposal)
|
||||
case proposal.cached_votes_up
|
||||
when 0 then 0
|
||||
when 1..Proposal.votes_needed_for_success then (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success).floor
|
||||
else 100
|
||||
when 0 then 0
|
||||
when 1..Proposal.votes_needed_for_success then (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success).floor
|
||||
else 100
|
||||
end
|
||||
end
|
||||
|
||||
def supports_percentage(proposal)
|
||||
percentage = (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success)
|
||||
case percentage
|
||||
when 0 then "0%"
|
||||
when 0..(0.1) then "0.1%"
|
||||
when (0.1)..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1)
|
||||
else "100%"
|
||||
when 0 then "0%"
|
||||
when 0..(0.1) then "0.1%"
|
||||
when (0.1)..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1)
|
||||
else "100%"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -8,4 +8,4 @@ module SettingsHelper
|
||||
@all_settings ||= Hash[ Setting.all.map{|s| [s.key, s.value.presence]} ]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -20,4 +20,5 @@ module StatsHelper
|
||||
opt[:data][:graph] = admin_api_stats_path(spending_proposals: true)
|
||||
content_tag :div, "", opt
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
module TracksHelper
|
||||
|
||||
def track_event(data={})
|
||||
track_data = ""
|
||||
prefix = " data-track-event-"
|
||||
@@ -9,4 +10,5 @@ module TracksHelper
|
||||
track_data
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user