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 {
opacity: .96; opacity: .96;
} }
input[type="file"] {
padding: 4px 8px;
}
/* /*
main input, main input,
main button, main button,

8
src/Controller/TorrentController.php

@ -96,6 +96,7 @@ class TorrentController extends AbstractController
'torrent' => 'torrent' =>
[ [
'id' => $torrent->getId(), 'id' => $torrent->getId(),
'md5file' => $torrent->getMd5File(),
'added' => $torrent->getAdded(), 'added' => $torrent->getAdded(),
/* /*
'user' => 'user' =>
@ -231,17 +232,11 @@ class TorrentController extends AbstractController
'attribute' => 'attribute' =>
[ [
'value' => $request->get('locales') ? $request->get('locales') : [$request->get('_locale')], 'value' => $request->get('locales') ? $request->get('locales') : [$request->get('_locale')],
'placeholder' => $translator->trans('Content language')
] ]
], ],
'torrent' => 'torrent' =>
[ [
'error' => [], 'error' => [],
'attribute' =>
[
'value' => null, // is local file, there is no values passed
'placeholder' => $translator->trans('Select torrent file')
]
], ],
'sensitive' => 'sensitive' =>
[ [
@ -249,7 +244,6 @@ class TorrentController extends AbstractController
'attribute' => 'attribute' =>
[ [
'value' => $request->get('sensitive'), '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
return $this->render( return $this->render(
'default/user/dashboard.html.twig', 'default/user/dashboard.html.twig',
[ [
'activities' => $activityService->findLastActivities( 'activities' => $activityService->findLastActivities( // @TODO locale/sensitive filters
$user->getEvents(), $user->getEvents(),
$this->getParameter('app.pagination'), $this->getParameter('app.pagination'),
($page - 1) * $this->getParameter('app.pagination') ($page - 1) * $this->getParameter('app.pagination')

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

@ -20,12 +20,13 @@
{% endmacro %} {% endmacro %}
{% from _self import recursive_file_tree %} {% from _self import recursive_file_tree %}
{% extends 'default/layout.html.twig' %} {% 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 %} {% block main_content %}
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night"> <div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
<div class="padding-b-16-px"> <div class="padding-b-16-px">
<h1 class="display-block text-center margin-b-16-px"> <h1 class="display-block text-center margin-b-16-px">
{{ 'Torrent'|trans }} #{{ torrent.id }} {{ file.name }}
{#{{ 'Torrent' | trans }} #{{ torrent.id }}#}
</h1> </h1>
<div class="text-center"> <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 }}"> <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 @@
<div class="padding-y-16-px"> <div class="padding-y-16-px">
<table class="width-100"> <table class="width-100">
<tbody> <tbody>
{% if file.name %}
<tr> <tr>
<td> <td>
{{ 'Filename'|trans }} {{ 'ID'|trans }}
</td> </td>
<td> <td>
{{ file.name }} #{{ torrent.id }}
</td> </td>
</tr> </tr>
{% endif %}
{% if file.created %}
<tr> <tr>
<td> <td>
{{ 'Created'|trans }} {{ 'MD5'|trans }}
</td> </td>
<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> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if file.hash.v2 %}
{% if file.size %}
<tr> <tr>
<td> <td>
{{ 'Size'|trans }} {{ 'Info hash v2'|trans }}
</td> </td>
<td> <td>
{{ file.size | format_bytes }} {{ file.hash.v2 }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if file.pieces %}
<tr> <tr>
<td> <td>
{{ 'Pieces'|trans }} {{ 'Filename'|trans }}
</td> </td>
<td> <td>
{{ file.pieces | format_number }} {{ file.name }}
</td>
</tr>
{% if file.created %}
<tr>
<td>
{{ 'Created'|trans }}
</td>
<td>
{{ file.created | format_date }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if file.hash.v1 %}
{% if file.size %}
<tr> <tr>
<td> <td>
{{ 'Info hash v1'|trans }} {{ 'Size'|trans }}
</td> </td>
<td> <td>
{{ file.hash.v1 }} {{ file.size | format_bytes }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if file.hash.v2 %} {% if file.pieces %}
<tr> <tr>
<td> <td>
{{ 'Info hash v2'|trans }} {{ 'Pieces'|trans }}
</td> </td>
<td> <td>
{{ file.hash.v2 }} {{ file.pieces | format_number }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}

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

@ -1,32 +1,25 @@
{% extends 'default/layout.html.twig' %} {% extends 'default/layout.html.twig' %}
{% block title %}{{'Submit torrent'|trans }} - {{ name }}{% endblock %} {% block title %}{{'Submit torrent' | trans }} - {{ name }}{% endblock %}
{% block main_content %} {% block main_content %}
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night"> <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"> <div class="padding-b-16-px border-bottom-default">
<h1>{{'Submit torrent'|trans }}</h1> <h1>{{'Submit torrent' | trans }}</h1>
</div> </div>
<form name="submit" method="post" enctype="multipart/form-data" action="{{ path('torrent_submit') }}"> <form name="submit" method="post" enctype="multipart/form-data" action="{{ path('torrent_submit') }}">
<div class="margin-y-16-px"> <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 %} {% for error in form.torrent.error %}
<div class="text-color-red margin-y-8-px"> <div class="text-color-red margin-y-8-px">
{{ error }} {{ error }}
</div> </div>
{% endfor %} {% 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>
<div class="margin-b-16-px border-bottom-default"></div>
<div class="margin-y-16-px"> <div class="margin-y-16-px">
<label for="locales"> <label for="locales">
{{'Content language'|trans }} {{'Content language' | trans }}
</label> </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"> <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"/> <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> </svg>
@ -37,32 +30,30 @@
</div> </div>
{% endfor %} {% endfor %}
<div class="padding-t-8-px"> <div class="padding-t-8-px">
<select class="width-100 padding-x-0" name="locales[]" multiple="multiple">
{% for locale in locales %} {% for locale in locales %}
<div class="padding-t-8-px">
{% if locale in form.locales.attribute.value %} {% if locale in form.locales.attribute.value %}
<option class="padding-x-8-px padding-y-8-px" value="{{ locale }}" selected="selected"> <input type="checkbox" name="locales[]" id="{{ locale }}" value="{{ locale }}" checked="checked" />
{{ locale|locale_name(locale)|u.title }}
</option>
{% else %} {% else %}
<option class="padding-x-8-px padding-y-8-px" value="{{ locale }}"> <input type="checkbox" name="locales[]" id="{{ locale }}" value="{{ locale }}" />
{{ locale|locale_name(locale)|u.title }}
</option>
{% endif %} {% endif %}
<label class="margin-l-4-px" for="{{ locale }}">
{{ locale | locale_name(locale) | u.title }}
</label>
</div>
{% endfor %} {% endfor %}
{# {#
<option class="padding-x-8-px padding-y-8-px" value="other">
{{'Other...'|trans }} {{'Other...'|trans }}
</option>
#} #}
</select>
</div> </div>
</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 %} /> <input type="checkbox" name="sensitive" id="sensitive" value="true" {% if form.sensitive.attribute.value %}checked="checked"{% endif %} />
<label for="sensitive"> <label for="sensitive">
{{'Sensitive'|trans }} {{'Sensitive'|trans }}
</label> </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"> <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"/> <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> </svg>

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

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

Loading…
Cancel
Save