diff options
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | Capfile | 15 | ||||
-rw-r--r-- | Gemfile | 6 | ||||
-rw-r--r-- | Gemfile.lock | 37 | ||||
-rw-r--r-- | app/config/capistrano/deploy.rb | 19 | ||||
-rw-r--r-- | app/config/capistrano/deploy/production.rb | 0 | ||||
-rw-r--r-- | app/config/capistrano/deploy/staging.rb | 2 | ||||
-rw-r--r-- | composer.lock | 47 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ExportController.php | 12 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | 19 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig | 19 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php | 63 |
12 files changed, 129 insertions, 118 deletions
diff --git a/.travis.yml b/.travis.yml index 229e3e0e..c09bcd22 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -16,12 +16,15 @@ cache: | |||
16 | - $HOME/.npm | 16 | - $HOME/.npm |
17 | - $HOME/.yarn-cache | 17 | - $HOME/.yarn-cache |
18 | 18 | ||
19 | if: | | ||
20 | type = pull_request OR \ | ||
21 | branch = master | ||
22 | |||
19 | php: | 23 | php: |
20 | - 7.1 | 24 | - 7.1 |
21 | - 7.2 | 25 | - 7.2 |
22 | - 7.3 | 26 | - 7.3 |
23 | - 7.4 | 27 | - 7.4 |
24 | - nightly | ||
25 | 28 | ||
26 | node_js: | 29 | node_js: |
27 | - "5" | 30 | - "5" |
@@ -34,11 +37,10 @@ env: | |||
34 | matrix: | 37 | matrix: |
35 | fast_finish: true | 38 | fast_finish: true |
36 | include: | 39 | include: |
37 | - php: 7.2 | 40 | - php: 7.3 |
38 | env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite | 41 | env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite |
39 | allow_failures: | 42 | allow_failures: |
40 | - php: 7.4 | 43 | - php: 7.4 |
41 | - php: nightly | ||
42 | 44 | ||
43 | # exclude v1 branches | 45 | # exclude v1 branches |
44 | branches: | 46 | branches: |
diff --git a/Capfile b/Capfile deleted file mode 100644 index cc807112..00000000 --- a/Capfile +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | set :deploy_config_path, 'app/config/capistrano/deploy.rb' | ||
2 | set :stage_config_path, 'app/config/capistrano/deploy' | ||
3 | |||
4 | # Load DSL and set up stages | ||
5 | require 'capistrano/setup' | ||
6 | |||
7 | # Include default deployment tasks | ||
8 | require 'capistrano/deploy' | ||
9 | |||
10 | require 'capistrano/composer' | ||
11 | require 'capistrano/file-permissions' | ||
12 | require 'capistrano/symfony' | ||
13 | |||
14 | # Load custom tasks from `lib/capistrano/tasks` if you have any defined | ||
15 | Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } | ||
diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 233be899..00000000 --- a/Gemfile +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | source "https://rubygems.org" | ||
2 | |||
3 | gem 'capistrano', '~> 3.4' | ||
4 | gem 'capistrano-composer' | ||
5 | gem 'capistrano-symfony', '~> 1.0.0.rc1' | ||
6 | gem 'capistrano-file-permissions' | ||
diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 7b13b399..00000000 --- a/Gemfile.lock +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | GEM | ||
2 | remote: https://rubygems.org/ | ||
3 | specs: | ||
4 | capistrano (3.4.0) | ||
5 | i18n | ||
6 | rake (>= 10.0.0) | ||
7 | sshkit (~> 1.3) | ||
8 | capistrano-composer (0.0.6) | ||
9 | capistrano (>= 3.0.0.pre) | ||
10 | capistrano-file-permissions (1.0.0) | ||
11 | capistrano (~> 3.0) | ||
12 | capistrano-symfony (1.0.0.rc1) | ||
13 | capistrano (~> 3.1) | ||
14 | capistrano-composer (~> 0.0.3) | ||
15 | capistrano-file-permissions (~> 1.0) | ||
16 | colorize (0.7.7) | ||
17 | i18n (0.7.0) | ||
18 | net-scp (1.2.1) | ||
19 | net-ssh (>= 2.6.5) | ||
20 | net-ssh (2.9.2) | ||
21 | rake (10.4.2) | ||
22 | sshkit (1.7.1) | ||
23 | colorize (>= 0.7.0) | ||
24 | net-scp (>= 1.1.2) | ||
25 | net-ssh (>= 2.8.0) | ||
26 | |||
27 | PLATFORMS | ||
28 | ruby | ||
29 | |||
30 | DEPENDENCIES | ||
31 | capistrano (~> 3.4) | ||
32 | capistrano-composer | ||
33 | capistrano-file-permissions | ||
34 | capistrano-symfony (~> 1.0.0.rc1) | ||
35 | |||
36 | BUNDLED WITH | ||
37 | 1.13.5 | ||
diff --git a/app/config/capistrano/deploy.rb b/app/config/capistrano/deploy.rb deleted file mode 100644 index fee04620..00000000 --- a/app/config/capistrano/deploy.rb +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # config valid only for current version of Capistrano | ||
2 | |||
3 | set :application, 'wallabag' | ||
4 | set :repo_url, 'git@github.com:wallabag/wallabag.git' | ||
5 | |||
6 | set :ssh_user, 'framasoft_bag' | ||
7 | server '78.46.248.87', user: fetch(:ssh_user), roles: %w{web app db} | ||
8 | |||
9 | set :format, :pretty | ||
10 | set :log_level, :info | ||
11 | # set :log_level, :debug | ||
12 | |||
13 | set :composer_install_flags, '--no-dev --prefer-dist --no-interaction --optimize-autoloader' | ||
14 | |||
15 | set :linked_files, %w{app/config/parameters.yml} | ||
16 | set :linked_dirs, [fetch(:log_path), "var/sessions", "web/uploads", "data"] | ||
17 | set :keep_releases, 3 | ||
18 | |||
19 | after 'deploy:updated', 'symfony:cache:clear' | ||
diff --git a/app/config/capistrano/deploy/production.rb b/app/config/capistrano/deploy/production.rb deleted file mode 100644 index e69de29b..00000000 --- a/app/config/capistrano/deploy/production.rb +++ /dev/null | |||
diff --git a/app/config/capistrano/deploy/staging.rb b/app/config/capistrano/deploy/staging.rb deleted file mode 100644 index ad899a85..00000000 --- a/app/config/capistrano/deploy/staging.rb +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | set :branch, 'master' | ||
2 | set :deploy_to, '/var/www/v2.wallabag.org/web/' | ||
diff --git a/composer.lock b/composer.lock index 7d0ea54a..e0231ac8 100644 --- a/composer.lock +++ b/composer.lock | |||
@@ -1918,24 +1918,24 @@ | |||
1918 | }, | 1918 | }, |
1919 | { | 1919 | { |
1920 | "name": "friendsofsymfony/oauth2-php", | 1920 | "name": "friendsofsymfony/oauth2-php", |
1921 | "version": "1.2.3", | 1921 | "version": "1.3.0", |
1922 | "source": { | 1922 | "source": { |
1923 | "type": "git", | 1923 | "type": "git", |
1924 | "url": "https://github.com/FriendsOfSymfony/oauth2-php.git", | 1924 | "url": "https://github.com/FriendsOfSymfony/oauth2-php.git", |
1925 | "reference": "a41fef63f81ef2ef632350a6c7dc66d15baa9240" | 1925 | "reference": "606b8ea1c3c927c272ac1409116332ad5a2ed94c" |
1926 | }, | 1926 | }, |
1927 | "dist": { | 1927 | "dist": { |
1928 | "type": "zip", | 1928 | "type": "zip", |
1929 | "url": "https://api.github.com/repos/FriendsOfSymfony/oauth2-php/zipball/a41fef63f81ef2ef632350a6c7dc66d15baa9240", | 1929 | "url": "https://api.github.com/repos/FriendsOfSymfony/oauth2-php/zipball/606b8ea1c3c927c272ac1409116332ad5a2ed94c", |
1930 | "reference": "a41fef63f81ef2ef632350a6c7dc66d15baa9240", | 1930 | "reference": "606b8ea1c3c927c272ac1409116332ad5a2ed94c", |
1931 | "shasum": "" | 1931 | "shasum": "" |
1932 | }, | 1932 | }, |
1933 | "require": { | 1933 | "require": { |
1934 | "php": "^5.5.9|>=7.0.8", | 1934 | "php": "^5.5.9|^7.0.8|^7.1.3|^7.2.5", |
1935 | "symfony/http-foundation": "~3.0|~4.0" | 1935 | "symfony/http-foundation": "~3.0|~4.0|~5.0" |
1936 | }, | 1936 | }, |
1937 | "require-dev": { | 1937 | "require-dev": { |
1938 | "phpunit/phpunit": "~4.0" | 1938 | "phpunit/phpunit": "^4.8 || ^5.0" |
1939 | }, | 1939 | }, |
1940 | "type": "library", | 1940 | "type": "library", |
1941 | "extra": { | 1941 | "extra": { |
@@ -1946,7 +1946,10 @@ | |||
1946 | "autoload": { | 1946 | "autoload": { |
1947 | "psr-4": { | 1947 | "psr-4": { |
1948 | "OAuth2\\": "lib/" | 1948 | "OAuth2\\": "lib/" |
1949 | } | 1949 | }, |
1950 | "exclude-from-classmap": [ | ||
1951 | "/tests/" | ||
1952 | ] | ||
1950 | }, | 1953 | }, |
1951 | "notification-url": "https://packagist.org/downloads/", | 1954 | "notification-url": "https://packagist.org/downloads/", |
1952 | "license": [ | 1955 | "license": [ |
@@ -1968,20 +1971,20 @@ | |||
1968 | "oauth", | 1971 | "oauth", |
1969 | "oauth2" | 1972 | "oauth2" |
1970 | ], | 1973 | ], |
1971 | "time": "2018-01-30T19:58:25+00:00" | 1974 | "time": "2020-03-03T22:14:46+00:00" |
1972 | }, | 1975 | }, |
1973 | { | 1976 | { |
1974 | "name": "friendsofsymfony/rest-bundle", | 1977 | "name": "friendsofsymfony/rest-bundle", |
1975 | "version": "2.7.1", | 1978 | "version": "2.7.2", |
1976 | "source": { | 1979 | "source": { |
1977 | "type": "git", | 1980 | "type": "git", |
1978 | "url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git", | 1981 | "url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git", |
1979 | "reference": "affb4fe1eb079b9b659656bd548b7089c0a04fb2" | 1982 | "reference": "22fbbc35a2964564bfde765007655174262315c9" |
1980 | }, | 1983 | }, |
1981 | "dist": { | 1984 | "dist": { |
1982 | "type": "zip", | 1985 | "type": "zip", |
1983 | "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/affb4fe1eb079b9b659656bd548b7089c0a04fb2", | 1986 | "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/22fbbc35a2964564bfde765007655174262315c9", |
1984 | "reference": "affb4fe1eb079b9b659656bd548b7089c0a04fb2", | 1987 | "reference": "22fbbc35a2964564bfde765007655174262315c9", |
1985 | "shasum": "" | 1988 | "shasum": "" |
1986 | }, | 1989 | }, |
1987 | "require": { | 1990 | "require": { |
@@ -2071,7 +2074,7 @@ | |||
2071 | "keywords": [ | 2074 | "keywords": [ |
2072 | "rest" | 2075 | "rest" |
2073 | ], | 2076 | ], |
2074 | "time": "2020-02-24T09:04:31+00:00" | 2077 | "time": "2020-03-04T21:18:53+00:00" |
2075 | }, | 2078 | }, |
2076 | { | 2079 | { |
2077 | "name": "friendsofsymfony/user-bundle", | 2080 | "name": "friendsofsymfony/user-bundle", |
@@ -3692,26 +3695,26 @@ | |||
3692 | }, | 3695 | }, |
3693 | { | 3696 | { |
3694 | "name": "incenteev/composer-parameter-handler", | 3697 | "name": "incenteev/composer-parameter-handler", |
3695 | "version": "v2.1.3", | 3698 | "version": "v2.1.4", |
3696 | "source": { | 3699 | "source": { |
3697 | "type": "git", | 3700 | "type": "git", |
3698 | "url": "https://github.com/Incenteev/ParameterHandler.git", | 3701 | "url": "https://github.com/Incenteev/ParameterHandler.git", |
3699 | "reference": "933c45a34814f27f2345c11c37d46b3ca7303550" | 3702 | "reference": "084befb11ec21faeadcddefb88b66132775ff59b" |
3700 | }, | 3703 | }, |
3701 | "dist": { | 3704 | "dist": { |
3702 | "type": "zip", | 3705 | "type": "zip", |
3703 | "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/933c45a34814f27f2345c11c37d46b3ca7303550", | 3706 | "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/084befb11ec21faeadcddefb88b66132775ff59b", |
3704 | "reference": "933c45a34814f27f2345c11c37d46b3ca7303550", | 3707 | "reference": "084befb11ec21faeadcddefb88b66132775ff59b", |
3705 | "shasum": "" | 3708 | "shasum": "" |
3706 | }, | 3709 | }, |
3707 | "require": { | 3710 | "require": { |
3708 | "php": ">=5.3.3", | 3711 | "php": ">=5.3.3", |
3709 | "symfony/yaml": "^2.3 || ^3.0 || ^4.0" | 3712 | "symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0" |
3710 | }, | 3713 | }, |
3711 | "require-dev": { | 3714 | "require-dev": { |
3712 | "composer/composer": "^1.0@dev", | 3715 | "composer/composer": "^1.0@dev", |
3713 | "symfony/filesystem": "^2.3 || ^3 || ^4", | 3716 | "symfony/filesystem": "^2.3 || ^3 || ^4 || ^5", |
3714 | "symfony/phpunit-bridge": "^4.0" | 3717 | "symfony/phpunit-bridge": "^4.0 || ^5.0" |
3715 | }, | 3718 | }, |
3716 | "type": "library", | 3719 | "type": "library", |
3717 | "extra": { | 3720 | "extra": { |
@@ -3739,7 +3742,7 @@ | |||
3739 | "keywords": [ | 3742 | "keywords": [ |
3740 | "parameters management" | 3743 | "parameters management" |
3741 | ], | 3744 | ], |
3742 | "time": "2018-02-13T18:05:56+00:00" | 3745 | "time": "2020-03-17T21:10:00+00:00" |
3743 | }, | 3746 | }, |
3744 | { | 3747 | { |
3745 | "name": "j0k3r/graby", | 3748 | "name": "j0k3r/graby", |
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 282fd733..cec8d499 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php | |||
@@ -68,6 +68,18 @@ class ExportController extends Controller | |||
68 | ); | 68 | ); |
69 | 69 | ||
70 | $title = 'Tag ' . $tag->getLabel(); | 70 | $title = 'Tag ' . $tag->getLabel(); |
71 | } elseif ('search' === $category) { | ||
72 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); | ||
73 | $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); | ||
74 | |||
75 | $entries = $repository->getBuilderForSearchByUser( | ||
76 | $this->getUser()->getId(), | ||
77 | $searchTerm, | ||
78 | $currentRoute | ||
79 | )->getQuery() | ||
80 | ->getResult(); | ||
81 | |||
82 | $title = 'Search ' . $searchTerm; | ||
71 | } else { | 83 | } else { |
72 | $entries = $repository | 84 | $entries = $repository |
73 | ->$methodBuilder($this->getUser()->getId()) | 85 | ->$methodBuilder($this->getUser()->getId()) |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index b747ed84..4182628f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -96,16 +96,21 @@ | |||
96 | {% if tag is defined %} | 96 | {% if tag is defined %} |
97 | {% set currentTag = tag %} | 97 | {% set currentTag = tag %} |
98 | {% endif %} | 98 | {% endif %} |
99 | {% set exportSearchTerm = null %} | ||
100 | {% if searchTerm is defined %} | ||
101 | {% set exportSearchTerm = searchTerm %} | ||
102 | {% endif %} | ||
103 | {% set previousRoute = app.request.attributes.get('currentRoute') %} | ||
99 | <h2>{{ 'entry.list.export_title'|trans }}</h2> | 104 | <h2>{{ 'entry.list.export_title'|trans }}</h2> |
100 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> | 105 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> |
101 | <ul> | 106 | <ul> |
102 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag }) }}">EPUB</a></li>{% endif %} | 107 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">EPUB</a></li>{% endif %} |
103 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag }) }}">MOBI</a></li>{% endif %} | 108 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">MOBI</a></li>{% endif %} |
104 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag }) }}">PDF</a></li>{% endif %} | 109 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">PDF</a></li>{% endif %} |
105 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag }) }}">JSON</a></li>{% endif %} | 110 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">JSON</a></li>{% endif %} |
106 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag }) }}">CSV</a></li>{% endif %} | 111 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">CSV</a></li>{% endif %} |
107 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag }) }}">TXT</a></li>{% endif %} | 112 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">TXT</a></li>{% endif %} |
108 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag }) }}">XML</a></li>{% endif %} | 113 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">XML</a></li>{% endif %} |
109 | </ul> | 114 | </ul> |
110 | </aside> | 115 | </aside> |
111 | 116 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index 3906e1e0..0c21dc5d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig | |||
@@ -63,15 +63,20 @@ | |||
63 | {% if tag is defined %} | 63 | {% if tag is defined %} |
64 | {% set currentTag = tag.slug %} | 64 | {% set currentTag = tag.slug %} |
65 | {% endif %} | 65 | {% endif %} |
66 | {% set exportSearchTerm = null %} | ||
67 | {% if searchTerm is defined %} | ||
68 | {% set exportSearchTerm = searchTerm %} | ||
69 | {% endif %} | ||
70 | {% set previousRoute = app.request.attributes.get('currentRoute') %} | ||
66 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> | 71 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> |
67 | <ul> | 72 | <ul> |
68 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag }) }}">EPUB</a></li>{% endif %} | 73 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">EPUB</a></li>{% endif %} |
69 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag }) }}">MOBI</a></li>{% endif %} | 74 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">MOBI</a></li>{% endif %} |
70 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag }) }}">PDF</a></li>{% endif %} | 75 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">PDF</a></li>{% endif %} |
71 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag }) }}">JSON</a></li>{% endif %} | 76 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">JSON</a></li>{% endif %} |
72 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag }) }}">CSV</a></li>{% endif %} | 77 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">CSV</a></li>{% endif %} |
73 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag }) }}">TXT</a></li>{% endif %} | 78 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">TXT</a></li>{% endif %} |
74 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag }) }}">XML</a></li>{% endif %} | 79 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">XML</a></li>{% endif %} |
75 | </ul> | 80 | </ul> |
76 | </div> | 81 | </div> |
77 | 82 | ||
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index d7ce7c45..36822ab3 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php | |||
@@ -3,9 +3,13 @@ | |||
3 | namespace Tests\Wallabag\CoreBundle\Controller; | 3 | namespace Tests\Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | 5 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; |
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
6 | 7 | ||
7 | class ExportControllerTest extends WallabagCoreTestCase | 8 | class ExportControllerTest extends WallabagCoreTestCase |
8 | { | 9 | { |
10 | private $adminEntry; | ||
11 | private $bobEntry; | ||
12 | |||
9 | public function testLogin() | 13 | public function testLogin() |
10 | { | 14 | { |
11 | $client = $this->getClient(); | 15 | $client = $this->getClient(); |
@@ -243,6 +247,30 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
243 | $this->assertContains('foo', $content[0]['tags']); | 247 | $this->assertContains('foo', $content[0]['tags']); |
244 | } | 248 | } |
245 | 249 | ||
250 | public function testJsonExportFromSearch() | ||
251 | { | ||
252 | $this->setUpForJsonExportFromSearch(); | ||
253 | |||
254 | $this->logInAs('admin'); | ||
255 | $client = $this->getClient(); | ||
256 | |||
257 | ob_start(); | ||
258 | $crawler = $client->request('GET', '/export/search.json?search_entry[term]=entry+search¤tRoute=homepage'); | ||
259 | ob_end_clean(); | ||
260 | |||
261 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
262 | |||
263 | $headers = $client->getResponse()->headers; | ||
264 | $this->assertSame('application/json', $headers->get('content-type')); | ||
265 | $this->assertSame('attachment; filename="Search entry search articles.json"', $headers->get('content-disposition')); | ||
266 | $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); | ||
267 | |||
268 | $content = json_decode($client->getResponse()->getContent(), true); | ||
269 | $this->assertCount(1, $content); | ||
270 | |||
271 | $this->tearDownForJsonExportFromSearch(); | ||
272 | } | ||
273 | |||
246 | public function testXmlExport() | 274 | public function testXmlExport() |
247 | { | 275 | { |
248 | $this->logInAs('admin'); | 276 | $this->logInAs('admin'); |
@@ -282,6 +310,41 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
282 | $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at); | 310 | $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at); |
283 | } | 311 | } |
284 | 312 | ||
313 | private function setUpForJsonExportFromSearch() | ||
314 | { | ||
315 | $client = $this->getClient(); | ||
316 | $em = $this->getEntityManager(); | ||
317 | |||
318 | $userRepository = $client->getContainer() | ||
319 | ->get('wallabag_user.user_repository.test'); | ||
320 | |||
321 | $user = $userRepository->findOneByUserName('admin'); | ||
322 | $this->adminEntry = new Entry($user); | ||
323 | $this->adminEntry->setUrl('http://0.0.0.0/entry-search-admin'); | ||
324 | $this->adminEntry->setTitle('test title entry search admin'); | ||
325 | $this->adminEntry->setContent('this is my content /o/'); | ||
326 | $em->persist($this->adminEntry); | ||
327 | |||
328 | $user = $userRepository->findOneByUserName('bob'); | ||
329 | $this->bobEntry = new Entry($user); | ||
330 | $this->bobEntry->setUrl('http://0.0.0.0/entry-search-bob'); | ||
331 | $this->bobEntry->setTitle('test title entry search bob'); | ||
332 | $this->bobEntry->setContent('this is my content /o/'); | ||
333 | $em->persist($this->bobEntry); | ||
334 | |||
335 | $em->flush(); | ||
336 | } | ||
337 | |||
338 | private function tearDownForJsonExportFromSearch() | ||
339 | { | ||
340 | $em = $this->getEntityManager(); | ||
341 | |||
342 | $em->remove($this->adminEntry); | ||
343 | $em->remove($this->bobEntry); | ||
344 | |||
345 | $em->flush(); | ||
346 | } | ||
347 | |||
285 | private function getSanitizedFilename($title) | 348 | private function getSanitizedFilename($title) |
286 | { | 349 | { |
287 | return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title)); | 350 | return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title)); |