Merge branch 'master' into next
This commit is contained in:
commit
d3700e6201
471 changed files with 490115 additions and 102173 deletions
|
@ -17,44 +17,6 @@ module ApplicationHelper
|
|||
link_to(image_tag("RSS.png", :size => "16x16", :border => 0), Hash[*args], :class => "rsssmall")
|
||||
end
|
||||
|
||||
def style_rules
|
||||
css = ""
|
||||
|
||||
css << ".hidden { display: none !important }"
|
||||
css << ".hide_unless_logged_in { display: none !important }" unless current_user
|
||||
css << ".hide_if_logged_in { display: none !important }" if current_user
|
||||
css << ".hide_if_user_#{current_user.id} { display: none !important }" if current_user
|
||||
css << ".show_if_user_#{current_user.id} { display: inline !important }" if current_user
|
||||
css << ".hide_unless_administrator { display: none !important }" unless current_user && current_user.administrator?
|
||||
css << ".hide_unless_moderator { display: none !important }" unless current_user && current_user.moderator?
|
||||
|
||||
content_tag(:style, css, :type => "text/css")
|
||||
end
|
||||
|
||||
def if_logged_in(tag = :div, &block)
|
||||
content_tag(tag, capture(&block), :class => "hide_unless_logged_in")
|
||||
end
|
||||
|
||||
def if_not_logged_in(tag = :div, &block)
|
||||
content_tag(tag, capture(&block), :class => "hide_if_logged_in")
|
||||
end
|
||||
|
||||
def if_user(user, tag = :div, &block)
|
||||
content_tag(tag, capture(&block), :class => "hidden show_if_user_#{user.id}") if user
|
||||
end
|
||||
|
||||
def unless_user(user, tag = :div, &block)
|
||||
if user
|
||||
content_tag(tag, capture(&block), :class => "hide_if_user_#{user.id}")
|
||||
else
|
||||
content_tag(tag, capture(&block))
|
||||
end
|
||||
end
|
||||
|
||||
def if_administrator(tag = :div, &block)
|
||||
content_tag(tag, capture(&block), :class => "hide_unless_administrator")
|
||||
end
|
||||
|
||||
def richtext_area(object_name, method, options = {})
|
||||
id = "#{object_name}_#{method}"
|
||||
type = options.delete(:format) || "markdown"
|
||||
|
|
|
@ -163,7 +163,7 @@ module BrowseHelper
|
|||
# The simple wikidata-tag (this is limited to only one value)
|
||||
if key == "wikidata" && value =~ /^[Qq][1-9][0-9]*$/
|
||||
return [{
|
||||
:url => "//www.wikidata.org/wiki/#{value}?uselang=#{I18n.locale}",
|
||||
:url => "//www.wikidata.org/entity/#{value}?uselang=#{I18n.locale}",
|
||||
:title => value
|
||||
}]
|
||||
# Key has to be one of the accepted wikidata-tags
|
||||
|
@ -172,7 +172,7 @@ module BrowseHelper
|
|||
value =~ /^[Qq][1-9][0-9]*(\s*;\s*[Qq][1-9][0-9]*)*$/
|
||||
# Splitting at every semicolon to get a separate hash for each wikidata-ID
|
||||
return value.split(";").map do |id|
|
||||
{ :title => id, :url => "//www.wikidata.org/wiki/#{id.strip}?uselang=#{I18n.locale}" }
|
||||
{ :title => id, :url => "//www.wikidata.org/entity/#{id.strip}?uselang=#{I18n.locale}" }
|
||||
end
|
||||
end
|
||||
nil
|
||||
|
|
|
@ -7,19 +7,19 @@ module UserBlocksHelper
|
|||
# if the block hasn't expired yet show the date, if the user just needs to login show that
|
||||
if block.needs_view?
|
||||
if block.ends_at > Time.now.getutc
|
||||
I18n.t("user_block.helper.time_future_and_until_login", :time => friendly_date(block.ends_at)).html_safe
|
||||
I18n.t("user_blocks.helper.time_future_and_until_login", :time => friendly_date(block.ends_at)).html_safe
|
||||
else
|
||||
I18n.t("user_block.helper.until_login")
|
||||
I18n.t("user_blocks.helper.until_login")
|
||||
end
|
||||
else
|
||||
I18n.t("user_block.helper.time_future", :time => friendly_date(block.ends_at)).html_safe
|
||||
I18n.t("user_blocks.helper.time_future", :time => friendly_date(block.ends_at)).html_safe
|
||||
end
|
||||
else
|
||||
# the max of the last update time or the ends_at time is when this block finished
|
||||
# either because the user viewed the block (updated_at) or it expired or was
|
||||
# revoked (ends_at)
|
||||
last_time = [block.ends_at, block.updated_at].max
|
||||
I18n.t("user_block.helper.time_past", :time => friendly_date(last_time)).html_safe
|
||||
I18n.t("user_blocks.helper.time_past", :time => friendly_date(last_time)).html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue