repositories_helper.rb revision 22297c9ed98da092bf39cc111584a7b072cffdea
1057N/Amodule RepositoriesHelper
1057N/A
1057N/A def clone_methods(visible: Repository::DEFAULT_CLONE_TYPE)
1057N/A methods = %w{git ssh-git}
1703N/A methods.map! { |method| [method, method == visible]} if visible
1057N/A methods
660N/A end
1057N/A
1057N/A# def clone_method_links
1057N/A# clone_methods.map do |clone_method|
1057N/A# clone_method_link clone_method
1057N/A# end.join(', ')
1057N/A# end
1057N/A
1057N/A def clone_method_link(method)
1057N/A link_to method, "##{method}", class: 'clone_method_link', data: {clone: method}
1057N/A end
1057N/A
1057N/A def clone_type
1057N/A params[:clone_type] || Repository::DEFAULT_CLONE_TYPE
660N/A end
3311N/A
1109N/A def repository_clone_url(repository, clone_type: 'git', port: nil)
2506N/A case clone_type
3473N/A when 'git'
3473N/A repository_tree_url(repository, protocol: 'git', port: nil) << '.git'
3473N/A when 'ssh-git'
2437N/A "git@#{Settings.hostname}:#{repository.path}.git"
2437N/A end
2437N/A end
3356N/A
3356N/A def access_change_hint
2506N/A t 'repository.access.change_hint' if resource.is_private
3473N/A end
2737N/A
2737N/A def access_options
2557N/A t('repository.access.options').select do |k,v|
2557N/A if @repository.mirror?
2557N/A k.to_s.split('_')[1] == 'r'
3421N/A else
3404N/A true
2557N/A end
3421N/A end.invert
3404N/A end
3473N/A
3404N/A def repository_modal_body
3404N/A modal_body(t("delete_repository"), t("delete_repository_desc", oms: Settings.OMS.pluralize), (controller_name == "repositories" ? resource : parent), t("repository.delete"))
2557N/A end
2557N/Aend
3421N/A