From cd89f6c5021ef129ecc4652aa620a3562ae30979 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 14 Aug 2016 23:02:14 -0700 Subject: Web editor: improve edit file and diff preview --- templates/repo/diff_box.tmpl | 4 +- templates/repo/diff_preview.tmpl | 32 ---------- templates/repo/diff_preview_new.tmpl | 12 ---- templates/repo/edit.tmpl | 97 ----------------------------- templates/repo/editor/diff_preview.tmpl | 32 ++++++++++ templates/repo/editor/diff_preview_new.tmpl | 12 ++++ templates/repo/editor/edit.tmpl | 96 ++++++++++++++++++++++++++++ 7 files changed, 142 insertions(+), 143 deletions(-) delete mode 100644 templates/repo/diff_preview.tmpl delete mode 100644 templates/repo/diff_preview_new.tmpl delete mode 100644 templates/repo/edit.tmpl create mode 100644 templates/repo/editor/diff_preview.tmpl create mode 100644 templates/repo/editor/diff_preview_new.tmpl create mode 100644 templates/repo/editor/edit.tmpl (limited to 'templates') diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl index a048ce6084..35af649b0f 100644 --- a/templates/repo/diff_box.tmpl +++ b/templates/repo/diff_box.tmpl @@ -71,9 +71,9 @@ {{if not $file.IsSubmodule}}
{{if $file.IsDeleted}} - {{$.i18n.Tr "repo.diff.view_file"}} + {{$.i18n.Tr "repo.diff.view_file"}} {{else}} - {{$.i18n.Tr "repo.diff.view_file"}} + {{$.i18n.Tr "repo.diff.view_file"}} {{end}}
{{end}} diff --git a/templates/repo/diff_preview.tmpl b/templates/repo/diff_preview.tmpl deleted file mode 100644 index 1c4787a33c..0000000000 --- a/templates/repo/diff_preview.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -{{$highlightClass := .File.GetHighlightClass}} -
-
-
- - - {{range $j, $section := .File.Sections}} - {{range $k, $line := $section.Lines}} - - {{if eq .GetType 4}} - - {{else}} - - - {{end}} - - - {{end}} - {{end}} - -
- {{/* {{if gt $j 0}}{{end}} */}} - - {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - - {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} - -
{{$section.GetComputedInlineDiffFor $line}}
-
-
-
-
diff --git a/templates/repo/diff_preview_new.tmpl b/templates/repo/diff_preview_new.tmpl deleted file mode 100644 index 34abfe1823..0000000000 --- a/templates/repo/diff_preview_new.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -
-
- - - - - - - -
    {{.FileContent}}
-
-
diff --git a/templates/repo/edit.tmpl b/templates/repo/edit.tmpl deleted file mode 100644 index 49a3df7842..0000000000 --- a/templates/repo/edit.tmpl +++ /dev/null @@ -1,97 +0,0 @@ -{{template "base/head" .}} -
- {{template "repo/header" .}} -
- {{.branchName}} - {{template "base/alert" .}} -
- {{.CsrfTokenHtml}} - - -
- -
- -
-
- {{.i18n.Tr "repo.release.loading"}} -
-
- {{.i18n.Tr "repo.release.loading"}} -
-
-
- -
-

{{.i18n.Tr "repo.commit_changes"}}

-
- '{{else}}{{.i18n.Tr "repo.update"}} '{{.TreeName}}'{{end}}" value="{{.CommitSummary}}"> -
-
- -
-
-
-
-
- -
-
- -
-
-
-
-
- - - -
-
-
-
- - {{.i18n.Tr "repo.cancel"}} -
-
-
-
-{{template "base/footer" .}} diff --git a/templates/repo/editor/diff_preview.tmpl b/templates/repo/editor/diff_preview.tmpl new file mode 100644 index 0000000000..1c4787a33c --- /dev/null +++ b/templates/repo/editor/diff_preview.tmpl @@ -0,0 +1,32 @@ +{{$highlightClass := .File.GetHighlightClass}} +
+
+
+ + + {{range $j, $section := .File.Sections}} + {{range $k, $line := $section.Lines}} + + {{if eq .GetType 4}} + + {{else}} + + + {{end}} + + + {{end}} + {{end}} + +
+ {{/* {{if gt $j 0}}{{end}} */}} + + {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} + + {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} + +
{{$section.GetComputedInlineDiffFor $line}}
+
+
+
+
diff --git a/templates/repo/editor/diff_preview_new.tmpl b/templates/repo/editor/diff_preview_new.tmpl new file mode 100644 index 0000000000..34abfe1823 --- /dev/null +++ b/templates/repo/editor/diff_preview_new.tmpl @@ -0,0 +1,12 @@ +
+
+ + + + + + + +
    {{.FileContent}}
+
+
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl new file mode 100644 index 0000000000..5e3349eaab --- /dev/null +++ b/templates/repo/editor/edit.tmpl @@ -0,0 +1,96 @@ +{{template "base/head" .}} +
+ {{template "repo/header" .}} +
+ {{template "base/alert" .}} +
+ {{.CsrfTokenHtml}} + + +
+ +
+ +
+
+ {{.i18n.Tr "repo.release.loading"}} +
+
+ {{.i18n.Tr "repo.release.loading"}} +
+
+
+ +
+

{{.i18n.Tr "repo.commit_changes"}}

+
+ '{{else}}{{.i18n.Tr "repo.update"}} '{{.TreeName}}'{{end}}" value="{{.commit_summary}}"> +
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+
+
+ + + +
+
+
+
+ + {{.i18n.Tr "repo.cancel"}} +
+
+
+
+{{template "base/footer" .}} -- cgit v1.2.3