summaryrefslogtreecommitdiff
path: root/app/views/projects/diffs/_image.html.haml
blob: ca10921c5e2e485cddc1fd543b898cd662887c66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
- diff = diff_file.diff
- file_raw_path = namespace_project_raw_path(@project.namespace, @project, tree_join(diff_file.new_ref, diff.new_path))
// diff_refs will be nil for orphaned commits (e.g. first commit in repo)
- if diff_file.old_ref
  - old_file_raw_path = namespace_project_raw_path(@project.namespace, @project, tree_join(diff_file.old_ref, diff.old_path))

- if diff.renamed_file || diff.new_file || diff.deleted_file
  .image
    %span.wrap
      .frame{ class: image_diff_class(diff) }
        %img{ src: diff.deleted_file ? old_file_raw_path : file_raw_path, alt: diff.new_path }
      %p.image-info= number_to_human_size(file.size)
- else
  .image
    .two-up.view
      %span.wrap
        .frame.deleted
          %a{ href: namespace_project_blob_path(@project.namespace, @project, tree_join(diff_file.old_ref, diff.old_path)) }
            %img{ src: old_file_raw_path, alt: diff.old_path }
        %p.image-info.hide
          %span.meta-filesize= number_to_human_size(old_file.size)
          |
          %b W:
          %span.meta-width
          |
          %b H:
          %span.meta-height
      %span.wrap
        .frame.added
          %a{ href: namespace_project_blob_path(@project.namespace, @project, tree_join(diff_file.new_ref, diff.new_path)) }
            %img{ src: file_raw_path, alt: diff.new_path }
        %p.image-info.hide
          %span.meta-filesize= number_to_human_size(file.size)
          |
          %b W:
          %span.meta-width
          |
          %b H:
          %span.meta-height

    .swipe.view.hide
      .swipe-frame
        .frame.deleted
          %img{ src: old_file_raw_path, alt: diff.old_path }
        .swipe-wrap
          .frame.added
            %img{ src: file_raw_path, alt: diff.new_path }
        %span.swipe-bar
          %span.top-handle
          %span.bottom-handle

    .onion-skin.view.hide
      .onion-skin-frame
        .frame.deleted
          %img{ src: old_file_raw_path, alt: diff.old_path }
        .frame.added
          %img{ src: file_raw_path, alt: diff.new_path }
        .controls
          .transparent
          .drag-track
            .dragger{ :style => "left: 0px;" }
          .opaque


  .view-modes.hide
    %ul.view-modes-menu
      %li.two-up{ data: { mode: 'two-up' } } 2-up
      %li.swipe{ data: { mode: 'swipe' } } Swipe
      %li.onion-skin{ data: { mode: 'onion-skin' } } Onion skin