Welcome to mirror list, hosted at ThFree Co, Russian Federation.

modals.html « gallery « sections « partials « layouts - github.com/kdevo/osprey-delight.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8aa51cf74fbeb75ace4aa153f00a24cbbb0a3787 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{{ range where site.RegularPages "Section" "gallery" }}

  {{ $modalID := .File.BaseFileName }}

  {{ $scratch := newScratch }}
  {{ if .Params.github.repo -}}
    {{ $scratch.Set "repo" (getJSON "https://api.github.com/repos/" .Params.github.repo) }}
  {{- end }}

  <div id="modal-{{ $modalID }}" class="modal">

    <!-- Modal box -->
    <div class="modal-box">
      <div class="close">{{ partial "icon" "close" }}</div>
      <div class="modal-container">
        <div class="modal-header">
          <div class="modal-header-img-container" {{ if .Params.color }}style="background-color:{{ .Params.color }}"{{ end }}>
            {{ partial "sections/gallery/img" . }}
          </div>
        </div>

        <div class="modal-content"{{ if .Params.terminal.lines -}} hidden id="content-{{ $modalID }}" {{- end}}>
          <h2>{{ .Params.title }}</h2>

          <!-- Content -->
          <article class="entry-content">
            {{ if eq (len (trim .Content "\r\n" )) 0 -}}
              <p>{{ with $scratch.Get "repo" }}{{ .description }}{{ end }}</p>
            {{- else -}}
              {{ if $scratch.Get "repo" }}
                {{ replace .Content "{github-description}" ($scratch.Get "repo").description | safeHTML }}
              {{- else -}}
                {{ .Content }}
              {{- end }}
            {{- end }}
          </article>

          <!-- Buttons -->
          <div class="row center-xs">
            <!-- The following two params are left for backward-compatibility -->
            {{ with .Params.linkView }}
              <div class="col-xs">
                <a href="{{ . }}"><button type="submit">{{ partial "icon" "view" }}  {{ i18n "view" }}</button></a>
              </div>
            {{ end }}
            {{ with .Params.linkCode }}
              <div class="col-xs">
                <a href="{{ . }}"><button type="submit">{{ partial "icon" "code" }} {{ i18n "code" }}</button></a>
              </div>
            {{ end }}
            {{ range .Params.buttons -}}
              <div class="col-xs">
                <a href="{{ .url }}" {{ if default false .newTab -}}target="_blank" rel="noopener"{{- end }}>
                  <button type="submit">{{ with .icon }}{{ partial "icon" . }}{{ end }} {{ i18n (default "view" .i18n) }}</button>
                </a>
              </div>
            {{ end }}
            {{ if (default true .Params.github.showButtons) }}
              {{ with $scratch.Get "repo" -}}
                <div class="col-xs">
                  <a href="{{ replace (replace .archive_url "{/ref}" "") "{archive_format}" "zipball" }}" target="_blank">
                    <button type="submit">{{ partial "icon" "download" }} {{ i18n "download" }}</button>
                  </a>
                </div>
                <div class="col-xs">
                  <a href="{{ .html_url }}" target="_blank" rel="noopener">
                    <button type="submit">{{ partial "icon" "code" }} {{ i18n "code" }}</button>
                  </a>
                </div>
              {{- end }}
            {{- end }}
          </div>
          
          {{ if .Params.github.showInfo }}
            {{ with (getJSON ($scratch.Get "repo").languages_url) -}}
            {{ $scratch.Set "repo-lang" . }}
            {{ $sum := 0 }}
            {{ range $lang, $val := . }}{{ $sum = add $sum $val }}{{ end }}
            {{ $scratch.Set "repo-lang-sum" $sum }}
            {{ $scratch.Set "repo-lang-main" (math.Round (mul 100 (div (index . ($scratch.Get "repo").language) $sum))) }}
            {{- end }}
            {{ with $scratch.Get "repo" }}
              <div class="row center-xs"><div class="repo-info">
              <a href="{{ .html_url }}/pulse">{{ partial "icon" (dict "name" "github-octocat" "loader" "svg-use-text") }}</a> 
              <a href="{{ .languages_url }}">{{ .language }}{{ with ($scratch.Get "repo-lang-main") }}{{ if lt . 100.0 }} ({{ . }}%) {{ end }}{{ end }}</a>
              {{ with .license }}{{ with (getJSON .url) }} &bull; <a href="{{ .html_url }}">{{ .spdx_id }}</a> {{ end }} {{ end }}
              {{ if gt .stargazers_count 0 }} &bull; <a href="{{ .html_url }}/stargazers"> {{ .stargazers_count }} stars </a>{{ end }}
              {{ if gt .forks_count 0 }} &bull; <a href="{{ .html_url }}/network/members"> {{ .forks_count }} forks </a>{{ end }}
              &bull; <a href="{{ .html_url }}/issues">{{ .open_issues_count }} open issues</a>
          </div></div>{{ end }}{{ end }}
        </div>

        {{ if .Params.terminal.lines -}}
          <div class="term-content">
          <div id="term-{{ $modalID }}" data-termynal>
          {{ range .Params.terminal.lines }}
          {{ if eq .type "progress" }}
            <span data-ty="{{ .type }}" data-ty-delay="{{ .wait }}" data-ty-progressPercent="{{ .data }}"></span>
          {{ else }}
            <span data-ty="{{ .type }}" data-ty-delay="{{ .wait }}">{{ .data }}</span>
          {{ end }}
        {{ end }}
          </div>
        </div>
        {{- end }}
      </div>
    </div>
  </div>
{{ end }}