v1.0
This commit is contained in:
parent
93efff9452
commit
0f6ebcb694
317 changed files with 11347 additions and 0 deletions
2
app/helpers/admin/projects_helper.rb
Normal file
2
app/helpers/admin/projects_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module Admin::ProjectsHelper
|
||||
end
|
2
app/helpers/admin/users_helper.rb
Normal file
2
app/helpers/admin/users_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module Admin::UsersHelper
|
||||
end
|
77
app/helpers/application_helper.rb
Normal file
77
app/helpers/application_helper.rb
Normal file
|
@ -0,0 +1,77 @@
|
|||
require 'digest/md5'
|
||||
module ApplicationHelper
|
||||
def gravatar_icon(user_email)
|
||||
"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon"
|
||||
end
|
||||
|
||||
def commit_name(project, commit)
|
||||
if project.commit.id == commit.id
|
||||
"master"
|
||||
else
|
||||
commit.id
|
||||
end
|
||||
end
|
||||
|
||||
def admin_namespace?
|
||||
controller.class.name.split("::").first=="Admin"
|
||||
end
|
||||
|
||||
def projects_namespace?
|
||||
!current_page?(root_url) &&
|
||||
controller.controller_name != "keys" &&
|
||||
!admin_namespace?
|
||||
end
|
||||
|
||||
def last_commit(project)
|
||||
if project.repo_exists?
|
||||
time_ago_in_words(project.commit.committed_date) + " ago"
|
||||
else
|
||||
"Never"
|
||||
end
|
||||
end
|
||||
|
||||
def search_autocomplete_source
|
||||
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
|
||||
default_nav = [
|
||||
{ :label => "Keys", :url => keys_path },
|
||||
{ :label => "Projects", :url => projects_path },
|
||||
{ :label => "Admin", :url => admin_root_path }
|
||||
]
|
||||
|
||||
project_nav = []
|
||||
|
||||
if @project && !@project.new_record?
|
||||
project_nav = [
|
||||
{ :label => "#{@project.code} / Issues", :url => project_issues_path(@project) },
|
||||
{ :label => "#{@project.code} / Wall", :url => wall_project_path(@project) },
|
||||
{ :label => "#{@project.code} / Tree", :url => tree_project_path(@project) },
|
||||
{ :label => "#{@project.code} / Commits", :url => project_commits_path(@project) },
|
||||
{ :label => "#{@project.code} / Team", :url => team_project_path(@project) }
|
||||
]
|
||||
end
|
||||
|
||||
[projects, default_nav, project_nav].flatten.to_json
|
||||
end
|
||||
|
||||
def handle_file_type(file_name, mime_type)
|
||||
if file_name =~ /(\.rb|\.ru|\.rake|Rakefile|\.gemspec|\.rbx|Gemfile)$/
|
||||
:ruby
|
||||
elsif file_name =~ /\.py$/
|
||||
:python
|
||||
elsif file_name =~ /(\.pl|\.scala|\.c|\.cpp|\.java|\.haml|\.html|\.sass|\.scss|\.xml|\.php|\.erb)$/
|
||||
$1[1..-1].to_sym
|
||||
elsif file_name =~ /\.js$/
|
||||
:javascript
|
||||
elsif file_name =~ /\.sh$/
|
||||
:bash
|
||||
elsif file_name =~ /\.coffee$/
|
||||
:coffeescript
|
||||
elsif file_name =~ /\.yml$/
|
||||
:yaml
|
||||
elsif file_name =~ /\.md$/
|
||||
:minid
|
||||
else
|
||||
:text
|
||||
end
|
||||
end
|
||||
end
|
24
app/helpers/commits_helper.rb
Normal file
24
app/helpers/commits_helper.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
module CommitsHelper
|
||||
def diff_line(line, line_new = 0, line_old = 0)
|
||||
full_line = html_escape(line.gsub(/\n/, ''))
|
||||
color = if line[0] == "+"
|
||||
full_line = "<span class=\"old_line\"> </span><span class=\"new_line\">#{line_new}</span> " + full_line
|
||||
"#DFD"
|
||||
elsif line[0] == "-"
|
||||
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\"> </span> " + full_line
|
||||
"#FDD"
|
||||
else
|
||||
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line
|
||||
"none"
|
||||
end
|
||||
|
||||
raw "<div style=\"white-space:pre;background:#{color};\">#{full_line}</div>"
|
||||
end
|
||||
|
||||
def more_commits_link
|
||||
offset = params[:offset] || 0
|
||||
limit = params[:limit] || 100
|
||||
link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit),
|
||||
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
|
||||
end
|
||||
end
|
2
app/helpers/dashboard_helper.rb
Normal file
2
app/helpers/dashboard_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module DashboardHelper
|
||||
end
|
2
app/helpers/issues_helper.rb
Normal file
2
app/helpers/issues_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module IssuesHelper
|
||||
end
|
2
app/helpers/keys_helper.rb
Normal file
2
app/helpers/keys_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module KeysHelper
|
||||
end
|
2
app/helpers/profile_helper.rb
Normal file
2
app/helpers/profile_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module ProfileHelper
|
||||
end
|
6
app/helpers/projects_helper.rb
Normal file
6
app/helpers/projects_helper.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
module ProjectsHelper
|
||||
def view_mode_style(type)
|
||||
cookies["project_view"] ||= "tile"
|
||||
cookies["project_view"] == type ? nil : "display:none"
|
||||
end
|
||||
end
|
2
app/helpers/team_members_helper.rb
Normal file
2
app/helpers/team_members_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module TeamMembersHelper
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue