【发布时间】:2011-02-09 20:19:09
【问题描述】:
刚刚克隆了 basic_project 并尝试按照此进行自定义 - http://pinaxproject.com/docs/0.7/tabs/#ref-tabs
创建了一个新应用“myapp”,将新标签添加到 right_nav 并编辑了“site_tabs.css”。
但是当我点击标签时,虽然页面确实变成了myapp,但标签的背景颜色并没有改变。
文档中的这一行 - Create a myapps/base.html template that all pages under that tab will extend. Make sure it defines a block body_class with content myapp 让我感到困惑。
"body_class" with content myapp 是什么?,它是某个类具有“{% block body_class%}”的“div”吗?
我的 myapp 页面的代码现在非常简单 -
{% extends "site_base.html" %}
{% load i18n %}
{% load ifsetting_tag %}
{% block head_title %}
{% trans "Custom App page" %}
{% endblock %}
< div class="myapp">
< h1 >
{% trans "Custom App page" %}</h1>
{% if user.is_authenticated %}
< p >You are signed in !!</p>
{% else %}
< p >You are NOT signed in !!</p>
{% endif %}
< /div >
site_base.css如下-
body.profile #tab_profile a,
body.myapp #tab_myapp a,
body.notices #tab_notices a
{
color: #000; /* selected tab text colour */
}
body.profile #tab_profile,
body.myapp #tab_myapp,
body.notices #tab_notices
{
margin: 0; /* to compensate for border */
padding: 5px 0 5px;
background-color: #DEF; /* selected tab colour */
border-left: 1px solid #000; /* tab border */
border-top: 1px solid #000; /* tab border */
border-right: 1px solid #000; /* tab border */
}
任何指针都会很棒。谢谢。
【问题讨论】:
-
你的 site_base.html 和 site_tabs.css 是什么样的?
-
site_base.html 是 pinax 版本 0.7.3 的默认值。在问题中添加 site_tabs.css。