diff options
Diffstat (limited to 'askbot/skins/default/templates')
62 files changed, 1619 insertions, 364 deletions
diff --git a/askbot/skins/default/templates/500.html b/askbot/skins/default/templates/500.html deleted file mode 100644 index 8ec1bce4..00000000 --- a/askbot/skins/default/templates/500.html +++ /dev/null @@ -1,5 +0,0 @@ -{% load extra_tags %} -{% include_jinja "500.jinja.html" request %} -{% comment %}this template must be django -because of the use of default handler500 -{% endcomment %} diff --git a/askbot/skins/default/templates/answer_edit.html b/askbot/skins/default/templates/answer_edit.html index a1dbb4f9..8c3687f1 100644 --- a/askbot/skins/default/templates/answer_edit.html +++ b/askbot/skins/default/templates/answer_edit.html @@ -14,14 +14,25 @@ <label for="id_revision" >{% trans %}revision{% endtrans %}:</label> <br/> {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul() }}{% endif %} <div style="vertical-align:middle"> - {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans %}select revision{% endtrans %}"> + {{ revision_form.revision }} <input type="hidden" + id="select_revision" + name="select_revision" + value="false"> </div> - {{ macros.edit_post(form, user = request.user) }} + {{ macros.edit_post( + form, + post_html = revision.text, + editor_type = settings.EDITOR_TYPE + ) + }} {% if settings.WIKI_ON and answer.wiki == False %} {{ macros.checkbox_in_div(form.wiki) }} {% endif %} + {% if request.user.is_authenticated() and request.user.can_make_group_private_posts() %} + {{ macros.checkbox_in_div(form.post_privately) }} + {% endif %} <div class="after-editor"> - <input type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> + <input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> <input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" /> </div> @@ -45,8 +56,10 @@ var codeFriendlyMarkdown = false; {% endif %} </script> - <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + {% if settings.EDITOR_TYPE == 'markdown' %} + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + {% endif %} <script type="text/javascript"> $().ready(function(){ $("#nav_questions").attr('className',"on"); @@ -74,7 +87,8 @@ ); $('#id_revision').unbind().change(function(){ - $("#select_revision").click(); + $("#select_revision").val('true'); + $('#edit_post_form_submit_button').click(); }); lanai.highlightSyntax(); diff --git a/askbot/skins/default/templates/ask.html b/askbot/skins/default/templates/ask.html index 8bec61b7..27434f83 100644 --- a/askbot/skins/default/templates/ask.html +++ b/askbot/skins/default/templates/ask.html @@ -16,8 +16,10 @@ <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> <script type='text/javascript' src='{{"/js/jquery.validate.js"|media}}'></script> <script type='text/javascript' src='{{"/js/post.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + {% if settings.EDITOR_TYPE == 'markdown' %} + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + {% endif %} <script type='text/javascript'> var sortMethod = undefined;//need for live_search var minSearchWordLength = {{settings.MIN_SEARCH_WORD_LENGTH}}; @@ -27,8 +29,12 @@ {% if mandatory_tags %} {% include "meta/mandatory_tags_js.html" %} {% endif %} + {% if settings.TAG_SOURCE == 'category-tree' %} + {% include "meta/category_tree_js.html" %} + {% endif %} <script type='text/javascript'> askbot['urls']['api_get_questions'] = '{% url api_get_questions %}'; + askbot['urls']['saveDraftQuestion'] = '{% url save_draft_question %}'; {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} var codeFriendlyMarkdown = true; {% else %} @@ -38,7 +44,6 @@ liveSearchNewThreadInit(); //set current module button style $('#editor').TextAreaResizer(); - //highlight code synctax when editor has new text $("#editor").typeWatch({highlight: false, wait: 3000, captureLength: 5, callback: lanai.highlightSyntax}); @@ -60,6 +65,17 @@ setupFormValidation($("#fmask"), CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages()); lanai.highlightSyntax(); + + if (askbot['data']['userIsAuthenticated']) { + var draftHandler = new DraftQuestion(); + draftHandler.decorate($(document)); + window.onbeforeunload = function() { + var saveHandler = draftHandler.getSaveHandler(); + saveHandler(true); + //var msg = gettext("%s, we've saved your draft, but..."); + //return interpolate(msg, [askbot['data']['userName']]); + }; + } }); </script> {% endblock %} diff --git a/askbot/skins/default/templates/ask_by_widget.html b/askbot/skins/default/templates/ask_by_widget.html new file mode 100644 index 00000000..f700f83a --- /dev/null +++ b/askbot/skins/default/templates/ask_by_widget.html @@ -0,0 +1,16 @@ +{% extends "widget_base.html" %} +{% block forestyle %} +{%endblock%} + +{%block body%} +Enter your question +<form action="." method="POST" accept-charset="utf-8"> + {% csrf_token %} + {{form.title}} + {% if form.ask_anonymously %} + {{form.ask_anonymously}} + {%endif%} + <input type="submit" value="Ask your question" /> +</form> +{{form.errors}} +{%endblock%} diff --git a/askbot/skins/default/templates/ask_widget_complete.html b/askbot/skins/default/templates/ask_widget_complete.html new file mode 100644 index 00000000..82fe570c --- /dev/null +++ b/askbot/skins/default/templates/ask_widget_complete.html @@ -0,0 +1,8 @@ +{% extends "widget_base.html" %} +{% block forestyle %} +{%endblock%} + +{%block body%} +<a href="{{question_url}}" >Question posted</a> +{%endblock%} + diff --git a/askbot/skins/default/templates/authopenid/widget_signin.html b/askbot/skins/default/templates/authopenid/widget_signin.html new file mode 100644 index 00000000..c3dbcfde --- /dev/null +++ b/askbot/skins/default/templates/authopenid/widget_signin.html @@ -0,0 +1,231 @@ +{% extends "widget_base.html" %}
+{% import "authopenid/authopenid_macros.html" as login_macros %}
+{% from "macros.html" import timeago %}
+<!-- signin.html -->
+{% block title %}{% spaceless %}{% trans %}User login{% endtrans %}{% endspaceless %}{% endblock %}
+{% block forestyle %}
+ <link rel="stylesheet" type="text/css" media="screen" href="{{"/jquery-openid/openid.css"|media}}"/>
+{% endblock %}
+{% block forejs %}
+ {% include "meta/bottom_scripts.html" %}
+ {% include "meta/html_head_javascript.html" %}
+{% endblock %}
+{% block content %}
+{% if have_buttons or view_subtype == 'email_sent' %}
+ <h1 class="section-title">{{page_title}}</h1>
+{% endif %}
+ {% if answer %}
+ <div class="message">
+ {% trans title=answer.question.title|escape, summary=answer.summary|escape %}
+ Your answer to {{title}} {{summary}} will be posted once you log in
+ {% endtrans %}
+ </div>
+ {% endif %}
+ {% if question %}
+ <div class="message">
+ {% trans title=question.title|escape, summary=question.summary|escape %}Your question
+ {{title}} {{summary}} will be posted once you log in
+ {% endtrans %}
+ </div>
+ {% endif %}
+ <p id='login-intro'>
+ {% if view_subtype == 'default' and have_buttons %}
+ {% trans %}Choose your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
+ {% elif view_subtype == 'add_openid' and have_buttons %}
+ {% if existing_login_methods %}
+ {% trans %}It's a good idea to make sure that your existing login methods still work, or add a new one. Please click any of the icons below to check/change or add new login methods.{% endtrans %}
+ {% else %}
+ {% trans %}Please add a more permanent login method by clicking one of the icons below, to avoid logging in via email each time.{% endtrans %}
+ {% endif %}
+ {% elif view_subtype == 'change_openid' and have_buttons %}
+ {% if existing_login_methods %}
+ {% trans %}Click on one of the icons below to add a new login method or re-validate an existing one.{% endtrans %}
+ {% else %}
+ {% trans %}You don't have a method to log in right now, please add one or more by clicking any of the icons below.{% endtrans %}
+ {% endif %}
+ {% elif view_subtype == 'email_sent' %}
+ {% trans %}Please check your email and visit the enclosed link to re-connect to your account{% endtrans %}
+ {% endif %}
+ </p>
+ {% if openid_error_message %}
+ <p class="warning">{{ openid_error_message }}</p>
+ {% endif %}
+ {% if view_subtype != 'email_sent' and view_subtype != 'bad_key' %}
+ <form id="signin-form" method="post" action="{% url widget_signin %}">{% csrf_token %}
+ {# in this branch - the real signin view we display the login icons
+ here we hide the local login button only if admin
+ wants to always show the password login form - then
+ the button is useless.
+ #}
+ {{ login_form.login_provider_name }}
+ {{ login_form.next }}
+ {{
+ login_macros.provider_buttons(
+ login_form = login_form,
+ major_login_providers = major_login_providers,
+ minor_login_providers = minor_login_providers,
+ hide_local_login = settings.SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN,
+ settings = settings,
+ logged_in = user.is_authenticated(),
+ show_buttons = have_buttons
+ )
+ }}
+ {% if use_password_login == True %}
+ <fieldset
+ id="password-fs"
+ {% if user.is_anonymous() %}
+ {% if not login_form.username.errors and not login_form.password_login_failed %}
+ {% if not settings.SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN %}
+ style="display:none;"
+ {%endif%}
+ {% endif %}
+ {% else %}
+ {% if not login_form.new_password.errors and not login_form.new_password_retyped.errors %}
+ {% if not settings.SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN %}
+ style="display:none;"
+ {% endif%}
+ {% endif %}
+ {% endif %}
+ >
+ {{login_form.password_action}}
+ {% if user.is_anonymous() %}
+ {% if have_buttons %}
+ <h2 id="password-heading">
+ {% trans %}or enter your <span>user name and password</span>, then sign in{% endtrans %}
+ </h2>
+ {% else %}
+ <h1 class="section-title">
+ {% trans %}Please, sign in{% endtrans %}
+ </h1>
+ {% endif %}
+ {% if have_buttons %}
+ <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
+ {% endif %}
+ {% if login_form.password_login_failed %}
+ <p class="error">{% trans %}Login failed, please try again{% endtrans %}</p>
+ {% endif %}
+ <table class="login">
+ <tr>
+ <td><label for="id_username">{% trans %}Login or email{% endtrans %}</label></td>
+ <td>{{login_form.username}}</td>
+ </tr>
+ <tr>
+ <td><label for="id_password">{% trans %}Password{% endtrans %}</label></td>
+ <td>{{login_form.password}}</td>
+ </tr>
+ </table>
+ <p id="local_login_buttons">
+ <input class="submit-b" name="login_with_password" type="submit" value="{% trans %}Sign in{% endtrans %}" />
+ {% if settings.USE_LDAP_FOR_PASSWORD_LOGIN == False %}
+ <a class="create-password-account" style="vertical-align:middle" href="{% url user_signup_with_password %}?login_provider=local">{% trans %}Create a password-protected account{% endtrans %}</a>
+ {% endif %}
+ </p>
+ {% elif settings.USE_LDAP_FOR_PASSWORD_LOGIN == False %}
+ <h2 id="password-heading">
+ {% trans %}To change your password - please enter the new one twice, then submit{% endtrans %}
+ </h2>
+ <table class="login">
+ <tr>
+ <td><label for="id_new_password">{% trans %}New password{% endtrans %}</label></td>
+ <td>
+ {{login_form.new_password}}
+ </td>
+ <td>
+ <span class="error">{{login_form.new_password.errors[0]}}</span>
+ </td>
+ </tr>
+ <tr>
+ <td><label for="id_new_password_retyped">{% trans %}Please, retype{% endtrans %}</label></td>
+ <td>
+ {{login_form.new_password_retyped}}
+ </td>
+ <td>
+ <span class="error">{{login_form.new_password_retyped.errors[0]}}</span>
+ </td>
+ </tr>
+ </table>
+ <p id="local_login_buttons">
+ <input class="submit-b" name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
+ </p>
+ {% endif %}
+ </fieldset>
+ {% endif %}
+ </form>
+ {% if user.is_authenticated() and existing_login_methods and settings.ALLOW_ADD_REMOVE_LOGIN_METHODS %}
+ <div
+ id='existing-login-methods'
+ {% if login_form.password_change_failed %}
+ style="display:none";
+ {% endif %}
+ >
+ <h2 id='ab-show-login-methods'>
+ {% trans %}Here are your current login methods{% endtrans %}
+ </h2>
+ <table id='ab-existing-login-methods'>
+ <tr>
+ <th>{% trans %}provider{% endtrans %}</th>
+ <th>{% trans %}last used{% endtrans %}</th>
+ <th>{% trans %}delete, if you like{% endtrans %}</th>
+ </tr>
+ {% for login_method in existing_login_methods %}
+ <tr class="ab-provider-row">
+ <td class="ab-provider-name">
+ {{login_method.provider_name}}
+ </td>
+ <td>
+ {% if login_method.last_used_timestamp %}
+ {{ timeago(login_method.last_used_timestamp) }}
+ {% endif %}
+ </td>
+ <td>
+ {% if login_method.is_deletable %}
+ <button>{% trans %}delete{% endtrans %}</button>
+ {% else %}
+ {% trans %}cannot be deleted{% endtrans %}
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+ {% endif %}
+ {% endif %}
+ {% if view_subtype != 'email_sent' or view_subtype == 'bad_key' %}
+ {% if user.is_anonymous() and settings.ALLOW_ACCOUNT_RECOVERY_BY_EMAIL %}
+ <form id="account-recovery-form" action="{% url user_account_recover %}" method="post">{% csrf_token %}
+ {% if view_subtype != 'bad_key' %}
+ <h2 id='account-recovery-heading'>{% trans %}Still have trouble signing in?{% endtrans %}</h2>
+ {% endif %}
+ <p class="hint">
+ <span class="text">
+ {% if view_subtype == 'bad_key' %}
+ {% trans %}Please, enter your email address below and obtain a new key{% endtrans %}
+ {% else %}
+ {% trans %}Please, enter your email address below to recover your account{% endtrans %}
+ {% endif %}
+ </span>
+ <span style="display:none" class="link"> - <a href="#">{% trans %}recover your account via email{% endtrans %}</a></span>
+ </p>
+ <fieldset id='email-input-fs'>
+ {% if account_recovery_form.email.errors %}
+ <p class="error">{{account_recovery_form.email.errors[0]}}</p>
+ {% endif %}
+ {{ account_recovery_form.email }}
+ <input
+ class="submit-b"
+ type="submit"
+ {% if view_subtype == 'bad_key' %}
+ value="{% trans %}Send a new recovery key{% endtrans %}"
+ {% else %}
+ value="{% trans %}Recover your account via email{% endtrans %}"
+ {% endif %}
+ />
+ </fieldset>
+ </form>
+ {% endif %}
+ {% endif %}
+{% endblock %}
+{% block endjs %}
+{% include "authopenid/providers_javascript.html" %}
+{% endblock %}
+<!-- end signin.html -->
diff --git a/askbot/skins/default/templates/base.html b/askbot/skins/default/templates/base.html index da771a41..eaf2261d 100644 --- a/askbot/skins/default/templates/base.html +++ b/askbot/skins/default/templates/base.html @@ -1,7 +1,5 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<!-- template base.html --> <html xmlns="http://www.w3.org/1999/xhtml"> - {% spaceless %} <head> <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title> {% include "meta/html_head_meta.html" %} @@ -15,7 +13,6 @@ {{ settings.CUSTOM_HTML_HEAD }} {% endif %} </head> - {% endspaceless %} <body class="{% block body_class %}{% endblock %}{% if user_messages %} user-messages{% endif %}{% if page_class %} {{page_class}}{% endif %}{% if request.user.is_anonymous() %} anon{% endif %} lang-{{settings.LANGUAGE_CODE}}"> {% include "widgets/system_messages.html" %} {% include "debug_header.html" %} @@ -52,4 +49,3 @@ </script> </body> </html> -<!-- end template base.html --> diff --git a/askbot/skins/default/templates/email/ask_for_signature.html b/askbot/skins/default/templates/email/ask_for_signature.html index cafeee2b..93e2fa4b 100644 --- a/askbot/skins/default/templates/email/ask_for_signature.html +++ b/askbot/skins/default/templates/email/ask_for_signature.html @@ -4,6 +4,7 @@ </p> <p> {% trans %}Your post could not be published, because we could not detect signature in your email.{% endtrans %}<br/> + {% trans %}This happened either because this is your first post or you have changed your email signature.{% endtrans %}<br/> {% trans %}Please make a simple response, without editing this message.{% endtrans %}<br/> {% trans %}We will then attempt to detect the signature in your response and you should be able to post.{% endtrans %} </p> diff --git a/askbot/skins/default/templates/email/notify_admins_about_new_tags.html b/askbot/skins/default/templates/email/notify_admins_about_new_tags.html new file mode 100644 index 00000000..9aaaffc2 --- /dev/null +++ b/askbot/skins/default/templates/email/notify_admins_about_new_tags.html @@ -0,0 +1,8 @@ +<p>Hello,</p> +<p>Please have a look at these new tags {{tags|join(', ')}}, +created by {{user.username}}.</p> +<p>If you decide not to use the tags, please reply to this email +to the user<p> +<p>Otherwise, please <a href="{{ thread_url }}">visit the question</a> +and apply the tags</p> +<p>Thank you.</p> diff --git a/askbot/skins/default/templates/embed/ask_by_widget.html b/askbot/skins/default/templates/embed/ask_by_widget.html new file mode 100644 index 00000000..4cec5f6d --- /dev/null +++ b/askbot/skins/default/templates/embed/ask_by_widget.html @@ -0,0 +1,225 @@ +{% extends "widget_base.html" %} +{% import "macros.html" as macros %} +{% block forestyle %} + {% if editor_type == 'markdown' %} + <link rel="stylesheet" type="text/css" href="{{"/js/wmd/wmd.css"|media}}" /> + {%else %} + <link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> + {%endif%} + {% if settings.USE_LOCAL_FONTS %} + {% include "meta/fonts.html" %} + {% else %} + <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:400,700&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css' /> + {% endif %} + <style type="text/css" media="screen"> + body{ + font-family: Verdana, Arial, Helvetica, sans-serif; + } + #editor { + display: block; + min-height: 200px; + width: 98%; + margin: 0; + border:none; + outline:none; + padding: 6px; + } + .wmd-container{ + border: #CCE6EC 3px solid; + width: 100%; + margin-top: 20px; + } + + #id_title{ + {% if editor_type == 'markdown' %} + width: 100%; + {%else%} + padding: 0px 0 0 5px; + width: 99.2%; + {%endif%} + font-size: 130%; + border: #CCE6EC 3px solid; + max-width: 600px; + } + + #id_title:focus { + outline: none; + box-shadow:none; + } + + .title{ + font-family: 'Open Sans Condensed', Arial, sans-serif; + font-size: 25px; + margin-bottom: 10px; + } + + #question-list { + height: auto; + z-index: 10000; + position: absolute; + border: 3px solid #CCE6EC; + border-top:none; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + background: #fff; + {% if editor_type == 'markdown' %} + width:97.4%; + {%else%} + width:90.8%; + {%endif%} + margin-top: -4.9px; + } + + #question-list h2{ + text-decoration: none; + margin: 0px; + font-size: 13px; + padding: 3px 0 3px 5px; + padding-bottom: 0; + border-top: #F0F0EC 1px solid; + min-height: 30px; + line-height: 30px; + font-weight: normal + } + + #question-list h2:first-child{ + border-top: none; + } + + #question-list a{ + color: #005580; + } + + #question-list a:hover{ + color: #005580; + text-decoration: underline; + } + + #question-list a:visited{ + color: #005580; + text-decoration: none; + } + + #question-list span{ + width: 28px; + height: 26px; + line-height: 26px; + text-align: center; + margin-right: 10px; + float: left; + display: block; + color: white; + background: #B8D0D5; + border-radius: 3px; + -ms-border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + -khtml-border-radius: 3px; + } + {% if editor_type == 'markdown' %} + #wmd-button-bar { + background: url({{"/js/wmd/images/editor-toolbar-background.png"|media}}) repeat-x bottom; + height: 30px; + border: 0; + display: block; + } + {% endif %} + + #submit{ + font-size: 130%; + margin-right: -6px; + float: right; + text-align: center; + text-decoration: none; + cursor: pointer; + color: #4A757F; + font-family: 'Open Sans Condensed', Arial, sans-serif; + text-shadow: 0px 1px 0px #C6D9DD; + -moz-text-shadow: 0px 1px 0px #c6d9dd; + -webkit-text-shadow: 0px 1px 0px #c6d9dd; + border-top: #EAF2F3 1px solid; + background-color: #D1E2E5; + background-repeat: no-repeat; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#D1E2E5), color-stop(25%, #D1E2E5), to(#A9C2C7)); + background-image: -webkit-linear-gradient(#D1E2E5, #D1E2E5 25%, #A9C2C7); + background-image: -moz-linear-gradient(top, #D1E2E5, #D1E2E5 25%, #A9C2C7); + background-image: -ms-linear-gradient(#D1E2E5, #D1E2E5 25%, #A9C2C7); + background-image: -o-linear-gradient(#D1E2E5, #D1E2E5 25%, #A9C2C7); + background-image: linear-gradient(#D1E2E5, #D1E2E5 25%, #A9C2C7); + border-radius: 4px; + -ms-border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + -khtml-border-radius: 4px; + -webkit-box-shadow: 1px 1px 2px #636363; + -moz-box-shadow: 1px 1px 2px #636363; + box-shadow: 1px 1px 2px #636363; + width: 200px; + } + + .field-errors{ + font-size: 10px; + color: #ff0000; + height: 10px; + } + {{widget.inner_style}} + </style> +{%endblock%} + +{%block body%} +<div class="title">{{widget.title}}</div> +<form action="." method="POST" accept-charset="utf-8"> + {% csrf_token %} + <label>{%trans%}Please enter a descriptive title for your question{%endtrans%}</label> + <div class="input-title"> + {{form.title}} + </div> + <div id='question-list'> + </div> + <div class="field-errors"> + {% for error in form.title.errors %} {{error}} {%endfor%} + </div> +{% if widget.include_text_field %} + {% if editor_type == 'markdown' %} + <div class="wmd-container"> + <div id="wmd-button-bar" class="wmd-panel"></div> + {{ form.text }}{# this element is resizable and will be wrapped by js #} + </div> + {% else %} + <div class="wmd-container"> + {{ form.media }} + {{ form.text }} + </div> + {% endif %} + <div class="field-errors"> + {% for error in form.text.errors %} {{error}} {%endfor%} + </div> + {% endif %} + {% if form.ask_anonymously %} + <p>{{form.ask_anonymously.label_tag()}}: {{form.ask_anonymously}}</p> + {%endif%} + <input type="submit" value="Ask your question" id="submit" /> +</form> +{%endblock%} +{% block endjs %} +<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> +{% if editor_type == 'markdown' %} + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> +{% else %} + {% include "meta/tinymce_css.html" %}{# todo - maybe move to form media? #} +{% endif %} + +<script type="text/javascript" src='{{"/js/live_search_new_thread.js"|media}}'></script> +<script type="text/javascript" charset="utf-8"> + var minSearchWordLength = {{settings.MIN_SEARCH_WORD_LENGTH}}; + askbot['urls']['api_get_questions'] = '{% url api_get_questions %}'; + askbot['urls']['upload'] = '{% url upload %}'; + $(document).ready(function(){ + $("#id_title").focus(); + $("#id_title").addClass('questionTitleInput'); + liveSearchNewThreadInit(true); + }); +</script> +{% endblock %} diff --git a/askbot/skins/default/templates/embed/ask_widget_complete.html b/askbot/skins/default/templates/embed/ask_widget_complete.html new file mode 100644 index 00000000..580c1f94 --- /dev/null +++ b/askbot/skins/default/templates/embed/ask_widget_complete.html @@ -0,0 +1,8 @@ +{% extends "widget_base.html" %} +{% block forestyle %} +{%endblock%} + +{%block body%} +<a href="{{question_url}}" target="_blank" >Question posted</a> +{%endblock%} + diff --git a/askbot/skins/default/templates/embed/askbot_widget.css b/askbot/skins/default/templates/embed/askbot_widget.css new file mode 100755 index 00000000..9b0b5af2 --- /dev/null +++ b/askbot/skins/default/templates/embed/askbot_widget.css @@ -0,0 +1,38 @@ +#{{variable_name}} { + visibility: hidden; + position: absolute; + left: 0px; + top: 0px; + width:100%; + height:100%; + text-align:center; + z-index: 99999; +} + +#{{variable_name}} div{ + width:600px; + {%if widget.include_text_field%} + {% if editor_type == 'markdown' %} + height:520px; + {%else%} + height:520px; + {%endif%} + {%else%} + height:220px; + {%endif%} + margin: 100px auto; + background-color: #fff; + border:1px solid #000; + padding:15px; + padding-left: 10px; + text-align: right; +} + +#{{variable_name}} a{ + padding:5px; +} + +#{{variable_name}} iframe{ + width:600px; + height:500px; +} diff --git a/askbot/skins/default/templates/embed/askbot_widget.js b/askbot/skins/default/templates/embed/askbot_widget.js new file mode 100755 index 00000000..8c358855 --- /dev/null +++ b/askbot/skins/default/templates/embed/askbot_widget.js @@ -0,0 +1,74 @@ +var {{variable_name}} = { + element_id: "{{variable_name}}", + widgetToggle: function() { + element = document.getElementById({{variable_name}}.element_id); + element.style.visibility = (element.style.visibility == "visible") ? "hidden" : "visible"; + if (element.style.visibility == "visible"){ + $("#" + {{variable_name}}.element_id + " iframe").focus(); + } + }, + toHtml: function() { + var html = {{variable_name}}.createButton(); + var link = document.createElement('link'); + link.setAttribute("rel", "stylesheet"); + link.setAttribute("href", 'http://{{host}}{%url render_ask_widget_css widget.id%}'); + + //creating the div + var motherDiv = document.createElement('div'); + motherDiv.setAttribute("id", {{variable_name}}.element_id); + motherDiv.style.visibility = "hidden"; + + var containerDiv = document.createElement('div'); + motherDiv.appendChild(containerDiv); + + {%if widget.outer_style %} + outerStyle = document.createElement('style'); + outerStyle.innerText = "{{widget.outer_style}}"; + motherDiv.appendChild(outerStyle); + {%endif%} + + var closeButton = document.createElement('a'); + closeButton.setAttribute('href', '#'); + closeButton.setAttribute('id', 'AskbotModalClose'); + closeButton.setAttribute('onClick', '{{variable_name}}.widgetToggle();'); + closeButton.innerHTML= 'Close'; + + containerDiv.appendChild(closeButton); + + var iframe = document.createElement('iframe'); + iframe.setAttribute('src', 'http://{{host}}{% url ask_by_widget widget.id %}'); + + containerDiv.appendChild(iframe); + + var body = document.getElementsByTagName('body')[0]; + if (body){ + body.appendChild(link); + body.appendChild(motherDiv); + } + }, + createButton: function() { + var label="{{widget.title}}"; //TODO: add to the model + var buttonDiv = document.createElement('div'); + buttonDiv.setAttribute('id', "AskbotAskButton"); + + var closeButton = document.createElement('input'); + closeButton.setAttribute('onClick', '{{variable_name}}.widgetToggle();'); + closeButton.setAttribute('type', 'button'); + closeButton.value = label; + + buttonDiv.appendChild(closeButton); + + return buttonDiv; + } +}; + +previous_function = window.onload; +var onload_functions = function(){ + if (previous_function){ + previous_function(); + } + {{variable_name}}.toHtml(); +} + +window.onload = onload_functions(); +document.write({{variable_name}}.createButton().outerHTML); diff --git a/askbot/skins/default/templates/embed/delete_widget.html b/askbot/skins/default/templates/embed/delete_widget.html new file mode 100644 index 00000000..ed80c537 --- /dev/null +++ b/askbot/skins/default/templates/embed/delete_widget.html @@ -0,0 +1,14 @@ +{% extends "one_column_body.html" %} +<!-- create_ask_widget.html --> +{% block title %}Delete {{widget_name|capitalize}} Widget{% endblock %} +{% block content %} +<h1>Are you sure that you cant to delete this {{widget_name|capitalize}}Widget?</h1> +<br/> +<strong>Warning: This could break the widgets on sites that currently use this widget please make sure that you don't use the widget in other sites</strong> +<form action="." method="POST"> + <p><input type='submit' value='Delete' /> <a href="{% url list_widgets widget_name %}">Go Back</a></p> +</form> +{% endblock %} +{% block endjs %} +{% endblock %} + diff --git a/askbot/skins/default/templates/embed/list_widgets.html b/askbot/skins/default/templates/embed/list_widgets.html new file mode 100644 index 00000000..83de5871 --- /dev/null +++ b/askbot/skins/default/templates/embed/list_widgets.html @@ -0,0 +1,45 @@ +{% extends "two_column_body.html" %} +<!-- create_ask_widget.html --> +{% block title %}{{widget_name|capitalize}} widget list{% endblock %} +{% block content %} + <h1>{{widget_name|capitalize}} widget list</h1> + +<table border="0"> + <tr> + <th>Widget Title </th> + <th>Code</th> + <th>Actions</th> + </tr> + {% if widget_name == 'ask' %} + {%for widget in widgets%} + <tr> + <td>{{widget.title}}</td> + <td> <script type="text/javascript" src="http://{{request.get_host()}}{% url render_ask_widget widget.id%}" ></script></td> + <td><a href="{% url edit_widget widget_name, widget.id %}">Edit</a> | <a href="{% url delete_widget widget_name, widget.id %}">Delete</a></td> + </tr> + {%endfor%} + {%else%} + {%for widget in widgets%} + <tr> + <td>{{widget.title}}</td> + <td> <iframe src="http://{{request.get_host()}}{% url question_widget widget.id%}" > </iframe></td> + <td><a href="{% url edit_widget widget_name, widget.id %}">Edit</a> | <a href="{% url delete_widget widget_name, widget.id %}">Delete</a></td> + </tr> + {%endfor%} + + {%endif%} +</table> + +{% endblock %} +{% block endjs %} +{% endblock %} + +{% block sidebar %} +<div class="box"> + <h2>{% trans %}How to use?{% endtrans %}</h2> + <p>{% trans %} + Just copy the <script> tag provided and paste it in the site where you wan to put it. + {%endtrans%} + </p> + </div> +{% endblock %} diff --git a/askbot/skins/default/templates/question_widget.html b/askbot/skins/default/templates/embed/question_widget.html index 9d32294b..92e29aa0 100644 --- a/askbot/skins/default/templates/question_widget.html +++ b/askbot/skins/default/templates/embed/question_widget.html @@ -3,19 +3,18 @@ <html> <head> <style type="text/css"> - {{settings.QUESTIONS_WIDGET_CSS|safe}} + {{widget.style|safe}} </style> </head> <body> - {{settings.QUESTIONS_WIDGET_HEADER|safe}} + {{widget.title|safe}} <div id="container"> <ul> {% for thread in threads %} - <li><a href="{{settings.APP_URL|strip_path}}{{ thread.get_absolute_url() }}"> + <li><a href="{{settings.APP_URL|strip_path}}{{ thread.get_absolute_url() }}" target="_blank"> {{ thread.title|escape }}</a></li> {% endfor %} </ul> </div> - {{settings.QUESTIONS_WIDGET_FOOTER|safe}} </body> </html> diff --git a/askbot/skins/default/templates/embed/widget_form.html b/askbot/skins/default/templates/embed/widget_form.html new file mode 100644 index 00000000..65128d8e --- /dev/null +++ b/askbot/skins/default/templates/embed/widget_form.html @@ -0,0 +1,23 @@ +{% extends "one_column_body.html" %} +<!-- create_ask_widget.html --> +{% block title %}{% trans %}{{action}} an {{widget_name}} widget{% endtrans %}{% endblock %} +{% block content %} +<h1 class="section-title">{% trans %}{{action}} an {{widget_name}} widget{% endtrans %}</h1> +{#% if form.non_field_errors() %} + {{ form.non_field_errors() }} +{% endif %#} +<form method="post"> + <table> + {{ form.as_table() }} + <tr> + <td colspan="2" style="text-align: center"> + <input type="submit" class="submit" value={% trans %}Save{% endtrans %} /> + </td> + </tr> + </table> +</form> + +{% endblock %} +{% block endjs %} +{% endblock %} + diff --git a/askbot/skins/default/templates/embed/widgets.html b/askbot/skins/default/templates/embed/widgets.html new file mode 100644 index 00000000..767ebc2c --- /dev/null +++ b/askbot/skins/default/templates/embed/widgets.html @@ -0,0 +1,36 @@ +{% extends "one_column_body.html" %} +<!-- template badges.html --> +{% block title %}{% spaceless %}{% trans %}Widgets{% endtrans %}{% endspaceless %}{% endblock %} +{% block content %} +<h1 class="section-title">{% trans %}Widgets{% endtrans %}</h1> +<p> +</p> +<table> + <thead> + <th colspan="3"> + {% trans %}Create and embed widgets into your sites, here a list of available widgets.{% endtrans %} + </th> + </thead> + <tbody> + <tr> + <td>{% trans %}Ask a question{% endtrans %}</td> + <td><a href="{% url create_widget 'ask' %}">{% trans %}create{% endtrans %}</a></td> + <td> + {% if ask_widgets > 0 %} + <a href="{% url list_widgets 'ask' %}">{% trans %}view list{% endtrans %}</a> + {% endif %} + </td> + </tr> + <tr> + <td>{% trans %}List of questions{% endtrans %}</td> + <td><a href="{% url create_widget 'question' %}">{% trans %}create{% endtrans %}</a></td> + <td> + {% if question_widgets > 0 %} + <a href="{% url list_widgets 'question' %}">{% trans %}view list{% endtrans %}</a> + {% endif %} + </td> + </tr> + </tbody> +</table> +{% endblock %} +<!-- end template badges.html --> diff --git a/askbot/skins/default/templates/groups.html b/askbot/skins/default/templates/groups.html index 2499ac9f..9c7dac3c 100644 --- a/askbot/skins/default/templates/groups.html +++ b/askbot/skins/default/templates/groups.html @@ -26,11 +26,21 @@ </p> {% endif %} <table id="groups-list"> - {% for group in groups %} - <tr> - {{ macros.user_group(group, groups_membership_info[group.id]) }} - </tr> - {% endfor %} + <thead> + <th>{% trans %}Group{% endtrans %}</th> + <th>{% trans %}Number of members{% endtrans %}</th> + <th>{% trans %}Description{% endtrans %}</th> + </thead> + <tbody> + {% for group in groups %} + <tr> + {{ macros.user_group( + group, groups_membership_info[group.id], show_count=True + ) + }} + </tr> + {% endfor %} + </tbody> </table> {% endblock %} {% block endjs %} diff --git a/askbot/skins/default/templates/list_suggested_tags.html b/askbot/skins/default/templates/list_suggested_tags.html new file mode 100644 index 00000000..4eeb0004 --- /dev/null +++ b/askbot/skins/default/templates/list_suggested_tags.html @@ -0,0 +1,67 @@ +{% extends "two_column_body.html" %} +{% import "macros.html" as macros %} +<!-- tags.html --> +{% block title %}{{ page_title }}{% endblock %} +{% block content %} + {% include "tags/header.html" %} + {% if tags %} + <table class="suggested-tags-table"> + <thead> + <tr> + <th class="tags-col">{% trans %}Tag{% endtrans %}</th> + <th class="users-col">{% trans %}Suggested by{% endtrans %}</th> + <th class="decision-col">{% trans %}Your decision{% endtrans %}</th> + <th>{% trans %}Suggested tag was used for questions{% endtrans %}</th> + </tr> + </thead> + <tbody> + {% for tag in tags %} + <tr class="suggested-tag-row" data-tag-id="{{ tag.id }}"> + <td class="tags-col"> + {{ macros.tag_widget(tag.name, is_link = False) }} + <span class="tag-number">×{{ tag.used_count }}</span> + </td> + <td class="users-col"> + {% for user in tag.suggested_by.all() %} + <p>{{ user.get_profile_link() }}</p> + {% endfor %} + </td> + <td colspan="2"> + <table>{# inner table for the list of questions #} + {% for thread in tag.threads.all() %} + <tr class="thread-info" data-thread-id="{{ thread.id }}"> + <td class="per-thread-controls"> + <button class="btn accept">{% trans %}Accept{% endtrans %}</button> + <button class="btn reject">{% trans %}Reject{% endtrans %}</button> + </td> + <td class="thread-links-col"> + <a title="{{ thread._question_post().summary|escape }}" + href="{{ thread.get_absolute_url() }}" + >{{ thread.title|escape }}</a> + </td> + </tr> + {% endfor %} + </table> + </td> + </tr> + <tr class="per-tag-controls" data-tag-id="{{ tag.id }}"> + <td colspan="4"> + {% if tag.threads.count() > 1 %} + <button class="btn accept">{% trans name=tag.name %}Apply tag "{{ name }}" to all above questions{% endtrans %}</button> + <button class="btn reject">{% trans %}Reject tag{% endtrans %}</button> + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + {% else %} + <span>{% trans %}Nothing found{% endtrans %}</span> + {% endif %} +{% endblock %} +{% block endjs %} + <script type="text/javascript"> + askbot['urls']['moderateSuggestedTag'] = '{% url "moderate_suggested_tag" %}'; + </script> + <script type="text/javascript" src="{{ '/js/tag_moderation.js'|media }}"></script> +{% endblock %} diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html index ac7e6474..d1732ee5 100644 --- a/askbot/skins/default/templates/macros.html +++ b/askbot/skins/default/templates/macros.html @@ -17,13 +17,13 @@ {{ response.response_type }} ({{ timeago(response.timestamp) }}):<br/> {% if inbox_section != 'flags' %} - {{ response.response_snippet|escape }} + {{ response.response_snippet }} {% endif %} </a> {% if inbox_section == 'flags' %} <a class="re_expand" href="{{ response.response_url }}"> <!--div class="re_snippet">{{ response.response_snippet|escape }}</div--> - <div class="re_content">{{ response.response_content|escape }}</div> + <div class="re_content">{{ response.response_content }}</div> </a> {% endif %} </div> @@ -57,6 +57,7 @@ {{ user_score_and_badge_summary(user, karma_mode = karma_mode, badges_mode = badges_mode) }}<br/> {{ user_website_link(user) }} {% endif %} + {{ user_primary_group(user) }} {%- endmacro -%} {%- macro post_last_updater_and_creator_info( @@ -206,46 +207,80 @@ poor design of the data or methods on data objects #} </ul> {%- endmacro -%} -{%- macro user_group(group, membership_info) -%} +{%- macro user_group_link(group) -%} + <a class="group-name" + href="{% url users_by_group group.id, group.name|replace('-', ' ')|slugify %}" + >{{ group.name|escape }}</a> +{%- endmacro -%} + +{%- macro user_group(group, membership_info, show_count=False) -%} <td> - <a class="group-name" - href="{% url users_by_group group.id, group.name|replace('-', ' ')|slugify %}" - >{{ group.name|escape }}</a> + {{ user_group_link(group) }} </td> + {% if show_count %} + <td>{{ group.users_count }}</td> + {% endif %} <td> <span class="group-description"> {% if group.tag_wiki %} {{ group.tag_wiki.summary }} {% endif %} </span> - </td> - <td> {% if membership_info %} + <br/> {{ group_join_button( group_id = group.id, - can_join = membership_info['can_join'], - is_member = membership_info['is_member'] + acceptance_level = membership_info['aceptance_level'], + membership_level = membership_info['membership_level'] ) }} {% endif %} </td> {%- endmacro -%} -{%- macro group_join_button(group_id = None, can_join = False, is_member = False) -%} - {% if can_join or is_member %} +{%- macro user_primary_group(user) -%} + {% set group=user.get_primary_group() %} + {% if group %} + <span class="primary-group-name"><a + class="primary-group-name" + href="{% url users_by_group group.id, group.name|replace('-', ' ')|slugify %}" + >{{ group.name|replace('-', ' ')|escape }}</a></span> + {% endif %} +{%- endmacro -%} + +{%- macro group_join_button( + group_id=None, acceptance_level='closed', membership_level='none') +-%} + {% if acceptance_level in ('open', 'moderated') %} <button - class="group-join-btn follow-toggle {% if is_member %}on on-state{% endif %}" + class="group-join-btn follow-toggle {% if membership_level != 'none' %}on on-state{% endif %}" data-group-id="{{group_id}}" - data-off-prompt-text="{% trans %}Leave this group{% endtrans %}" - data-on-prompt-text="{% trans %}Join this group{% endtrans %}" - data-on-state-text="{% trans %}You are a member{% endtrans %}" - data-off-state-text="{% trans %}Join this group{% endtrans %}" + {% if acceptance_level == 'open' %} + data-off-prompt-text="{% trans %}Leave this group{% endtrans %}" + data-on-prompt-text="{% trans %}Join this group{% endtrans %}" + data-on-state-text="{% trans %}You are a member{% endtrans %}" + data-off-state-text="{% trans %}Join this group{% endtrans %}" + {% else %} + {% if membership_level == 'full' %} + data-off-prompt-text="{% trans %}Leave this group{% endtrans %}" + data-on-state-text="{% trans %}You are a member{% endtrans %}" + {% else %} + data-off-prompt-text="{% trans %}Cancel application{% endtrans %}" + data-on-state-text="{% trans %}Waiting approval{% endtrans %}" + {% endif %} + data-on-prompt-text="{% trans %}Ask to join{% endtrans %}" + data-off-state-text="{% trans %}Ask to join{% endtrans %}" + {% endif %} > - {% if is_member %} + {% if membership_level == 'full' %} {% trans %}You are a member{% endtrans %} + {% elif membership_level == 'pending' %} + {% trans %}Waiting approval{% endtrans %} {% else %} - {% if can_join %} + {% if acceptance_level == 'open' %} {% trans %}Join this group{% endtrans %} + {% else %} + {% trans %}Ask to join{% endtrans %} {% endif %} {% endif %} </button> @@ -313,7 +348,7 @@ poor design of the data or methods on data objects #} {% endfor %} {%- endmacro -%} -{%- macro question_summary(thread, question, extra_class=None, search_state=None) -%} +{%- macro question_summary(thread, question, extra_class=None, search_state=None, visitor = None) -%} {%include "widgets/question_summary.html" %} {%- endmacro -%} @@ -484,8 +519,12 @@ for the purposes of the AJAX comment editor #} {%- macro edit_post( post_form, post_type = None, + post_html = None, mandatory_tags = None, edit_title = False, + use_category_selector = False, + tag_names = None, + editor_type = None, user = None ) -%} diff --git a/askbot/skins/default/templates/main_page/headline.html b/askbot/skins/default/templates/main_page/headline.html index cc6f47a5..11f638e1 100644 --- a/askbot/skins/default/templates/main_page/headline.html +++ b/askbot/skins/default/templates/main_page/headline.html @@ -7,19 +7,17 @@ {% endif %} </h1> <div class="clearfix"></div> - {% if search_tags %} - <div id="listSearchTags"> - <span class="left">{% trans %}Tagged{% endtrans %}</span> - {{ macros.tag_list_widget( - search_tags, - id = 'searchTags', - deletable = True, - make_links = False, - search_state = search_state - ) - }} - </div> - {% endif %} + <div id="listSearchTags" {% if not search_tags %}style="display: none;"{% endif %}> + <span class="left">{% trans %}Tagged{% endtrans %}</span> + {{ macros.tag_list_widget( + search_tags, + id = 'searchTags', + deletable = True, + make_links = False, + search_state = search_state + ) + }} + </div> {#% if author_name or search_tags or query %} <p class="search-tips"><b>{% trans %}Search tips:{% endtrans %}</b> {% if reset_method_count > 1 %} diff --git a/askbot/skins/default/templates/main_page/questions_loop.html b/askbot/skins/default/templates/main_page/questions_loop.html index 6a5e5e3d..ad7bf683 100644 --- a/askbot/skins/default/templates/main_page/questions_loop.html +++ b/askbot/skins/default/templates/main_page/questions_loop.html @@ -1,12 +1,10 @@ {% import "macros.html" as macros %} -{# cache 0 "questions" questions search_tags scope sort query context.page language_code #} -{% for thread in threads.object_list %} - {# {{macros.question_summary(thread, thread._question_post(), search_state=search_state)}} #} - {{ thread.get_summary_html(search_state=search_state) }} -{% endfor %} {% if threads.object_list|length == 0 %} {% include "main_page/nothing_found.html" %} {% else %} + {% for thread in threads.object_list %} + {{ thread.get_summary_html(search_state=search_state, visitor = request.user) }} + {% endfor %} <div class="evenMore"> {% trans %}Did not find what you were looking for?{% endtrans %} <a href="{% url ask %}">{% trans %}Please, post your question!{% endtrans %}</a> diff --git a/askbot/skins/default/templates/meta/bottom_scripts.html b/askbot/skins/default/templates/meta/bottom_scripts.html index 1bcdca1f..09970468 100644 --- a/askbot/skins/default/templates/meta/bottom_scripts.html +++ b/askbot/skins/default/templates/meta/bottom_scripts.html @@ -25,6 +25,7 @@ askbot['urls']['unfollow_user'] = '/followit/unfollow/user/{{'{{'}}userId{{'}}'}}/'; askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}'; askbot['settings']['static_url'] = '{{ settings.STATIC_URL }}'; + askbot['urls']['getEditor'] = '{% url "get_editor" %}'; </script> <script type="text/javascript" @@ -34,9 +35,9 @@ src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" {% endif %} ></script> +<script type="text/javascript" src='{{"/bootstrap/js/bootstrap.js"|media}}'></script> <!-- History.js --> <script type='text/javascript' src="{{"/js/jquery.history.js"|media }}"></script> -<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script> <script type='text/javascript' src="{{"/js/utils.js"|media }}"></script> {% if settings.ENABLE_MATHJAX %} <script type='text/javascript' src="{{settings.MATHJAX_BASE_URL}}/MathJax.js"> @@ -48,6 +49,7 @@ </script> {% endif %} <script type="text/javascript"> + /*<![CDATA[*/ $(document).ready(function(){ {% if active_tab == 'questions' %} if (Modernizr.history) { @@ -77,12 +79,24 @@ {% else %} animateHashes(); {% endif %} + if (askbot['data']['userIsAdminOrMod']) { + $('body').addClass('admin'); + } + {%if settings.GROUPS_ENABLED %} + askbot['urls']['add_group'] = "{% url add_group %}"; + var group_dropdown = new GroupDropdown({{group_list}}); + $('.dropdown').append(group_dropdown.getElement()); + {%if request.user.is_superuser%} + group_dropdown.enableAddGroups(); + {%endif%} + {% endif %} }); {% if user_messages %} $('#validate_email_alert').click(function(){notify.close(true)}) notify.show(); {% endif %} $('abbr.timeago').timeago(); + /*]]>*/ </script> {% if settings.USE_CUSTOM_JS %} <script diff --git a/askbot/skins/default/templates/meta/category_tree_js.html b/askbot/skins/default/templates/meta/category_tree_js.html new file mode 100644 index 00000000..2d176d0e --- /dev/null +++ b/askbot/skins/default/templates/meta/category_tree_js.html @@ -0,0 +1,26 @@ +<script type='text/javascript'> + askbot['functions'] = askbot['functions'] || {}; + askbot['functions']['initCategoryTree'] = function(){ + var sel_elems = $('.category-selector'); + if (sel_elems.length > 0) { + var selector = new CategorySelector(); + selector.setData(JSON.parse("{{category_tree_data|escapejs}}")); + selector.decorate(sel_elems); + selector.setState('select'); + + var tag_editor = new TagEditor(); + tag_editor.decorate($('.tag-editor')); + {% if page_class == 'question-page' %} + {% for tag_name in question.get_tag_names() %} + tag_editor.addTag('{{ tag_name }}'); + {% endfor %} + {% endif %} + selector.setSelectHandler(tag_editor.getAddTagHandler()); + return selector; + } + }; + askbot['functions']['initCategoryTree'](); + askbot['urls']['add_tag_category'] = '{% url add_tag_category %}'; + askbot['urls']['rename_tag'] = '{% url rename_tag %}'; + askbot['urls']['delete_tag'] = '{% url delete_tag %}'; +</script> diff --git a/askbot/skins/default/templates/meta/editor_data.html b/askbot/skins/default/templates/meta/editor_data.html index 9e243baa..f0402672 100644 --- a/askbot/skins/default/templates/meta/editor_data.html +++ b/askbot/skins/default/templates/meta/editor_data.html @@ -9,7 +9,8 @@ askbot['messages']['maxTagsPerPost'] = "{% trans tag_count = settings.MAX_TAGS_PER_POST %}please use {{tag_count}} tag{% pluralize %}please use {{tag_count}} tags or less{% endtrans %}"; askbot['messages']['tagLimits'] = "{% trans tag_count=settings.MAX_TAGS_PER_POST, max_chars=settings.MAX_TAG_LENGTH %}please use up to {{tag_count}} tags, less than {{max_chars}} characters each{% endtrans %}"; askbot['urls']['upload'] = '{% url "upload" %}'; - askbot['settings']['minTitleLength'] = {{settings.MIN_TITLE_LENGTH}} - askbot['settings']['minQuestionBodyLength'] = {{settings.MIN_QUESTION_BODY_LENGTH}} - askbot['settings']['minAnswerBodyLength'] = {{settings.MIN_ANSWER_BODY_LENGTH}} + askbot['settings']['minTitleLength'] = {{settings.MIN_TITLE_LENGTH}}; + askbot['settings']['minQuestionBodyLength'] = {{settings.MIN_QUESTION_BODY_LENGTH}}; + askbot['settings']['minAnswerBodyLength'] = {{settings.MIN_ANSWER_BODY_LENGTH}}; + askbot['settings']['tag_editor'] = '{{ tag_editor_settings|escapejs }}'; </script> diff --git a/askbot/skins/default/templates/meta/html_head_javascript.html b/askbot/skins/default/templates/meta/html_head_javascript.html index 65d0bdce..09362baa 100644 --- a/askbot/skins/default/templates/meta/html_head_javascript.html +++ b/askbot/skins/default/templates/meta/html_head_javascript.html @@ -1,14 +1,19 @@ -<script src="{{"/js/modernizr.custom.js"|media }}"></script> +<script type="text/javascript" src="{{"/js/modernizr.custom.js"|media }}"></script> +<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script> <script type="text/javascript"> var askbot = {}; askbot['data'] = {}; {% if request.user.is_authenticated() %} askbot['data']['userIsAuthenticated'] = true; askbot['data']['userId'] = {{request.user.id}}; + askbot['data']['userName'] = '{{ request.user.username }}'; askbot['data']['userIsAdminOrMod'] = {% if request.user.is_administrator() or request.user.is_moderator() %}true{% else %}false{% endif %}; + askbot['data']['userIsAdmin'] = {% if + request.user.is_administrator() + %}true{% else %}false{% endif %}; askbot['data']['userReputation'] = {{request.user.reputation}}; {% else %} askbot['data']['userIsAuthenticated'] = false; @@ -16,6 +21,14 @@ {% endif %} askbot['urls'] = {}; askbot['settings'] = {}; + askbot['settings']['editorType'] = '{{ settings.EDITOR_TYPE }}'; + {% if settings.ALLOWED_UPLOAD_FILE_TYPES %} + askbot['settings']['allowedUploadFileTypes'] = [ + "{{ settings.ALLOWED_UPLOAD_FILE_TYPES|join('", "')|replace('.','') }}" + ]; + {% else %} + askbot['settings']['allowedUploadFileTypes'] = []; + {% endif %} askbot['messages'] = {}; </script> {# avoid adding javascript here so that pages load faster #} diff --git a/askbot/skins/default/templates/meta/html_head_stylesheets.html b/askbot/skins/default/templates/meta/html_head_stylesheets.html index a9e4a644..85bb489c 100644 --- a/askbot/skins/default/templates/meta/html_head_stylesheets.html +++ b/askbot/skins/default/templates/meta/html_head_stylesheets.html @@ -1,3 +1,6 @@ +{%if settings.GROUPS_ENABLED%} +<link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> +{% endif %} {% if settings.ASKBOT_CSS_DEVEL == False %} <link href="{{"/style/style.css"|media }}" rel="stylesheet" type="text/css" /> @@ -5,9 +8,11 @@ <link href="{{"/style/style.less"|media }}" rel="stylesheet/less" type="text/css" /> <script type="text/javascript" src="{{"/js/less.min.js"|media}}"></script> {% endif %} +<link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> {% if settings.USE_LOCAL_FONTS %} {% include "meta/fonts.html" %} {% else %} + {# note: IE8 fix - a combined font link wont work so we have two #} <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&subset=latin-ext' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&subset=cyrillic-ext' rel='stylesheet' type='text/css'> {% endif %} diff --git a/askbot/skins/default/templates/meta/tinymce_css.html b/askbot/skins/default/templates/meta/tinymce_css.html new file mode 100644 index 00000000..b6a1e798 --- /dev/null +++ b/askbot/skins/default/templates/meta/tinymce_css.html @@ -0,0 +1,20 @@ +<style type="text/css">{# todo: clean up - this is also in style.less!!! #} + .defaultSkin table.mceLayout, + .defaultSkin table.mceLayout tr.mceFirst td { + border: none; + } + .defaultSkin table.mceLayout tr.mceLast td { + border-bottom: none; + } + .mceStatusbar { + height: 5px; + background: #fff; + } + .defaultSkin span.mce_askbot_imageuploader { + background-position: -380px 0px; + } + .defaultSkin span.mce_askbot_attachment { + background-image: url({{ '/images/attachment.png'|media }}); + background-position: 0px 0px; + } +</style> diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index a235de0c..57c71068 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -8,10 +8,13 @@ {% block forestyle %} <link rel="canonical" href="{{settings.APP_URL|strip_path}}{{question.get_absolute_url()}}" /> <link rel="stylesheet" type="text/css" href="{{'/js/wmd/wmd.css'|media}}" /> + <link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> {% endblock %} {% block forejs %} <script type="text/javascript"> + /*<![CDATA[*/ //below is pure cross-browser javascript, no jQuery + askbot['data']['userIsThreadModerator'] = {% if user_is_thread_moderator %}true{% else %}false{% endif %}; (function(){ var data = askbot['data']; if (data['userIsAuthenticated']){ @@ -57,20 +60,32 @@ var answer_convert_id = 'post-' + post_id + '-convert'; var convert_answer = document.getElementById(answer_convert_id); if (data['userIsAdminOrMod']){ - var answer_id = 'post-id-' + post_id; - var answer_container = document.getElementById(answer_id); - var answer_element= answer_container.getElementsByClassName('answer-body')[0].children[1]; - if (answer_element.textContent.length > 300){ - convert_answer.parentNode.removeChild(convert_answer); - } + var answer_id = 'post-id-' + post_id; + var answer_container = document.getElementById(answer_id); + var answer_element= answer_container.getElementsByClassName('answer-body')[0].children[1]; + if (answer_element.textContent.length > 300){ + convert_answer.parentNode.removeChild(convert_answer); + } } else{ - convert_answer.parentNode.removeChild(convert_answer); + convert_answer.parentNode.removeChild(convert_answer); + } + } + + function hidePublishAnswerLink(postId) { + if (data['userIsThreadModerator'] === false) { + //hide publish/unpublish answer links + var answerId = 'post-' + postId + '-publish'; + var pubBtn = document.getElementById(answerId); + pubBtn.parentNode.removeChild(pubBtn); } } function render_post_controls(post_id){ if (data['userIsAdminOrMod']){ - return;//all functions on + return;//all remaining functions stay on + } + if (data['user_posts'] === undefined) { + return; } if (post_id in data['user_posts']){ //todo: remove edit button from older comments @@ -104,10 +119,13 @@ } function render_add_comment_button(post_id, extra_comment_count){ var can_add = false; + if (data['user_posts'] === undefined) { + return; + } {% if user_can_post_comment %} can_add = true; {% else %} - if (post_id in data['user_posts']){ + if (data['user_posts'] && post_id in data['user_posts']){ can_add = true; } {% endif %} @@ -181,7 +199,9 @@ askbot['functions']['renderAddAnswerButton'] = render_add_answer_button; askbot['functions']['hideConvertLinks'] = hide_convert_links; askbot['functions']['hideConvertAnswerLinks'] = hide_convert_answer_links; + askbot['functions']['hidePublishAnswerLink'] = hidePublishAnswerLink; })(); + /*]]>*/ </script> {% endblock %} {% block content %} @@ -201,6 +221,9 @@ {% endblock %} {% block endjs %} {% include "question/javascript.html" %} + {% if settings.TAG_SOURCE == 'category-tree' %} + {% include "meta/category_tree_js.html" %} + {% endif %} {# <script type="text/javascript"> var messages = askbot['messages']; diff --git a/askbot/skins/default/templates/question/answer_card.html b/askbot/skins/default/templates/question/answer_card.html index 7161c186..ae7d30fa 100644 --- a/askbot/skins/default/templates/question/answer_card.html +++ b/askbot/skins/default/templates/question/answer_card.html @@ -16,6 +16,9 @@ <div class="post-update-info-container"> {% include "question/answer_author_info.html" %} </div> + {% if answer.id in published_answer_ids %} + <p><strong>{% trans %}This response is published{% endtrans %}</strong></p> + {% endif %} {{ answer.html }} </div> <div class="answer-controls post-controls"> diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html index b9904ba4..5dca2522 100644 --- a/askbot/skins/default/templates/question/javascript.html +++ b/askbot/skins/default/templates/question/javascript.html @@ -12,21 +12,30 @@ askbot['urls']['convertComment'] = '{% url comment_to_answer %}'; askbot['urls']['convertAnswer'] = '{% url answer_to_comment %}'; askbot['urls']['getComment'] = '{% url get_comment %}'; + askbot['urls']['saveDraftAnswer'] = '{% url save_draft_answer %}'; askbot['urls']['question_url_template'] = scriptUrl + '{{ 'question/'|transurl }}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #} askbot['urls']['vote_url_template'] = scriptUrl + '{{ 'questions/'|transurl }}{{ "{{QuestionID}}/" }}{{ 'vote/'|transurl }}'; askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}'; askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}'; askbot['urls']['upvote_comment'] = '{% url upvote_comment %}'; askbot['urls']['delete_post'] = '{% url delete_post %}'; + askbot['urls']['get_html_template'] = '{% url get_html_template %}'; + askbot['urls']['getGroupsList'] = '{% url get_groups_list %}'; + askbot['urls']['publishAnswer'] = '{% url publish_answer %}'; + askbot['data']['userIsThreadModerator'] = {% if user_is_thread_moderator %}true{% else %}false{% endif %}; askbot['messages']['addComment'] = '{% trans %}post a comment{% endtrans %}'; {% if settings.SAVE_COMMENT_ON_ENTER %} askbot['settings']['saveCommentOnEnter'] = true; {% else %} askbot['settings']['saveCommentOnEnter'] = false; {% endif %} + askbot['settings']['tagSource'] = '{{ settings.TAG_SOURCE }}'; </script> -<script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> -<script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> +<script type="text/javascript" src='{{"/bootstrap/js/bootstrap.js"|media}}'></script> +{% if settings.EDITOR_TYPE == 'markdown' %} + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> +{% endif %} <script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script> <script type='text/javascript' src='{{"/js/post.js"|media}}'></script> <script type="text/javascript"> @@ -54,6 +63,12 @@ $("#fmanswer_button").hide(); }); {%endif%} + + if (askbot['data']['userIsAuthenticated']) { + var draftHandler = new DraftAnswer(); + draftHandler.setThreadId({{ thread.id }}); + draftHandler.decorate($(document)); + } }); $(window).bind('hashchange', animate_hashes); diff --git a/askbot/skins/default/templates/question/new_answer_form.html b/askbot/skins/default/templates/question/new_answer_form.html index b5def81b..76772abf 100644 --- a/askbot/skins/default/templates/question/new_answer_form.html +++ b/askbot/skins/default/templates/question/new_answer_form.html @@ -38,7 +38,12 @@ {% endif %} </p> {% endif %} - {{ macros.edit_post(answer, user = request.user) }} + {{ macros.edit_post( + answer, + user = request.user, + editor_type = settings.EDITOR_TYPE + ) + }} <input id="add-answer-btn" type="submit" class="submit after-editor" style="float:left"/> <script type="text/javascript"> askbot['functions']['renderAddAnswerButton'](); @@ -46,6 +51,9 @@ {% if settings.WIKI_ON %} {{ macros.checkbox_in_div(answer.wiki) }} {% endif %} + {% if request.user.is_authenticated() and request.user.can_make_group_private_posts() %} + {{ macros.checkbox_in_div(answer.post_privately) }} + {% endif %} {% endif %} {% endif %} </form> diff --git a/askbot/skins/default/templates/question/sidebar.html b/askbot/skins/default/templates/question/sidebar.html index 08a75245..4d431ef2 100644 --- a/askbot/skins/default/templates/question/sidebar.html +++ b/askbot/skins/default/templates/question/sidebar.html @@ -1,4 +1,4 @@ -{% from "macros.html" import timeago %} +{% import "macros.html" as macros %} {% if settings.SIDEBAR_QUESTION_HEADER %} <div class="box"> {{ settings.SIDEBAR_QUESTION_HEADER }} @@ -48,12 +48,104 @@ </div> </div> +<div class="clearfix"></div> +{% if settings.GROUPS_ENABLED %} +<div class="box sharing-widget"> + {% if thread.is_private() %} + <h2>{% trans %}Invite{% endtrans %}</h2> + <p style="margin: 16px 0" + >Invite others to help answer this question</p> + <form action="{% url share_question_with_user %}" method="post">{% csrf_token %} + <input id="share_user_name" type="text" class="groups-input" name="recipient_name" /> + <input type="hidden" name="thread_id" value="{{ thread.id }}"/> + <input type="submit" class="add-groups" value="{% trans %}add{% endtrans %}"/> + </form> + <p class="share-input-col">{% trans %}- or -{% endtrans %}</p> + <form action="{% url share_question_with_group %}" method="post">{% csrf_token %} + <input id="share_group_name" type="text" class="groups-input" name="recipient_name" /> + <input type="hidden" name="thread_id" value="{{ thread.id }}"/> + <input type="submit" class="add-groups" value="{% trans %}add{% endtrans %}"/> + </form> + <p class="share-input-col">{% trans %}- or -{% endtrans %}</p> + <form action="{% url share_question_with_group %}" method="post">{% csrf_token %} + <input + type="hidden" + name="recipient_name" + value="{{ settings.GLOBAL_GROUP_NAME }}" + /> + <input type="hidden" name="thread_id" value="{{ thread.id }}"/> + <p class="share-input-col"> + <input + type="submit" + class="add-groups add-everyone-group" + value="{% trans %}share with everyone{% endtrans %}" + /> + </p> + </form> + + {% set shared_users_count = sharing_info['users'].count() %} + {% set shared_groups_count = sharing_info['groups'].count() %} + + {% if shared_users_count or shared_groups_count %} + <p + style="margin:16px 0 4px 0" + >{% trans %}This question is currently shared only with:{% endtrans %}</p> + {% endif %} + <h3>{% trans %}Individual users{% endtrans %}</h3> + {% set comma = joiner(',') %} + {{ comma() }} + <p> + <a href="{{ request.user.get_profile_url() }}"> + {% trans %}You{% endtrans -%} + </a>{%- if shared_users_count -%} + {%- for user in sharing_info['users'] %}{{ comma() }} + {{ user.get_profile_link() }} + {%- endfor -%} + {% endif -%} + {%- if sharing_info['more_users_count'] > 0 %} + {% trans %}and{% endtrans %} + <a + class="see-related-users" + data-url="{% url get_thread_shared_users %}" + data-thread-id="{{ thread.id }}" + >{% trans + more_count=sharing_info['more_users_count'] + %}{{ more_count }} more{% endtrans %} + </a> + {% endif %} + </p> + + {% if shared_groups_count %} + <h3>{% trans %}Groups{% endtrans %}</h3> + <p> + {% set comma = joiner(',') %} + {%- for group in sharing_info['groups'] -%}{{ comma() }} + {{ macros.user_group_link(group) }} + {%- endfor -%} + {% if sharing_info['more_groups_count'] > 0 %} + {% trans %}and{% endtrans %} + <a + class="see-related-groups" + data-url="{% url get_thread_shared_groups %}" + data-thread-id="{{ thread.id }}" + >{% trans more_count=sharing_info['more_groups_count'] %}{{ more_count }} more{% endtrans %} + </a> + {% endif %} + </p> + {% endif %} + {% else %} + <h2>{% trans %}Public thread{% endtrans %}</h2> + <p>{% trans site_name=settings.APP_SHORT_NAME %}This thread is public, all members of {{ site_name }} can read this page.{% endtrans %}</p> + {% endif %} +</div> +{% endif %} + {% if settings.SIDEBAR_QUESTION_SHOW_META %} <div class="box statsWidget"> <div class="clearfix"></div> <h2>{% trans %}Stats{% endtrans %}</h2> <p> - {% trans %}Asked{% endtrans %}: <strong>{{ timeago(question.added_at) }}</strong> + {% trans %}Asked{% endtrans %}: <strong>{{ macros.timeago(question.added_at) }}</strong> </p> <p> {% trans %}Seen{% endtrans %}: <strong>{{ thread.view_count|intcomma }} {% trans %}times{% endtrans %}</strong> @@ -64,7 +156,7 @@ </div> {% endif %} -{% if similar_threads.data and settings.SIDEBAR_QUESTION_SHOW_RELATED %} +{% if similar_threads.data() and settings.SIDEBAR_QUESTION_SHOW_RELATED %} {#% cache 1800 "related_questions" related_questions question.id language_code %#} <div class="box"> <h2>{% trans %}Related questions{% endtrans %}</h2> diff --git a/askbot/skins/default/templates/question_edit.html b/askbot/skins/default/templates/question_edit.html index adf2f35b..f176b11d 100644 --- a/askbot/skins/default/templates/question_edit.html +++ b/askbot/skins/default/templates/question_edit.html @@ -11,16 +11,22 @@ {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul() }}{% endif %} <div style="vertical-align:middle"> - {{ revision_form.revision }} <input type="submit" style="display:none" - id="select_revision" name="select_revision" - value="{% trans %}select revision{% endtrans %}"> + {{ revision_form.revision }} <input type="hidden" + id="select_revision" + name="select_revision" + value="false"> </div> + {% set use_category_selector = (settings.TAG_SOURCE == 'category-tree') %} {{ macros.edit_post( form, - post_type='question', - edit_title=True, + post_type = 'question', + post_html = revision.text, + edit_title = True, mandatory_tags = mandatory_tags, + use_category_selector = use_category_selector, + tag_names = tag_names, + editor_type = settings.EDITOR_TYPE, user = request.user ) }} @@ -32,8 +38,11 @@ {% if form.can_stay_anonymous() %} {{ macros.checkbox_in_div(form.reveal_identity) }} {% endif %} + {% if request.user.is_authenticated() and request.user.can_make_group_private_posts() %} + {{ macros.checkbox_in_div(form.post_privately) }} + {% endif %} </div> - <input type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> + <input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> <input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" /> </div> @@ -52,8 +61,10 @@ {% endif %} <script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script> <script type='text/javascript' src='{{"/js/post.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + {% if settings.EDITOR_TYPE == 'markdown' %} + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + {% endif %} <script type="text/javascript"> {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} var codeFriendlyMarkdown = true; @@ -63,8 +74,8 @@ //todo move javascript out $().ready(function(){ $("#nav_questions").attr('className',"on"); + $('#editor').TextAreaResizer(); - //highlight code synctax when editor has new text $("#editor").typeWatch({highlight: false, wait: 3000, captureLength: 5, callback: lanai.highlightSyntax}); @@ -89,11 +100,15 @@ ); $('#id_revision').unbind().change(function(){ - $("#select_revision").click(); + $("#select_revision").val('true'); + $('#edit_post_form_submit_button').click(); }); lanai.highlightSyntax(); }); </script> + {% if settings.TAG_SOURCE == 'category-tree' %} + {% include "meta/category_tree_js.html" %} + {% endif %} {% endblock %} <!-- end question_edit.html --> diff --git a/askbot/skins/default/templates/tags.html b/askbot/skins/default/templates/tags.html index 007388af..e9049e8e 100644 --- a/askbot/skins/default/templates/tags.html +++ b/askbot/skins/default/templates/tags.html @@ -4,30 +4,7 @@ {% block title %}{% spaceless %}{% trans %}Tags{% endtrans %}{% endspaceless %}{% endblock %} {% block content %} <!-- Tabs --> -<div id="content-header"> - {% if stag %} - <h1 class="section-title">{% trans %}Tags, matching "{{ stag }}"{% endtrans %}</h1> - {% else %} - <h1 class="section-title">{% trans %}Tag list{% endtrans %}</h1> - {% endif %} - <div class="tabBar tabBar-tags"> - <div class="tabsA"> - <span class="label">{% trans %}Sort by »{% endtrans %}</span> - <a - id="sort_name" - href="{% url tags %}?sort=name" - {% if tab_id == 'name' %}class="on"{% endif %} - title="{% trans %}sorted alphabetically{% endtrans %}" - ><span>{% trans %}by name{% endtrans %}</span></a> - <a - id="sort_used" - href="{% url tags %}?sort=used" - {% if tab_id == 'used' %}class="on"{% endif %} - title="{% trans %}sorted by frequency of tag use{% endtrans %}" - ><span>{% trans %}by popularity{% endtrans %}</span></a> - </div> - </div> -</div> +{% include "tags/header.html" %} {% if tag_list_type == 'list' %} {% if not tags.object_list %} <span>{% trans %}Nothing found{% endtrans %}</span> diff --git a/askbot/skins/default/templates/tags/header.html b/askbot/skins/default/templates/tags/header.html new file mode 100644 index 00000000..9f1d73e4 --- /dev/null +++ b/askbot/skins/default/templates/tags/header.html @@ -0,0 +1,38 @@ +<div id="content-header"> + {% if page_title %} + <h1 class="section-title">{{ page_title }}</h1> + {% else %} + {% if stag %} + <h1 class="section-title">{% trans %}Tags, matching "{{ stag }}"{% endtrans %}</h1> + {% else %} + <h1 class="section-title">{% trans %}Tags{% endtrans %}</h1> + {% endif %} + {% endif %} + <div class="tabBar tabBar-tags"> + <div class="tabsA"> + <span class="label">{% trans %}Sort by »{% endtrans %}</span> + <a + id="sort_name" + href="{% url tags %}?sort=name" + {% if tab_id == 'name' %}class="on"{% endif %} + title="{% trans %}sorted alphabetically{% endtrans %}" + ><span>{% trans %}by name{% endtrans %}</span></a> + <a + id="sort_used" + href="{% url tags %}?sort=used" + {% if tab_id == 'used' %}class="on"{% endif %} + title="{% trans %}sorted by frequency of tag use{% endtrans %}" + ><span>{% trans %}by popularity{% endtrans %}</span></a> + {% if settings.ENABLE_TAG_MODERATION %} + {% if request.user.is_authenticated() and request.user.is_administrator_or_moderator() %} + <a + href="{% url list_suggested_tags %}" + {% if tab_id == 'suggested' %}class="on"{% endif %} + title="{% trans %}suggested{% endtrans %}" + ><span>{% trans %}suggested{% endtrans %}</span></a> + {% endif %} + {% endif %} + </div> + </div> +</div> +<div class="clearfix"></div> diff --git a/askbot/skins/default/templates/user_inbox/base.html b/askbot/skins/default/templates/user_inbox/base.html new file mode 100644 index 00000000..4d74f8bc --- /dev/null +++ b/askbot/skins/default/templates/user_inbox/base.html @@ -0,0 +1,63 @@ +{% extends "user_profile/user.html" %} +{% block before_css %} + <link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> +{% endblock %} +{% block profilesection %} + {% trans %}inbox{% endtrans %} +{% endblock %} +{% block usercontent %} +<div style="padding-top:5px;font-size:13px;"> + {% set re_count = request.user.new_response_count + + request.user.seen_response_count + %} + {% if re_count + flags_count + group_join_requests_count > 0 %} + <div id="re_sections"> + {% trans %}Sections:{% endtrans %} + {% set sep = joiner('|') %} + {% if re_count > 0 %}{{ sep() }} + <a href="{{request.user.get_absolute_url()}}?sort=inbox§ion=forum" + {% if inbox_section == 'forum' %}class="on"{% endif %} + > + {% trans %}forum responses ({{re_count}}){% endtrans -%} + </a> + {% endif %} + {% if flags_count > 0 %}{{ sep() }} + <a href="{{request.user.get_absolute_url()}}?sort=inbox§ion=flags" + {% if inbox_section == 'flags' %}class="on"{% endif %} + > + {% trans %}flagged items ({{flags_count}}){% endtrans %} + </a> + {% endif %} + {% if group_join_requests_count %}{{ sep() }} + <a href="{{request.user.get_absolute_url()}}?sort=inbox§ion=join_requests" + {% if inbox_section == 'join_requests' %}class="on"{% endif %} + > + {% trans %}group join requests{% endtrans %} + </a> + {% endif %} + </div> + {% endif %} + {% block inbox_content %} + {% endblock %} +</div> +{% endblock %} +{% block userjs %} + <script type="text/javascript"> + var askbot = askbot || {}; + askbot['urls'] = askbot['urls'] || {}; + askbot['urls']['manageInbox'] = '{% url manage_inbox %}'; + askbot['urls']['save_post_reject_reason'] = '{% url save_post_reject_reason %}'; + askbot['urls']['delete_post_reject_reason'] = '{% url delete_post_reject_reason %}'; + {% if request.user.is_administrator_or_moderator() %} + askbot['data']['postRejectReasons'] = [ + {% for reason in post_reject_reasons %} + {'id': {{reason.id}}, 'title': '{{reason.title|escapejs}}'}, + {% endfor %} + ]; + {% endif %} + $(document).ready(function(){ + $('body').addClass('inbox-{{ inbox_section }}'); + setup_inbox(); + }); + </script> +{% endblock %} diff --git a/askbot/skins/default/templates/user_inbox/group_join_requests.html b/askbot/skins/default/templates/user_inbox/group_join_requests.html new file mode 100644 index 00000000..2defe5e1 --- /dev/null +++ b/askbot/skins/default/templates/user_inbox/group_join_requests.html @@ -0,0 +1,50 @@ +{% extends "user_inbox/base.html" %} +{% import "macros.html" as macros %} +{% block profilesection %} + {% trans %}inbox - group join requests{% endtrans %} +{% endblock %} +{% block inbox_content %} + <table> + {% for join_request in join_requests %} + <tr> + <td>{% trans + user=join_request.user, + group=groups_dict[join_request.object_id].name + %}{{ user }} wants to join group {{ group }}{% endtrans %} + </td> + <td>{# forms with accept and reject buttons #} + <form action="{% url moderate_group_join_request %}" method="post" + >{% csrf_token %} + <input + type="hidden" + name="request_id" + value="{{join_request.id}}" + /> + <input type="hidden" name="action" value="approve"/> + <input + class="btn" + type="submit" + value="{% trans %}Approve{% endtrans %}" + /> + </form> + </td> + <td> + <form action="{% url moderate_group_join_request %}" method="post"> + {% csrf_token %} + <input + type="hidden" + name="request_id" + value="{{join_request.id}}" + /> + <input type="hidden" name="action" value="deny"/> + <input + class="btn" + type="submit" + value="{% trans %}Deny{% endtrans %}" + /> + </form> + </td> + </tr> + {% endfor %} + </table> +{% endblock %} diff --git a/askbot/skins/default/templates/user_inbox/responses_and_flags.html b/askbot/skins/default/templates/user_inbox/responses_and_flags.html new file mode 100644 index 00000000..c889bb0a --- /dev/null +++ b/askbot/skins/default/templates/user_inbox/responses_and_flags.html @@ -0,0 +1,43 @@ +{% extends "user_inbox/base.html" %} +{% import "macros.html" as macros %} +{% block profilesection %} + {% trans %}inbox - responses{% endtrans %} +{% endblock %} +{% block inbox_content %} + <div id="re_tools"> + <strong>{% trans %}select:{% endtrans %}</strong> + <a id="sel_all">{% trans %}all{% endtrans %}</a> | + <a id="sel_seen">{% trans %}seen{% endtrans %}</a> | + <a id="sel_new">{% trans %}new{% endtrans %}</a> | + <a id="sel_none">{% trans %}none{% endtrans %}</a><br /> + <div class="btn-group"> + {% if inbox_section == 'forum' %} + <a class="btn" id="re_mark_seen">{% trans %}mark as seen{% endtrans %}</a> + <a class="btn" id="re_mark_new">{% trans %}mark as new{% endtrans %}</a> + <a class="btn" id="re_dismiss">{% trans %}dismiss{% endtrans %}</a> + {% else %} + <a class="btn" id="re_remove_flag">{% trans %}remove flags/approve{% endtrans %}</a> + <a + class="btn" + id="re_delete_post" + >{% trans %}delete post{% endtrans %}</a> + {% endif %} + </div> + </div> + {% include "user_profile/reject_post_dialog.html" %} + <div id="responses"> + {% for response in responses %} + <div class="response-parent" data-response-id="{{response.id}}"> + <p class="headline"> + <strong>"{{ response.response_title.strip()|escape}}"</strong> + </p> + {{ macros.inbox_post_snippet(response, inbox_section) }} + {% for nested_response in response.nested_responses %} + {{ macros.inbox_post_snippet(nested_response, inbox_section) }} + {%endfor%} + </div> + <div class="clearfix"></div> + {% endfor %} + </div> + </div> +{% endblock %} diff --git a/askbot/skins/default/templates/user_profile/reject_post_dialog.html b/askbot/skins/default/templates/user_profile/reject_post_dialog.html index 987c511a..3483e83e 100644 --- a/askbot/skins/default/templates/user_profile/reject_post_dialog.html +++ b/askbot/skins/default/templates/user_profile/reject_post_dialog.html @@ -44,6 +44,7 @@ <ul class="select-box"> {% for reason in post_reject_reasons %} <li + class="select-box-item" data-original-title="{{reason.details.text|escape}}" data-item-id="{{reason.id}}" >{{reason.title|escape}}</li> diff --git a/askbot/skins/default/templates/user_profile/user.html b/askbot/skins/default/templates/user_profile/user.html index 2f06a3c9..3aee3cfa 100644 --- a/askbot/skins/default/templates/user_profile/user.html +++ b/askbot/skins/default/templates/user_profile/user.html @@ -24,7 +24,7 @@ askbot['data']['viewUserName'] = '{{ view_user.username|escape }}'; askbot['data']['viewUserId'] = {{view_user.id}}; askbot['urls']['edit_group_membership'] = '{% url edit_group_membership %}'; - askbot['urls']['get_groups_list'] = '{% url get_groups_list %}'; + askbot['urls']['getGroupsList'] = '{% url get_groups_list %}'; </script> {% if request.user|can_moderate_user(view_user) %} <script type='text/javascript' src='{{"/js/jquery.form.js"|media}}'></script> diff --git a/askbot/skins/default/templates/user_profile/user_inbox.html b/askbot/skins/default/templates/user_profile/user_inbox.html deleted file mode 100644 index cda45027..00000000 --- a/askbot/skins/default/templates/user_profile/user_inbox.html +++ /dev/null @@ -1,99 +0,0 @@ -{% extends "user_profile/user.html" %} -{% import "macros.html" as macros %} -{% block before_css %} - <link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> -{% endblock %} -<!-- user_responses.html --> -{# -This template accepts a list of response list -they are a generalized form of any response and - -The following properties of response object are used: -timestamp - when it happened -user - user who gave response (database object) -response_type - type of response -response_url - link to the question -response_title - title of the question -response_snippet - abbreviated content of the response -inbox_section - forum|flags -#} -{% block profilesection %} - {% trans %}inbox{% endtrans %} -{% endblock %} -{% block usercontent %} - <div style="padding-top:5px;font-size:13px;"> - {% set re_count = request.user.new_response_count + - request.user.seen_response_count - %} - {% if moderation_items %} - {% set flag_count = moderation_items['new_count'] + - moderation_items['seen_count'] - %} - {% else %} - {% set flag_count = 0 %} - {% endif %} - {% if re_count > 0 and flag_count > 0 %} - <div id="re_sections"> - {% trans %}Sections:{% endtrans %} - <a href="{{request.user.get_absolute_url()}}?sort=inbox§ion=forum" - {% if inbox_section == 'forum' %}class="on"{% endif %} - > - {% trans %}forum responses ({{re_count}}){% endtrans -%} - </a> | - <a href="{{request.user.get_absolute_url()}}?sort=inbox§ion=flags" - {% if inbox_section == 'flags' %}class="on"{% endif %} - > - {% trans %}flagged items ({{flag_count}}){% endtrans %} - </a> - </div> - {% endif %} - <div id="re_tools"> - <strong>{% trans %}select:{% endtrans %}</strong> - <a id="sel_all">{% trans %}all{% endtrans %}</a> | - <a id="sel_seen">{% trans %}seen{% endtrans %}</a> | - <a id="sel_new">{% trans %}new{% endtrans %}</a> | - <a id="sel_none">{% trans %}none{% endtrans %}</a><br /> - <div class="btn-group"> - {% if inbox_section == 'forum' %} - <a class="btn" id="re_mark_seen">{% trans %}mark as seen{% endtrans %}</a> - <a class="btn" id="re_mark_new">{% trans %}mark as new{% endtrans %}</a> - <a class="btn" id="re_dismiss">{% trans %}dismiss{% endtrans %}</a> - {% else %} - <a class="btn" id="re_remove_flag">{% trans %}remove flags/approve{% endtrans %}</a> - <a - class="btn" - id="re_delete_post" - >{% trans %}delete post{% endtrans %}</a> - {% endif %} - </div> - </div> - {% include "user_profile/reject_post_dialog.html" %} - <div id="responses"> - {% for response in responses %} - <div class="response-parent"> - <p class="headline"> - <strong>"{{ response.response_title.strip()|escape}}"</strong> - </p> - {{ macros.inbox_post_snippet(response, inbox_section) }} - {% for nested_response in response.nested_responses %} - {{ macros.inbox_post_snippet(nested_response, inbox_section) }} - {%endfor%} - </div> - {% endfor %} - </div> - </div> -{% endblock %} -{% block userjs %} - <script type="text/javascript"> - var askbot = askbot || {}; - askbot['urls'] = askbot['urls'] || {}; - askbot['urls']['manageInbox'] = '{% url manage_inbox %}'; - askbot['urls']['save_post_reject_reason'] = '{% url save_post_reject_reason %}'; - askbot['urls']['delete_post_reject_reason'] = '{% url delete_post_reject_reason %}'; - $(document).ready(function(){ - setup_inbox(); - }); - </script> - <script type="text/javascript" src="{{'/bootstrap/js/bootstrap.js'|media}}" /> -<!-- end user_responses.html --> -{% endblock %} diff --git a/askbot/skins/default/templates/user_profile/user_info.html b/askbot/skins/default/templates/user_profile/user_info.html index ad460dbc..89f06321 100644 --- a/askbot/skins/default/templates/user_profile/user_info.html +++ b/askbot/skins/default/templates/user_profile/user_info.html @@ -56,6 +56,22 @@ <td><b>{{view_user.real_name}}</b></td> </tr> {% endif %} + {% if settings.GROUPS_ENABLED %} + <tr> + <td>{% if user_groups %}{% trans %}groups{% endtrans %}{% endif %}</td> + <td> + <table id="groups-list"> + {% for group in user_groups %} + <tr> + {{ macros.user_group(group, groups_membership_info[group.id]) }} + </tr> + {% endfor %} + </table> + <div class="clearfix"></div> + <a id="add-group">{% trans %}add group{% endtrans %}</a> + </td> + </div> + {% endif %} <tr> <td>{% trans %}member since{% endtrans %}</td> <td><strong>{{ macros.timeago(view_user.date_joined) }}</strong></td> diff --git a/askbot/skins/default/templates/user_profile/user_stats.html b/askbot/skins/default/templates/user_profile/user_stats.html index 2ccc277f..dc3d97e0 100644 --- a/askbot/skins/default/templates/user_profile/user_stats.html +++ b/askbot/skins/default/templates/user_profile/user_stats.html @@ -7,23 +7,6 @@ {% endblock %} {% block usercontent %} {% include "user_profile/user_info.html" %} - {% if settings.GROUPS_ENABLED %} - <div id="user-groups"> - <h2>{% trans - username = view_user.username|escape - %}{{username}}'s groups{% endtrans %} - </h2> - <table id="groups-list"> - {% for group in user_groups %} - <tr> - {{ macros.user_group(group, groups_membership_info[group.id]) }} - </tr> - {% endfor %} - </table> - <div class="clearfix"></div> - <a id="add-group">{% trans %}add group{% endtrans %}</a> - </div> - {% endif %} <a name="questions"></a> {% spaceless %} <h2>{% trans counter=question_count %}<span class="count">{{counter}}</span> Question{% pluralize %}<span class="count">{{counter}}</span> Questions{% endtrans %}</h2> diff --git a/askbot/skins/default/templates/user_profile/users_questions.html b/askbot/skins/default/templates/user_profile/users_questions.html index 128c6612..ca66b7e2 100644 --- a/askbot/skins/default/templates/user_profile/users_questions.html +++ b/askbot/skins/default/templates/user_profile/users_questions.html @@ -2,7 +2,13 @@ {% import "macros.html" as macros %} <div class="user-stats-table"> {% for question in questions %} - {{macros.question_summary(question.thread, question, extra_class='narrow', search_state=search_state)}} + {{ + macros.question_summary( + question.thread, question, + extra_class='narrow', search_state=search_state, + visitor = request.user + ) + }} {% endfor %} </div> <!-- end users_questions.html --> diff --git a/askbot/skins/default/templates/users.html b/askbot/skins/default/templates/users.html index 5b963399..a159dee1 100644 --- a/askbot/skins/default/templates/users.html +++ b/askbot/skins/default/templates/users.html @@ -2,11 +2,6 @@ {% import "macros.html" as macros %} <!-- users.html --> {% block title %}{% spaceless %}{% trans %}Users{% endtrans %}{% endspaceless %}{% endblock %} -{% block before_css %} - {% if group and request.user.is_authenticated() and request.user.is_administrator() %} - <link href="{{'/bootstrap/css/bootstrap.css'|media}}" rel="stylesheet" type="text/css" /> - {% endif %} -{% endblock %} {% block forestyle %} <link rel="stylesheet" type="text/css" href="{{"/js/wmd/wmd.css"|media}}" /> {% endblock %} @@ -21,7 +16,18 @@ </h1> <div class="tabBar"> <div class="tabsA"> - <span class="label">{% trans %}Sort by »{% endtrans %}</span> + {#% if settings.GROUPS_ENABLED and user_groups %} + <span class="label">{% trans %}Select/Sort by »{% endtrans %}</span> + {% for a_group in user_groups %} + <a + href="{% url users_by_group group_id=a_group.id, group_slug=a_group.name|slugify %}" + {% if group.name == a_group.name %}class="on"{% endif %} + title="{% trans name=a_group.name|escape %}people in group {{name}}{% endtrans %}" + ><span>{{ a_group.name|replace('-',' ')|escape }}</span></a> + {% endfor %} + {% else %#} + <span class="label">{% trans %}Sort by »{% endtrans %}</span> + {#% endif %#} {% if settings.KARMA_MODE == 'public' %} <a id="sort_reputation" @@ -52,7 +58,6 @@ </div> <div class="clearfix"></div> </div> -<div class="clean"></div> {% if search_query %} <p>{% trans %}users matching query {{search_query}}:{% endtrans %}</p> {% endif %} @@ -85,7 +90,6 @@ askbot['urls']['delete_group_logo_url'] = '{% url delete_group_logo %}'; askbot['urls']['join_or_leave_group'] = '{% url join_or_leave_group %}'; </script> - <script type="text/javascript" src='{{"/bootstrap/js/bootstrap.js"|media}}'></script> <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> diff --git a/askbot/skins/default/templates/widget_base.html b/askbot/skins/default/templates/widget_base.html new file mode 100644 index 00000000..44be3e5f --- /dev/null +++ b/askbot/skins/default/templates/widget_base.html @@ -0,0 +1,22 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!-- template widget_base.html --> +<html xmlns="http://www.w3.org/1999/xhtml"> + {% spaceless %} + <head> + {% include "meta/html_head_javascript.html" %} + {% block before_css %}{% endblock %} + {% block forestyle %}{% endblock %} + {% block forejs %}{% endblock %} + </head> + {% endspaceless %} + <body class="lang-{{settings.LANGUAGE_CODE}}"> + {% block body%} + {% endblock %} + {% block content%} + {% endblock %} + {% include "meta/bottom_scripts.html" %} + {% block endjs %} + {% endblock %} + </body> +</html> +<!-- end template widget_base.html --> diff --git a/askbot/skins/default/templates/widgets/answer_edit_tips.html b/askbot/skins/default/templates/widgets/answer_edit_tips.html index 1c2cdc60..2bb5b256 100644 --- a/askbot/skins/default/templates/widgets/answer_edit_tips.html +++ b/askbot/skins/default/templates/widgets/answer_edit_tips.html @@ -22,46 +22,6 @@ </p> </div> </div> - -<div class="box"> - <h2>{% trans %}Markdown basics{% endtrans %}</h2> - <ul> - {% if settings.MARKUP_CODE_FRIENDLY or settings.ENABLE_MATHJAX %} - <li> - {% trans %}*italic*{% endtrans %} - </li> - <li> - {% trans %}**bold**{% endtrans %} - </li> - {% else %} - <li> - {% trans %}*italic* or _italic_{% endtrans %} - </li> - <li> - {% trans %}**bold** or __bold__{% endtrans %} - </li> - {% endif %} - <li> - <b>{% trans %}link{% endtrans %}</b>:[{% trans %}text{% endtrans %}](http://url.com/ "{% trans %}title{% endtrans %}") - - </li> - <li> - <b>{% trans %}image{% endtrans %}</b>:![alt {% trans %}text{% endtrans %}](/path/img.jpg "{% trans %}title{% endtrans %}") - - </li> - <li> - {% trans %}numbered list:{% endtrans %} - 1. Foo - 2. Bar - </li> - <li> - {% trans %}basic HTML tags are also supported{% endtrans %} - </li> - </ul> - <p class='info-box-follow-up-links'> -<!-- will be change to a popup windows - <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans %}learn more about Markdown{% endtrans %} »</a> ---> - </p> -</div> -<!-- end template answer_edit_tips.html --> +{% if settings.EDITOR_TYPE == 'markdown' %} + {% include "widgets/markdown_help.html" %} +{% endif %} diff --git a/askbot/skins/default/templates/widgets/ask_button.html b/askbot/skins/default/templates/widgets/ask_button.html index 31448b73..e202b110 100644 --- a/askbot/skins/default/templates/widgets/ask_button.html +++ b/askbot/skins/default/templates/widgets/ask_button.html @@ -2,5 +2,8 @@ {% if not search_state %} {# get empty SearchState() if there's none #} {% set search_state=search_state|get_empty_search_state %} {% endif %} - <a id="askButton" href="{{ search_state.full_ask_url() }}">{% trans %}Ask Your Question{% endtrans %}</a> + <a + id="askButton" + href="{{ search_state.full_ask_url() }}{% if group %}{% if '?' in search_state.full_ask_url() %}&{% else %}?{% endif %}group_id={{ group.id }}{% endif %}" + >{% if group %}{% trans %}Ask the Group{% endtrans %}{% else %}{% trans %}Ask Your Question{% endtrans %}{% endif %}</a> {% endif %} diff --git a/askbot/skins/default/templates/widgets/ask_form.html b/askbot/skins/default/templates/widgets/ask_form.html index 77a92544..d528609f 100644 --- a/askbot/skins/default/templates/widgets/ask_form.html +++ b/askbot/skins/default/templates/widgets/ask_form.html @@ -26,9 +26,12 @@ post_type = 'question', edit_title = False, mandatory_tags = mandatory_tags, + use_category_selector = (settings.TAG_SOURCE == 'category-tree'), + editor_type = settings.EDITOR_TYPE, user = request.user ) }} + {{ form.group_id }} <div class="question-options"> {% if settings.WIKI_ON %} {{ macros.checkbox_in_div(form.wiki) }} @@ -36,6 +39,9 @@ {% if settings.ALLOW_ASK_ANONYMOUSLY %} {{ macros.checkbox_in_div(form.ask_anonymously) }} {% endif %} + {% if request.user.is_authenticated() and request.user.can_make_group_private_posts() %} + {{ macros.checkbox_in_div(form.post_privately) }} + {% endif %} </div> {% if not request.user.is_authenticated() %} <input type="submit" name="post_anon" value="{% trans %}Login/Signup to Post{% endtrans %}" class="submit" /> diff --git a/askbot/skins/default/templates/widgets/group_info.html b/askbot/skins/default/templates/widgets/group_info.html index 5d3a4c7f..0ce93d18 100644 --- a/askbot/skins/default/templates/widgets/group_info.html +++ b/askbot/skins/default/templates/widgets/group_info.html @@ -2,8 +2,8 @@ <div id="group-wiki-{{group.id}}" class="box group-wiki"> <h2>{% trans %}Group info{% endtrans %}</h2> <img class="group-logo" - {% if group.group_profile.logo_url %} - src="{{ group.group_profile.logo_url }}" + {% if group.logo_url %} + src="{{ group.logo_url }}" {% else %} style="display:none" {% endif %} @@ -16,15 +16,15 @@ <div class="clearfix"></div> {{ macros.group_join_button( group_id = group.id, - can_join = user_can_join_group, - is_member = user_is_group_member + acceptance_level = user_acceptance_level, + membership_level = user_membership_level ) }} {% if request.user.is_authenticated() and request.user.is_administrator() %} <div class="controls"> <a class="edit-description" >{% trans %}edit description{% endtrans %}</a> - {% if group.group_profile.logo_url %} + {% if group.logo_url %} <span>|</span> <a class="change-logo" >{% trans %}change logo{% endtrans %}</a> @@ -39,7 +39,7 @@ {% if group_email_moderation_enabled %} <input type="checkbox" id="moderate-email" - {% if group.group_profile.moderate_email %}checked="checked"{% endif %} + {% if group.moderate_email %}checked="checked"{% endif %} data-toggle-url="{% url toggle_group_profile_property %}" /> <label for="moderate-email"> @@ -47,20 +47,41 @@ </label> <br/> {% endif %} - <input type="checkbox" - id="open-or-close-group" - {% if group.group_profile.is_open %}checked="checked"{% endif %} + + <input + type="checkbox" + id="moderate-answers-to-enquirers" + {% if group.moderate_answers_to_enquirers %}checked="checked"{% endif %} data-toggle-url="{% url toggle_group_profile_property %}" /> - <label for="open-or-close-group"> - {% trans %}anyone can join{% endtrans %} + <label for="moderate-answers-to-enquirers"> + {% trans %}show only selected answers to enquirers{% endtrans %} </label> <br/> + + <label for="group-openness-selector"> + {% trans %}How users join this group?{% endtrans %} + </label> + <br/> + <select + id="group-openness-selector" + data-url="{% url set_group_openness %}" + > + {% for choice in group_openness_choices %} + <option + {% if choice[0] == group.openness %} + selected="selected" + {% endif %} + value="{{choice[0]}}" + >{{ choice[1] }}</option> + {% endfor %} + </select> + <br/> <a id="preapproved-emails" title="{% trans %}list of email addresses of pre-approved users{% endtrans %}" - data-object-id="{{group.group_profile.id}}" - data-model-name="GroupProfile" + data-object-id="{{group.group_ptr_id}}" + data-model-name="Group" data-property-name="preapproved_emails" data-url="{% url edit_object_property_text %}" data-editor-heading="{% trans %}List of preapproved email addresses{% endtrans %}" @@ -70,8 +91,8 @@ <a id="preapproved-email-domains" title="{% trans %}list of preapproved email address domain names{% endtrans %}" - data-object-id="{{group.group_profile.id}}" - data-model-name="GroupProfile" + data-object-id="{{group.group_ptr_id}}" + data-model-name="Group" data-property-name="preapproved_email_domains" data-url="{% url edit_object_property_text %}" data-editor-heading="{% trans %}List of preapproved email domain names{% endtrans %}" diff --git a/askbot/skins/default/templates/widgets/groups_list.html b/askbot/skins/default/templates/widgets/groups_list.html new file mode 100644 index 00000000..0669f34f --- /dev/null +++ b/askbot/skins/default/templates/widgets/groups_list.html @@ -0,0 +1,4 @@ +{% import "macros.html" as macros %} +{% for group in groups %} + <p>{{ macros.user_group(group) }}</p> +{% endfor %} diff --git a/askbot/skins/default/templates/widgets/markdown_help.html b/askbot/skins/default/templates/widgets/markdown_help.html new file mode 100644 index 00000000..9816fe26 --- /dev/null +++ b/askbot/skins/default/templates/widgets/markdown_help.html @@ -0,0 +1,42 @@ +<div class="box"> + <h2>{% trans %}Markdown basics{% endtrans %}</h2> + <ul> + {% if settings.MARKUP_CODE_FRIENDLY or settings.ENABLE_MATHJAX %} + <li> + {% trans %}*italic*{% endtrans %} + </li> + <li> + {% trans %}**bold**{% endtrans %} + </li> + {% else %} + <li> + {% trans %}*italic* or _italic_{% endtrans %} + </li> + <li> + {% trans %}**bold** or __bold__{% endtrans %} + </li> + {% endif %} + <li> + <b>{% trans %}link{% endtrans %}</b>:[{% trans %}text{% endtrans %}](http://url.com/ "{% trans %}title{% endtrans %}") + + </li> + <li> + <b>{% trans %}image{% endtrans %}</b>:![alt {% trans %}text{% endtrans %}](/path/img.jpg "{% trans %}title{% endtrans %}") + + </li> + <li> + {% trans %}numbered list:{% endtrans %} + 1. Foo + 2. Bar + </li> + <li> + {% trans %}basic HTML tags are also supported{% endtrans %} + </li> + </ul> + <p class='info-box-follow-up-links'> +<!-- will be change to a popup windows + <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans %}learn more about Markdown{% endtrans %} »</a> +--> + </p> +</div> +<!-- end template answer_edit_tips.html --> diff --git a/askbot/skins/default/templates/widgets/meta_nav.html b/askbot/skins/default/templates/widgets/meta_nav.html index 1b28c787..20c22491 100644 --- a/askbot/skins/default/templates/widgets/meta_nav.html +++ b/askbot/skins/default/templates/widgets/meta_nav.html @@ -1,20 +1,23 @@ +{% import "macros.html" as macros%} <a id="navTags" href="{% url tags %}" {% if active_tab == 'tags' %}class="on"{% endif %} >{% trans %}tags{% endtrans %}</a> +{% if settings.GROUPS_ENABLED %} +<span class="dropdown"> +<a + id="navGroups" class='{% if active_tab == 'groups' %}"on"{% endif %}' + href="{% url groups %}" data-target="#" > + {% trans %}people & groups{% endtrans %} +</a> +</span> +{%else%} <a id="navUsers" href="{% url users %}" {% if active_tab == 'users' %}class="on"{% endif %} >{% trans %}users{% endtrans %}</a> -{% if settings.GROUPS_ENABLED %} -<a - id="navGroups" - href="{% url groups %}" - {% if active_tab == 'groups' %}class="on"{% endif %} ->{% trans %}groups{% endtrans %} -</a> {% endif %} {% if settings.BADGES_MODE == 'public' %} <a diff --git a/askbot/skins/default/templates/widgets/question_edit_tips.html b/askbot/skins/default/templates/widgets/question_edit_tips.html index 842aa491..f60304c1 100644 --- a/askbot/skins/default/templates/widgets/question_edit_tips.html +++ b/askbot/skins/default/templates/widgets/question_edit_tips.html @@ -17,47 +17,6 @@ --> </p> </div> - -<div id="markdownHelp"class="box"> - <h2>{% trans %}Markdown basics{% endtrans %}</h2> - <ul> - {% if settings.MARKDUP_CODE_FRIENDLY or settings.ENABLE_MATHJAX %} - <li> - {% trans %}*italic*{% endtrans %} - </li> - <li> - {% trans %}**bold**{% endtrans %} - </li> - {% else %} - <li> - {% trans %}*italic* or _italic_{% endtrans %} - </li> - <li> - {% trans %}**bold** or __bold__{% endtrans %} - </li> - {% endif %} - <li> - <b>{% trans %}link{% endtrans %}</b>:[{% trans %}text{% endtrans %}](http://url.com/ "{% trans %}title{% endtrans %}") - - </li> - - <li> - <b>{% trans %}image{% endtrans %}</b>:![alt {% trans %}text{% endtrans %}](/path/img.jpg "{% trans %}title{% endtrans %}") - - </li> - <li> - {% trans %}numbered list:{% endtrans %} - 1. Foo - 2. Bar - </li> - <li> - {% trans %}basic HTML tags are also supported{% endtrans %} - </li> - </ul> - <p class='info-box-follow-up-links'> -<!-- will be change to a popup windows - <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans %}learn more about Markdown{% endtrans %} »</a> ---> - </p> -</div> -<!-- end question_edit_tips.html --> +{% if settings.EDITOR_TYPE == 'markdown' %} + {% include "/widgets/markdown_help.html" %} +{% endif %} diff --git a/askbot/skins/default/templates/widgets/question_summary.html b/askbot/skins/default/templates/widgets/question_summary.html index 5fd51e08..78aa2f0c 100644 --- a/askbot/skins/default/templates/widgets/question_summary.html +++ b/askbot/skins/default/templates/widgets/question_summary.html @@ -1,4 +1,4 @@ -{% from "macros.html" import user_country_flag, tag_list_widget, timeago %} +{% from "macros.html" import user_country_flag, tag_list_widget, timeago, user_primary_group %} <div class="short-summary{% if extra_class %} {{extra_class}}{% endif %}" id="question-{{question.id}}"> <div class="counts"> <div class="views @@ -12,8 +12,9 @@ {% trans cnt=thread.view_count %}view{% pluralize %}views{% endtrans %} </div> </div> + {% set answer_count = thread.get_answer_count(visitor) %} <div class="answers - {% if thread.answer_count == 0 -%} + {% if answer_count == 0 -%} no-answers {% else -%} {%- if thread.accepted_answer_id -%} {# INFO: Use _id to not fetch the whole answer post #} @@ -24,9 +25,9 @@ {%- endif -%}"> <span class="item-count" - >{{thread.answer_count|humanize_counter}}{% if thread.accepted_answer_id %}{% endif %}</span> + >{{ answer_count|humanize_counter }}{% if thread.accepted_answer_id %}{% endif %}</span> <div> - {% trans cnt=thread.answer_count %}answer{% pluralize %}answers{% endtrans %} + {% trans cnt = answer_count %}answer{% pluralize %}answers{% endtrans %} </div> </div> <div class="votes @@ -49,9 +50,10 @@ <a href="{% url user_profile thread.last_activity_by.id, thread.last_activity_by.username|slugify %}">{{thread.last_activity_by.username|escape}}</a> {{ user_country_flag(thread.last_activity_by) }} {#{user_score_and_badge_summary(thread.last_activity_by)}#} {% endif %} + {% if thread.last_activity_by.get_primary_group() %}-{% endif %} + {{ user_primary_group(thread.last_activity_by) }} </div> </div> <h2><a title="{{question.summary|escape}}" href="{{ question.get_absolute_url(thread=thread) }}">{{thread.get_title(question)|escape}}</a></h2> {{ tag_list_widget(thread.get_tag_names(), search_state=search_state) }} </div> - diff --git a/askbot/skins/default/templates/widgets/tag_category_selector.html b/askbot/skins/default/templates/widgets/tag_category_selector.html new file mode 100644 index 00000000..9eabb6eb --- /dev/null +++ b/askbot/skins/default/templates/widgets/tag_category_selector.html @@ -0,0 +1,3 @@ +{% include "widgets/three_column_category_selector.html" %} +<div class="tags-desc">{% trans %}Tags{% endtrans %}</div> +{% include "widgets/tag_editor.html" %} diff --git a/askbot/skins/default/templates/widgets/tag_editor.html b/askbot/skins/default/templates/widgets/tag_editor.html new file mode 100644 index 00000000..8f3fa8cd --- /dev/null +++ b/askbot/skins/default/templates/widgets/tag_editor.html @@ -0,0 +1,31 @@ +{% import "macros.html" as macros %} +<p style="margin:-18px 0 0 42px; color: brown; font-size: 13px; font-style: italic" + class="tag-editor-error-alert" +> + <span for="id_tags" generated="true" class="form-error" style="float: left;"></span> +</p> +<div class="tag-editor" style="margin-top: 18px">{# there's a hack with the margin in js as well #} + {{ macros.tag_list_widget( + tag_names, + deletable = True, + make_links = False + ) + }} + <input + class="new-tags-input" + type="text" + name="new_tags_input" + /> + <div class="clearfix"></div> + <input + id="id_tags" + name="tags" + type="hidden" + value="{% if tag_names %}{{tag_names|join(' ')}}{% endif %}" + /> + {# + tag input is hidden because we want to edit the list visually + we also want to eventually allow multiword tags, which are + not easy to enter into a simple input box + #} +</div> diff --git a/askbot/skins/default/templates/widgets/three_column_category_selector.html b/askbot/skins/default/templates/widgets/three_column_category_selector.html new file mode 100644 index 00000000..ab0886c6 --- /dev/null +++ b/askbot/skins/default/templates/widgets/three_column_category_selector.html @@ -0,0 +1,22 @@ +{# just a skeleton for the category selector - filled by js #} +<table class="category-selector"> + <thead> + <th colspan="3">{% trans %}Categorize your question using this tag selector or entering text in tag box.{% endtrans %} + <a style="display:none;" + class='category-editor-toggle' + data-on-state-text='{% trans %}(done editing){% endtrans %}' + data-off-state-text='{% trans %}(edit categories){% endtrans %}' + data-on-prompt-text='{% trans %}(edit categories){% endtrans %}' + data-off-prompt-text='{% trans %}(done editing){% endtrans %}' + >{% trans %}(edit categories){% endtrans %} + </a> + </th> + </thead> + <tbody> + <tr> + <td><ul class="select-box cat-col-0"></ul></td> + <td><ul class="select-box cat-col-1"></ul></td> + <td><ul class="select-box cat-col-2"></ul></td> + </tr> + </tbody> +</table> diff --git a/askbot/skins/default/templates/widgets/user_list.html b/askbot/skins/default/templates/widgets/user_list.html index e51abc5b..52cf8bd4 100644 --- a/askbot/skins/default/templates/widgets/user_list.html +++ b/askbot/skins/default/templates/widgets/user_list.html @@ -1,4 +1,4 @@ -{%from "macros.html" import gravatar %} +{% import "macros.html" as macros %} <div class="userList"> <table class="list-table"> <tr> @@ -6,10 +6,10 @@ {% for user in users %} <div class="user"> <ul> - <li class="thumb">{{ gravatar(user, 32) }}</li> - <li><a href="{% url user_profile user.id, user.username|slugify %}{% if profile_section %}?sort={{profile_section}}{% endif %}">{{user.username|escape}}</a>{{ user_country_flag(user) }}</li> + <li class="thumb">{{ macros.gravatar(user, 32) }}</li> + <li><a href="{% url user_profile user.id, user.username|slugify %}{% if profile_section %}?sort={{profile_section}}{% endif %}">{{user.username|escape}}</a>{{ macros.user_country_flag(user) }}</li> <li>{{ - user_score_and_badge_summary( + macros.user_score_and_badge_summary( user, karma_mode = karma_mode, badges_mode = badges_mode diff --git a/askbot/skins/default/templates/widgets/user_navigation.html b/askbot/skins/default/templates/widgets/user_navigation.html index 227053b0..06b0cdb9 100644 --- a/askbot/skins/default/templates/widgets/user_navigation.html +++ b/askbot/skins/default/templates/widgets/user_navigation.html @@ -21,5 +21,6 @@ {% endif %} {% if request.user.is_authenticated() and request.user.is_administrator() %} <a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a> + <a href="{% url widgets %}">{% trans %}widgets{% endtrans %}</a> {% endif %} <a href="{% url "help" %}" title="{% trans %}help{% endtrans %}">{% trans %}help{% endtrans %}</a> |