i want to add a preference settings page where a logged in user can change
font size and also turn off advertisement on the website
and this will be unique to the user.i don like the cookie method that runs
on client machines.
I am thinking of a function that can manipulate css property values and
these preferences never expire;
something like below, though it is not a working and proper coding;
#View
<style>
.txt{font-size:{{if auth.is_logged_in():}}{{for settings in
records:}}{{=db.settings[auth.user_id].fontsize}}{{pass}}{{else:}}{{=12}}px:}
.adcontainer{display:{{=db.settings[auth.user_id]advertisement}}{{pass}}{{else:}}{{none}}{{pass}};}
</style>
#Model
db.define_table('settings',
Field('fontsize','interger', auth.user,default=auth.user_id),
Field('advertisement','string',auth.user,default.user_id))
db.settings.fontsize.default= '12'
db.settings.advertisement.default= 'on'
db.settings.fontsize.requires=IS_IN_SET(('12','13','14'))
db.settings.advertisement.requires=IS_IN_SET(('on','of'))
! and some kind of variables in the model here for the css values
#Controller
def preference():
records = db.(db.settings).select(orderby=db.setting.id, limitby=(0,1))
form = SQLFORM.(db.setting)
if form.accepts(request.vars):
redirect(URL('default', 'index', args=form.vars.id))
return dict(form=form,records=records)
def index():
records =
db.(db.settings==auth.user_id).select(orderby=~db.settings.id,
limitby=(0,1))
return dict(records=records)
I would like a complete working one based on the above
any help!
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.