diff options
author | lizyn <zhiylin@outlook.com> | 2020-02-24 10:04:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 10:04:13 +0800 |
commit | b19df31d78d881a43bcf6b3215e5fc3781e8e8aa (patch) | |
tree | d0d9861694a4b5e5fbfdbeb53c255ecd15fe9328 /src/Wallabag/CoreBundle/Form | |
parent | 4d0c632c70ea50d459c3c55ddda2e0f394dd51cb (diff) | |
parent | 04d918cae0227c06a41d27fb6533dddbf30dfe71 (diff) | |
download | wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.gz wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.zst wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.zip |
Merge pull request #1 from wallabag/master
Keep up with the master again
Diffstat (limited to 'src/Wallabag/CoreBundle/Form')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 11 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/EditEntryType.php | 2 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 9 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/FeedType.php (renamed from src/Wallabag/CoreBundle/Form/Type/RssType.php) | 10 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | 1 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/RenameTagType.php | 35 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/TaggingRuleImportType.php | 29 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | 9 |
8 files changed, 85 insertions, 21 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 1714ce74..6901fa08 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | 6 | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
7 | use Symfony\Component\Form\Extension\Core\Type\IntegerType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | 8 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
8 | use Symfony\Component\Form\FormBuilderInterface; | 9 | use Symfony\Component\Form\FormBuilderInterface; |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | 10 | use Symfony\Component\OptionsResolver\OptionsResolver; |
@@ -37,19 +38,13 @@ class ConfigType extends AbstractType | |||
37 | 'choices' => array_flip($this->themes), | 38 | 'choices' => array_flip($this->themes), |
38 | 'label' => 'config.form_settings.theme_label', | 39 | 'label' => 'config.form_settings.theme_label', |
39 | ]) | 40 | ]) |
40 | ->add('items_per_page', null, [ | 41 | ->add('items_per_page', IntegerType::class, [ |
41 | 'label' => 'config.form_settings.items_per_page_label', | 42 | 'label' => 'config.form_settings.items_per_page_label', |
42 | 'property_path' => 'itemsPerPage', | 43 | 'property_path' => 'itemsPerPage', |
43 | ]) | 44 | ]) |
44 | ->add('reading_speed', ChoiceType::class, [ | 45 | ->add('reading_speed', IntegerType::class, [ |
45 | 'label' => 'config.form_settings.reading_speed.label', | 46 | 'label' => 'config.form_settings.reading_speed.label', |
46 | 'property_path' => 'readingSpeed', | 47 | 'property_path' => 'readingSpeed', |
47 | 'choices' => [ | ||
48 | 'config.form_settings.reading_speed.100_word' => '0.5', | ||
49 | 'config.form_settings.reading_speed.200_word' => '1', | ||
50 | 'config.form_settings.reading_speed.300_word' => '1.5', | ||
51 | 'config.form_settings.reading_speed.400_word' => '2', | ||
52 | ], | ||
53 | ]) | 48 | ]) |
54 | ->add('action_mark_as_read', ChoiceType::class, [ | 49 | ->add('action_mark_as_read', ChoiceType::class, [ |
55 | 'label' => 'config.form_settings.action_mark_as_read.label', | 50 | 'label' => 'config.form_settings.action_mark_as_read.label', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php index 08355928..2fc4c204 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php | |||
@@ -22,11 +22,13 @@ class EditEntryType extends AbstractType | |||
22 | 'disabled' => true, | 22 | 'disabled' => true, |
23 | 'required' => false, | 23 | 'required' => false, |
24 | 'label' => 'entry.edit.url_label', | 24 | 'label' => 'entry.edit.url_label', |
25 | 'default_protocol' => null, | ||
25 | ]) | 26 | ]) |
26 | ->add('origin_url', UrlType::class, [ | 27 | ->add('origin_url', UrlType::class, [ |
27 | 'required' => false, | 28 | 'required' => false, |
28 | 'property_path' => 'originUrl', | 29 | 'property_path' => 'originUrl', |
29 | 'label' => 'entry.edit.origin_url_label', | 30 | 'label' => 'entry.edit.origin_url_label', |
31 | 'default_protocol' => null, | ||
30 | ]) | 32 | ]) |
31 | ->add('save', SubmitType::class, [ | 33 | ->add('save', SubmitType::class, [ |
32 | 'label' => 'entry.edit.save_label', | 34 | 'label' => 'entry.edit.save_label', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 702c7f7a..17070c59 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -23,9 +23,6 @@ class EntryFilterType extends AbstractType | |||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Repository & user are used to get a list of language entries for this user. | 25 | * Repository & user are used to get a list of language entries for this user. |
26 | * | ||
27 | * @param EntityRepository $entryRepository | ||
28 | * @param TokenStorageInterface $tokenStorage | ||
29 | */ | 26 | */ |
30 | public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage) | 27 | public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage) |
31 | { | 28 | { |
@@ -54,8 +51,8 @@ class EntryFilterType extends AbstractType | |||
54 | $lower = $values['value']['left_number'][0]; | 51 | $lower = $values['value']['left_number'][0]; |
55 | $upper = $values['value']['right_number'][0]; | 52 | $upper = $values['value']['right_number'][0]; |
56 | 53 | ||
57 | $min = (int) ($lower * $this->user->getConfig()->getReadingSpeed()); | 54 | $min = (int) ($lower * $this->user->getConfig()->getReadingSpeed() / 200); |
58 | $max = (int) ($upper * $this->user->getConfig()->getReadingSpeed()); | 55 | $max = (int) ($upper * $this->user->getConfig()->getReadingSpeed() / 200); |
59 | 56 | ||
60 | if (null === $lower && null === $upper) { | 57 | if (null === $lower && null === $upper) { |
61 | // no value? no filter | 58 | // no value? no filter |
@@ -108,7 +105,7 @@ class EntryFilterType extends AbstractType | |||
108 | ->add('httpStatus', TextFilterType::class, [ | 105 | ->add('httpStatus', TextFilterType::class, [ |
109 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 106 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
110 | $value = $values['value']; | 107 | $value = $values['value']; |
111 | if (false === array_key_exists($value, Response::$statusTexts)) { | 108 | if (false === \array_key_exists($value, Response::$statusTexts)) { |
112 | return; | 109 | return; |
113 | } | 110 | } |
114 | 111 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/FeedType.php index 49b31c1e..9b34daf4 100644 --- a/src/Wallabag/CoreBundle/Form/Type/RssType.php +++ b/src/Wallabag/CoreBundle/Form/Type/FeedType.php | |||
@@ -7,14 +7,14 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
7 | use Symfony\Component\Form\FormBuilderInterface; | 7 | use Symfony\Component\Form\FormBuilderInterface; |
8 | use Symfony\Component\OptionsResolver\OptionsResolver; | 8 | use Symfony\Component\OptionsResolver\OptionsResolver; |
9 | 9 | ||
10 | class RssType extends AbstractType | 10 | class FeedType extends AbstractType |
11 | { | 11 | { |
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 13 | { |
14 | $builder | 14 | $builder |
15 | ->add('rss_limit', null, [ | 15 | ->add('feed_limit', null, [ |
16 | 'label' => 'config.form_rss.rss_limit', | 16 | 'label' => 'config.form_feed.feed_limit', |
17 | 'property_path' => 'rssLimit', | 17 | 'property_path' => 'feedLimit', |
18 | ]) | 18 | ]) |
19 | ->add('save', SubmitType::class, [ | 19 | ->add('save', SubmitType::class, [ |
20 | 'label' => 'config.form.save', | 20 | 'label' => 'config.form.save', |
@@ -31,6 +31,6 @@ class RssType extends AbstractType | |||
31 | 31 | ||
32 | public function getBlockPrefix() | 32 | public function getBlockPrefix() |
33 | { | 33 | { |
34 | return 'rss_config'; | 34 | return 'feed_config'; |
35 | } | 35 | } |
36 | } | 36 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php index 7d74fee3..7af1e589 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | |||
@@ -15,6 +15,7 @@ class NewEntryType extends AbstractType | |||
15 | ->add('url', UrlType::class, [ | 15 | ->add('url', UrlType::class, [ |
16 | 'required' => true, | 16 | 'required' => true, |
17 | 'label' => 'entry.new.form_new.url_label', | 17 | 'label' => 'entry.new.form_new.url_label', |
18 | 'default_protocol' => null, | ||
18 | ]) | 19 | ]) |
19 | ; | 20 | ; |
20 | } | 21 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/RenameTagType.php b/src/Wallabag/CoreBundle/Form/Type/RenameTagType.php new file mode 100644 index 00000000..e6270048 --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/RenameTagType.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
7 | use Symfony\Component\Form\FormBuilderInterface; | ||
8 | use Symfony\Component\OptionsResolver\OptionsResolver; | ||
9 | |||
10 | class RenameTagType extends AbstractType | ||
11 | { | ||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
13 | { | ||
14 | $builder | ||
15 | ->add('label', TextType::class, [ | ||
16 | 'required' => true, | ||
17 | 'attr' => [ | ||
18 | 'placeholder' => 'tag.rename.placeholder', | ||
19 | ], | ||
20 | ]) | ||
21 | ; | ||
22 | } | ||
23 | |||
24 | public function configureOptions(OptionsResolver $resolver) | ||
25 | { | ||
26 | $resolver->setDefaults([ | ||
27 | 'data_class' => 'Wallabag\CoreBundle\Entity\Tag', | ||
28 | ]); | ||
29 | } | ||
30 | |||
31 | public function getBlockPrefix() | ||
32 | { | ||
33 | return 'tag'; | ||
34 | } | ||
35 | } | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleImportType.php b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleImportType.php new file mode 100644 index 00000000..c6a8c0b8 --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleImportType.php | |||
@@ -0,0 +1,29 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\Extension\Core\Type\FileType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
8 | use Symfony\Component\Form\FormBuilderInterface; | ||
9 | |||
10 | class TaggingRuleImportType extends AbstractType | ||
11 | { | ||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
13 | { | ||
14 | $builder | ||
15 | ->add('file', FileType::class, [ | ||
16 | 'label' => 'config.form_rules.file_label', | ||
17 | 'required' => true, | ||
18 | ]) | ||
19 | ->add('import', SubmitType::class, [ | ||
20 | 'label' => 'config.form_rules.import_submit', | ||
21 | ]) | ||
22 | ; | ||
23 | } | ||
24 | |||
25 | public function getBlockPrefix() | ||
26 | { | ||
27 | return 'upload_tagging_rule_file'; | ||
28 | } | ||
29 | } | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index 07c99949..6e4c9154 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -21,9 +21,14 @@ class UserInformationType extends AbstractType | |||
21 | ->add('email', EmailType::class, [ | 21 | ->add('email', EmailType::class, [ |
22 | 'label' => 'config.form_user.email_label', | 22 | 'label' => 'config.form_user.email_label', |
23 | ]) | 23 | ]) |
24 | ->add('twoFactorAuthentication', CheckboxType::class, [ | 24 | ->add('emailTwoFactor', CheckboxType::class, [ |
25 | 'required' => false, | 25 | 'required' => false, |
26 | 'label' => 'config.form_user.twoFactorAuthentication_label', | 26 | 'label' => 'config.form_user.emailTwoFactor_label', |
27 | ]) | ||
28 | ->add('googleTwoFactor', CheckboxType::class, [ | ||
29 | 'required' => false, | ||
30 | 'label' => 'config.form_user.googleTwoFactor_label', | ||
31 | 'mapped' => false, | ||
27 | ]) | 32 | ]) |
28 | ->add('save', SubmitType::class, [ | 33 | ->add('save', SubmitType::class, [ |
29 | 'label' => 'config.form.save', | 34 | 'label' => 'config.form.save', |