<commit_before># app/helpers/link_to_helper.rb:
# This module is included into all controllers via controllers/application.rb
# -
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: <EMAIL>; WWW: http://www.mysociety.org/

module LinkToHelper

    # Links to various models

    # Requests
    def request_url(info_request, extra_params={})
        params = {:url_title => info_request.url_title, :only_path => true}
        return show_request_url(params.merge(extra_params))
    end

    def request_link(info_request, cls=nil )
        link_to h(info_request.title), request_url(info_request), :class => cls
    end

    def request_admin_url(info_request)
        return admin_url('request/show/' + info_request.id.to_s)
    end

    def request_admin_link(info_request, name="admin", cls=nil)
      link_to name, request_admin_url(info_request), :class => cls
    end

    def request_both_links(info_request)
        link_to(h(info_request.title), main_url(request_url(info_request))) + " (" + link_to("admin", request_admin_url(info_request)) + ")"
    end

    def request_similar_url(info_request)
        return similar_request_url(:url_title => info_request.url_title, :only_path => true)
    end

    def request_details_path(info_request)
        return details_request_url(:url_title => info_request.url_title, :only_path => true)
    end

    # Incoming / outgoing messages
    def incoming_message_url(incoming_message)
        return request_url(incoming_message.info_request)+"#incoming-"+incoming_message.id.to_s
    end

    def outgoing_message_url(outgoing_message)
        return request_url(outgoing_message.info_request)+"#outgoing-"+outgoing_message.id.to_s
    end

    def comment_url(comment)
        return request_url(comment.info_request)+"#comment-"+comment.id.to_s
    end

    # Respond to request
    def respond_to_last_url(info_request, options = {})
        last_response = info_request.get_last_response
        if last_response.nil?
            show_response_no_followup_url(options.merge(:id => info_request.id))
        else
            show_response_url(options.merge(:id => info_request.id, :incoming_message_id => last_response.id))
        end
    end

    def respond_to_last_path(info_request)
        respond_to_last_url(info_request, :only_path => true)
    end

    # Public bodies
    def public_body_url(public_body)<commit_msg>Add options parameter to url helpers<commit_after># app/helpers/link_to_helper.rb:
# This module is included into all controllers via controllers/application.rb
# -
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: <EMAIL>; WWW: http://www.mysociety.org/

module LinkToHelper

    # Links to various models

    # Requests
    def request_url(info_request, extra_params={})
        params = {:url_title => info_request.url_title, :only_path => true}
        return show_request_url(params.merge(extra_params))
    end

    def request_link(info_request, cls=nil )
        link_to h(info_request.title), request_url(info_request), :class => cls
    end

    def request_admin_url(info_request)
        return admin_url('request/show/' + info_request.id.to_s)
    end

    def request_admin_link(info_request, name="admin", cls=nil)
      link_to name, request_admin_url(info_request), :class => cls
    end

    def request_both_links(info_request)
        link_to(h(info_request.title), main_url(request_url(info_request))) + " (" + link_to("admin", request_admin_url(info_request)) + ")"
    end

    def request_similar_url(info_request)
        return similar_request_url(:url_title => info_request.url_title, :only_path => true)
    end

    def request_details_path(info_request)
        return details_request_url(:url_title => info_request.url_title, :only_path => true)
    end

    # Incoming / outgoing messages
    def incoming_message_url(incoming_message, options = {})
        return request_url(incoming_message.info_request, options.merge(:anchor => "incoming-#{incoming_message.id}"))
    end

    def outgoing_message_url(outgoing_message, options = {})
        return request_url(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}"))
    end

    def comment_url(comment, options = {})
        return request_url(comment.info_request, options.merge(:anchor => "comment-#{comment.id}"))
    end

    # Respond to request
    def respond_to_last_url(info_request, options = {})
        last_response = info_request.get_last_response
        if last_response.nil?
            show_response_no_followup_url(options.merge(:id => info_request.id))
        else
            show_response_url(options.merge(:id => info_request.id, :incoming_message_id => last_response.id))
        end
    end

    def respond_to_last_path(info_request)
        respond_to_last_url(info_request, :only_path => true)
    end

    # Public bodies
    def public_body_url(public_body)
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.0016129032258064516, 'mean_word_length': 3.835282651072125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7434198', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1541, 'n_words': 289}