# -*- coding: utf-8 -*- <% Rails.logger.warn "'titleize' is a deprecated attribute of the 'you' tag. Please, use 'capitalize' instead." -%> <% raise ArgumentError, "You can add only one attribute-key to the 'you' tag." if attributes.size > 1 -%> <% k = case when attributes[:have] then 'have' when attributes[:are] then 'are' when attributes[:do] then 'do' end -%> <%= s = t("tags.you.current_user.#{k || attributes.keys.first || 'default'}",:default=>"you #{k}") (titleize||capitalize) ? s.sub(/^./){|c| c.upcase} : s %> <%= s = t("tags.you.other_user.#{k || attributes.keys.first || 'default'}", :name=>name(:no_wrapper => true), :default=>"#{name(:no_wrapper => true)} #{'has' if attributes[:have]}#{'is' if attributes[:are]}#{'does' if attributes[:do]}") (titleize||capitalize) ? s.sub(/^./){|c| c.upcase} : s %> <%= key ||= 'default' name ||= name(:no_wrapper => true) # prepare symbolized attributes for merging attrs = {} attributes.each_pair{|k,v| attrs[k.to_sym] = v} d = "#{name}'#{'s' unless name.ends_with?('s')} #{all_parameters.default}" options = {:default=>[d], :count=>(attrs[:count]||1), :name=>name} your_key = key.split('.').last unless key.eql?(your_key) || attrs.has_key?(your_key.to_sym) options[your_key.to_sym] = t(key, :count=>options[:count], :default=>your_key.titleize) end s = if this == current_user options[:default].unshift :"tags.your.default.current_user" t("tags.your.#{your_key}.current_user", options.merge(attrs)) else options[:default].unshift :"tags.your.default.other_user" t("tags.your.#{your_key}.other_user", options.merge(attrs)) end capitalize ? s.sub(/^./){|c| c.upcase} : s %>