Browse Source

update torrent page

main
ghost 1 year ago
parent
commit
63dfeb9d4c
  1. 4
      public/asset/default/css/common.css
  2. 8
      src/Controller/TorrentController.php
  3. 2
      src/Controller/UserController.php
  4. 59
      templates/default/torrent/info.html.twig
  5. 43
      templates/default/torrent/submit.html.twig
  6. 9
      templates/default/user/settings.html.twig

4
public/asset/default/css/common.css

@ -59,6 +59,10 @@ textarea { @@ -59,6 +59,10 @@ textarea {
opacity: .96;
}
input[type="file"] {
padding: 4px 8px;
}
/*
main input,
main button,

8
src/Controller/TorrentController.php

@ -96,6 +96,7 @@ class TorrentController extends AbstractController @@ -96,6 +96,7 @@ class TorrentController extends AbstractController
'torrent' =>
[
'id' => $torrent->getId(),
'md5file' => $torrent->getMd5File(),
'added' => $torrent->getAdded(),
/*
'user' =>
@ -231,17 +232,11 @@ class TorrentController extends AbstractController @@ -231,17 +232,11 @@ class TorrentController extends AbstractController
'attribute' =>
[
'value' => $request->get('locales') ? $request->get('locales') : [$request->get('_locale')],
'placeholder' => $translator->trans('Content language')
]
],
'torrent' =>
[
'error' => [],
'attribute' =>
[
'value' => null, // is local file, there is no values passed
'placeholder' => $translator->trans('Select torrent file')
]
],
'sensitive' =>
[
@ -249,7 +244,6 @@ class TorrentController extends AbstractController @@ -249,7 +244,6 @@ class TorrentController extends AbstractController
'attribute' =>
[
'value' => $request->get('sensitive'),
'placeholder' => $translator->trans('Apply sensitive filters to publication'),
]
]
];

2
src/Controller/UserController.php

@ -67,7 +67,7 @@ class UserController extends AbstractController @@ -67,7 +67,7 @@ class UserController extends AbstractController
return $this->render(
'default/user/dashboard.html.twig',
[
'activities' => $activityService->findLastActivities(
'activities' => $activityService->findLastActivities( // @TODO locale/sensitive filters
$user->getEvents(),
$this->getParameter('app.pagination'),
($page - 1) * $this->getParameter('app.pagination')

59
templates/default/torrent/info.html.twig

@ -20,12 +20,13 @@ @@ -20,12 +20,13 @@
{% endmacro %}
{% from _self import recursive_file_tree %}
{% extends 'default/layout.html.twig' %}
{% block title %}{{ 'Torrent' | trans }} #{{ torrent.id }}{% if pagination.page > 1 %} - {{ 'Page' | trans }} {{ pagination.page }}{% endif %} - {{ name }}{% endblock %}
{% block title %}{{ file.name }} - {{ 'Torrent' | trans }} #{{ torrent.id }}{% if pagination.page > 1 %} - {{ 'Page' | trans }} {{ pagination.page }}{% endif %} - {{ name }}{% endblock %}
{% block main_content %}
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
<div class="padding-b-16-px">
<h1 class="display-block text-center margin-b-16-px">
{{ 'Torrent'|trans }} #{{ torrent.id }}
{{ file.name }}
{#{{ 'Torrent' | trans }} #{{ torrent.id }}#}
</h1>
<div class="text-center">
<a class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_download_magnet', {torrentId : torrent.id}) }}" title="{{ 'Open magnet link' | trans }}">
@ -86,64 +87,78 @@ @@ -86,64 +87,78 @@
<div class="padding-y-16-px">
<table class="width-100">
<tbody>
{% if file.name %}
<tr>
<td>
{{ 'Filename'|trans }}
{{ 'ID'|trans }}
</td>
<td>
{{ file.name }}
#{{ torrent.id }}
</td>
</tr>
{% endif %}
{% if file.created %}
<tr>
<td>
{{ 'Created'|trans }}
{{ 'MD5'|trans }}
</td>
<td>
{{ file.created | format_date }}
{{ torrent.md5file }}
</td>
</tr>
{% if file.hash.v1 %}
<tr>
<td>
{{ 'Info hash v1'|trans }}
</td>
<td>
{{ file.hash.v1 }}
</td>
</tr>
{% endif %}
{% if file.size %}
{% if file.hash.v2 %}
<tr>
<td>
{{ 'Size'|trans }}
{{ 'Info hash v2'|trans }}
</td>
<td>
{{ file.size | format_bytes }}
{{ file.hash.v2 }}
</td>
</tr>
{% endif %}
{% if file.pieces %}
<tr>
<td>
{{ 'Pieces'|trans }}
{{ 'Filename'|trans }}
</td>
<td>
{{ file.pieces | format_number }}
{{ file.name }}
</td>
</tr>
{% if file.created %}
<tr>
<td>
{{ 'Created'|trans }}
</td>
<td>
{{ file.created | format_date }}
</td>
</tr>
{% endif %}
{% if file.hash.v1 %}
{% if file.size %}
<tr>
<td>
{{ 'Info hash v1'|trans }}
{{ 'Size'|trans }}
</td>
<td>
{{ file.hash.v1 }}
{{ file.size | format_bytes }}
</td>
</tr>
{% endif %}
{% if file.hash.v2 %}
{% if file.pieces %}
<tr>
<td>
{{ 'Info hash v2'|trans }}
{{ 'Pieces'|trans }}
</td>
<td>
{{ file.hash.v2 }}
{{ file.pieces | format_number }}
</td>
</tr>
{% endif %}

43
templates/default/torrent/submit.html.twig

@ -1,32 +1,25 @@ @@ -1,32 +1,25 @@
{% extends 'default/layout.html.twig' %}
{% block title %}{{'Submit torrent'|trans }} - {{ name }}{% endblock %}
{% block title %}{{'Submit torrent' | trans }} - {{ name }}{% endblock %}
{% block main_content %}
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
<div class="margin-b-24-px padding-b-16-px border-bottom-default">
<h1>{{'Submit torrent'|trans }}</h1>
<div class="padding-b-16-px border-bottom-default">
<h1>{{'Submit torrent' | trans }}</h1>
</div>
<form name="submit" method="post" enctype="multipart/form-data" action="{{ path('torrent_submit') }}">
<div class="margin-y-16-px">
<label for="torrent">
{{'Torrent file'|trans }}
</label>
<sub class="opacity-0 parent-hover-opacity-09" title="{{ form.torrent.attribute.placeholder }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</svg>
</sub>
{% for error in form.torrent.error %}
<div class="text-color-red margin-y-8-px">
{{ error }}
</div>
{% endfor %}
<input class="width-100 margin-t-8-px" type="file" name="torrent" id="torrent" value="" accept=".torrent" />
<input class="width-100" type="file" name="torrent" value="" accept=".torrent" />
</div>
<div class="margin-b-16-px border-bottom-default"></div>
<div class="margin-y-16-px">
<label for="locales">
{{'Content language'|trans }}
{{'Content language' | trans }}
</label>
<sub class="opacity-0 parent-hover-opacity-09" title="{{ form.locales.attribute.placeholder }}">
<sub class="opacity-0 parent-hover-opacity-09" title="{{ 'This torrent contains selected languages' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</svg>
@ -37,32 +30,30 @@ @@ -37,32 +30,30 @@
</div>
{% endfor %}
<div class="padding-t-8-px">
<select class="width-100 padding-x-0" name="locales[]" multiple="multiple">
{% for locale in locales %}
<div class="padding-t-8-px">
{% if locale in form.locales.attribute.value %}
<option class="padding-x-8-px padding-y-8-px" value="{{ locale }}" selected="selected">
{{ locale|locale_name(locale)|u.title }}
</option>
<input type="checkbox" name="locales[]" id="{{ locale }}" value="{{ locale }}" checked="checked" />
{% else %}
<option class="padding-x-8-px padding-y-8-px" value="{{ locale }}">
{{ locale|locale_name(locale)|u.title }}
</option>
<input type="checkbox" name="locales[]" id="{{ locale }}" value="{{ locale }}" />
{% endif %}
<label class="margin-l-4-px" for="{{ locale }}">
{{ locale | locale_name(locale) | u.title }}
</label>
</div>
{% endfor %}
{#
<option class="padding-x-8-px padding-y-8-px" value="other">
{{'Other...'|trans }}
</option>
#}
</select>
</div>
</div>
<div class="margin-y-16-px">
<div class="margin-b-16-px border-bottom-default"></div>
<div>
<input type="checkbox" name="sensitive" id="sensitive" value="true" {% if form.sensitive.attribute.value %}checked="checked"{% endif %} />
<label for="sensitive">
{{'Sensitive'|trans }}
</label>
<sub class="opacity-0 parent-hover-opacity-09" title="{{ form.sensitive.attribute.placeholder }}">
<sub class="opacity-0 parent-hover-opacity-09" title="{{ 'Mark torrent content as sensitive' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</svg>

9
templates/default/user/settings.html.twig

@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">
{{ 'Search' | trans }}
{{ 'Filters' | trans }}
</td>
</tr>
<tr>
@ -92,12 +92,15 @@ @@ -92,12 +92,15 @@
{{ 'Events' | trans }}
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
{% for group, event in events %}
<tr>
<td class="padding-t-16-px">
<td class="padding-t-8-px">
{{ group }}
</td>
<td class="padding-t-16-px">
<td class="padding-t-8-px">
{% for key, value in event %}
<span class="margin-r-8-px">
{% if value in user.events %}

Loading…
Cancel
Save