Merge pull request #854 from niphlod/fix/bs3

first iteration on bs3 cleanup
This commit is contained in:
mdipierro
2015-03-18 18:13:21 -05:00
7 changed files with 409 additions and 662 deletions
+13 -10
View File
@@ -9,9 +9,15 @@
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()
## app configuration made easy. Look inside private/appconfig.ini
from gluon.contrib.appconfig import AppConfig
## once in production, remove reload=True to gain full speed
myconf = AppConfig(reload=True)
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all'])
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore+ndb')
@@ -26,7 +32,9 @@ else:
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## choose a style for forms
response.formstyle = 'bootstrap3_inline' # or 'bootstrap3_stacked' or 'bootstrap2' or other
response.formstyle = myconf.take('forms.formstyle') # or 'bootstrap3_stacked' or 'bootstrap2' or other
response.form_label_separator = myconf.take('forms.separator')
## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
@@ -54,20 +62,15 @@ auth.define_tables(username=False, signature=False)
## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' if request.is_local else 'smtp.gmail.com:587'
mail.settings.sender = 'you@gmail.com'
mail.settings.login = 'username:password'
mail.settings.server = 'logging' if request.is_local else myconf.take('smtp.sender')
mail.settings.sender = myconf.take('smtp.sender')
mail.settings.login = myconf.take('smtp.login')
## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.janrain_account import use_janrain
use_janrain(auth, filename='private/janrain.key')
#########################################################################
## Define your tables below (or better in another model file) for example
##
+46 -36
View File
@@ -40,34 +40,35 @@ def _():
ctr = request.controller
# useful links to internal and external resources
response.menu += [
(SPAN('web2py', _class='highlighted'), False, 'http://web2py.com', [
(T('My Sites'), False, URL('admin', 'default', 'site')),
(T('This App'), False, URL('admin', 'default', 'design/%s' % app), [
(T('Controller'), False,
URL(
'admin', 'default', 'edit/%s/controllers/%s.py' % (app, ctr))),
(T('View'), False,
URL(
'admin', 'default', 'edit/%s/views/%s' % (app, response.view))),
(T('Layout'), False,
URL(
'admin', 'default', 'edit/%s/views/layout.html' % app)),
(T('Stylesheet'), False,
URL(
'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % app)),
(T('DB Model'), False,
URL(
'admin', 'default', 'edit/%s/models/db.py' % app)),
(T('Menu Model'), False,
URL(
'admin', 'default', 'edit/%s/models/menu.py' % app)),
(T('Database'), False, URL(app, 'appadmin', 'index')),
(T('Errors'), False, URL(
'admin', 'default', 'errors/' + app)),
(T('About'), False, URL(
'admin', 'default', 'about/' + app)),
]),
('web2py.com', False, 'http://www.web2py.com', [
(T('This App'), False, '#', [
(T('Design'), False, URL('admin', 'default', 'design/%s' % app)),
LI(_class="divider"),
(T('Controller'), False,
URL(
'admin', 'default', 'edit/%s/controllers/%s.py' % (app, ctr))),
(T('View'), False,
URL(
'admin', 'default', 'edit/%s/views/%s' % (app, response.view))),
(T('Layout'), False,
URL(
'admin', 'default', 'edit/%s/views/layout.html' % app)),
(T('Stylesheet'), False,
URL(
'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % app)),
(T('DB Model'), False,
URL(
'admin', 'default', 'edit/%s/models/db.py' % app)),
(T('Menu Model'), False,
URL(
'admin', 'default', 'edit/%s/models/menu.py' % app)),
(T('Database'), False, URL(app, 'appadmin', 'index')),
(T('Errors'), False, URL(
'admin', 'default', 'errors/' + app)),
(T('About'), False, URL(
'admin', 'default', 'about/' + app)),
]),
('web2py.com', False, '#', [
(T('Download'), False,
'http://www.web2py.com/examples/default/download'),
(T('Support'), False,
@@ -85,7 +86,9 @@ def _():
(T('Recipes'), False, 'http://web2pyslices.com/'),
(T('Semantic'), False, 'http://web2py.com/semantic'),
]),
(T('Documentation'), False, 'http://www.web2py.com/book', [
(T('Documentation'), False, '#', [
(T('Online book'), False, 'http://www.web2py.com/book'),
LI(_class="divider"),
(T('Preface'), False,
'http://www.web2py.com/book/default/chapter/00'),
(T('Introduction'), False,
@@ -116,18 +119,25 @@ def _():
'http://www.web2py.com/book/default/chapter/13'),
(T('Other Recipes'), False,
'http://www.web2py.com/book/default/chapter/14'),
(T('Buy this book'), False,
(T("Buy web2py's book"), False,
'http://stores.lulu.com/web2py'),
]),
(T('Community'), False, None, [
(T('Community'), False, None, [
(T('Groups'), False,
'http://www.web2py.com/examples/default/usergroups'),
(T('Twitter'), False, 'http://twitter.com/web2py'),
(T('Live Chat'), False,
'http://webchat.freenode.net/?channels=web2py'),
]),
(T('Plugins'), False, 'http://web2py.com/plugins')]
)]
(T('Twitter'), False, 'http://twitter.com/web2py'),
(T('Live Chat'), False,
'http://webchat.freenode.net/?channels=web2py'),
]),
(T('Plugins'), False, None, [
('plugin_wiki', False,
'http://web2py.com/examples/default/download'),
(T('Other Plugins'), False,
'http://web2py.com/plugins'),
(T('Layout Plugins'),
False, 'http://web2py.com/layouts'),
])
]
if DEVELOPMENT_MENU: _()
if "auth" in locals(): auth.wikimenu()
@@ -0,0 +1,19 @@
; App configuration
; db configuration
[db]
uri = sqlite://storage.sqlite
migrate = 1
pool_size = 1
; smtp address and credentials
[smtp]
server = smtp.gmail.com:587
sender = you@gmail.com
login = username:password
; form styling
[forms]
formstyle = bootstrap3_inline
separator =
@@ -1,544 +1,310 @@
/*!
* part of the package to convert web2py elements to bootstrap3 theme
* Developed by Paolo Caruccio ( paolo.caruccio66@gmail.com )
* Released under MIT license
* version 1 rev.201402261600
*
* Supported version of bootstrap framework: 3.0.2+
* The full package includes:
* - bootstrap3.py python module
* - this css file
* - web2py-bootstrap3.js
* - example of layout.html
* - rules overriding web2py.css
*/
div.flash {
background-image: none;
border-radius: 4px;
-o-border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-width: 1px;
color: rgb(51, 51, 51);
font-weight: normal;
margin: 0 0 20px 0;
min-width: 28px;
max-width: 300px;
opacity: 1;
padding: 15px 35px 15px 15px;
vertical-align: baseline;
right: auto;
background-image: none;
border-radius: 4px;
-o-border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
color: #333;
font-weight: 400;
min-width: 28px;
max-width: 300px;
opacity: 1;
vertical-align: baseline;
right: auto;
border-width: 1px;
margin: 0 0 20px;
padding: 15px 35px 15px 15px;
}
div.flash.alert:hover {
opacity: 1;
opacity: 1;
}
.ie-lte8 div.flash {
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#222222', endColorstr='#000000', GradientType=0);
}
.ie-lte8 div.flash:hover {
filter:alpha(opacity=100);
}
ul.navbar-nav li {
margin-bottom: 0;
}
ul.list-group, .bs3-form ul , ul.nav-tabs, ul.nav-pills {
margin-left: 0;
}
p.lead {
text-align: inherit;
}
form label {
white-space: normal;
}
form.form-inline [type="text"], [type="password"], select {
margin-right: 0;
filter: alpha(opacity=25);
}
div.error {
display: none;
width: auto;
background: transparent;
border: none;
padding: 0;
padding-left: 5px;
background-image: none;
}
/*
* bootstrap3 adapters
* essential rules
*/
/* flash messages */
div.flash.alert {
display: none;
position: fixed;
top: 70px;
right: 75px;
cursor: pointer;
z-index: 1000;
background-color: #f9edbe;
border-color: #f0c36d; }
div.flash.alert.centered {
right: auto; }
div.flash.alert.leftside {
right: auto;
left: 75px; }
div.flash.alert #closeflash {
display: inline-block;
position: relative;
top: -2px;
right: -21px;
color: inherit;
cursor: pointer;
opacity: 0.5;
float: right;
font-size: 21px;
font-weight: bold;
line-height: 1;
text-shadow: 0 1px 0 #ffffff;
margin: 0;
padding: 0;
}
/* buttons */
.bs3-form-btn {
margin-top: 3px;
margin-bottom: 3px;
}
/*image preview in update forms*/
.w2p-uploaded-file .btn-group {
vertical-align: top;
margin-top: 0;
}
#file-reset-btn {
vertical-align: top;
}
.w2p-uploaded-file input[type="file"] {
display:inline-block;
padding-top: 7px;
}
.w2p-file-preview img {
max-width: 150px;
}
.w2p-file-preview:hover img {
background-color: #ebebeb;
border-color: #adadad;
}
.w2p-file-preview span {
min-width: 150px;
max-width: 150px;
display: inline-block;
line-height: 40px;
min-height: 40px;
}
#no-file {
display: inline-block;
background-color: #eee;
vertical-align: middle;
text-align: center;
border-radius: 4px;
min-width: 150px;
max-width: 150px;
line-height: 43px;
min-height: 43px;
}
/* form-inline */
.form-inline .form-group {
margin-right: 4px;
}
/* list widget */
.w2p_list li {
margin-bottom: 6px;
}
.w2p_list li input {
display: inline-block;
width: 59%;
margin-right: 4px;
}
/* autocomplete widget */
div[id^=_autocomplete_] {
margin-top: -10px;
z-index: 1;
}
select.autocomplete {
display: block;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-color: #428bca;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
/* nav-tabs */
.nav-tabs {
margin-bottom: 15px;
}
/* dropdown multilevels in menu*/
/* fix issue when screen height is shorter than bs3 default */
.navbar-collapse.short-screen {
max-height: 200px !important;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
margin-top: 5px;
margin-right: -10px;
border-style: solid;
/* right-arrow */
border-color: transparent #cccccc;
border-width: 4px 0 4px 4px;
}
@media (min-width: 768px) {
/* animation */
.navbar-nav .dropdown-menu {
top: -9999px;
display: block;
opacity: 0;
-webkit-transition: opacity .4s ease-in-out; }
.dropdown-submenu {
position: relative; }
.dropdown-submenu>.dropdown-menu {
position: absolute;
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 4px 4px 4px;
/* animation */
left: -9999px;
opacity: 0;
display: block;
-webkit-transition: opacity .4s ease-in-out; }
.navbar ul.nav li[data-w2pmenulevel="l0"]:hover >ul.dropdown-menu {
display: block;
/* animation */
top: 100%;
opacity: 1; }
.dropdown-submenu:hover>.dropdown-menu {
display: block;
/* animation */
left: 100%;
opacity: 1; }
.dropdown-submenu:hover>a,
.dropdown-submenu:focus>a {
color: #fff;
text-decoration: none;
background-color: #357ebd; }
.navbar-inverse .navbar-nav>li>a:hover,
.navbar-inverse .navbar-nav>li>a:focus,
.navbar-inverse .navbar-nav>li:hover>a {
color: #fff;
background-color: black; }
.dropdown-submenu>a:hover:after,
.dropdown-submenu:hover>a:after {
/* left-arrow */
border-color: transparent #fff;
border-width: 4px 4px 4px 0; }
}
@media (max-width: 767px){
.dropdown-menu {
width: 100%;
display: none; }
.dropdown-submenu>.dropdown-menu {
position: static;
float: none;
display: none;
width: auto;
background: transparent;
border: none;
margin: 0;
padding: 0;
box-shadow: none;
text-indent: 8px; }
.dropdown-submenu>.dropdown-menu.open {
display: block;
height: 100%; }
.dropdown-submenu>a:after {
/* down-arrow */
border-color: #cccccc transparent;
border-width: 4px 4px 0px 4px; }
.dropdown-submenu>a:hover:after {
border-color: #ffffff transparent; }
.dropdown-submenu>a.active {
font-weight: 700; }
.dropdown-submenu>a.active:after {
/* up-arrow */
border-color: #ffffff transparent;
border-width: 0px 4px 4px 4px; }
background-image: none;
color: red;
display: inline-block;
padding: 5px;
}
/*
* application customization
* add custom rules
*/
/* web2py logo */
#web2py-logo {
color: #c6cecc;
div.flash.alert {
display: none;
position: fixed;
top: 70px;
right: 75px;
cursor: pointer;
z-index: 1000;
background-color: #f9edbe;
border-color: #f0c36d;
}
#web2py-logo b {
display: inline-block;
margin-top: -1px;
}
#web2py-logo b>span {
font-size: 22px;
color: white;
}
#web2py-logo:hover {
color: white;
}
/*footer*/
#footer>div.row {
padding-top: 9px;
margin: 20px 0 40px 0;
border-top: 1px solid #eee;
}
#footer p {
margin-left: -15px;
margin-right: -15px;
}
.dropdown .highlighted {
color: #428bca;
}
form {
max-width: 600px;
.w2p-toolbar-hidden {
margin: 10px;
}
ul.w2p_list {
margin-left: 0;
padding-left: 0;
margin-left: 0;
padding-left: 0;
}
.w2p_list li {
margin-bottom: 6px;
}
.w2p_list li input {
display: inline-block;
width: 90%;
margin-right: 4px;
}
.w2p_list li a {
margin-bottom: 2px;
}
div[id^=_autocomplete_] {
margin-top: -10px;
z-index: 1;
}
select.autocomplete {
display: block;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
border-color: #428bca;
padding: 6px 12px;
}
#web2py-logo {
color: #c6cecc;
}
#web2py-logo b {
display: inline-block;
margin-top: -1px;
}
#web2py-logo b>span {
font-size: 22px;
color: #FFF;
}
#web2py-logo:hover {
color: #FFF;
}
.footer > .container-fluid {
padding-left: 15px;
padding-right: 15px;
margin: 20px;
}
.background {
background: url(../images/background.jpg) no-repeat center center;
}
html {
background-color: #333;
background: url(../images/background.jpg) no-repeat center center;
}
body {
padding-top: 50px
padding-top: 50px;
margin-bottom: 60px;
}
header {
-webkit-box-shadow: 0px 0px 8px 2px #000000;
-moz-box-shadow: 0px 0px 8px 2px #000000;
box-shadow: 0px 0px 8px 2px #000000;
-webkit-box-shadow: 0 0 8px 2px #000;
-moz-box-shadow: 0 0 8px 2px #000;
box-shadow: 0 0 8px 2px #000;
margin-bottom: 10px;
}
main {
padding-bottom: 50px;
html {
position: relative;
min-height: 100%;
}
footer {
padding:50px; background: #333; color: #aaa;
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background: #333;
color: #aaa;
}
header h1 {
color: white !important; text-shadow: 0 0 7px black;
color: #FFF!important;
text-shadow: 0 0 7px #000;
}
header .jumbotron {
background-color: transparent;
}
.nav a, .btn, .btn-default {
text-shadow: none; font-weight: bold;
background-color: transparent;
}
.flash {
opacity: 0.9 !important; right: 100px;
opacity: 0.9!important;
right: 100px;
}
.dropdown {
z-index: 2000;
.right {
float: right;
text-align: right;
}
.help-block {
margin-top: 0;
margin-bottom: 0;
.left {
float: left;
text-align: left;
}
#w2padmin-btn {
margin:30px 0 30px 0;
.center {
width: 100%;
text-align: center;
vertical-align: middle;
}
.hidden {display:none;visibility:visible}
.right {float:right; text-align:right}
.left {float:left; text-align:left}
.center {width:100%; text-align:center; vertical-align:middle}
/* fix ie problem with menu */
td.w2p_fw {padding-bottom:1px}
td.w2p_fl,td.w2p_fw,td.w2p_fc {vertical-align:top}
td.w2p_fl {text-align:left}
td.w2p_fl, td.w2p_fw {padding-right:7px}
td.w2p_fl,td.w2p_fc {padding-top:4px}
div.w2p_export_menu {margin:5px 0}
div.w2p_export_menu a, div.w2p_wiki_tags a, div.w2p_cloud a {margin-left:5px; padding:2px 5px; background-color:#f1f1f1; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;}
/* tr#submit_record__row {border-top:1px solid #E5E5E5} */
#submit_record__row td {padding-top:.5em}
/* Fix */
#auth_user_remember__row label {display:inline}
#web2py_user_form td {vertical-align:top}
div.error_wrapper {display:block}
div.error {
color:red;
padding:5px;
display:inline-block;
td.w2p_fw {
padding-bottom: 1px;
}
.copyright {float:left}
#poweredBy {float:right}
/* #MEDIA QUERIES SECTION */
/*
*Grid
*
* The default style for SQLFORM.grid even using jquery-iu or another ui framework
* will look better with the declarations below
* if needed to remove base.css consider keeping these following lines in some css file.
*/
/* .web2py_table {border:1px solid #ccc} */
.web2py_paginator {}
.web2py_grid {width:100%}
.web2py_grid table {width:100%}
.web2py_grid tbody td {padding:2px 5px 2px 5px; vertical-align: middle;}
.web2py_grid .web2py_form td {vertical-align: top;}
.web2py_grid thead th,.web2py_grid tfoot td {
background-color:#EAEAEA;
padding:10px 5px 10px 5px;
td.w2p_fl {
text-align: left;
}
.web2py_grid tr.odd {background-color:#F9F9F9}
.web2py_grid tr:hover {background-color:#F5F5F5}
/*
.web2py_breadcrumbs a {
line-height:20px; margin-right:5px; display:inline-block;
padding:3px 5px 3px 5px;
font-family:'lucida grande',tahoma,verdana,arial,sans-serif;
color:#3C3C3D;
text-shadow:1px 1px 0 #FFFFFF;
white-space:nowrap; overflow:visible; cursor:pointer;
background:#ECECEC;
border:1px solid #CACACA;
-webkit-border-radius:2px; -moz-border-radius:2px;
-webkit-background-clip:padding-box; border-radius:2px;
outline:none; position:relative; zoom:1; *display:inline;
td.w2p_fl,
td.w2p_fw {
padding-right: 7px;
}
td.w2p_fl,
td.w2p_fc {
padding-top: 4px;
}
div.w2p_export_menu {
margin: 5px 0;
}
div.w2p_export_menu a,
div.w2p_wiki_tags a,
div.w2p_cloud a {
margin-left: 5px;
padding: 2px 5px;
}
#submit_record__row td {
padding-top: .5em;
}
div.error_wrapper {
display: block;
}
.copyright {
float: left;
}
#poweredBy {
float: right;
}
.web2py_grid tbody td {
vertical-align: middle;
padding: 2px 5px;
}
.web2py_grid thead th,
.web2py_grid tfoot td {
background-color: #EAEAEA;
padding: 10px 5px;
}
.web2py_grid tr.odd {
background-color: #F9F9F9;
}
.web2py_grid tr:hover {
background-color: #F5F5F5;
}
*/
.web2py_console form {
width: 100%;
display: inline;
vertical-align: middle;
margin: 0 0 0 5px;
}
.web2py_console form select {
margin:0;
margin: 0;
}
.web2py_search_actions {
float:left;
text-align:left;
float: left;
text-align: left;
width: 100%;
}
.web2py_grid .row_buttons {
min-height:25px;
vertical-align:middle;
min-height: 25px;
vertical-align: middle;
}
.web2py_grid .row_buttons a {
margin:3px;
margin: 3px;
}
.web2py_search_actions {
width:100%;
}
.web2py_grid .row_buttons a,
.web2py_paginator ul li a,
.web2py_search_actions a,
.web2py_console input[type=submit],
.web2py_console input[type=button],
.web2py_console button {
line-height:20px;
margin-right:2px; display:inline-block;
padding:3px 5px 3px 5px;
line-height: 20px;
margin-right: 2px;
display: inline-block;
padding: 3px 5px;
}
.web2py_counter {
margin-top:5px;
margin-right:2px;
width:35%;
float:right;
text-align:right;
margin-top: 5px;
margin-right: 2px;
width: 35%;
float: right;
text-align: right;
}
.web2py_table {
clear: both;
display: block;
}
/*Fix firefox problem*/
.web2py_table {clear:both; display:block}
.web2py_paginator {
padding:5px;
text-align:right;
background-color:#f2f2f2;
text-align: right;
background-color: #f2f2f2;
padding: 5px;
}
.web2py_paginator ul {
list-style-type:none;
margin:0px;
padding:0px;
list-style-type: none;
margin: 0;
padding: 0;
}
.web2py_paginator ul li {
display:inline;
}
.web2py_paginator .current {
font-weight:bold;
font-weight: 700;
}
.web2py_breadcrumbs ul {
list-style:none;
margin-bottom:18px;
list-style: none;
margin-bottom: 18px;
}
li.w2p_grid_breadcrumb_elem {
display:inline-block;
display: inline-block;
}
.web2py_console input,
.web2py_console select,
.web2py_console a {
margin: 2px;
}
.web2py_console form { vertical-align: middle; }
.web2py_console input, .web2py_console select,
.web2py_console a { margin: 2px; }
#wiki_page_body {
width: 600px;
height: auto;
min-height: 400px;
width: 600px;
height: auto;
min-height: 400px;
}
/* fix some IE problems */
.ie-lte7 .topbar .container {z-index:2}
.ie-lte8 div.flash{ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#222222', endColorstr='#000000', GradientType=0 ); }
.ie-lte8 div.flash:hover {filter:alpha(opacity=25);}
.ie9 #w2p_query_panel {padding-bottom:2px}
.web2py_console .form-control {width: 20%; display: inline;}
.web2py_console #w2p_keywords {width: 50%;}
.web2py_search_actions a, .web2py_console input[type=submit], .web2py_console input[type=button], .web2py_console button { padding: 6px 12px; }
/*
input.date,input.time,input.datetime,input.double,input.integer {
max-width: 300px;
.ie-lte7 .topbar .container {
z-index: 2;
}
*/
.ie9 #w2p_query_panel {
padding-bottom: 2px;
}
.web2py_console .form-control {
width: 20%;
display: inline;
}
.web2py_console #w2p_keywords {
width: 50%;
}
.web2py_search_actions a,
.web2py_console input[type=submit],
.web2py_console input[type=button],
.web2py_console button {
padding: 6px 12px;
}
td.w2p_fl,
td.w2p_fw,
td.w2p_fc,
#web2py_user_form td,
.web2py_grid .web2py_form td {
vertical-align: top;
}
#auth_user_remember__row label,
.web2py_paginator ul li {
display: inline;
}
.web2py_grid,
.web2py_grid table {
width: 100%;
}
@@ -1,134 +1,82 @@
/*!
* part of the package to convert web2py elements to bootstrap3 theme
* Developed by Paolo Caruccio ( paolo.caruccio66@gmail.com )
* Released under MIT license
* version 1 rev.201402261600
*
* Supported version of bootstrap framework: 3.0.2+
* The full package includes:
* - bootstrap3.py python module
* - web2py-bootstrap3.css
* - this js file
* - example of layout.html
*/
jQuery(function(){
// bootstrap3 classes for elements of horizontal form - calculations
var fh_label_class = 'col-md-4',
fh_offest_class = 'col-md-offset-4',
fh_control_class = 'col-md-8';
// functions
function menu_is_collapsed() {
return !jQuery('.navbar-toggle').is(':hidden');
};
function closeSubmenu() {
jQuery(".dropdown-submenu > a.active").each(function(){
var o = jQuery(this);
o.parent().children("ul")
.toggleClass('open').data('phase', null);
o.toggleClass('active');
});
};
jQuery.fn.center = function (options) {
var defaults = {'parent': false, 'mode': "both"};
var settings = jQuery.extend(defaults, options);
var parent;
if (settings.parent)
parent = this.parent();
else
parent = window;
if (settings.mode != "horizontally") {
this.css("top", Math.max
(0, ((jQuery(parent).height() - jQuery(this).outerHeight()) / 2) + jQuery(parent).scrollTop()) + "px");
}
if (settings.mode != "vertically") {
this.css("left", Math.max
(0, ((jQuery(parent).width() - jQuery(this).outerWidth()) / 2) + jQuery(parent).scrollLeft()) + "px");
}
return this;
};
// alert centering
jQuery('.flash.alert.centered').center({'mode': "horizontally"});
// navs
jQuery(".nav ul.dropdown-menu").not("#w2p-auth-bar").each(function() {
var toggle = jQuery(this).parent();
if (toggle.parent().hasClass("nav")) {
toggle.attr("data-w2pmenulevel", "l0");
toggle.children("a")
.addClass("dropdown-toggle")
.append('<span class="caret"> </span>')
.attr("data-toggle", "dropdown");
} else {
toggle.addClass("dropdown-submenu").removeClass("dropdown");
};
});
jQuery('.navbar-nav a.dropdown-toggle').click(function(e) {
if (menu_is_collapsed())
e.preventDefault();
else
window.location=jQuery(this).attr('href');
});
jQuery(".dropdown-submenu>a").click(function(event) {
if (menu_is_collapsed()) {
event.preventDefault();
event.stopPropagation();
var submenu = jQuery(this).parent().children("ul");
submenu.data('phase','opening');
var dropdownOfThis = jQuery(this).parent().parent();
var actives = dropdownOfThis.find('ul.dropdown-menu.open');
if (actives && actives.length) {
var hasData = actives.data('phase');
if (hasData && hasData=='opened') {
actives.removeClass('open');
actives.siblings('a.active').removeClass('active');
hasData || actives.data('phase', null);
};
};
submenu.toggleClass('open').data('phase','opened');
jQuery(this).toggleClass('active');
}else{
window.location=jQuery(this).attr('href');
};
});
jQuery(".nav-tabs .web2py-menu-active").addClass('active');
jQuery(".nav-tabs a").not(".dropdown-toggle").attr("data-toggle", "tab");
// button fixes
jQuery("button:not(.btn),input[type=button]:not(.btn),.w2p_list a").addClass('btn btn-default');
// form fixes
jQuery("form.bs3-form p.w2p-autocomplete-widget input").addClass('form-control');
// on page load
function adjust_maxheight_of_collapsed_nav() {
var cn = jQuery('div.navbar-collapse');
var sh = jQuery(window).height();
if (cn.get(0)) {
if (sh<320)
cn.addClass('short-screen');
else if(cn.hasClass('short-screen'))
cn.removeClass('short-screen');
}
};
adjust_maxheight_of_collapsed_nav();
// resize and orientation change events
jQuery(window).on('orientationchange resize', function(event) {
adjust_maxheight_of_collapsed_nav();
jQuery('.flash.alert').center({'mode':"horizontally"});
if (menu_is_collapsed() === false) {
closeSubmenu();
jQuery('.navbar-nav .dropdown.open a.dropdown-toggle').dropdown('toggle');
jQuery('#main-menu.in, #login-menu.in').collapse('hide');
};
});
(function($, undefined) {
$.web2py.ajax_fields = function(target) {
/*
*this attaches something to a newly loaded fragment/page
* Ideally all events should be bound to the document, so we can avoid calling
* this over and over... all will be bound to the document
*/
/*adds btn class to buttons*/
$('button', target).addClass('btn btn-default');
$("p.w2p-autocomplete-widget input").addClass('form-control');
$('form input[type="submit"], form input[type="button"]', target).addClass('btn btn-default');
/* javascript for PasswordWidget*/
$('input[type=password][data-w2p_entropy]', target).each(function() {
web2py.validate_entropy($(this));
});
/* javascript for ListWidget*/
$('ul.w2p_list', target).each(function() {
function pe(ul, e) {
var new_line = ml(ul);
rel(ul);
if ($(e.target).parent().is(':visible')) {
/* make sure we didn't delete the element before we insert after */
new_line.insertAfter($(e.target).parent());
} else {
/* the line we clicked on was deleted, just add to end of list */
new_line.appendTo(ul);
}
new_line.find(":text").focus();
return false;
}
function rl(ul, e) {
if ($(ul).children().length > 1) {
/* only remove if we have more than 1 item so the list is never empty */
$(e.target).parent().remove();
}
}
function ml(ul) {
/* clone the first field */
var line = $(ul).find("li:first").clone(true);
line.find(':text').val('');
return line;
}
function rel(ul) {
/* keep only as many as needed*/
$(ul).find("li").each(function() {
var trimmed = $.trim($(this.firstChild).val());
if (trimmed == '') $(this).remove();
else $(this.firstChild).val(trimmed);
});
}
var ul = this;
$(ul).find(":text").after('<a class="btn btn-default" href="#">+</a>&nbsp;<a class="btn btn-default" href="#">-</a>').keypress(function(e) {
return (e.which == 13) ? pe(ul, e) : true;
}).next().click(function(e) {
pe(ul, e);
e.preventDefault();
}).next().click(function(e) {
rl(ul, e);
e.preventDefault();
});
});
}
$(function() {
$(".nav ul.dropdown-menu").each(function() {
var toggle = jQuery(this).parent();
if (toggle.parent().hasClass("nav")) {
toggle.attr("data-w2pmenulevel", "l0");
toggle.children("a")
.addClass("dropdown-toggle")
.append('<span class="caret"> </span>')
.attr("data-toggle", "dropdown");
} else {
toggle.addClass("dropdown-submenu").removeClass("dropdown");
};
});
});
})(jQuery);
@@ -34,13 +34,15 @@
{{pass}}
{{block right_sidebar}}
<a id="w2padmin-btn" class="btn btn-primary btn-lg btn-block"
href="{{=URL('admin','default','index')}}">
<i class="glyphicon glyphicon-cog"></i>
{{=T("admin")}}
</a>
<div class="panel panel-info">
<div class="panel-heading">{{=T("Don't know what to do?")}}</div>
<div class="panel-heading"><h3 class="panel-title"><a class="btn-block"
href="{{=URL('admin','default','index')}}">
<i class="glyphicon glyphicon-cog"></i>
{{=T("admin")}}
</a></h3></div>
<div class="panel-body">
{{=T("Don't know what to do?")}}
</div>
<ul class="list-group">
<li class="list-group-item">{{=A(T("Online examples"), _href=URL('examples','default','index'))}}</li>
<li class="list-group-item"><a href="http://web2py.com">web2py.com</a></li>
+3 -4
View File
@@ -18,7 +18,6 @@ except:
import datetime
import thread
import logging
import copy
import sys
import glob
import os
@@ -1023,7 +1022,7 @@ class Auth(object):
allow_basic_login_only=False,
on_failed_authentication=lambda x: redirect(x),
formstyle=None,
label_separator=": ",
label_separator=None,
logging_enabled = True,
allow_delete_accounts=False,
password_field='password',
@@ -1328,7 +1327,7 @@ class Auth(object):
login_url=url_login,
logged_url=URL(controller, function, args='profile'),
download_url=URL(controller, 'download'),
mailer=(mailer == True) and Mail() or mailer,
mailer=(mailer is True) and Mail() or mailer,
on_failed_authorization =
URL(controller, function, args='not_authorized'),
login_next = url_index,
@@ -1359,9 +1358,9 @@ class Auth(object):
reset_password_onaccept = [],
hmac_key = hmac_key,
formstyle = current.response.formstyle,
label_separator = current.response.form_label_separator
)
settings.lock_keys = True
# ## these are messages that can be customized
messages = self.messages = Messages(current.T)
messages.update(Auth.default_messages)