Added standard templates
This commit is contained in:
parent
d99e5ec840
commit
20becdbd27
14 changed files with 293 additions and 24 deletions
|
|
@ -77,8 +77,12 @@ class ptemplate:
|
|||
theme_templates='themes/'+config.theme+'/templates'
|
||||
|
||||
module_templates=module+'/templates'
|
||||
|
||||
#Standard templates
|
||||
|
||||
standard_templates=path.dirname(__name__)+'/templates'
|
||||
|
||||
return TemplateLookup(directories=[theme_templates, module_templates], default_filters=['h'], input_encoding='utf-8', encoding_errors='replace')
|
||||
return TemplateLookup(directories=[theme_templates, module_templates, standard_templates], default_filters=['h'], input_encoding='utf-8', encoding_errors='replace')
|
||||
|
||||
#return Environment(autoescape=self.guess_autoescape, auto_reload=True, loader=FileSystemLoader([theme_templates, module_templates]))
|
||||
|
||||
|
|
|
|||
4
citoplasma/templates/admin/content.html
Normal file
4
citoplasma/templates/admin/content.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<%inherit file="home.html" />
|
||||
<%block name="content">
|
||||
${content_index|n}
|
||||
</%block>
|
||||
45
citoplasma/templates/admin/home.html
Normal file
45
citoplasma/templates/admin/home.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<!--<link href="{{'css/admin/admin.css'|make_media_url}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{'css/font-awesome.min.css'|make_media_url}}" rel="stylesheet" type="text/css"/>-->
|
||||
${add_css_home('admin/admin.css')}
|
||||
${add_css_home('font-awesome.min.css')}
|
||||
${HeaderHTML.css_home()|n}
|
||||
${add_js_home('jquery.min.js')}
|
||||
${HeaderHTML.js_home()|n}
|
||||
${HeaderHTML.header_home()|n}
|
||||
</head>
|
||||
<body>
|
||||
<div id="languages_general">
|
||||
</div>
|
||||
<div id="logout">
|
||||
<a href="${make_url('admin/logout')}">Logout</a>
|
||||
</div>
|
||||
|
||||
<div id="center_body">
|
||||
<div id="header"><span id="title_phango">Paramecio</span> <span id="title_framework">Framework!</span> </div>
|
||||
<div class="content_admin">
|
||||
<div id="menu">
|
||||
<div class="menu_title">${lang('admin', 'applications', 'Applications')}</div>
|
||||
% for module in sorted(menu):
|
||||
% if type(menu[module]).__name__=='list':
|
||||
<a href="${make_url('admin/'+module)}">${menu[module][0]}</a>
|
||||
% else:
|
||||
<div class="father_admin">${menu[module]}</div>
|
||||
% endif
|
||||
% endfor
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>${title}</h1>
|
||||
<%block name="content">
|
||||
</%block>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loading_ajax">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
9
citoplasma/templates/admin/index.html
Normal file
9
citoplasma/templates/admin/index.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<%inherit file="home.html"/>
|
||||
<%block name="content">
|
||||
<div class="title">
|
||||
Bienvenido al administrador
|
||||
</div>
|
||||
<div class="cont">
|
||||
Desde aquí podrá administrar su site
|
||||
</div>
|
||||
</%block>
|
||||
66
citoplasma/templates/admin/login.phtml
Normal file
66
citoplasma/templates/admin/login.phtml
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%block name="title">${lang('admin', 'login', 'Paramecio Login')}</%block></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
||||
${add_js_home('jquery.min.js')}
|
||||
${add_css_home('admin/login.css')}
|
||||
${add_css_home('font-awesome.min.css')}
|
||||
${HeaderHTML.css_home()|n}
|
||||
${HeaderHTML.js_home()|n}
|
||||
<%block name="ajax">
|
||||
<script language="javascript">
|
||||
$(document).ready( function () {
|
||||
|
||||
$('#login_submit').click( function () {
|
||||
|
||||
$('#loading').show();
|
||||
|
||||
$.ajax({
|
||||
url: "${make_url('admin/login')}",
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
data: {'username': $('#username_form').val(), 'password': $('#password_form').val()}
|
||||
}).done(function(data) {
|
||||
|
||||
if(data.error==0)
|
||||
{
|
||||
|
||||
window.location.href="${make_url('admin')}";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$('#loading').hide('slow');
|
||||
|
||||
$('#username_error').html("${lang('common', 'error_login', 'Error, wrong username or password')}");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</%block>
|
||||
</head>
|
||||
<body>
|
||||
<%block name="content">
|
||||
<form id="login">
|
||||
<div id="title">
|
||||
${lang('admin', 'login', 'Paramecio Login')}
|
||||
</div>
|
||||
${forms|n}
|
||||
<div id="submit_block">
|
||||
<input type="submit" value="${lang('common', 'login', 'Login')}" class="submit" id="login_submit"/>
|
||||
<span id="loading"> </span>
|
||||
</div>
|
||||
</form>
|
||||
</%block>
|
||||
</body>
|
||||
</html>
|
||||
60
citoplasma/templates/admin/register.phtml
Normal file
60
citoplasma/templates/admin/register.phtml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<%inherit file="login.phtml"/>
|
||||
<%block name="ajax">
|
||||
<script language="Javascript">
|
||||
$(document).ready( function () {
|
||||
|
||||
$("#register_submit").click( function () {
|
||||
|
||||
$.ajax({
|
||||
url: "${make_url('admin/register')}",
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
data: {'username': $('#username_form').val(), 'email': $('#email_form').val(), 'password': $('#password_form').val(), 'repeat_password': $('#repeat_password_form').val()}
|
||||
}).done(function(data) {
|
||||
//$( this ).addClass( "done" );
|
||||
//Redirect if register
|
||||
|
||||
if(data.error==0)
|
||||
{
|
||||
|
||||
//$('#result_register').html('Done!. Redirecting...');
|
||||
$('#loading').show();
|
||||
|
||||
window.location.href="${make_url('admin/login')}";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert(JSON.stringify(data));
|
||||
//$('#result_register').html('Error');
|
||||
$('#username_error').html(data.username);
|
||||
$('#email_error').html(data.email);
|
||||
$('#password_error').html(data.password);
|
||||
|
||||
$('#repeat_password_error').html(data.password_repeat);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</%block>
|
||||
<%block name="title">${lang('admin', 'sign_up', 'Paramecio Sign up')}</%block>
|
||||
<%block name="content">
|
||||
<form id="login">
|
||||
<div id="title">
|
||||
${lang('admin', 'sign_up', 'Paramecio Sign up')}
|
||||
</div>
|
||||
${forms|n}
|
||||
<div id="result_register"></div>
|
||||
<div id="submit_block">
|
||||
<input type="submit" value="${lang('common', 'sign_up', 'Sign up')}" class="submit" id="register_submit"/>
|
||||
<span id="loading"> </span>
|
||||
</div>
|
||||
</form>
|
||||
</%block>
|
||||
5
citoplasma/templates/forms/modelform.html
Normal file
5
citoplasma/templates/forms/modelform.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="form">
|
||||
{% for form in forms.values() %}
|
||||
<p><label>{{form.label|safe}}</label>{{form.form()}}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
14
citoplasma/templates/forms/modelform.phtml
Normal file
14
citoplasma/templates/forms/modelform.phtml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<%def name="check_required(required)">
|
||||
% if required:
|
||||
${'*'}
|
||||
% endif
|
||||
</%def>
|
||||
<div class="form">
|
||||
% for form in forms.values():
|
||||
% if form.type!='hidden':
|
||||
<p><label>${form.label} ${check_required(form.required)}</label>${form.form()|n} <span class="error" id="${form.name}_error">${form.txt_error}</span></p>
|
||||
% else:
|
||||
${form.form()|n}
|
||||
% endif
|
||||
% endfor
|
||||
</div>
|
||||
4
citoplasma/templates/utils/admin.phtml
Normal file
4
citoplasma/templates/utils/admin.phtml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
${show_flash_message()|n}
|
||||
<h1>${admin.title}</h1>
|
||||
<a href="${add_get_parameters(admin.url, op_admin='1')}">${lang('common', 'add_item', 'Add new item')}</a>
|
||||
${admin.list.show()|n}
|
||||
13
citoplasma/templates/utils/insertform.phtml
Normal file
13
citoplasma/templates/utils/insertform.phtml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<p><a href="${admin.url}">${lang('common', 'home', 'Home')}</a> >>
|
||||
% if id!='0':
|
||||
${title_edit}
|
||||
%else:
|
||||
${title_edit}
|
||||
%endif
|
||||
</p>
|
||||
<form method="post" action="${add_get_parameters(admin.url, op_admin=2, id=id)}">
|
||||
<h2>${title_edit}</h2>
|
||||
<span class="error">${model.query_error}</span>
|
||||
${ form|n }
|
||||
<p><input type="submit" value="${lang('common', 'send', 'Send') }"></p>
|
||||
</form>
|
||||
53
citoplasma/templates/utils/list.phtml
Normal file
53
citoplasma/templates/utils/list.phtml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<!--{% set header_js_list %}
|
||||
<script language="Javascript">
|
||||
/*alert('pepe');*/
|
||||
</script>
|
||||
{% endset %}
|
||||
{{ header_js_list|add_header_home() }}-->
|
||||
<%def name="select_field()">
|
||||
% if simplelist.search_field==field:
|
||||
selected
|
||||
% endif
|
||||
</%def>
|
||||
<%def name="set_css_arrow(simplelist, field)">
|
||||
% if simplelist.order_field==field:
|
||||
fa fa-arrow-circle-${simplelist.order_class[simplelist.s['order']]}
|
||||
% endif
|
||||
</%def>
|
||||
% if simplelist.yes_search:
|
||||
<div class="form">
|
||||
<form method="get" action="{{simplelist.url}}">
|
||||
${lang('common','search', 'Search')}: <input type="text" name="search_text" value="${simplelist.search_text|n}">
|
||||
<select name="search_field">
|
||||
% for field in simplelist.search_fields:
|
||||
<option value="${simplelist.model.forms[field].name}" ${select_field()}>${simplelist.model.forms[field].label}</option>
|
||||
% endfor
|
||||
</select>
|
||||
<input type="submit" value="${lang('common', 'search', 'Search')}" />
|
||||
</form>
|
||||
</div>
|
||||
% endif
|
||||
<table class="table_list">
|
||||
<tr class="title_list">
|
||||
% for field in simplelist.fields_showed:
|
||||
<td><a href="${add_get_parameters(simplelist.url, order_field=simplelist.model.fields[field].name, begin_page=simplelist.begin_page, order=simplelist.change_order[field], search_text=simplelist.search_text, search_field=simplelist.search_field)}" class="${set_css_arrow(simplelist, field)}">${simplelist.model.fields[field].label}</a></td>
|
||||
% endfor
|
||||
% for extra_field in simplelist.arr_extra_fields:
|
||||
<td>${ extra_field }</td>
|
||||
% endfor
|
||||
</tr>
|
||||
% for row in list:
|
||||
<tr class="row_list">
|
||||
% for field in simplelist.fields_showed:
|
||||
<td>${simplelist.model.fields[field].show_formatted(row[field])}</td>
|
||||
% endfor
|
||||
|
||||
% for extra_field_func in simplelist.arr_extra_options:
|
||||
<td>${ simplelist.set_options(extra_field_func, row)|n }</td>
|
||||
% endfor
|
||||
</tr>
|
||||
% endfor
|
||||
</table>
|
||||
<p>
|
||||
${pages|n}
|
||||
</p>
|
||||
Loading…
Add table
Add a link
Reference in a new issue