sync
This commit is contained in:
@@ -1,2 +1,28 @@
|
||||
module AdvertisementsHelper
|
||||
def render_advertisement(ad_type)
|
||||
if Danbooru.config.can_user_see_ads?(CurrentUser.user)
|
||||
@advertisement = Advertisement.find(:first, :conditions => ["ad_type = ? AND status = 'active'", ad_type], :order => "random()")
|
||||
content_tag(
|
||||
"div",
|
||||
link_to_remote(
|
||||
image_tag(
|
||||
@advertisement.image_url,
|
||||
:alt => "Advertisement",
|
||||
:width => @advertisement.width,
|
||||
:height => @advertisement.height
|
||||
),
|
||||
advertisement_hit_path(:advertisement_id => @advertisement.id),
|
||||
:style => "margin-bottom: 1em;"
|
||||
)
|
||||
)
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def render_rss_advertisement
|
||||
if Danbooru.config.can_user_see_ads?(CurrentUser.user)
|
||||
render :partial => "static/jlist_rss_ads"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,6 +12,16 @@ module ApplicationHelper
|
||||
def format_text(text, options = {})
|
||||
DText.parse(text)
|
||||
end
|
||||
|
||||
def error_messages_for(instance_name)
|
||||
instance = instance_variable_get("@#{instance_name}")
|
||||
|
||||
if instance.errors.any?
|
||||
%{<div class="error-messages"><h1>There were errors</h1><p>#{instance.__send__(:errors).full_messages.join(", ")}</div>}.html_safe
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
def nav_link_match(controller, url)
|
||||
|
||||
@@ -1,2 +1,17 @@
|
||||
module ArtistsHelper
|
||||
def link_to_artist(name)
|
||||
artist = Artist.find_by_name(name)
|
||||
|
||||
if artist
|
||||
link_to(artist.name, artist_path(artist))
|
||||
else
|
||||
link_to(name, new_artist_path(:name => name)) + " " + content_tag("span", "*", :class => "new-artist")
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_artists(names)
|
||||
names.map do |name|
|
||||
link_to_artist(name)
|
||||
end.join(", ").html_safe
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user