changes to form styling

This commit is contained in:
Karen 2011-10-14 01:05:45 +05:30
parent 6572afb7c8
commit 9d962cedd3
7 changed files with 144 additions and 90 deletions

View File

@ -1,75 +1,76 @@
from models import Module, ModuleTab
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from ox.django.shortcuts import render_to_json_response
def main(request, module_slug):
m = get_object_or_404(Module, slug=module_slug)
tabs = m.moduletab_set.all()
default_tab = tabs[0]
try:
formStr = default_tab.model_class().add_form
has_add = True
add_form = default_tab.model_class().get_add_form()
except:
add_form = None
has_add = False
list_options = {} #get some options as GET params, etc. to potentially pass to get_list
default_tab_list = default_tab.model_class().get_list(list_options)
context = RequestContext(request, {
'title': m.title,
'about': m.about,
'has_add': has_add,
'add_form': add_form(),
'default_tab': tabs[0],
'default_list': default_tab_list,
'default_sorts': default_tab.get_dict()['sorts'],
'tabs': tabs[1:]
})
return render_to_response("noel/insidepage.html", context)
def get_tab(request):
tab_slug = request.GET.get("tab", "")
tab = get_object_or_404(ModuleTab, slug=tab_slug)
return render_to_json_response(tab.get_dict())
def get_list(request):
tab_slug = request.GET.get("tab", "")
tab = get_object_or_404(ModuleTab, slug=tab_slug)
object_id = request.GET.get("object_id", False)
sortString = request.GET.get("sort", "")
if sortString == "" or sortString == 'null':
sortArray = []
else:
sortOperator = sortString[0]
sortField = sortString[1:]
sortArray = [{
'operator': sortOperator,
'key': sortField
}]
list_options = {
'search': request.GET.get("search", ""),
'sort': sortArray,
'page': request.GET.get("page", 1),
'object_id': object_id,
'count': request.GET.get("count", 15) #FIXME: make list_length either in settings.py or config per model
}
object_list = tab.get_list(list_options)
return render_to_json_response(object_list)
def get_details(request):
tab_slug = request.GET.get("tab", '')
tab = get_object_or_404(ModuleTab, slug=tab_slug)
model_class = tab.model_class()
object_id = request.GET.get("object_id", 0)
obj = get_object_or_404(model_class, pk=object_id)
return render_to_json_response(obj.insidepage_dict())
from models import Module, ModuleTab
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from ox.django.shortcuts import render_to_json_response
def main(request, module_slug):
m = get_object_or_404(Module, slug=module_slug)
tabs = m.moduletab_set.all()
default_tab = tabs[0]
try:
formStr = default_tab.model_class().add_form
has_add = True
add_form_class = default_tab.model_class().get_add_form()
add_form = add_form_class()
except:
add_form = None
has_add = False
list_options = {} #get some options as GET params, etc. to potentially pass to get_list
default_tab_list = default_tab.model_class().get_list(list_options)
context = RequestContext(request, {
'title': m.title,
'about': m.about,
'has_add': has_add,
'add_form': add_form,
'default_tab': tabs[0],
'default_list': default_tab_list,
'default_sorts': default_tab.get_dict()['sorts'],
'tabs': tabs[1:]
})
return render_to_response("noel/insidepage.html", context)
def get_tab(request):
tab_slug = request.GET.get("tab", "")
tab = get_object_or_404(ModuleTab, slug=tab_slug)
return render_to_json_response(tab.get_dict())
def get_list(request):
tab_slug = request.GET.get("tab", "")
tab = get_object_or_404(ModuleTab, slug=tab_slug)
object_id = request.GET.get("object_id", False)
sortString = request.GET.get("sort", "")
if sortString == "" or sortString == 'null':
sortArray = []
else:
sortOperator = sortString[0]
sortField = sortString[1:]
sortArray = [{
'operator': sortOperator,
'key': sortField
}]
list_options = {
'search': request.GET.get("search", ""),
'sort': sortArray,
'page': request.GET.get("page", 1),
'object_id': object_id,
'count': request.GET.get("count", 15) #FIXME: make list_length either in settings.py or config per model
}
object_list = tab.get_list(list_options)
return render_to_json_response(object_list)
def get_details(request):
tab_slug = request.GET.get("tab", '')
tab = get_object_or_404(ModuleTab, slug=tab_slug)
model_class = tab.model_class()
object_id = request.GET.get("object_id", 0)
obj = get_object_or_404(model_class, pk=object_id)
return render_to_json_response(obj.insidepage_dict())

