diff options
author | Ciro Santillli <ciro.santilli@gmail.com> | 2014-02-04 08:48:33 +0100 |
---|---|---|
committer | Ciro Santillli <ciro.santilli@gmail.com> | 2014-02-11 16:23:33 +0100 |
commit | 61748c993de8a38300c0c038cec5a07e6c324cd6 (patch) | |
tree | af9693096914e2de64eaf5bdde06f59b90317eaa /app | |
parent | 1284f21c073e42c44b9faa7b0ad1ec90b66ca8fb (diff) | |
download | gitlab-ce-61748c993de8a38300c0c038cec5a07e6c324cd6.tar.gz |
Headers have ids and link to their own id.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/images/icon-link.png | bin | 0 -> 1019 bytes | |||
-rw-r--r-- | app/assets/stylesheets/generic/files.scss | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/generic/issue_box.scss | 5 | ||||
-rw-r--r-- | app/assets/stylesheets/generic/typography.scss | 21 | ||||
-rw-r--r-- | app/assets/stylesheets/main/mixins.scss | 4 | ||||
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 19 | ||||
-rw-r--r-- | app/views/help/_layout.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/issues/show.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_mr_box.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/milestones/show.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/notes/_note.html.haml | 2 |
11 files changed, 48 insertions, 25 deletions
diff --git a/app/assets/images/icon-link.png b/app/assets/images/icon-link.png Binary files differnew file mode 100644 index 00000000000..32ade0fe9a3 --- /dev/null +++ b/app/assets/images/icon-link.png diff --git a/app/assets/stylesheets/generic/files.scss b/app/assets/stylesheets/generic/files.scss index 20877507c91..85111a45913 100644 --- a/app/assets/stylesheets/generic/files.scss +++ b/app/assets/stylesheets/generic/files.scss @@ -50,7 +50,6 @@ } &.wiki { - padding: 20px; font-size: 14px; line-height: 1.6; diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss index afe9c5f8186..c3a39f02513 100644 --- a/app/assets/stylesheets/generic/issue_box.scss +++ b/app/assets/stylesheets/generic/issue_box.scss @@ -23,11 +23,12 @@ line-height: 28px; margin: 0; color: #444; + border-bottom: 1px solid #eee; } .context { border: none; - border-top: 1px solid #eee; + border-bottom: 1px solid #eee; } .description { @@ -35,7 +36,7 @@ } .title, .context, .description { - padding: 15px; + padding: 15px 15px 15px 30px; .clearfix { margin: 0; diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss index 419a63d4d3a..1a07fde53f1 100644 --- a/app/assets/stylesheets/generic/typography.scss +++ b/app/assets/stylesheets/generic/typography.scss @@ -90,6 +90,27 @@ a:focus { font-size: 14px; line-height: 1.6; + + /* Link to current header. */ + h1, h2, h3, h4, h5, h6 { + position: relative; + &:hover > :last-child { + $size: 16px; + position: absolute; + right: 100%; + top: 50%; + margin-top: -$size/2; + margin-right: 0px; + padding-right: 20px; + display: inline-block; + width: $size; + height: $size; + background-image: url("icon-link.png"); + background-size: contain; + background-repeat: no-repeat; + } + } + ul { padding: 0; margin: 0 0 9px 25px !important; diff --git a/app/assets/stylesheets/main/mixins.scss b/app/assets/stylesheets/main/mixins.scss index 4afe61d756c..a7a5ed73abd 100644 --- a/app/assets/stylesheets/main/mixins.scss +++ b/app/assets/stylesheets/main/mixins.scss @@ -114,6 +114,10 @@ font-size: 1.2em; } + // Larger 30px left margin is required for the header link icon. + // Use on all markdown including those without header links for uniformity. + margin: 20px 20px 20px 30px; + blockquote p { color: #888; font-size: 14px; diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 315f1b805b5..b25662e3ba2 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -28,14 +28,16 @@ module GitlabMarkdownHelper link_to(gfm_body.html_safe, url, html_options) end - def markdown(text) - unless @markdown - gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self, - # 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) + def markdown(text, options={}) + unless (@markdown and options == @options) + @options = options + gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self, { + # 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, # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use no_intra_emphasis: true, @@ -47,7 +49,6 @@ module GitlabMarkdownHelper space_after_headers: true, superscript: true) end - @markdown.render(text).html_safe end diff --git a/app/views/help/_layout.html.haml b/app/views/help/_layout.html.haml index a413616bad0..201d63ca243 100644 --- a/app/views/help/_layout.html.haml +++ b/app/views/help/_layout.html.haml @@ -8,4 +8,5 @@ = link_to title, path .col-md-9 - = yield + .wiki + = yield diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index cd4a158e427..5033dfefe2e 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -46,10 +46,9 @@ = render partial: 'issue_context', locals: { issue: @issue } - if @issue.description.present? - .description - .wiki - = preserve do - = markdown @issue.description + .wiki + = preserve do + = markdown @issue.description - content_for :note_actions do - if can?(current_user, :modify_issue, @issue) diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml index b4f648ab197..9b95c092187 100644 --- a/app/views/projects/merge_requests/show/_mr_box.html.haml +++ b/app/views/projects/merge_requests/show/_mr_box.html.haml @@ -15,10 +15,9 @@ - if @merge_request.description.present? - .description - .wiki - = preserve do - = markdown @merge_request.description + .wiki + = preserve do + = markdown @merge_request.description - if @merge_request.closed? .description.alert-danger diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index e7c3785c056..283b4dfeacd 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -42,13 +42,11 @@ .progress.progress-info .progress-bar{style: "width: #{@milestone.percent_complete}%;"} - - if @milestone.description.present? - .description + .wiki = preserve do = markdown @milestone.description - %ul.nav.nav-tabs.append-bottom-10 %li.active = link_to '#tab-issues', 'data-toggle' => 'tab' do diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index fd2a3f43674..217e36e38d0 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -31,7 +31,7 @@ .note-body .note-text = preserve do - = markdown(note.note) + = markdown(note.note, {no_header_anchors: true}) .note-edit-form = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f| |