Skip to content

Commit

Permalink
Only append cobrand_data to URI if present.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Jun 5, 2013
1 parent 3269d92 commit a8e7842
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 19 deletions.
8 changes: 4 additions & 4 deletions t/app/controller/admin.t
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,13 @@ subtest 'report search' => sub {

$mech->content_contains( $report->title );
my $r_id = $report->id;
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id</a>} );
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id</a>} );

$mech->get_ok('/admin/reports?search=' . $report->user->email);

my $u_id = $update->id;
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id</a>} );
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/#update_$u_id">$u_id</a>} );
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id</a>} );
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id#update_$u_id">$u_id</a>} );

$update->state('hidden');
$update->update;
Expand All @@ -1056,7 +1056,7 @@ subtest 'report search' => sub {
$report->update;

$mech->get_ok('/admin/reports?search=' . $report->user->email);
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id</a>} );
$mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id</a>} );
};

subtest 'search abuse' => sub {
Expand Down
12 changes: 9 additions & 3 deletions templates/web/default/admin/list_updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ <h2>[% loc('Updates') %]</h2>
[% FOREACH update IN updates -%]
<tr[% ' class="adminhidden"' IF update.state == 'hidden' || update.problem.state == 'hidden' %]>
<td>[%- IF update.state == 'confirmed' && update.problem.state != 'hidden' -%]
[%- cobrand_data = update.cobrand_data %]
[%- cobrand_data = c.data_for_generic_update IF !update.cobrand %]
<a href="[% c.uri_for_email( '/report', update.problem.id, cobrand_data ) %]#update_[% update.id %]">[% update.id %]</a>
[%- cobrand_data = update.cobrand_data;
cobrand_data = c.data_for_generic_update IF !update.cobrand;
IF cobrand_data;
uri = c.uri_for_email( '/report', update.problem.id, cobrand_data );
ELSE;
uri = c.uri_for_email( '/report', update.problem.id );
END;
%]
<a href="[% uri %]#update_[% update.id %]">[% update.id %]</a>
[%- ELSE %]
[%- update.id %]
[%- END -%]</td>
Expand Down
12 changes: 9 additions & 3 deletions templates/web/default/admin/problem_row.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
[%- FOR problem IN problems %]
<tr[% ' class="adminhidden"' IF problem.state == 'hidden' %]>
<td class="record-id">[%- IF problem.is_visible -%]
[%- cobrand_data = problem.cobrand_data %]
[%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
<a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% problem.id %]</a>
[%- cobrand_data = problem.cobrand_data;
cobrand_data = c.data_for_generic_problem IF !problem.cobrand;
IF cobrand_data;
uri = c.uri_for_email( '/report', problem.id, cobrand_data );
ELSE;
uri = c.uri_for_email( '/report', problem.id );
END;
%]
<a href="[% uri %]">[% problem.id %]</a>
[%- ELSE %]
[%- problem.id %]
[%- END -%]</td>
Expand Down
12 changes: 9 additions & 3 deletions templates/web/default/admin/report_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
<input type="hidden" name="token" value="[% token %]" >
<input type="hidden" name="submit" value="1" >
<ul>
[%- cobrand_data = problem.cobrand_data %]
[%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
<li><a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% loc('View report on site' )%]</a></li>
[%- cobrand_data = problem.cobrand_data;
cobrand_data = c.data_for_generic_problem IF !problem.cobrand;
IF cobrand_data;
uri = c.uri_for_email( '/report', problem.id, cobrand_data );
ELSE;
uri = c.uri_for_email( '/report', problem.id );
END;
%]
<li><a href="[% uri %]">[% loc('View report on site' )%]</a></li>
<li><label for='title'>[% loc('Subject:') %]</label> <input size=60 type='text' id='title' name='title' value='[% problem.title | html %]'></li>
<li><label for='detail'>[% loc('Details:') %]</label>
<textarea name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li>
Expand Down
6 changes: 3 additions & 3 deletions templates/web/default/admin/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ <h2>[% curdate %]</h2>
[% CASE 'problemCreated' %]
[%- tprintf(loc('Problem %d created'), item.obj.id) %]; [% PROCESS problem_name problem=item.obj -%]
[% CASE 'problemConfirmed' %]
[%- tprintf( loc('Problem %s confirmed'), '<a href="' _ c.uri_for_email( '/report', item.obj.id, c.cobrand_data ) _ '">' _ item.obj.id _ '</a>') %]; [% PROCESS problem_name problem=item.obj -%]
[%- tprintf( loc('Problem %s confirmed'), '<a href="' _ c.uri_for_email( '/report', item.obj.id ) _ '">' _ item.obj.id _ '</a>') %]; [% PROCESS problem_name problem=item.obj -%]
[% CASE 'problemSent' %]
[% tprintf(loc("Problem %s sent to council %s"), '<a href="' _ c.uri_for_email( '/report', item.obj.id, c.cobrand_data ) _ '">' _ item.obj.id _ '</a>', item.obj.bodies_str ) %]
[% tprintf(loc("Problem %s sent to council %s"), '<a href="' _ c.uri_for_email( '/report', item.obj.id ) _ '">' _ item.obj.id _ '</a>', item.obj.bodies_str ) %]
[% CASE 'quesSent' %]
[% tprintf(loc("Questionnaire %d sent for problem %d"), item.obj.id, item.obj.problem_id ) %]
[% CASE 'quesAnswered' %]
[% tprintf(loc("Questionnaire %d answered for problem %d, %s to %s"), item.obj.id, item.obj.problem_id, item.obj.old_state, item.obj.new_state ) %]
[% CASE 'update' %]
[% name = ( item.obj.name || 'anonymous' ) | html %]
[% tprintf(loc("Update %s created for problem %d; by %s"), "<a href='" _ c.uri_for_email( '/report', item.obj.problem_id, c.cobrand_data ) _ "#update_" _ item.obj.id _ "'>" _ item.obj.id _ "</a>", item.obj.problem_id, name) %] &lt;[% item.obj.user.email | html %]&gt;
[% tprintf(loc("Update %s created for problem %d; by %s"), "<a href='" _ c.uri_for_email( '/report', item.obj.problem_id ) _ "#update_" _ item.obj.id _ "'>" _ item.obj.id _ "</a>", item.obj.problem_id, name) %] &lt;[% item.obj.user.email | html %]&gt;
[% CASE 'alertSub' %]
[% tprintf(loc("Alert %d created for %s, type %s, parameters %s / %s"), item.obj.id, item.obj.user.email, item.obj.alert_type.ref, item.obj.parameter, item.obj.parameter2) | html %]
[% CASE 'alertDel' %]
Expand Down
12 changes: 9 additions & 3 deletions templates/web/default/admin/update_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
<input type="hidden" name="token" value="[% token %]" >
<input type="hidden" name="submit" value="1" >
<ul>
[%- cobrand_data = update.cobrand_data %]
[%- cobrand_data = c.data_for_generic_update IF !update.cobrand %]
<li><a href="[% c.uri_for_email( '/report', update.problem_id, cobrand_data ) %]#update_[% update.id %]">[% loc('View report on site' )%]</a></li>
[%- cobrand_data = update.cobrand_data;
cobrand_data = c.data_for_generic_update IF !update.cobrand;
IF cobrand_data;
uri = c.uri_for_email( '/report', update.problem_id, cobrand_data );
ELSE;
uri = c.uri_for_email( '/report', update.problem_id );
END;
%]
<li><a href="[% uri %]#update_[% update.id %]">[% loc('View report on site' )%]</a></li>

<li><label for='detail'>[% loc('Text:') %]</label>
<textarea name='text' id='text' cols=60 rows=10>[% update.text | html %]</textarea></li>
Expand Down

0 comments on commit a8e7842

Please sign in to comment.