lib/generators/schofield/attribute.rb in schofield-0.2.1 vs lib/generators/schofield/attribute.rb in schofield-0.2.2
- old
+ new
@@ -61,13 +61,24 @@
def actual_name
@attachment_name || @model_name || @name
end
def to_column
+ "'#{actual_name.humanize}', lambda { |x| " +
case
- when image? then "'#{actual_name.humanize} ', lambda { |x| image_tag(x.#{@attachment_name}.url(:thumbnail), :alt => '', :class => 'thumbnail') }"
+ when image? then "image_tag(x.#{@attachment_name}.url(:thumbnail), :alt => '', :class => 'thumbnail')"
when attachment? then "link_to('#{actual_name.humanize}', x.#{@attachment_name}.url)"
- else "'#{actual_name.humanize}', lambda { |x| x.#{actual_name} }"
+ else "x.#{actual_name}"
+ end + ' }'
+ end
+
+ def weight
+ case
+ when image? then 1
+ when @name == 'name' then 2
+ when @name == 'title' then 3
+ when reference? then 4
+ else 5
end
end
end
\ No newline at end of file