diff options
author | Timm Drevensek <abubadabu@gmail.com> | 2014-03-26 23:07:11 +0400 |
---|---|---|
committer | Timm Drevensek <abubadabu@gmail.com> | 2014-03-26 23:07:11 +0400 |
commit | ea82bcd396c9e6ab8542474ee70365297a4ff2dc (patch) | |
tree | e5bb4fd9946e5520937b4f5d1241894ba45e6767 /app/helpers | |
parent | c0744e5ba07a16475b014b976664c729c59516b7 (diff) | |
parent | 24e9c5e83e1b5b304aa0109e95bbd69a554f5e3f (diff) |
Merge branch 'master' into request/relative_submodules
Conflicts:
CHANGELOG
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 12 | ||||
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 10 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 12 | ||||
-rw-r--r-- | app/helpers/merge_requests_helper.rb | 15 | ||||
-rw-r--r-- | app/helpers/profile_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/tree_helper.rb | 2 |
6 files changed, 22 insertions, 31 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4e7d01acd2a..faecde299c1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,7 +54,7 @@ module ApplicationHelper if group && group.avatar.present? group.avatar.url else - '/assets/no_group_avatar.png' + image_path('no_group_avatar.png') end end @@ -89,16 +89,15 @@ module ApplicationHelper "Never" end - def grouped_options_refs(destination = :tree) + def grouped_options_refs repository = @project.repository options = [ ["Branches", repository.branch_names], - ["Tags", repository.tag_names] + ["Tags", VersionSorter.rsort(repository.tag_names)] ] - # If reference is commit id - - # we should add it to branch/tag selectbox + # 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}$/) options << ["Commit", [@ref]] @@ -147,8 +146,7 @@ module ApplicationHelper def authbutton(provider, size = 64) file_name = "#{provider.to_s.split('_').first}_#{size}.png" - image_tag("authbuttons/#{file_name}", - alt: "Sign in with #{provider.to_s.titleize}") + image_tag(image_path("authbuttons/#{file_name}"), alt: "Sign in with #{provider.to_s.titleize}") end def simple_sanitize(str) diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 6cad5e4658e..69425bc171d 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -35,7 +35,6 @@ module GitlabMarkdownHelper # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch- filter_html: true, with_toc_data: true, - hard_wrap: true, safe_links_only: true }.merge(options)) @markdown = Redcarpet::Markdown.new(gitlab_renderer, @@ -45,7 +44,7 @@ module GitlabMarkdownHelper fenced_code_blocks: true, autolink: true, strikethrough: true, - lax_html_blocks: true, + lax_spacing: true, space_after_headers: true, superscript: true) end @@ -64,8 +63,7 @@ module GitlabMarkdownHelper # project_path_with_namespace - namespace/projectname, eg. gitlabhq/gitlabhq # ref - name of the branch or reference, eg. stable # requested_path - path of request, eg. doc/api/README.md, used in special case when path is pointing to the .md file were the original request is coming from - # wiki - whether the markdown is from wiki or not - def create_relative_links(text, project, ref, requested_path, wiki = false) + def create_relative_links(text, project, ref, requested_path) @path_to_satellite = project.satellite.path project_path_with_namespace = project.path_with_namespace paths = extract_paths(text) @@ -135,12 +133,12 @@ module GitlabMarkdownHelper end # Checks if the path exists in the repo - # eg. checks if doc/README.md exists, if it doesn't then it is a wiki link + # eg. checks if doc/README.md exists, if not then link to blob def path_with_ref(path, ref) if file_exists?(path) "#{local_path(path)}/#{correct_ref(ref)}" else - "wikis" + "blob/#{correct_ref(ref)}" end end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 0374992ebfc..95f0eff58b1 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -85,11 +85,15 @@ module IssuesHelper options_from_collection_for_select(@project.milestones.active, 'id', 'title', object.milestone_id) end - def issue_alert_class(issue) - if issue.closed? - 'alert-danger' + def issue_box_class(item) + if item.respond_to?(:expired?) && item.expired? + 'issue-box-expired' + elsif item.respond_to?(:merged?) && item.merged? + 'issue-box-merged' + elsif item.closed? + 'issue-box-closed' else - 'alert-success' + 'issue-box-open' end end end diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 62f061bb079..ba25a87f392 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -1,8 +1,9 @@ module MergeRequestsHelper def new_mr_path_from_push_event(event) + target_project = event.project.forked_from_project || event.project new_project_merge_request_path( event.project, - new_mr_from_push_event(event, event.project) + new_mr_from_push_event(event, target_project) ) end @@ -19,7 +20,7 @@ module MergeRequestsHelper target_project_id: target_project.id, source_branch: event.branch_name, target_branch: target_project.repository.root_ref, - title: event.branch_name.titleize + title: event.branch_name.humanize } end @@ -41,14 +42,4 @@ module MergeRequestsHelper "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" end end - - def merge_request_alert_class(merge_request) - if merge_request.merged? - 'alert-info' - elsif merge_request.closed? - 'alert-danger' - else - 'alert-success' - end - end end diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb index dd9e03d95a8..297ae83d895 100644 --- a/app/helpers/profile_helper.rb +++ b/app/helpers/profile_helper.rb @@ -10,7 +10,7 @@ module ProfileHelper end def show_profile_social_tab? - Gitlab.config.omniauth.enabled && !current_user.ldap_user? + enabled_social_providers.any? && !current_user.ldap_user? end def show_profile_remove_tab? diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 2dbc1cffb16..50501dffefb 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -40,7 +40,7 @@ module TreeHelper # Returns boolean def markup?(filename) filename.downcase.end_with?(*%w(.textile .rdoc .org .creole - .mediawiki .rst .asciidoc .pod)) + .mediawiki .rst .adoc .asciidoc .pod)) end def gitlab_markdown?(filename) |