Permalink
Browse files

typus_table_position_field now uses first/last methods when acts_as_l…

…ist is enabled, it disables up/down links when the item is first or last in the list.

Signed-off-by: Francesc Esplugas <francesc@intraducibles.com>
  • Loading branch information...
1 parent 46300fc commit f1c4592c2832990ae91b9a0516f05caa38b4f68c Luqman Amjad committed with Francesc Esplugas Aug 20, 2009
@@ -167,14 +167,14 @@ def typus_table_position_field(attribute, item)
:id => item.id,
:go => position.last }
- html_position << <<-HTML
-#{link_to _(position.first), params.merge(options)}
- HTML
-
+ first_or_last = (item.respond_to?(:first?) && (position.last == 'move_higher' && item.first?)) || (item.respond_to?(:last?) && (position.last == 'move_lower' && item.last?))
+ html_position << link_to_unless(first_or_last, _(position.first), params.merge(options)) do |name|
+ %(<span class="inactive">#{name}</span>)
+ end
end
<<-HTML
-<td>#{html_position.join('/ ')}</td>
+<td>#{html_position.join(' / ')}</td>
HTML
end
@@ -421,6 +421,10 @@ a.on {
vertical-align: top;
}
+ #content table.typus span.inactive {
+ color: #888;
+ }
+
/* @end */
/* @group Rails Errors */

0 comments on commit f1c4592

Please sign in to comment.