@@ -60,10 +60,12 @@ role {
6060 my $model = $self -> config-> {model };
6161 my $entity ;
6262 my %props ;
63+ my %edit_arguments = $params -> edit_arguments-> ($self , $c );
6364
64- if ($model eq ' Event' || $model eq ' Genre' ) {
65+ if ($model eq ' Event' || $model eq ' Genre' || $model eq ' Recording ' ) {
6566 my $type = model_to_type($model );
66- my $form = $c -> form( form => $params -> form );
67+ my %form_args = %{ $edit_arguments {form_args } || {}};
68+ my $form = $c -> form( form => $params -> form, ctx => $c , %form_args );
6769 %props = ( form => $form -> TO_JSON );
6870
6971 $c -> stash(
@@ -98,23 +100,29 @@ role {
98100 delete $c -> flash-> {message };
99101 },
100102 pre_validation => sub {
103+ my $form = shift ;
104+
101105 if ($model eq ' Event' ) {
102- my $form = shift ;
103106 my %event_descriptions = map {
104107 $_ -> id => $_ -> l_description
105108 } $c -> model(' EventType' )-> get_all();
106109
107110 $props {eventTypes } = $form -> options_type_id;
108111 $props {eventDescriptions } = \%event_descriptions ;
109112 }
113+
114+ if ($model eq ' Recording' ) {
115+ $props {usedByTracks } = $form -> used_by_tracks;
116+ }
117+
110118 },
111119 redirect => sub {
112120 $c -> response-> redirect($c -> uri_for_action(
113121 $self -> action_for(' show' ), [ $entity -> gid ]));
114122 },
115123 no_redirect => $args {within_dialog },
116124 edit_rels => 1,
117- $params -> edit_arguments-> ( $self , $c ) ,
125+ % edit_arguments ,
118126 );
119127 };
120128};
0 commit comments