View File

@ -1,6 +1,6 @@
#bottomRight
{width:570px;
height:100%; /*IS THIS REQUIRED??*/
min-height:300px; /*IS THIS REQUIRED??*/
background-color:#FFF;
color:#3b3b39; /*was originally f7bd00*/
font-family:'Arial Regular', Arial, Helvetica, sans-serif;

View File

@ -40,12 +40,9 @@ padding-left:16px;}
#topTextSpan
{font-weight:bold;}
#plus
.plus
{font-size:24px;
color:#ffb400;
position:absolute;
right:42px;
top:6px;
cursor:pointer;}
#plusTooltip /*SANJ, this is the basic CSS for your javascript tooltip; no element exists in the HTML doc*/
@ -86,7 +83,7 @@ outline:none;
.searchInnerField:focus
{border:1px solid #999; }
{border:none; }
#tabsInner /*tabs not touching because i would prefer not to give fixed width, shadow, etc.*/
{font-size:14px;
@ -399,7 +396,6 @@ position:fixed;
top:0px;
left:0px;
bottom:0px;
right:0px;
width:100%;
height:100%;
@ -408,14 +404,58 @@ z-index:1000;} /*everything except the lightbox panel should be below this z-ind
#lightboxPanel {
display:none;
position:fixed;
top:200px;
top:140px;
left:0;
right:0;
margin:0 auto;
width:400px;
width:600px;
max-height:500px; /*SANJ, PLEASE DO THE RESIZE IN JS*/
overflow-y:auto;
background-color:#FFF;
padding:15px;
z-index:1001;} /*must have the highest z-index, just more than the lightbox*/
z-index:1001;
color:#737373;
-moz-border-radius:12px;
-webkit-border-radius:12px;
border-radius:12px;} /*must have the highest z-index, just more than the lightbox*/
#addForm input, #addForm textarea {
border:1px solid #e3e3e3;
padding:2px 2px 2px 4px;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
-moz-box-shadow:inset 2px 2px 6px #d7d7d7;
-webkit-box-shadow:inset 2px 2px 6px #d7d7d7;
box-shadow:inset 2px 2px 6px #d7d7d7;
margin-bottom:10px;
vertical-align:text-top;}
#addForm input:focus, #addForm textarea:focus
{outline:none;
border:1px solid #999;}
#addForm label
{font-weight:bold;}
#addForm input[type=submit]
{background-color:#f7bd00;
color:#FFF;
font-size:14px;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
padding:3px 10px;
border:1px solid transparent;
margin-top:10px;}
input#id_law_image
{border:none;
box-shadow:1px 1px 1px transparent;}
input#id_law_image:focus
{outline
#searchContainer {
width:960px;

View File

@ -183,7 +183,7 @@ background-color:#ff8400;}
{color:#FFF;}
#woodPng
{width:40%;
{width:30%;
height:30%;
position:absolute;
left:0;

View File

@ -79,7 +79,6 @@ margin-bottom:10px;}
#formItf textarea{
vertical-align:text-top;
}
#formItf input:focus

View File

@ -5,6 +5,11 @@
<title>{% block title %} {% endblock %}</title>
<link rel="stylesheet" href="/static/css/reset.css" type="text/css" />
<link rel="stylesheet" href="/static/css/noel/main.css" type="text/css" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<script type="text/javascript" src="/static/js/jquery.js"></script>
{% block extra_head %}

View File

@ -28,6 +28,14 @@
<form id="addForm" action="" method="POST" data-id="{{ default_tab.id }}">
<table>
{{ add_form.as_table }}
<tr>
<td>
</td>
<td>
<input type="submit" />
</td>
</tr>
</table>
</form>
</div>
@ -45,10 +53,11 @@
<h3 id="topText">{{ title|format_title|safe }}</h3>
<div id="searchInnerDiv">
<img src="/static/images/noel/search-inner.png" width="22" height="18" alt="search" class="searchInner">
<img src="/static/images/noel/search-inner.png" width="22" height="18" id="aboutBtn" alt="About" class="searchInner">
<!--<img src="/static/images/noel/search-inner.png" width="22" height="18" alt="search" class="searchInner">-->
<img src="/static/images/noel/aboutus.gif" width="20" height="20" id="aboutBtn" alt="About">
{% if has_add %}
<img src="/static/images/noel/search-inner.png" width="22" height="18" id="addBtn" alt="Add" class="searchInner">
<span class="plus" id="addBtn">&#000043;</span>
{% endif %}
<!--