lib/rich/cms/content/item.rb in rich_cms-3.0.0 vs lib/rich/cms/content/item.rb in rich_cms-3.0.1

- old
+ new

@@ -57,19 +57,26 @@ if class_name = @group.selector.match(/^\.\w+$/) (options[:html] ||= {}).store :class, [class_name.to_s.gsub(/^\./, ""), options[:html].try(:fetch, :class, nil)].compact.join(" ") end - attrs << options[:html].collect{|k, v| "#{k}=\"#{::ERB::Util.html_escape v}\""}.join(" ") if options[:html] attrs << data .collect{|k, v| "data-#{k}=\"#{::ERB::Util.html_escape v}\""}.join(" ") end + attrs << options[:html].collect{|k, v| "#{k}=\"#{::ERB::Util.html_escape v}\""}.join(" ") if options[:html] + tag = options[:tag] || @group.tag || (%w(text html).include?(options[:as].to_s.downcase) ? :div : :span) - "<#{tag} #{attrs.join(" ")}>#{value.blank? ? default : value}</#{tag}>".html_safe + if options[:tag] == :none && !Auth.can_edit?(@object) + "#{value.blank? ? default : value}" + else + # Make default for editable + tag = :span if tag == :none + "<#{tag} #{attrs.join(" ")}>#{value.blank? ? default : value}</#{tag}>".html_safe + end end end end end -end \ No newline at end of file +end