different style for required fields
wreis [Thu, 14 Feb 2008 03:15:30 +0000 (03:15 +0000)]
lib/Reaction/UI/Widget/Field/Mutable.pm
share/skin/default/layout/field/mutable.tt

index 7547799..e323c33 100644 (file)
@@ -17,6 +17,14 @@ class Mutable is 'Reaction::UI::Widget::Field', which {
      }
    };
 
+   implements fragment field_is_required {
+     if ( $_{viewport}->attribute->is_required ) {
+         render 'field_is_required_yes';
+     } else {
+         render 'field_is_required_no';
+     }
+   };
+
 };
 
 1;
index c4b3205..674d33a 100644 (file)
@@ -4,7 +4,13 @@
 
 =for layout label
 
-<label for="[%field_id%]">[% label %]:</label>
+<label for="[%field_id%]" [% field_is_required %]>[% label %]:</label>
+
+=for layout field_is_required_yes
+
+class="required_field"
+
+=for layout field_is_required_no
 
 =for layout field