forked from mozilla/kitsune
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Done with mobile/new_question.html general structure. * TODO: lots of CSS, new_question_login.html, confirm_email.html
- Loading branch information
Showing
9 changed files
with
284 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
apps/questions/templates/questions/includes/aaq_macros.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{# vim: set ts=2 et sts=2 sw=2: #} | ||
{% macro select_product(products) -%} | ||
<h2>{{ _('Which Firefox product would you like to post a question about?') }}</h2> | ||
<ul class="select-one"> | ||
{% for key, product in products.iteritems() %} | ||
<li> | ||
<a href="{{ url('questions.new_question')|urlparams(product=key) }}"> | ||
{{ product.name }} | ||
<span>{{ product.subtitle }}</span> | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{%- endmacro %} | ||
|
||
{% macro selected_product(product, can_change) -%} | ||
<div class="selected"> | ||
<label>{{ _('Product') }}:</label> | ||
<span>{{ product.name }}</span> | ||
{% if can_change %} | ||
<a href="{{ url('questions.new_question') }}">{{ _('change') }}</a> | ||
{% endif %} | ||
</div> | ||
{%- endmacro %} | ||
|
||
{% macro select_category(product) -%} | ||
<h2>{{ _('Which of these categories best describes your problem?') }}</h2> | ||
<ul class="select-one"> | ||
{% for key, category in product.categories.iteritems() %} | ||
<li> | ||
<a href="{{ url('questions.new_question')|urlparams(product=product.key, category=key) }}">{{ category.name }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{%- endmacro %} | ||
|
||
{% macro selected_category(category, product, can_change) -%} | ||
<div class="selected"> | ||
<label>{{ _('Category') }}:</label> | ||
<span>{{ category.name }}</span> | ||
{% if can_change %} | ||
<a href="{{ url('questions.new_question')|urlparams(product=product.key) }}">{{ _('change') }}</a> | ||
{% endif %} | ||
</div> | ||
{%- endmacro %} | ||
|
||
{% macro current_articles_and_html(articles, html, category) -%} | ||
{% if html %} | ||
<h2>{{ html|safe }}</h2> | ||
{% else %} | ||
<h2>{{ _('We have lots of helpful articles on <mark>{category}</mark> and hundreds of questions in our database. Try one of the following:')|fe(category=category.name) }}</h2> | ||
{% endif %} | ||
{% if articles %} | ||
<ul class="articles select-one"> | ||
{% for article in articles %} | ||
<li> | ||
<a href="{{ article.url }}" target="_blank">{{ article.title }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{%- endmacro %} | ||
|
||
{% macro aaq_search_form(product, category, settings, request) -%} | ||
<form id="ask-search-form" class="aaq search" action="{% if settings.SESSION_COOKIE_SECURE %}https://{{ host }}{{ request.get_full_path() }}{% endif %}" method="get"> | ||
<input type="hidden" name="product" value="{{ product.key }}" /> | ||
<input type="hidden" name="category" value="{{ category.key }}" /> | ||
<input type="text" class="question" name="search" value="{{ request.GET.search }}" /> | ||
<input type="submit" class="btn btn-important" value="{{ _('Ask this') }}" /> | ||
</form> | ||
{%- endmacro %} | ||
|
||
{% macro show_results(search_results, product, category, request) -%} | ||
{% if search_results %} | ||
<h2>{{ _("We've found some articles and previously answered questions that may solve your issue:") }}</h2> | ||
<ul class="select-one search-results"> | ||
{% for result in search_results %} | ||
<li> | ||
<a href="{{ result['url'] }}">{{ result['title'] }}</a> | ||
<p> | ||
{{ result['excerpt_html']|safe }} | ||
</p> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% set button_text = _('None of these solve my problem') %} | ||
{% else %} | ||
<h2 class="no-results">{{ _('This question has not been asked before.') }}</h2> | ||
{% set button_text = _('Provide more details') %} | ||
{% endif %} | ||
|
||
<form action="" method="get"> | ||
<input type="hidden" name="product" value="{{ product.key }}" /> | ||
<input type="hidden" name="category" value="{{ category.key }}" /> | ||
<input type="hidden" name="search" value="{{ request.GET.search }}" /> | ||
<input type="hidden" name="showform" value="1" /> | ||
<input type="submit" id="show-form-btn" class="btn" value="{{ button_text }}" /> | ||
</form> | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
apps/questions/templates/questions/mobile/new_question.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{# vim: set ts=2 et sts=2 sw=2: #} | ||
{% extends "mobile/base.html" %} | ||
{% from "layout/errorlist.html" import errorlist %} | ||
{% from "questions/includes/aaq_macros.html" import select_product, selected_product, select_category, selected_category, current_articles_and_html, aaq_search_form, show_results %} | ||
{% set title = _('Ask a New Question') %} | ||
{% set classes = 'aaq' %} | ||
{% set hide_extra_content = True %} | ||
|
||
{% block content %} | ||
<h1 class="title">{{ title }}</h1> | ||
|
||
{% if not current_product %} | ||
{{ select_product(products) }} | ||
{% endif %} | ||
|
||
{% if current_product and not current_category and current_product.categories %} | ||
{{ select_category(current_product) }} | ||
{% endif %} | ||
|
||
{% if not tried_search and (current_articles or current_html) and not search_results and not form %} | ||
{{ current_articles_and_html(current_articles, current_html, current_category) }} | ||
{% if not form and not deadend %} | ||
{% set form_header_set = True %} | ||
<h2>{{ _('or, summarize your question in a sentence:') }}</h2> | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if not tried_search and current_category and ((current_articles or search_results or current_html) | ||
or not (current_articles and search_results and current_html)) | ||
and not form and not deadend %} | ||
{% if not form_header_set %} | ||
<h2>{{ _('Summarize your question in a sentence:') }}</h2> | ||
{% endif %} | ||
{{ aaq_search_form(current_product, current_category, settings, request) }} | ||
{% endif %} | ||
|
||
{% if tried_search and not form %} | ||
{{ show_results(search_results, current_product, current_category, request) }} | ||
{% endif %} | ||
|
||
{% if form %} | ||
<form id="question-form" action="" method="post"> | ||
{{ csrf() }} | ||
<h2>{{ _('Fill in the details of your question:') }}</h2> | ||
<h3>{{ _('The more information you can provide, the better the chance your question will be answered.') }}</h3> | ||
{{ errorlist(form) }} | ||
{% for field in form.hidden_fields() %} | ||
{{ field|safe }} | ||
{% endfor %} | ||
<ol> | ||
{% for field in form.visible_fields() %} | ||
<li class="{% if field.errors %}invalid{% endif %}"> | ||
{{ field.label_tag()|safe }} | ||
{{ field|safe }} | ||
</li> | ||
{% endfor %} | ||
<li class="submit"> | ||
<input type="submit" value="{{ _('Post Question') }}" /> | ||
</li> | ||
</ol> | ||
</form> | ||
{% endif %} | ||
|
||
<div class="selections"> | ||
{% if current_product %} | ||
{{ selected_product(current_product, True) }} | ||
{% endif %} | ||
{% if current_product and current_category %} | ||
{{ selected_category(current_category, current_product, True) }} | ||
{% endif %} | ||
{% if tried_search %} | ||
{{ aaq_search_form(current_product, current_category, settings, request) }} | ||
{% endif %} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.