Skip to content

Commit

Permalink
Starting work on translating subscribed threads to Twig (#2971)
Browse files Browse the repository at this point in the history
* Starting work on translatig subscribed threads

Signed-off-by: Euan Torano <euantorano@gmail.com>

* Finish subscriptions page in UCP

Signed-off-by: Euan Torano <euantorano@gmail.com>

* Use `&amp;` rather than `&` in URL.

Signed-off-by: Euan Torano <euantorano@gmail.com>

* Move HTML out of PHP into view

Also use `threadprefix` as `raw` as it can contain HTML.
  • Loading branch information
euantorano committed Jan 11, 2018
1 parent dc9f2ca commit 1a00bdc
Show file tree
Hide file tree
Showing 3 changed files with 342 additions and 270 deletions.
31 changes: 31 additions & 0 deletions inc/views/base/usercp/subscribed_thread_row.twig
@@ -0,0 +1,31 @@
<tr>
<td align="center" class="{{ thread.bg_colour }}" width="2%">
<span class="thread_status {{ thread.folder }}" title="{{ thread.folder_label }}">&nbsp;</span>
</td>
<td align="center" class="{{ thread.bg_colour }}" width="2%">
<img src="{{ thread.icon.path }}" alt="{{ thread.icon.name }}" title="{{ thread.icon.name }}" />
</td>
<td class="{{ thread.bg_colour }}">
<a href="{{ thread.newpostlink }}"><img src="{{ theme.imgdir }}/jump.png" alt="{{ lang.goto_first_unread }}" title="{{ lang.goto_first_unread }}" /></a>
{% if thread.threadprefix %}
{{ thread.threadprefix|raw }}&nbsp;
{% endif %}
<a href="{{ thread.threadlink }}" class="{{ thread.new_class }}">{{ thread.subject }}</a><br />
<span class="smalltext">{{ lang.notification_method }} {{ thread.notification_type }}</span>
</td>
<td align="center" class="{{ thread.bg_colour }}">
<a href="{{ mybb.settings.bburl }}/misc.php?action=whoposted&amp;tid={{ thread.tid }}" onclick="MyBB.whoPosted({{ thread.tid }}); return false;">
{{ thread.replies }}
</a>
</td>
<td align="center" class="{{ thread.bg_colour }}">
{{ thread.views }}
</td>
<td class="{{ thread.bg_colour }}" style="white-space: nowrap">
<span class="smalltext">{{ thread.last_post_date|raw }}<br />
<a href="{{ thread.lastpostlink }}">{{ lang.lastpost }}</a>: {{ thread.last_poster_link|raw }}</span>
</td>
<td class="{{ thread.bg_colour }}" align="center">
<input type="checkbox" class="checkbox" name="check[{{ thread.tid }}]" value="{{ thread.tid }}" />
</td>
</tr>
93 changes: 93 additions & 0 deletions inc/views/base/usercp/subscribed_threads.twig
@@ -0,0 +1,93 @@
{% extends 'layouts/master.twig' %}

{% block head %}
<title>{{ mybb.settings.bburl }} - {{ lang.subscriptions }}</title>
{% endblock head %}

{% block body %}
{{ multipage|raw }} {# TODO: improve multipage so that `|raw` isn't required - perhaps make it a Twig function? #}
<form action="usercp.php" method="post" name="input">
<input type="hidden" name="my_post_key" value="{{ mybb.post_code }}" />
<input type="hidden" name="action" value="do_subscriptions" />
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder">
<tr>
<td class="thead" colspan="7"><strong>{{ lang.subscriptions }} ({{ thread_count }})</strong></td>
</tr>
<tr>
<td width="66%" colspan="3" class="tcat">
<span class="smalltext">
<strong>{{ lang.thread }}</strong>
</span>
</td>
<td class="tcat" align="center" width="7%">
<span class="smalltext">
<strong>{{ lang.replies }}</strong>
</span>
</td>
<td class="tcat" align="center" width="7%">
<span class="smalltext">
<strong>{{ lang.views }}</strong>
</span>
</td>
<td class="tcat" align="center" width="200">
<span class="smalltext">
<strong>{{ lang.lastpost }}</strong>
</span>
</td>
<td class="tcat" align="center" width="1">
<input name="allbox" title="Select All" type="checkbox" class="checkbox checkall" value="1" />
</td>
</tr>

{% for thread in threads %}
{% include 'usercp/subscribed_thread_row.twig' %}
{% else %}
<tr>
<td class="trow1" colspan="7">{{ lang.no_thread_subscriptions }}</td>
</tr>
{% endfor %}

<tr>
<td class="tfoot" colspan="7">
<div class="float_right">
<label for="do"><strong>{{ lang.with_selected }}</strong></label>
<select name="do" id="do">
<option value="delete">{{ lang.delete_subscriptions }}</option>
<option value="no_notification">{{ lang.update_no_notification }}</option>
<option value="email_notification">{{ lang.update_email_notification }}</option>
<option value="pm_notification">{{ lang.update_pm_notification }}</option>
</select>
<input type="submit" class="button" value="{{ lang.go }}" />
</div>
<div>
<strong>
<a href="usercp2.php?action=removesubscriptions&amp;my_post_key={{ mybb.post_code }}">
{{ lang.remove_all_subscriptions }}
</a>
</strong>
</div>
</td>
</tr>
</table>
</form>
{{ multipage|raw }}
<br />
<div class="float_left">
<div class="float_left">
<dl class="thread_legend smalltext">
<dd><span class="thread_status newfolder" title="{{ lang.new_posts_thread }}">&nbsp;</span> {{ lang.new_posts_thread }}</dd>
<dd><span class="thread_status newhotfolder" title="{{ lang.new_hot_thread }}">&nbsp;</span> {{ lang.new_hot_thread }}</dd>
<dd><span class="thread_status hotfolder" title="{{ lang.hot_thread }}">&nbsp;</span> {{ lang.hot_thread }}</dd>
</dl>
</div>

<div class="float_left">
<dl class="thread_legend smalltext">
<dd><span class="thread_status folder" title="{{ lang.no_new_thread }}">&nbsp;</span> {{ lang.no_new_thread }}</dd>
<dd><span class="thread_status dot_folder" title="{{ lang.posts_by_you }}">&nbsp;</span> {{ lang.posts_by_you }}</dd>
<dd><span class="thread_status lockfolder" title="{{ lang.locked_thread }}">&nbsp;</span> {{ lang.locked_thread }}</dd>
</dl>
</div>
<br class="clear" />
</div>
{% endblock body %}

0 comments on commit 1a00bdc

Please sign in to comment.