diff options
| author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-11 23:33:50 +0200 |
|---|---|---|
| committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-11 23:33:50 +0200 |
| commit | 52be9e20f9e2382f01a778d7b348283e7dd757e6 (patch) | |
| tree | 2a22a5575f62c0ffada22ac27121c648544a4822 /app/helpers | |
| parent | af7214d0f077f738ed57194feb0cd468c43d4310 (diff) | |
| parent | 7998725e3c2557c04ceece028dd73a316a3a746c (diff) | |
| download | gitlab-ce-52be9e20f9e2382f01a778d7b348283e7dd757e6.tar.gz | |
Merge remote-tracking branch 'origin/master' into ci-commit-as-pipeline
# Conflicts:
# app/views/projects/commits/_commit.html.haml
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/commits_helper.rb | 4 | ||||
| -rw-r--r-- | app/helpers/form_helper.rb | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index de508036888..35ba543cef1 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -28,7 +28,7 @@ module CommitsHelper def commit_to_html(commit, project, inline = true) template = inline ? "inline_commit" : "commit" - escape_javascript(render "projects/commits/#{template}", commit: commit, project: project) unless commit.nil? + render "projects/commits/#{template}", commit: commit, project: project unless commit.nil? end # Breadcrumb links for a Project and, if applicable, a tree path @@ -117,7 +117,7 @@ module CommitsHelper end end link_to( - "Browse Files ยป", + "Browse Files", namespace_project_tree_path(project.namespace, project, commit), class: "pull-right" ) diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb new file mode 100644 index 00000000000..6a43be2cf3e --- /dev/null +++ b/app/helpers/form_helper.rb @@ -0,0 +1,18 @@ +module FormHelper + def form_errors(model) + return unless model.errors.any? + + pluralized = 'error'.pluralize(model.errors.count) + headline = "The form contains the following #{pluralized}:" + + content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do + content_tag(:h4, headline) << + content_tag(:ul) do + model.errors.full_messages. + map { |msg| content_tag(:li, msg) }. + join. + html_safe + end + end + end +end |
