Module: RailsInfo::VersionControlHelper

Defined in:
app/helpers/rails_info/version_control_helper.rb

Instance Method Summary collapse

Instance Method Details



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/rails_info/version_control_helper.rb', line 8

def version_control_diff_link(path, rev)
  rev = params['rev'] || rev
  rev_to = params['rev_to'] || @filter.previous_revision_by_file[path]
  
  #url = 'https://projects.mtvnn.com/projects/' + @filter.project_slug + '/repository'
  
  url = if rev == rev_to 
    'https://projects.mtvnn.com/projects/' + @filter.project_slug + '/repository/revisions/' + rev + '/entry/' + path
  else 
    #'/diff/' + path + '?rev=' + rev + '&rev_to=' + rev_to
    "/rails/info/version_control/diffs/new?repository_path=#{@filter.repository_path}&path=#{path}&rev=#{rev}&rev_to=#{rev_to}"
  end
  
  link_to 'Diff', url, class: 'modal_link diff', target: '_blank'
end


24
25
26
27
28
29
30
31
# File 'app/helpers/rails_info/version_control_helper.rb', line 24

def version_control_file_revision_link(text, rev, path, options = {})
  method = options[:method] ? options[:method] : 'entry'
  
  url = 'https://projects.mtvnn.com/projects/' + @filter.project_slug + '/repository'
  url += '/revisions/' + rev + '/' + method + '/' + path
  
  link_to text, url, target: '_blank'
end

#version_control_path_id(path) ⇒ Object

replaces / and . by underscore



4
5
6
# File 'app/helpers/rails_info/version_control_helper.rb', line 4

def version_control_path_id(path)
  path.gsub(/\/|\./, '_')
end