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

about.html « sections « partials « layouts - github.com/2-REC/hugo-myportfolio-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de8b08f6b1e23f257750d55c7d2e183e946f983a (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{{ $params := .Site.Params.about }}
{{ with .Site.Data.about }}
  {{/* 2-REC - TODO: CHECK IF VALUES ARE VALID! (sum of all = 12) */}}
  {{ $main_side := 7 }}
  {{ with $params.main_side -}}
    {{ $main_side = . }}
  {{ end }}
  {{ $extra_side := 3 }}
  {{ with $params.extra_side -}}
    {{ $extra_side = . }}
  {{ end }}
  {{ $remaining := sub (sub 12 $main_side) $extra_side }}
  {{ $set_left := 0 }}
  {{ $offset_left := div $remaining 2 }}
  {{ with $params.offset_left -}}
    {{ $set_left = 1 }}
    {{ $offset_left = . }}
  {{ end }}
  {{ $remaining = sub $remaining $offset_left }}
  {{ $offset_right := $remaining }}
  {{ with $params.offset_right -}}
    {{ $offset_right = . }}
  {{ end }}
  {{ $remaining = sub $remaining $offset_right }}
  {{ if and (eq $set_left 0) (ne $remaining 0) }}
    {{ $offset_left = add $offset_left $remaining }}
    {{ $remaining = 0 }}
  {{ end }}
  {{ $offset_center := $remaining }}
  <section class="section" id="about"
    style="
      {{- with .background_image -}}
        --about-bkg-image: url('{{ (printf "images/%s" .) | absURL }}');
      {{- end -}}
      {{- if ne $params.background "full" -}}
        {{- if eq $params.layout "left" -}}
          --about-bkg-width: {{ mul (div $extra_side 12.0) 100 }}%;
          --about-bkg-margin-left: {{ mul (div $main_side 12.0) 100 }}%;
          --about-bkg-margin-right: 0;
        {{- else if eq $params.layout "right" -}}
          --about-bkg-width: {{ mul (div $extra_side 12.0) 100 }}%;
          --about-bkg-margin-left: 0;
          --about-bkg-margin-right: {{ mul (div $main_side 12.0) 100 }}%;
        {{- end -}}
      {{- end -}}
      {{/* TODO: keep this in 'config'? (should be enough with only in CSS) */}}
      {{- with $params.background_opacity -}}
        --about-bkg-opacity: {{ . }};
      {{- end -}}
      {{- with $params.background_position -}}
        --about-bkg-position: {{ . }};
      {{- end -}}
      {{- with $params.background_size -}}
        --about-bkg-size: {{ . }};
      {{- end -}}
  ">
    {{ with .title }}
    <div class="container-fluid">
      {{ partial "title-bar.html" (dict "title" . "align" $params.title_align "length" $params.title_length) }}
    </div>
    {{ end }}
    <div class="container-fluid">
      <div class="row">
        {{ if eq $params.layout "right" }}
          <div class="col-xs-12 col-md-{{ $extra_side }}"></div>
        {{ else if eq $params.layout "left" }}
          {{ $offset_left := sub (sub 12 $extra_side) $main_side }}
          <div class="col-xs-12 col-md-{{ $offset_left }}"></div>
        {{ end }}
        {{ if and (ne $params.layout "left") (ne $params.layout "right") }}
          {{/* ~Hack to add space outside (offset left) */}}
{{/*
          <div class="col-xs-12 col-md-offset-1 col-md-{{ sub $extra_side 1 }}">
*/}} 
          <div class="col-xs-12 col-md-offset-{{ $offset_left }} col-md-{{ $extra_side }}">
        {{ else }}
          <div class="col-xs-12 col-md-{{ $main_side }}">
        {{ end }}
            <div class="profile">
              {{ if .avatar }}
                {{/* 2-REC: Special "hover easter egg" */}}
                {{ if .avatar2 }}
                  <div class="portrait" style="position:relative; overflow: hidden;">
                    <img id="avatar1" src="{{ printf "images/%s" .avatar }}">
                    <img id="avatar2" src="{{ printf "images/%s" .avatar2 }}" oncontextmenu="return false;">
                  </div>
                {{ else }}
                  <img class="portrait" src="{{ printf "/images/%s" .avatar}}">
                {{ end }}
              {{ end }}
              {{ with .short_text }}
                <div class="text-primary short-text">
                  <p>{{ . | markdownify }}</p>
                </div>
              {{ end }}
            </div>
        {{ if .long_text }}
          {{ if and (ne $params.layout "left") (ne $params.layout "right") }}
          </div>
          {{/* ~Hack to add space outside (shorter right) */}}
{{/*
          <div class="col-xs-12 col-md-{{ sub $main_side 1 }} text-tertiary long-text">
*/}}
          <div class="col-xs-12 col-md-offset-{{ $offset_center }} col-md-{{ $main_side }}">
            <div class="text-tertiary long-text">
            <p>{{ .long_text | markdownify }}</p>
            </div>
          </div>
          {{ else }}
            <div>
              <p></p>
            </div>
            <div class="text-tertiary long-text">
              <p>{{ .long_text | markdownify }}</p>
            </div>
          </div>
          {{ end }}
        {{ end }}
        {{ if eq $params.layout "left" }}
          <div class="col-xs-12 col-md-{{ $extra_side }}"></div>
        {{ end }}
      </div>
    </div>
  </section>
{{ end }}