From 16b49124be59aa74a35f855fd4e0d75f100051de Mon Sep 17 00:00:00 2001 From: Andrey Vakarev Date: Sun, 3 Jun 2012 22:27:34 +0300 Subject: [PATCH 1/2] Remove unused methods --- app/helpers/application_helper.rb | 39 +------------------------------ app/helpers/commits_helper.rb | 15 ------------ app/helpers/dashboard_helper.rb | 34 --------------------------- app/helpers/issues_helper.rb | 6 ----- app/helpers/projects_helper.rb | 20 ---------------- 5 files changed, 1 insertion(+), 113 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4b0e642c..85595c1e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -8,10 +8,6 @@ module ApplicationHelper "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon" end - def fixed_mode? - true - end - def request_protocol request.ssl? ? "https" : "http" end @@ -20,32 +16,6 @@ module ApplicationHelper "#{request_protocol}://#{GIT_HOST["host"]}/" end - def body_class(default_class = nil) - main = content_for(:body_class).blank? ? - default_class : - content_for(:body_class) - - [main, "collapsed"].join(" ") - 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" @@ -62,7 +32,7 @@ module ApplicationHelper [ "Tag", @project.tags ] ] - # If reference is commit id - + # If reference is commit id - # we should add it to branch/tag selectbox if(@ref && !options.flatten.include?(@ref) && @ref =~ /^[0-9a-zA-Z]{6,52}$/) @@ -114,10 +84,6 @@ module ApplicationHelper Devise.omniauth_providers.include?(:ldap) end - def layout - controller.send :_layout - end - def app_theme if current_user && current_user.theme_id == 1 "ui_basic" @@ -126,7 +92,4 @@ module ApplicationHelper end end - def string_to_utf8 str - Gitlab::Encode.utf8 str - end end diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index e9bd542c..a314f387 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -1,19 +1,4 @@ module CommitsHelper - def old_line_number(line, i) - - end - - def new_line_number(line, i) - - 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 - def commit_msg_with_link_to_issues(project, message) return '' unless message out = '' diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index 55ed901c..a94ddfc2 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -1,36 +1,2 @@ module DashboardHelper - def dashboard_feed_path(project, object) - case object.class.name.to_s - when "Issue" then project_issue_path(project, project.issues.find(object.id)) - when "Commit" then project_commit_path(project, project.repo.commits(object.id).first) - when "MergeRequest" then project_merge_request_path(project, object.id) - when "Note" - then - note = object - case note.noteable_type - when "Issue" then project_issue_path(project, note.noteable_id) - when "Snippet" then project_snippet_path(project, note.noteable_id) - when "Commit" then project_commit_path(project, :id => note.noteable_id) - when "MergeRequest" then project_merge_request_path(project, note.noteable_id) - else wall_project_path(project) - end - else wall_project_path(project) - end - rescue - "#" - end - - def dashboard_feed_title(object) - klass = object.class.to_s.split("::").last - - title = case klass - when "Note" then markdown(object.note) - when "Issue" then object.title - when "Commit" then object.safe_message - when "MergeRequest" then object.title - else return "Project Wall" - end - - truncate(sanitize(title, :tags => []), :length => 60) - end end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index d902be0e..ba953ed3 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -1,10 +1,4 @@ module IssuesHelper - def sort_class - if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0") - "handle" - end - end - def project_issues_filter_path project, params = {} params[:f] ||= cookies['issue_filter'] project_issues_path project, params diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index f864f6aa..db5c5ce1 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,22 +1,2 @@ module ProjectsHelper - def view_mode_style(type) - cookies["project_view"] ||= "tile" - cookies["project_view"] == type ? nil : "display:none" - end - - def load_note_parent(id, type, project) - case type - when "Issue" then @project.issues.find(id) - when "Commit" then @project.repo.commits(id).first - when "Snippet" then @project.snippets.find(id) - else - true - end - rescue - nil - end - - def repository_tab_class - end - end From 6ee4548c9912b2d52576f9dc06abe8c76074bc50 Mon Sep 17 00:00:00 2001 From: Andrey Vakarev Date: Sun, 3 Jun 2012 22:32:40 +0300 Subject: [PATCH 2/2] Removed empty helpers (probably auto-generated) --- app/helpers/admin/projects_helper.rb | 2 -- app/helpers/admin/users_helper.rb | 2 -- app/helpers/dashboard_helper.rb | 2 -- app/helpers/keys_helper.rb | 2 -- app/helpers/profile_helper.rb | 2 -- app/helpers/projects_helper.rb | 2 -- app/helpers/team_members_helper.rb | 2 -- app/helpers/user_issues_helper.rb | 2 -- app/helpers/user_merge_requests_helper.rb | 3 --- app/helpers/wikis_helper.rb | 2 -- 10 files changed, 21 deletions(-) delete mode 100644 app/helpers/admin/projects_helper.rb delete mode 100644 app/helpers/admin/users_helper.rb delete mode 100644 app/helpers/dashboard_helper.rb delete mode 100644 app/helpers/keys_helper.rb delete mode 100644 app/helpers/profile_helper.rb delete mode 100644 app/helpers/projects_helper.rb delete mode 100644 app/helpers/team_members_helper.rb delete mode 100644 app/helpers/user_issues_helper.rb delete mode 100644 app/helpers/user_merge_requests_helper.rb delete mode 100644 app/helpers/wikis_helper.rb diff --git a/app/helpers/admin/projects_helper.rb b/app/helpers/admin/projects_helper.rb deleted file mode 100644 index 348fb1f1..00000000 --- a/app/helpers/admin/projects_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Admin::ProjectsHelper -end diff --git a/app/helpers/admin/users_helper.rb b/app/helpers/admin/users_helper.rb deleted file mode 100644 index 5995c2aa..00000000 --- a/app/helpers/admin/users_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Admin::UsersHelper -end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb deleted file mode 100644 index a94ddfc2..00000000 --- a/app/helpers/dashboard_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module DashboardHelper -end diff --git a/app/helpers/keys_helper.rb b/app/helpers/keys_helper.rb deleted file mode 100644 index d1a77931..00000000 --- a/app/helpers/keys_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module KeysHelper -end diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb deleted file mode 100644 index 5a0d6b31..00000000 --- a/app/helpers/profile_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ProfileHelper -end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb deleted file mode 100644 index db5c5ce1..00000000 --- a/app/helpers/projects_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ProjectsHelper -end diff --git a/app/helpers/team_members_helper.rb b/app/helpers/team_members_helper.rb deleted file mode 100644 index 6b8a38f8..00000000 --- a/app/helpers/team_members_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module TeamMembersHelper -end diff --git a/app/helpers/user_issues_helper.rb b/app/helpers/user_issues_helper.rb deleted file mode 100644 index aca7d5b8..00000000 --- a/app/helpers/user_issues_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module UserIssuesHelper -end diff --git a/app/helpers/user_merge_requests_helper.rb b/app/helpers/user_merge_requests_helper.rb deleted file mode 100644 index 6e5db315..00000000 --- a/app/helpers/user_merge_requests_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -module UserMergeRequestsHelper -end - diff --git a/app/helpers/wikis_helper.rb b/app/helpers/wikis_helper.rb deleted file mode 100644 index bb168351..00000000 --- a/app/helpers/wikis_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module WikisHelper -end