First time here? Check out the FAQ!
3

FAQ to settings

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.

mether's avatar
1.5k
mether
updated 2011-07-31 13:17:00 -0600
DominiCattus's avatar
105
DominiCattus
asked 2011-07-21 10:04:26 -0600
edit flag offensive 0 remove flag close merge delete

Comments

I'd like both of these... maybe I can find time to hack them both.
NoahY's avatar NoahY (2011-07-22 11:00:14 -0600) edit
add a comment see more comments

2 Answers

2

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 :)

NoahY's avatar
303
NoahY
answered 2011-07-22 11:40:54 -0600
edit flag offensive 0 remove flag delete link

Comments

the new code is in my github repository.
NoahY's avatar NoahY (2011-07-22 11:41:22 -0600) 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's avatar NoahY (2011-07-22 12:28:55 -0600) edit
Thanks! I'll try to merge it to my code.. About hooks - it will be nice, but sure is not critical now. )
DominiCattus's avatar DominiCattus (2011-07-25 03:57:58 -0600) 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's avatar NoahY (2011-07-25 10:44:14 -0600) 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's avatar Evgeny (2011-07-25 10:50:57 -0600) edit
add a comment see more comments
1

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

NoahY's avatar
303
NoahY
answered 2011-07-22 12:01:54 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments