Skip to content

Commit 2c3024b

Browse files
committed
Add custom styles to labels on learning resources
1 parent 2172da5 commit 2c3024b

4 files changed

Lines changed: 76 additions & 32 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@import 'apps/commons/static/commons/css/base';
2+
3+
ul {
4+
margin-top: 1rem;
5+
6+
&.resources {
7+
li {
8+
list-style: initial;
9+
margin-left: 20px;
10+
}
11+
}
12+
13+
.label {
14+
display: inline-block;
15+
font-size: 13px;
16+
padding-left: 9px;
17+
padding-right: 9px;
18+
border-radius: 10px;
19+
20+
&:hover {
21+
background-color: #154360 !important;
22+
a {
23+
color: white !important;
24+
}
25+
}
26+
}
27+
}
28+
29+
.learn-index {
30+
ul li i {
31+
padding-right: 10px;
32+
}
33+
34+
.label {
35+
font-size: 1rem;
36+
margin-bottom: 0.5rem;
37+
}
38+
}
39+
40+
.learn-resources_by_label {
41+
.resource {
42+
margin-right: 1rem;
43+
}
44+
}

apps/learn/templates/learn/index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "jobs/base.html" %}
1+
{% extends "learn/base.html" %}
22

33
{% load utils %}
44

@@ -10,11 +10,15 @@
1010

1111
<h1 class="title">Aprende Python</h1>
1212

13-
<p>En esta sección podrás encontrar recursos de aprendizaje Python.</p>
13+
<p>En esta sección podrás encontrar <strong>recursos de aprendizaje Python</strong>. Están clasificados por etiquetas:</p>
1414

1515
<ul>
1616
{% for label in labels %}
17-
<li><a href="{% url "learn:resources_by_label" label=label %}">{{ label }}</a></li>
17+
<li>
18+
<span class="label" style="background-color: #{{ label.color }}">
19+
<a style="color: #{{ label.foreground_color }}" href="{% url "learn:resources_by_label" label=label %}">{{ label }}</a>
20+
</span>
21+
</li>
1822
{% endfor %}
1923
</ul>
2024

apps/learn/templates/learn/resources_by_label.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "jobs/base.html" %}
1+
{% extends "learn/base.html" %}
22

33
{% load utils %}
44

@@ -10,20 +10,19 @@
1010

1111
<nav class="breadcrumb" aria-label="breadcrumbs">
1212
<ul>
13-
<li><a href="{% url "homepage" %}"></a></li>
1413
<li><a href="{% url "learn:index" %}">Aprende Python</a></li>
1514
<li class="is-active"><a href="#" aria-current="page">{{ label }}</a></li>
1615
</ul>
1716
</nav>
1817

19-
<h1 class="title">{{ label }}</h1>
18+
<h1 class="title"><i class="fas fa-tag"></i> {{ label }}</h1>
2019

21-
<ul>
20+
<ul class="resources">
2221
{% for resource in resources %}
2322
<li>
24-
<a href="{{ resource.url }}">{{ resource }}</a>
23+
<a class="resource" href="{{ resource.url }}">{{ resource }}</a>
2524
{% for label in resource.labels.all %}
26-
<span class="tag" style="background-color: #{{ label.color }}">
25+
<span class="label" style="background-color: #{{ label.color }}">
2726
<a style="color: #{{ label.foreground_color }}" href="{% url "learn:resources_by_label" label=label %}">{{ label }}</a>
2827
</span>
2928
{% endfor %}

gulp/config.js

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
1-
import path from 'path';
1+
import path from 'path'
22

3-
4-
function getNodeModulesPathFrom(module_name)
5-
{
6-
let module_path = require.resolve(module_name);
7-
while(module_path !== '/' && path.basename(module_path) !== "node_modules")
8-
{
9-
module_path = path.dirname(module_path);
3+
function getNodeModulesPathFrom(module_name) {
4+
let module_path = require.resolve(module_name)
5+
while (module_path !== '/' && path.basename(module_path) !== 'node_modules') {
6+
module_path = path.dirname(module_path)
107
}
11-
return module_path;
8+
return module_path
129
}
1310

14-
1511
const APPS = [
16-
"commons",
17-
"events",
18-
"homepage",
19-
"about",
20-
"legal",
21-
"members",
22-
"jobs",
23-
];
12+
'commons',
13+
'events',
14+
'homepage',
15+
'about',
16+
'legal',
17+
'members',
18+
'jobs',
19+
'learn',
20+
]
2421

25-
const NODE_MODULES_DIR = getNodeModulesPathFrom('@fortawesome/fontawesome-free');
22+
const NODE_MODULES_DIR = getNodeModulesPathFrom('@fortawesome/fontawesome-free')
2623

2724
const LIBS = {
2825
CSS: {
29-
commons: [NODE_MODULES_DIR + "/@fortawesome/fontawesome-free/css/all.css"],
30-
homepage: ["apps/homepage/static/homepage/css/vendor.scss"],
26+
commons: [NODE_MODULES_DIR + '/@fortawesome/fontawesome-free/css/all.css'],
27+
homepage: ['apps/homepage/static/homepage/css/vendor.scss'],
3128
},
3229
JS: {},
33-
};
30+
}
3431

35-
export { APPS, LIBS, NODE_MODULES_DIR };
32+
export { APPS, LIBS, NODE_MODULES_DIR }

0 commit comments

Comments
 (0)