Skip to content

Commit

Permalink
WIP: url title permutations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-griffen committed Nov 20, 2023
1 parent e6c3333 commit 49f3d4c
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def new
def set_info_request
@info_request = InfoRequest
.not_embargoed
.find_by_url_title!(params[:request_id])
.find_by_url_title!(params[:url_title])

Check warning on line 54 in app/controllers/reports_controller.rb

View workflow job for this annotation

GitHub Actions / build

[rubocop] reported by reviewdog 🐶 Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains) Raw Output: app/controllers/reports_controller.rb:54:25: C: Layout/DotPosition: Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains)
end

def set_comment
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/widget_votes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def check_widget_config
end

def find_info_request
@info_request = InfoRequest.not_embargoed.find(params[:request_id])
@info_request = InfoRequest.not_embargoed.find_by(url_title: params[:url_title])

Check warning on line 41 in app/controllers/widget_votes_controller.rb

View workflow job for this annotation

GitHub Actions / build

[rubocop] reported by reviewdog 🐶 Line is too long. [84/80] (https://rubystyle.guide#max-line-length) Raw Output: app/controllers/widget_votes_controller.rb:41:81: C: Layout/LineLength: Line is too long. [84/80] (https://rubystyle.guide#max-line-length)
end

def check_prominence
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/widgets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def check_widget_config
end

def find_info_request
@info_request = InfoRequest.find(params[:request_id])
@info_request = InfoRequest.find_by(url_title: params[:url_title])
end

def check_prominence
Expand Down
2 changes: 1 addition & 1 deletion app/views/comment/_single_comment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<% link_to_this_url = comment_url(comment) %>

<% report_path =
new_request_report_path(request_id: @info_request.url_title,
new_report_path(url_title: @info_request.url_title,
comment_id: comment.id) %>

<%= render partial: 'request/correspondence_footer',
Expand Down
2 changes: 1 addition & 1 deletion app/views/reports/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>
<p><%= _("Why specifically do you consider this request unsuitable?") %></p>

<%= form_tag request_report_path(:request_id => @info_request.url_title) do %>
<%= form_tag report_path(:url_title => @info_request.url_title) do %>
<p>
<label class="form_label" for="reason"><%= _('Reason:') %></label>
<%= select_tag :reason, options_for_select(@report_reasons, @reason), :prompt => _("Choose a reason") %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/request/_act.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<% if AlaveteliConfiguration::enable_widgets %>
<div class="act_link">
<i class="act-link-icon act-link-icon--widget"></i>
<%= link_to _("Create a widget for this request"), new_request_widget_path(info_request) %>
<%= link_to _("Create a widget for this request"), new_widget_path(url_title: info_request.url_title) %>
</div>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/request/_after_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</li>
<% else %>
<li>
<%= link_to _("Report this request"), new_request_report_path(:request_id => info_request.url_title) %><span class="action-menu__info-link">
<%= link_to _("Report this request"), new_report_path(:url_title => info_request.url_title) %><span class="action-menu__info-link">
<%= link_to _("Help"), help_about_path(:anchor => "reporting") %>
</span>
</li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/request/_incoming_correspondence.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<% link_to_this_url = incoming_message_url(incoming_message) %>

<% report_path =
new_request_report_path(request_id: @info_request.url_title,
new_report_path(url_title: @info_request.url_title,
incoming_message_id: incoming_message.id) %>

<%= render partial: 'request/correspondence_footer',
Expand Down
2 changes: 1 addition & 1 deletion app/views/request/_outgoing_correspondence.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<% link_to_this_url = outgoing_message_url(outgoing_message) %>

<% report_path =
new_request_report_path(request_id: @info_request.url_title,
new_report_path(url_title: @info_request.url_title,
outgoing_message_id: outgoing_message.id) %>

<%= render partial: 'request/correspondence_footer',
Expand Down
4 changes: 2 additions & 2 deletions app/views/widgets/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<%= _("To add a widget for <b>{{info_request_title}}</b>, copy and paste " \
"the following code to your web page:",
:info_request_title => @info_request.title) %>
<textarea autofocus readonly rows='4' cols='60' id='widgetbox'><iframe src='<%= request_widget_url(@info_request) %>' width='320' height='215' frameborder='0' marginwidth='0' marginheight='0'></iframe></textarea>
<textarea autofocus readonly rows='4' cols='60' id='widgetbox'><iframe src='<%= widget_url(url_title: @info_request.url_title) %>' width='320' height='215' frameborder='0' marginwidth='0' marginheight='0'></iframe></textarea>

</p>

<p>
<%= _("The widget will look like this:") %>
<br>
<iframe src='<%= request_widget_url(@info_request) %>' width='320' height='215' frameborder='0' marginwidth='0' marginheight='0'></iframe>
<iframe src='<%= widget_url(url_title: @info_request.url_title) %>' width='320' height='215' frameborder='0' marginwidth='0' marginheight='0'></iframe>
</p>
2 changes: 1 addition & 1 deletion app/views/widgets/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<%= _('I also want to know!') %>
<% end %>
<% else %>
<%= form_tag request_widget_votes_url(@info_request),
<%= form_tag widget_votes_url(url_title: @info_request.url_title),
:method => 'post', :target => '_top' do %>
<%= submit_tag _('I also want to know!'),
:class => 'alaveteli-widget__bottom__action alaveteli-widget__button--create-vote',
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def matches?(request)
end
get '/health_checks' => redirect('/health/checks')

resources :request, :only => [] do
scope path: 'request/:url_title' do
resource :report, :only => [:new, :create]
resource :widget, :only => [:new, :show]
resources :widget_votes, :only => [:create]
Expand Down
Loading

0 comments on commit 49f3d4c

Please sign in to comment.