Ask Your Question
3

FAQ to settings

asked 2011-07-21 10:04:26 -0500

DominiCattus gravatar image

updated 2011-07-31 13:17:00 -0500

mether gravatar image

Could FAQ be moved to settings?
Sometimes there's need to customize it, some points should be removed, some added. There's possibility to change the source code, but I update the source from git, and would prefer to have it editable in settings.

Another question - how can I add my links to header of template? (Like here: "Home Documentation Contact us"). There's customizable footer in settings, but no header.

edit retag flag offensive close merge delete

Comments

I'd like both of these... maybe I can find time to hack them both.
NoahY gravatar imageNoahY ( 2011-07-22 11:00:14 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2011-07-22 11:40:54 -0500

NoahY gravatar image

Okay, that was easy... not sure if Evgeny will accept the exact solution, but here's what I did for the faq:

  1. moved faq.html to faq_static.html
  2. created new faq.html similar to about.html (i.e. dynamic)
  3. added faq section to settings->flatpages
  4. edit meta.py to check for FORUM_FAQ setting. If doesn't exist, load faq_static, otherwise load FORUM_FAQ content:
if getattr(askbot_settings, 'FORUM_FAQ',''):
    return render_into_skin('faq.html', data, request)
return render_into_skin('faq_static.html', data, request)

next stop, custom header :)

edit flag offensive delete link more

Comments

the new code is in my github repository.
NoahY gravatar imageNoahY ( 2011-07-22 11:41:22 -0500 )edit
One caveat is that much of the faq is generated code, which you will lose by editing it this way. maybe we can add a hook to parse code like `{{settings.MIN_REP_TO_VOTE_UP}}`, etc.?
NoahY gravatar imageNoahY ( 2011-07-22 12:28:55 -0500 )edit
Thanks! I'll try to merge it to my code.. About hooks - it will be nice, but sure is not critical now. )
DominiCattus gravatar imageDominiCattus ( 2011-07-25 03:57:58 -0500 )edit
I've pushed a modification that allows you to include hooks AND translations. See here: http://askbot.org/en/question/520/how-to-perform-template-on-askbot-setting for the discussion, or just merge from my repo. You can now copy and paste the entire faq_static.html into the settings box and it parses both {{% trans %}} and {{settings}} tags.
NoahY gravatar imageNoahY ( 2011-07-25 10:44:14 -0500 )edit
Very cool, I will look at this in the afternoon (it is 12am here now), just don't want to switch to something else right now. Thank you!
Evgeny gravatar imageEvgeny ( 2011-07-25 10:50:57 -0500 )edit
1

answered 2011-07-22 12:01:54 -0500

NoahY gravatar image

And done... I've added a setting to settings->Skin that adds a custom header portion. Note that this doesn't change the header as it is, just adds html at the end. To actually customize the header would be messier, since it depends on various functions, e.g. whether the user is logged in, their karma, etc.

Also pushed to github:

https://github.com/NoahY/askbot-devel

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2011-07-21 10:04:26 -0500

Seen: 208 times

Last updated: Jul 22 '11