orionblastar / K666

K666 is forum discussion software, this is an attempt to write the Free version FreeK666 without violating copyright
http://k666.kr5ddit.com
MIT License
5 stars 0 forks source link

Standardise Base View #19

Closed procrasti closed 8 years ago

procrasti commented 8 years ago

Branch: basehtml Depends: https://github.com/orionblastar/K666/issues/12

TODO:

Okay, now you'll see that our index page, and the signup and messages pages, have nothing in common!

We're going to fix that.

I want you to take the base.html template file from allauth, and copy it into freek666/templates/base.html

Then, you're going to use it from our index.html file!

So, new index.html:

{% extends "base.html" %}

{% block head_title %}
    {% include "fragments/title_fragment.html" %}
{% endblock head_title %}

{% block content %}
    {% include "fragments/page_header_fragment.html" %}
    {% include "fragments/intro_fragment.html" %}
    {% include "fragments/images_fragment.html" %}
    {% include "fragments/donations_fragment.html" %}
{% endblock content %}

You can see that when you name a block, it replaces the block in the template it is extending!

Now, to bring what we have in the index.html to the other pages, take the page header fragment, and the donations fragment, and put them in base.html instead... Now, they will appear on every page! Our index, the accounts pages, and the messaging pages!

How cool is that!

procrasti commented 8 years ago

Now, if you go check the django_messages/templates/django_messages/base.html, you will see it has a sidebar block, which isn't being shown because it's trying to override a block that does not exist in our base.html.

To fix this, just add:

{% block sidebar %}
{% endblock sidebar %}

To our base.html, and you should see the compose, inbox, etc links when we view the messages.

Don't worry about formatting yet!

procrasti commented 8 years ago

You should look at standardising the base view next.

Issue: https://github.com/orionblastar/K666/issues/19

orionblastar commented 8 years ago

I made some changes and put them in the basehtml branch. I did git push origin basehtml and it went into the new branch instead of master.

I'm confused if the page header and donation fragments are put into base.html it will show up twice in index.html, so do we need to modify index.html to remove the page header and donations fragments?

procrasti commented 8 years ago

so do we need to modify index.html to remove the page header and donations fragments?

Yes, if they are in base, they shouldn't be in index.

You can try it out yourself and make that kind of decision.

procrasti commented 8 years ago

I want you to take the base.html template file from allauth, and copy it into freek666/templates/base.html

Not into templates/fragments... it must go into freek666/templates/base.html.

Remember to use git mv, not just plain mv, so git keeps track of you moving the file.

orionblastar commented 8 years ago

OK I moved with git mv the base.html file. I added the header and donation fragments to base.html and removed them from index.html. I had to figure out where to put donations so it shows up on the bottom of each screen. Pushed it in to origin basehtml, let me know if I got it correct or not.

procrasti commented 8 years ago

Yep, merged into master... This is done.