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: 656578007dc31a2d14f392a1e63c7d8130194244 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{{ $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 }}
{{- $sum := add (add (add $main_side $extra_side) $offset_left) $offset_right -}}
{{- if gt $sum 12 -}}
ERROR: Sum of columns width bigger than 12! - Check "params.about" in "config.toml"
{{- 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 (add $main_side $offset_left) 12.0) 100 }}%;
          --about-bkg-margin-right: {{ mul (div $offset_right 12.0) 100 }}%;
        {{- else if eq $params.layout "right" -}}
          --about-bkg-width: {{ mul (div $extra_side 12.0) 100 }}%;
          --about-bkg-margin-left: {{ mul (div $offset_left 12.0) 100 }}%;
          --about-bkg-margin-right: {{ mul (div (add $main_side $offset_right) 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-{{ add $extra_side $offset_left }}"></div>
        {{- else if eq $params.layout "left" -}}
          {{- if gt $offset_left 0 -}}
          <div class="col-xs-12 col-md-{{ $offset_left }}"></div>
          {{- end -}}
        {{- 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="container-fluid profile">
              <div class="row">
                {{- $width_portrait := 12 -}}
                {{- $width_text := 12 -}}
                {{- if or (eq $params.layout "left") (eq $params.layout "right") -}}
                  {{- $width_portrait = $params.portrait_width -}}
                  {{- $width_text = sub 12 $width_portrait -}}
                {{- end -}}
                {{- if .avatar -}}
                  <div class="col-xs-12 col-md-{{ $width_portrait }}">
                  {{/* 2-REC: Special "hover easter egg" */}}
                  {{- if .avatar2 -}}
                    <div class="portrait">
                      <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 -}}
                  </div>
                {{- end -}}
                {{- with .short_text -}}
                  <div class="col-xs-12 col-md-{{ $width_text }}">
                    <div class="text-primary short-text">
                      {{ . | markdownify }}
                    </div>
                  </div>
                {{- end -}}
              </div>
            </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 }}