Log in

Customising footer and title

pdp7Losing Braincells
  • 15 Nov

I tried to customise footer but without any luck.

Modified /path/to/spirit/venv/lib/python3.6/site-packages/spirit/core/templates/spirit/_footer.html

But nothing happens. I even removed this file from the server but still it's the same old default footer.

Also, where I can find this "Latest active topics" block title setting? Would like to change that also.

These might be rather simple things if one knows anything about these webthingies nowadays, but this old fart doesn't know rats ass about these django and sass or what ever thingies :)

Thanks!

nitelyEsteban Castro Borsani
  • 4
  • 16 Nov

But nothing happens. I even removed this file from the server but still it's the same old default footer.

Sounds like you did not restarted the server afterwards. You must restart the server after changing any html file to take effect (unless debug mode is on)

But the best way to change some of the html files is to override them. You can do that by creating a ./project/templates/spirit/_footer.html file in your root project, and then changing the following setting in base.py:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.template.context_processors.request',
                'django.contrib.messages.context_processors.messages',
                'djconfig.context_processors.config',
            ],
        },
    },
]

By:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'APP_DIRS': True,
       'DIRS': [
            os.path.join(BASE_DIR, 'project', 'templates'),
        ],
        'OPTIONS': {
            'context_processors': [
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.template.context_processors.request',
                'django.contrib.messages.context_processors.messages',
                'djconfig.context_processors.config',
            ],
        },
    },
]

Notice all I did was add the DIRS key. The "project" thing assumes you followed the spirit install steps, so the templates folder will be located next to the st_search, media, project, etc folders.

Be aware I did not tried this, so let me know whether it works or not (I can try it myself on weekend then). Remember to restart the server after making all the modifications.

Also, where I can find this "Latest active topics" block title setting? Would like to change that also.

You can override that piece of template as well, it's located at spirit/topic/templates/spirit/topic/active.html and to override it just create a ./project/templates/spirit/topic/active.html file. Copy paste the file and edit it.

pdp7Losing Braincells
  • 16 Nov

Ok then. I thought it must be something I have no idea of. Didn't occur to me that I need to restart the whole thingie. Unfortunately I'm not having access on that level in the box I'm working on, so I have to discuss with my man about this matter, since I'm going to do this customisation on this forum... I might need a another one to fool around and not breaking everything on production :)

So if I want to change link text in posts I just tweak those css files and restart and everything is fine and dandy?

Thanks and my apologies for the completely uneducated questions I might have. Since as I said, I have no experience on these thingies that are used nowadays... those glorious days of late 90's, when things were mess and chaos, are just a faint memory :)

Thanks a lot!

nitelyEsteban Castro Borsani
  • 16 Nov

Didn't occur to me that I need to restart the whole thingie

Not necessarily the whole thing, but just the Django server (probably gunicorn or uwsgi). Restarting the whole thing will work too of course.

So if I want to change link text in posts I just tweak those css files and restart and everything is fine and dandy?

The html files, yes. For example to change the topics title, you would replace:

{% block title %}{% trans "Latest active topics" %}{% endblock %}

by

{% block title %}{% trans "Some custom title here" %}{% endblock %}
pdp7Losing Braincells
  • 16 Nov

@nitely said:

So if I want to change link text in posts I just tweak those css files and restart and everything is fine and dandy?

The html files, yes. For example to change the topics title, you would replace:

Stupid me forgetting words from the sentence and think people make sense out of them. I meant "link text colour", since I'd like it to be something different than this light gray it's by default.

Sorry about this.

nitelyEsteban Castro Borsani
  • 3
  • 16 Nov

Ah, I totally misread it. I'm using something called sass that gets compiled into css. So, changing the autogenerated css file is probably not a good idea, at least not if you plan on ever upgrading Spirit.

The easiest way is to change it within the admin panel. Go to your forum /st/admin/config/ and copy/paste this style into the "footer snippet" text box:

<style>
.comment-text a {
  color: #0074D9 !important;
}

.comment-text a:visited {
  color: #7FDBFF !important;
}

.comment-text a:hover, .comment-text a:focus {
  color: #001f3f !important;
}
</style>

To find what style to override you may inspect the element with your browser (that's what I did).

Doing this is a bit hacky. There is an issue to remove that functionality since it's considered a security risk. Once it's removed you'll have to override the _base.html and add the code there. You may add a custom css file there too instead.

PS. I've added this snippet to the forum now. Just temporarily

pdp7Losing Braincells
  • 16 Nov

Excellent this works for now... Another thing I wanted to change is strike-through .. now it's not really what is should be... Can I do this the same way or does it need some other way?

Thanks!

nitelyEsteban Castro Borsani
  • 2
  • 17 Nov

now it's not really what is should be...

Yes, I know. You can do it the same way, but it removes the red highlight from the comment edition diff, click on the edit counter in one of my previous comments to see what I mean. Here is the code:

<style>

.comment-text del {
    background-color: transparent !important;
    text-decoration: line-through !important;
}

</style>

I have added it to the forum

pdp7Losing Braincells
  • 17 Nov

Ok thanks!

I see what you mean. But in our forum it's better to have true strikethrough rather that highlighting... Need to dig into the styles and such to get and idea but that's when I get this another forum running that I can break :P

I'm still a bit confused with the structure of things since I've never worked with any of these modern frameworks and such thingies. It was much simple and straight forward back then when we used to rape all the standards and protocols in order to make websites usable and pretty. :)

Reply