BigW Consortium Gitlab

_image.html.haml 2.15 KB
Newer Older
1
- diff = diff_file.diff
2 3 4 5 6 7 8 9 10 11 12
- if diff.renamed_file || diff.new_file || diff.deleted_file
  .image
    %span.wrap
      .frame{class: image_diff_class(diff)}
        %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
      %p.image-info= "#{number_to_human_size file.size}"
- else
  .image
    %div.two-up.view
      %span.wrap
        .frame.deleted
Vinnie Okada committed
13
          %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(@commit.parent_id, diff.old_path))}
14
            %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
15
        %p.image-info.hide
16 17 18
          %span.meta-filesize= "#{number_to_human_size old_file.size}"
          |
          %b W:
19
          %span.meta-width
20 21 22 23 24
          |
          %b H:
          %span.meta-height
      %span.wrap
        .frame.added
Vinnie Okada committed
25
          %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(@commit.id, diff.new_path))}
26
            %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
27
        %p.image-info.hide
28 29 30
          %span.meta-filesize= "#{number_to_human_size file.size}"
          |
          %b W:
31
          %span.meta-width
32 33 34 35
          |
          %b H:
          %span.meta-height

36
    %div.swipe.view.hide
37 38 39 40 41 42 43 44 45 46
      .swipe-frame
        .frame.deleted
          %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
        .swipe-wrap
          .frame.added
            %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
        %span.swipe-bar
          %span.top-handle
          %span.bottom-handle

47
    %div.onion-skin.view.hide
48 49 50 51 52
      .onion-skin-frame
        .frame.deleted
          %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
        .frame.added
          %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
53
        .controls
54 55 56 57 58 59
          .transparent
          .drag-track
            .dragger{:style => "left: 0px;"}
          .opaque


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