Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/revision/diff-utils.js
/** | /** | ||||
* Copyright (C) 2018-2019 The Software Heritage developers | * Copyright (C) 2018-2020 The Software Heritage developers | ||||
* See the AUTHORS file at the top-level directory of this distribution | * See the AUTHORS file at the top-level directory of this distribution | ||||
* License: GNU Affero General Public License version 3, or any later version | * License: GNU Affero General Public License version 3, or any later version | ||||
* See top-level LICENSE file for more information | * See top-level LICENSE file for more information | ||||
*/ | */ | ||||
import 'waypoints/lib/jquery.waypoints'; | import 'waypoints/lib/jquery.waypoints'; | ||||
import {swhSpinnerSrc} from 'utils/constants'; | import {swhSpinnerSrc} from 'utils/constants'; | ||||
▲ Show 20 Lines • Show All 340 Lines • ▼ Show 20 Lines | function genDiffPanel(diffData) { | ||||
let diffPanelTitle = diffData.path; | let diffPanelTitle = diffData.path; | ||||
if (diffData.type === 'rename') { | if (diffData.type === 'rename') { | ||||
diffPanelTitle = `${diffData.from_path} → ${diffData.to_path}`; | diffPanelTitle = `${diffData.from_path} → ${diffData.to_path}`; | ||||
} | } | ||||
let diffPanelHtml = | let diffPanelHtml = | ||||
`<div id="panel_${diffData.id}" class="card swh-file-diff-panel"> | `<div id="panel_${diffData.id}" class="card swh-file-diff-panel"> | ||||
<div class="card-header bg-gray-light border-bottom-0"> | <div class="card-header bg-gray-light border-bottom-0"> | ||||
<a data-toggle="collapse" href="#panel_${diffData.id}_content"> | <a data-toggle="collapse" href="#panel_${diffData.id}_content"> | ||||
<div class="pull-left swh-title-color"> | <div class="float-left swh-title-color"> | ||||
<strong>${diffPanelTitle}</strong> | <strong>${diffPanelTitle}</strong> | ||||
</div> | </div> | ||||
</a> | </a> | ||||
<div class="pull-right"> | <div class="ml-auto float-right"> | ||||
<div class="btn-group btn-group-toggle diff-styles" data-toggle="buttons" style="visibility: hidden;"> | <div class="btn-group btn-group-toggle diff-styles" data-toggle="buttons" style="visibility: hidden;"> | ||||
<label class="btn btn-default btn-sm form-check-label active unified-diff-button" onclick="swh.revision.showUnifiedDiff(event, '${diffData.id}')"> | <label class="btn btn-default btn-sm form-check-label active unified-diff-button" onclick="swh.revision.showUnifiedDiff(event, '${diffData.id}')"> | ||||
<input type="radio" name="diffs-switch" id="unified" autocomplete="off" checked> Unified | <input type="radio" name="diffs-switch" id="unified" autocomplete="off" checked> Unified | ||||
</label> | </label> | ||||
<label class="btn btn-default btn-sm form-check-label splitted-diff-button" onclick="swh.revision.showSplittedDiff(event, '${diffData.id}')"> | <label class="btn btn-default btn-sm form-check-label splitted-diff-button" onclick="swh.revision.showSplittedDiff(event, '${diffData.id}')"> | ||||
<input type="radio" name="diffs-switch" id="side-by-side" autocomplete="off"> Side-by-side | <input type="radio" name="diffs-switch" id="side-by-side" autocomplete="off"> Side-by-side | ||||
</label> | </label> | ||||
</div> | </div> | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |