diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Resources')
3 files changed, 214 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 8e21b052..c92b4eb3 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -53,6 +53,27 @@ services: | |||
53 | class: Wallabag\CoreBundle\Helper\ContentProxy | 53 | class: Wallabag\CoreBundle\Helper\ContentProxy |
54 | arguments: | 54 | arguments: |
55 | - @wallabag_core.graby | 55 | - @wallabag_core.graby |
56 | - @wallabag_core.rule_based_tagger | ||
57 | - @logger | ||
58 | |||
59 | wallabag_core.rule_based_tagger: | ||
60 | class: Wallabag\CoreBundle\Helper\RuleBasedTagger | ||
61 | arguments: | ||
62 | - @rulerz | ||
63 | - @wallabag_core.tag_repository | ||
64 | - @wallabag_core.entry_repository | ||
65 | |||
66 | wallabag_core.entry_repository: | ||
67 | class: Wallabag\CoreBundle\Repository\EntryRepository | ||
68 | factory: [ @doctrine.orm.default_entity_manager, getRepository ] | ||
69 | arguments: | ||
70 | - WallabagCoreBundle:Entry | ||
71 | |||
72 | wallabag_core.tag_repository: | ||
73 | class: Wallabag\CoreBundle\Repository\TagRepository | ||
74 | factory: [ @doctrine.orm.default_entity_manager, getRepository ] | ||
75 | arguments: | ||
76 | - WallabagCoreBundle:Tag | ||
56 | 77 | ||
57 | wallabag_core.registration_confirmed: | 78 | wallabag_core.registration_confirmed: |
58 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener | 79 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener |
@@ -70,3 +91,13 @@ services: | |||
70 | arguments: | 91 | arguments: |
71 | - %wallabag_url% | 92 | - %wallabag_url% |
72 | - src/Wallabag/CoreBundle/Resources/views/themes/_global/public/img/appicon/apple-touch-icon-152.png | 93 | - src/Wallabag/CoreBundle/Resources/views/themes/_global/public/img/appicon/apple-touch-icon-152.png |
94 | |||
95 | wallabag.operator.array.matches: | ||
96 | class: Wallabag\CoreBundle\Operator\PHP\Matches | ||
97 | tags: | ||
98 | - { name: rulerz.operator, executor: rulerz.executor.array, operator: matches } | ||
99 | |||
100 | wallabag.operator.doctrine.matches: | ||
101 | class: Wallabag\CoreBundle\Operator\Doctrine\Matches | ||
102 | tags: | ||
103 | - { name: rulerz.operator, executor: rulerz.executor.doctrine, operator: matches, inline: true } | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index 7a7d6af1..cc797c63 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig | |||
@@ -145,6 +145,39 @@ | |||
145 | {{ form_rest(form.pwd) }} | 145 | {{ form_rest(form.pwd) }} |
146 | </form> | 146 | </form> |
147 | 147 | ||
148 | <h2>{% trans %}Tagging rules{% endtrans %}</h2> | ||
149 | |||
150 | <ul> | ||
151 | {% for tagging_rule in app.user.config.taggingRules %} | ||
152 | <li> | ||
153 | if « {{ tagging_rule.rule }} » then tag as « {{ tagging_rule.tags|join(', ') }} » | ||
154 | <a href="{{ path('delete_tagging_rule', {id: tagging_rule.id}) }}" title="{% trans %}Delete{% endtrans %}" class="tool delete icon-trash icon"></a> | ||
155 | </li> | ||
156 | {% endfor %} | ||
157 | </ul> | ||
158 | |||
159 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.new_tagging_rule) }}> | ||
160 | {{ form_errors(form.new_tagging_rule) }} | ||
161 | |||
162 | <fieldset class="w500p inline"> | ||
163 | <div class="row"> | ||
164 | {{ form_label(form.new_tagging_rule.rule) }} | ||
165 | {{ form_errors(form.new_tagging_rule.rule) }} | ||
166 | {{ form_widget(form.new_tagging_rule.rule) }} | ||
167 | </div> | ||
168 | </fieldset> | ||
169 | |||
170 | <fieldset class="w500p inline"> | ||
171 | <div class="row"> | ||
172 | {{ form_label(form.new_tagging_rule.tags) }} | ||
173 | {{ form_errors(form.new_tagging_rule.tags) }} | ||
174 | {{ form_widget(form.new_tagging_rule.tags) }} | ||
175 | </div> | ||
176 | </fieldset> | ||
177 | |||
178 | {{ form_rest(form.new_tagging_rule) }} | ||
179 | </form> | ||
180 | |||
148 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 181 | {% if is_granted('ROLE_SUPER_ADMIN') %} |
149 | <h2>{% trans %}Add a user{% endtrans %}</h2> | 182 | <h2>{% trans %}Add a user{% endtrans %}</h2> |
150 | 183 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index 8f121a2b..d060311d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig | |||
@@ -15,8 +15,9 @@ | |||
15 | <li class="tab col s3"><a href="#set2">{% trans %}RSS{% endtrans %}</a></li> | 15 | <li class="tab col s3"><a href="#set2">{% trans %}RSS{% endtrans %}</a></li> |
16 | <li class="tab col s3"><a href="#set3">{% trans %}User information{% endtrans %}</a></li> | 16 | <li class="tab col s3"><a href="#set3">{% trans %}User information{% endtrans %}</a></li> |
17 | <li class="tab col s3"><a href="#set4">{% trans %}Password{% endtrans %}</a></li> | 17 | <li class="tab col s3"><a href="#set4">{% trans %}Password{% endtrans %}</a></li> |
18 | <li class="tab col s3"><a href="#set5">{% trans %}Tagging rules{% endtrans %}</a></li> | ||
18 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 19 | {% if is_granted('ROLE_SUPER_ADMIN') %} |
19 | <li class="tab col s3"><a href="#set5">{% trans %}Add a user{% endtrans %}</a></li> | 20 | <li class="tab col s3"><a href="#set6">{% trans %}Add a user{% endtrans %}</a></li> |
20 | {% endif %} | 21 | {% endif %} |
21 | </ul> | 22 | </ul> |
22 | </div> | 23 | </div> |
@@ -183,8 +184,155 @@ | |||
183 | </form> | 184 | </form> |
184 | </div> | 185 | </div> |
185 | 186 | ||
186 | {% if is_granted('ROLE_SUPER_ADMIN') %} | ||
187 | <div id="set5" class="col s12"> | 187 | <div id="set5" class="col s12"> |
188 | <div class="row"> | ||
189 | <div class="input-field col s12"> | ||
190 | <ul> | ||
191 | {% for tagging_rule in app.user.config.taggingRules %} | ||
192 | <li> | ||
193 | if « {{ tagging_rule.rule }} » then tag as « {{ tagging_rule.tags|join(', ') }} » | ||
194 | <a href="{{ path('delete_tagging_rule', {id: tagging_rule.id}) }}" title="{% trans %}Delete{% endtrans %}"> | ||
195 | <i class="tool grey-text delete mdi-action-delete"></i> | ||
196 | </a> | ||
197 | </li> | ||
198 | {% endfor %} | ||
199 | </ul> | ||
200 | </div> | ||
201 | </div> | ||
202 | |||
203 | {{ form_start(form.new_tagging_rule) }} | ||
204 | {{ form_errors(form.new_tagging_rule) }} | ||
205 | |||
206 | <div class="row"> | ||
207 | <div class="input-field col s12"> | ||
208 | {{ form_label(form.new_tagging_rule.rule) }} | ||
209 | {{ form_errors(form.new_tagging_rule.rule) }} | ||
210 | {{ form_widget(form.new_tagging_rule.rule) }} | ||
211 | </div> | ||
212 | </div> | ||
213 | |||
214 | <div class="row"> | ||
215 | <div class="input-field col s12"> | ||
216 | {{ form_label(form.new_tagging_rule.tags) }} | ||
217 | {{ form_errors(form.new_tagging_rule.tags) }} | ||
218 | {{ form_widget(form.new_tagging_rule.tags) }} | ||
219 | </div> | ||
220 | </div> | ||
221 | |||
222 | <div class="hidden">{{ form_rest(form.new_tagging_rule) }}</div> | ||
223 | <button class="btn waves-effect waves-light" type="submit" name="action"> | ||
224 | {% trans %}Save{% endtrans %} | ||
225 | </button> | ||
226 | </form> | ||
227 | |||
228 | <div class="row"> | ||
229 | <div class="input-field col s12"> | ||
230 | <h4>{% trans %}FAQ{% endtrans %}</h4> | ||
231 | |||
232 | <h5>{% trans %}What does « tagging rules » mean?{% endtrans %}</h5> | ||
233 | <p class="help"> | ||
234 | {% trans %} | ||
235 | They are rules used by Wallabag to automatically tag new entries.<br /> | ||
236 | Each time a new entry is added, all the tagging rules will be used to add | ||
237 | the tags you configured, thus saving you the trouble to manually classify | ||
238 | your entries. | ||
239 | {% endtrans %} | ||
240 | </p> | ||
241 | |||
242 | <h5>{% trans %}How do I use them?{% endtrans %}</h5> | ||
243 | <p class="help"> | ||
244 | {% trans %} | ||
245 | Let assume you want to tag new entries as « <i>short reading</i> » when the reading time is inferior to 3 minutes.<br /> | ||
246 | In that case, you should put « readingTime <= 3 » in the <i>Rule</i> field and « <i>short reading</i> » in the <i>Tags</i> | ||
247 | field.<br /> | ||
248 | Several tags can added simultaneously by separating them by a comma: « <i>short reading, must read</i> »<br /> | ||
249 | Complex rules can be written by using predefined operators: if « <i>readingTime >= 5 AND domainName = "github.com"</i> » then tag as « <i>long reading, github </i> » | ||
250 | {% endtrans %} | ||
251 | </p> | ||
252 | |||
253 | <h5>{% trans %}Which variables and operators can I use to write rules?{% endtrans %}</h5> | ||
254 | <p class="help"> | ||
255 | {% trans %}The following variables and operators can be used to create tagging rules:{% endtrans %} | ||
256 | |||
257 | <table> | ||
258 | <thead> | ||
259 | <tr> | ||
260 | <th>{% trans %}Variable{% endtrans %}</th> | ||
261 | <th>{% trans %}Meaning{% endtrans %}</th> | ||
262 | <th>{% trans %}Operator{% endtrans %}</th> | ||
263 | <th>{% trans %}Meaning{% endtrans %}</th> | ||
264 | </tr> | ||
265 | </thead> | ||
266 | |||
267 | <tbody> | ||
268 | <tr> | ||
269 | <td>title</td> | ||
270 | <td>{% trans %}Title of the entry{% endtrans %}</td> | ||
271 | <td><=</td> | ||
272 | <td>{% trans %}Less than…{% endtrans %}</td> | ||
273 | </tr> | ||
274 | <tr> | ||
275 | <td>url</td> | ||
276 | <td>{% trans %}URL of the entry{% endtrans %}</td> | ||
277 | <td><</td> | ||
278 | <td>{% trans %}Strictly less than…{% endtrans %}</td> | ||
279 | </tr> | ||
280 | <tr> | ||
281 | <td>isArchived</td> | ||
282 | <td>{% trans %}Whether the entry is archived or not{% endtrans %}</td> | ||
283 | <td>=></td> | ||
284 | <td>{% trans %}Greater than…{% endtrans %}</td> | ||
285 | </tr> | ||
286 | <tr> | ||
287 | <td>isStared</td> | ||
288 | <td>{% trans %}Whether the entry is starred or not{% endtrans %}</td> | ||
289 | <td>></td> | ||
290 | <td>{% trans %}Strictly greater than…{% endtrans %}</td> | ||
291 | </tr> | ||
292 | <tr> | ||
293 | <td>content</td> | ||
294 | <td>{% trans %}The entry's content{% endtrans %}</td> | ||
295 | <td>=</td> | ||
296 | <td>{% trans %}Equal to…{% endtrans %}</td> | ||
297 | </tr> | ||
298 | <tr> | ||
299 | <td>language</td> | ||
300 | <td>{% trans %}The entry's language{% endtrans %}</td> | ||
301 | <td>!=</td> | ||
302 | <td>{% trans %}Not equal to…{% endtrans %}</td> | ||
303 | </tr> | ||
304 | <tr> | ||
305 | <td>mimetype</td> | ||
306 | <td>{% trans %}The entry's mime-type{% endtrans %}</td> | ||
307 | <td>OR</td> | ||
308 | <td>{% trans %}One rule or another{% endtrans %}</td> | ||
309 | </tr> | ||
310 | <tr> | ||
311 | <td>readingTime</td> | ||
312 | <td>{% trans %}The estimated entry's reading time, in minutes{% endtrans %}</td> | ||
313 | <td>AND</td> | ||
314 | <td>{% trans %}One rule and another{% endtrans %}</td> | ||
315 | </tr> | ||
316 | <tr> | ||
317 | <td>domainName</td> | ||
318 | <td>{% trans %}The domain name of the entry{% endtrans %}</td> | ||
319 | <td>matches</td> | ||
320 | <td> | ||
321 | {% trans %} | ||
322 | Tests that a <i>subject</i> is matches a <i>search</i> (case-insensitive).<br /> | ||
323 | Example: <code>title matches "football"</code> | ||
324 | {% endtrans %} | ||
325 | </td> | ||
326 | </tr> | ||
327 | </tbody> | ||
328 | </table> | ||
329 | </p> | ||
330 | </div> | ||
331 | </div> | ||
332 | </div> | ||
333 | |||
334 | {% if is_granted('ROLE_SUPER_ADMIN') %} | ||
335 | <div id="set6" class="col s12"> | ||
188 | {{ form_start(form.new_user) }} | 336 | {{ form_start(form.new_user) }} |
189 | {{ form_errors(form.new_user) }} | 337 | {{ form_errors(form.new_user) }} |
190 | 338 | ||