diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-10 17:40:26 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-10-27 20:11:30 +0100 |
commit | 5d8de7587d67b5c3e5d1fed8562d9b87ecde80c1 (patch) | |
tree | 2236e571035332a63f87a09222f2278b93f63515 /tpl | |
parent | b8e5a253ab5521ce2be6c0d3e04e0101527df3c1 (diff) | |
download | Shaarli-5d8de7587d67b5c3e5d1fed8562d9b87ecde80c1.tar.gz Shaarli-5d8de7587d67b5c3e5d1fed8562d9b87ecde80c1.tar.zst Shaarli-5d8de7587d67b5c3e5d1fed8562d9b87ecde80c1.zip |
Feature: bulk creation of bookmarks
This changes creates a new form in addlink page allowing to create
multiple bookmarks at once more easily. It focuses on re-using as much
existing code and template component as possible.
These changes includes:
- a new form in addlink (hidden behind a button by default),
containing a text area for URL, and tags/private status to apply to
created links
- this form displays a new template called editlink.batch, itself
including editlink template multiple times
- User interation in this new templates are handle by a new JS script
(shaare-batch.js) making AJAX requests, and therefore does not need page
reloading
- ManageShaareController has been split into 3 distinct controllers:
+ ShaareAdd: displays addlink template
+ ShaareManage: various operation applied on existing shaares
(change visibility, pin, deletion, etc.)
+ ShaarePublish: handles creation/edit forms and saving Shaare's
form
- Updated translations
Fixes #137
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/default/addlink.html | 56 | ||||
-rw-r--r-- | tpl/default/editlink.batch.html | 23 | ||||
-rw-r--r-- | tpl/default/editlink.html | 15 |
3 files changed, 94 insertions, 0 deletions
diff --git a/tpl/default/addlink.html b/tpl/default/addlink.html index 67d3ebd1..7d4bc9e6 100644 --- a/tpl/default/addlink.html +++ b/tpl/default/addlink.html | |||
@@ -20,6 +20,62 @@ | |||
20 | </form> | 20 | </form> |
21 | </div> | 21 | </div> |
22 | </div> | 22 | </div> |
23 | |||
24 | <div class="pure-g addlink-batch-show-more-block pure-u-0"> | ||
25 | <div class="pure-u-lg-1-3 pure-u-1-24"></div> | ||
26 | <div class="pure-u-lg-1-3 pure-u-22-24 addlink-batch-show-more"> | ||
27 | <a href="#">{'BULK CREATION'|t} <i class="fa fa-plus-circle" aria-hidden="true"></i></a> | ||
28 | </div> | ||
29 | </div> | ||
30 | |||
31 | <div class="addlink-batch-form-block"> | ||
32 | {if="empty($async_metadata)"} | ||
33 | <div class="pure-g pure-alert pure-alert-warning pure-alert-closable"> | ||
34 | <div class="pure-u-2-24"></div> | ||
35 | <div class="pure-u-20-24"> | ||
36 | <p> | ||
37 | {'Metadata asynchronous retrieval is disabled.'|t} | ||
38 | {'We recommend that you enable the setting <em>general > enable_async_metadata</em> in your configuration file to use bulk link creation.'|t} | ||
39 | </p> | ||
40 | </div> | ||
41 | <div class="pure-u-2-24"> | ||
42 | <i class="fa fa-times pure-alert-close"></i> | ||
43 | </div> | ||
44 | </div> | ||
45 | {/if} | ||
46 | |||
47 | <div class="pure-g"> | ||
48 | <div class="pure-u-lg-1-3 pure-u-1-24"></div> | ||
49 | <div id="batch-addlink-form" class="page-form page-form-light pure-u-lg-1-3 pure-u-22-24"> | ||
50 | <h2 class="window-title">{"Shaare multiple new links"|t}</h2> | ||
51 | <form method="POST" action="{$base_path}/admin/shaare-batch" name="batch-addform" class="batch-addform"> | ||
52 | <div> | ||
53 | <label for="urls">{'Add one URL per line to create multiple bookmarks.'|t}</label> | ||
54 | <textarea name="urls" id="urls"></textarea> | ||
55 | |||
56 | <div> | ||
57 | <label for="tags">{'Tags'|t}</label> | ||
58 | </div> | ||
59 | <div> | ||
60 | <input type="text" name="tags" id="tags" class="lf_input" | ||
61 | data-list="{loop="$tags"}{$key}, {/loop}" data-multiple data-autofirst autocomplete="off"> | ||
62 | </div> | ||
63 | |||
64 | <div> | ||
65 | <input type="checkbox" name="private" | ||
66 | {if="$default_private_links"} checked="checked"{/if}> | ||
67 | <label for="lf_private">{'Private'|t}</label> | ||
68 | </div> | ||
69 | </div> | ||
70 | <div> | ||
71 | <input type="hidden" name="token" value="{$token}"> | ||
72 | <input type="submit" value="{'Add links'|t}"> | ||
73 | </div> | ||
74 | </form> | ||
75 | </div> | ||
76 | </div> | ||
77 | </div> | ||
78 | |||
23 | {include="page.footer"} | 79 | {include="page.footer"} |
24 | </body> | 80 | </body> |
25 | </html> | 81 | </html> |
diff --git a/tpl/default/editlink.batch.html b/tpl/default/editlink.batch.html new file mode 100644 index 00000000..71985c1a --- /dev/null +++ b/tpl/default/editlink.batch.html | |||
@@ -0,0 +1,23 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html{if="$language !== 'auto'"} lang="{$language}"{/if}> | ||
3 | <head> | ||
4 | {include="includes"} | ||
5 | </head> | ||
6 | <body> | ||
7 | {include="page.header"} | ||
8 | |||
9 | <div class="center"> | ||
10 | <input type="submit" name="save_edit_batch" class="pure-button-shaarli" value="{'Save all'|t}"> | ||
11 | </div> | ||
12 | |||
13 | {loop="$links"} | ||
14 | {include="editlink"} | ||
15 | {/loop} | ||
16 | |||
17 | <div class="center"> | ||
18 | <input type="submit" name="save_edit_batch" class="pure-button-shaarli" value="{'Save all'|t}"> | ||
19 | </div> | ||
20 | |||
21 | {include="page.footer"} | ||
22 | {if="$async_metadata"}<script src="{$asset_path}/js/metadata.min.js?v={$version_hash}#"></script>{/if} | ||
23 | <script src="{$asset_path}/js/shaare_batch.min.js?v={$version_hash}#"></script> | ||
diff --git a/tpl/default/editlink.html b/tpl/default/editlink.html index 7ab7e1fe..980b2b8e 100644 --- a/tpl/default/editlink.html +++ b/tpl/default/editlink.html | |||
@@ -1,3 +1,4 @@ | |||
1 | {if="empty($batch_mode)"} | ||
1 | <!DOCTYPE html> | 2 | <!DOCTYPE html> |
2 | <html{if="$language !== 'auto'"} lang="{$language}"{/if}> | 3 | <html{if="$language !== 'auto'"} lang="{$language}"{/if}> |
3 | <head> | 4 | <head> |
@@ -5,6 +6,10 @@ | |||
5 | </head> | 6 | </head> |
6 | <body> | 7 | <body> |
7 | {include="page.header"} | 8 | {include="page.header"} |
9 | {else} | ||
10 | {ignore}Lil hack: when included in a loop in batch mode, `$value` is assigned by RainTPL with template vars.{/ignore} | ||
11 | {function="extract($value) ? '' : ''"} | ||
12 | {/if} | ||
8 | <div id="editlinkform" class="edit-link-container" class="pure-g"> | 13 | <div id="editlinkform" class="edit-link-container" class="pure-g"> |
9 | <div class="pure-u-lg-1-5 pure-u-1-24"></div> | 14 | <div class="pure-u-lg-1-5 pure-u-1-24"></div> |
10 | <form method="post" | 15 | <form method="post" |
@@ -83,6 +88,13 @@ | |||
83 | 88 | ||
84 | 89 | ||
85 | <div class="submit-buttons center"> | 90 | <div class="submit-buttons center"> |
91 | {if="!empty($batch_mode)"} | ||
92 | <a href="#" class="button button-grey" name="cancel-batch-link" | ||
93 | title="{'Remove this bookmark from batch creation/modification.'}" | ||
94 | > | ||
95 | {'Cancel'|t} | ||
96 | </a> | ||
97 | {/if} | ||
86 | <input type="submit" name="save_edit" class="" id="button-save-edit" | 98 | <input type="submit" name="save_edit" class="" id="button-save-edit" |
87 | value="{if="$link_is_new"}{'Save'|t}{else}{'Apply Changes'|t}{/if}"> | 99 | value="{if="$link_is_new"}{'Save'|t}{else}{'Apply Changes'|t}{/if}"> |
88 | {if="!$link_is_new"} | 100 | {if="!$link_is_new"} |
@@ -100,7 +112,10 @@ | |||
100 | {/if} | 112 | {/if} |
101 | </form> | 113 | </form> |
102 | </div> | 114 | </div> |
115 | |||
116 | {if="empty($batch_mode)"} | ||
103 | {include="page.footer"} | 117 | {include="page.footer"} |
104 | {if="$link_is_new && $async_metadata"}<script src="{$asset_path}/js/metadata.min.js?v={$version_hash}#"></script>{/if} | 118 | {if="$link_is_new && $async_metadata"}<script src="{$asset_path}/js/metadata.min.js?v={$version_hash}#"></script>{/if} |
105 | </body> | 119 | </body> |
106 | </html> | 120 | </html> |
121 | {/if} | ||