diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-13 12:13:42 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-27 12:23:26 -0500 |
commit | ee17c659dc3899802ff3a21ddcab0c943d13dd53 (patch) | |
tree | c478920cb745b298c340f72432c6aa0f7fb93951 /app | |
parent | 21d2ebff6226e5438443d2eb4430736e9659b820 (diff) | |
download | gitlab-ce-ee17c659dc3899802ff3a21ddcab0c943d13dd53.tar.gz |
Add viewer switcher
Diffstat (limited to 'app')
-rw-r--r-- | app/views/projects/blob/_header.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/blob/_viewer_switcher.html.haml | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml index bb8a53aca6e..ed63c6fc3c9 100644 --- a/app/views/projects/blob/_header.html.haml +++ b/app/views/projects/blob/_header.html.haml @@ -12,6 +12,8 @@ = number_to_human_size(blob.raw_size) .file-actions.hidden-xs + = render 'projects/blob/viewer_switcher', blob: blob unless blame + .btn-group{ role: "group" }< = copy_blob_source_button(blob) unless blame = open_raw_file_button(namespace_project_raw_path(@project.namespace, @project, @id)) diff --git a/app/views/projects/blob/_viewer_switcher.html.haml b/app/views/projects/blob/_viewer_switcher.html.haml new file mode 100644 index 00000000000..6d69660e656 --- /dev/null +++ b/app/views/projects/blob/_viewer_switcher.html.haml @@ -0,0 +1,12 @@ +- if blob.show_viewer_switcher? + - simple_viewer = blob.simple_viewer + - rich_viewer = blob.rich_viewer + + .btn-group{ role: "group" } + - simple_label = "Display #{simple_viewer.switcher_title}" + %button.btn.btn-default.btn-sm.js-blob-viewer-switcher.has-tooltip{ 'aria-label' => simple_label, title: simple_label, data: { viewer: 'simple', container: 'body' } }> + = icon(simple_viewer.switcher_icon) + + - rich_label = "Display #{rich_viewer.switcher_title}" + %button.btn.btn-default.btn-sm.js-blob-viewer-switcher.has-tooltip{ 'aria-label' => rich_label, title: rich_label, data: { viewer: 'rich', container: 'body' } }> + = icon(rich_viewer.switcher_icon) |