Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Adopt to new modern dialog #322

Merged
merged 68 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c847b77
Localization
nagmat84 Aug 28, 2022
c08de48
Changed dependency for basicModal
nagmat84 Aug 27, 2022
d894be1
Rewrote CSS
nagmat84 Aug 27, 2022
bcefc0c
Adopted jsDoc for basic modal
nagmat84 Aug 27, 2022
c9c497c
Adopted create login dialog
nagmat84 Aug 27, 2022
c44ad31
Adopted create (regular) album dialog
nagmat84 Aug 27, 2022
77d93e2
Adopted create (tag) album dialog
nagmat84 Aug 27, 2022
dcaab06
Adopted show tags dialog
nagmat84 Aug 27, 2022
b22e319
Adopted rename album dialog
nagmat84 Aug 27, 2022
5eaaac9
Adopted set album description dialog
nagmat84 Aug 27, 2022
61209cb
Adopted set album license dialog
nagmat84 Aug 27, 2022
2d47af6
Adopted set album soring dialog
nagmat84 Aug 27, 2022
6aa6fd7
Fix `basicModal.visible`
nagmat84 Aug 27, 2022
c5f5ed5
Adopted login and about dialog
nagmat84 Aug 28, 2022
19a5430
Renamed some methods
nagmat84 Aug 28, 2022
d7e67a7
Adopt Album Protection Policy Dialog
nagmat84 Aug 28, 2022
dd02e89
Make formatting
nagmat84 Aug 28, 2022
4fe43ee
Adopted Album Sharing Dialog
nagmat84 Aug 31, 2022
c704443
Adopted QR dialog
nagmat84 Aug 31, 2022
719d2af
Adopted Delete Album Dialog
nagmat84 Sep 1, 2022
7e01b80
Adopted Album Move/Merge Dialog
nagmat84 Sep 1, 2022
bb98a9b
Adopted Enter Password Dialog
nagmat84 Sep 3, 2022
63806d4
Adopt Import From URL Dialog
nagmat84 Sep 4, 2022
0c96733
Adopt Import From Server Dialog
nagmat84 Sep 4, 2022
ef3eddc
Adopt Upload Dialogs
nagmat84 Sep 4, 2022
51ddda8
Fix closing of dialogs
nagmat84 Sep 4, 2022
9252e8e
Adopted U2F dialog
nagmat84 Sep 11, 2022
36b0524
Adopted all dialogs but those for photos
nagmat84 Sep 11, 2022
9e4e49e
Adopted Photo Title Dialog
nagmat84 Sep 11, 2022
dba2c24
Adopted Photo Protection Policy Dialog
nagmat84 Sep 11, 2022
7538bc5
Adopted Photo Description Dialog
nagmat84 Sep 11, 2022
d2a2253
Adopted Photo Tag Dialog
nagmat84 Sep 11, 2022
26a2086
Adopted change from dialog to content area
nagmat84 Sep 12, 2022
d22b631
Adopted Photo Link Dialog
nagmat84 Sep 13, 2022
c90d014
Adopted Photo QR Code Dialog
nagmat84 Sep 13, 2022
29fce28
Adopted Photo Archive Dialog
nagmat84 Sep 13, 2022
1092b8d
Some cleanup
nagmat84 Sep 13, 2022
09ce761
Fix last dialog
nagmat84 Sep 14, 2022
1b7b6ec
Merge branch 'master' into adopt-new-modern-dialog
nagmat84 Sep 17, 2022
b0d3464
Fixed API token dialog
nagmat84 Sep 17, 2022
e6b33b8
Run prettier
nagmat84 Sep 17, 2022
5779f6d
Update scripts/3rd-party/basicModal.js
nagmat84 Sep 21, 2022
70a00b8
Apply suggestions from code review
nagmat84 Sep 21, 2022
f301e2d
Fix Typo "Model" -> "Modal"
nagmat84 Sep 21, 2022
66619a4
Fixed localization of sorting dialog
nagmat84 Sep 24, 2022
8279248
Remove unnecessary else-branch in initLogin
nagmat84 Sep 24, 2022
7065ddb
Fixed localization
nagmat84 Sep 24, 2022
b60fded
Fix error dialog for failed login
nagmat84 Sep 24, 2022
7ffd055
Apply suggestions from code review
nagmat84 Sep 24, 2022
7be3bea
Apply suggestion from code review.
nagmat84 Sep 24, 2022
d4bdecd
Removed unnecessaey !!
nagmat84 Sep 24, 2022
7391934
Merge branch 'master' into adopt-new-modern-dialog
nagmat84 Sep 24, 2022
692dbac
Removed jQuery leftover
nagmat84 Sep 24, 2022
a6a7cad
Apply suggestions from code review
nagmat84 Sep 27, 2022
4320beb
Made difference between layouts compact and compact-inverse more expl…
nagmat84 Sep 27, 2022
a9f5ba1
Apply suggestions from code review
nagmat84 Sep 28, 2022
f181f2c
Repair import from server (again)
nagmat84 Sep 28, 2022
2b83d2a
Merge branch 'master' into adopt-new-modern-dialog
nagmat84 Sep 28, 2022
9e941bb
Fixed typo
nagmat84 Sep 28, 2022
88fa3e6
Switched NPM dep for basicModal to v4.0.0
nagmat84 Sep 28, 2022
1211769
Switch to PR commit for basicModal to solve focussing problem
nagmat84 Oct 17, 2022
3b75276
Fix round corners of search box
nagmat84 Oct 17, 2022
e72d7a5
Repair button border in download dialog
nagmat84 Oct 18, 2022
30fe8df
Fixed mising space
nagmat84 Oct 18, 2022
79a9761
Always keep the last updated element of the upload list at the end
nagmat84 Oct 18, 2022
70701ef
Merge branch 'master' into adopt-new-modern-dialog
nagmat84 Oct 18, 2022
9a085f5
Tweak the borders and shadows in dialog boxes
kamil4 Oct 18, 2022
069b906
Fix localization of general error during upload
nagmat84 Oct 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"name": "lychee",
"version": "4.0.10",
"description": "Self-hosted photo-management done right.",
"authors": "Tobias Reich <[email protected]>",
"authors": [
"Tobias Reich <[email protected]>",
"The Lychee Organization"
],
"license": "MIT",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/LycheeOrg/Lychee.git"
"url": "https://github.com/LycheeOrg/Lychee-front.git"
},
"scripts": {
"start": "gulp watch",
Expand All @@ -19,7 +22,7 @@
"node": ">= 10"
},
"dependencies": {
"basicmodal": "https://github.com/LycheeOrg/basicModal/archive/refs/tags/v3.3.9.tar.gz",
"basicmodal": "LycheeOrg/basicModal#30e6b70",
"jquery": "^3.4.0",
"justified-layout": "^4.1.0",
"lazysizes": "^5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/3rd-party/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ const SmartAlbumID = Object.freeze({
* @property {string} swipe_tolerance_x - actually a number
* @property {string} swipe_tolerance_y - actually a number
* @property {string} upload_processing_limit - actually a number
* @property {string} version - actually a number
* @property {string} version - a string of 6 digits without separating dots, i.e. version 4.6.3 is reported as `'040603'`
*/

/**
Expand Down
261 changes: 220 additions & 41 deletions scripts/3rd-party/basicModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,130 @@
*/

/**
* Returns an associative object containing the values from all `input` and
* `select` elements.
* @typedef ModalDialogConfiguration
* @property {string} [body=''] HTML snippet to be inserted into the content
* area of the dialog
* @property {string[]} [classList=[]] CSS class to be applied to the content area
* of the dialog
* @property {boolean} [closable=true] indicates whether the dialog can be closed
* via {@link close}
* @property {ModalDialogButtonsData} buttons configuration data for the main action and
* cancel button
* @property {ModalDialogReadyCB} [readyCB=null] callback to be called after the dialog
* has become visible and ready for user input
*/

/**
* @callback ModalDialogReadyCB
* @param {ModalDialogFormElements} htmlElements a dictionary that maps names to form elements
* @param {HTMLDivElement} dialog the DIV element that represents the content area of the dialog
* @returns {void}
*/

/**
* @callback ModalDialogClosedCB
* @returns {void}
*/

/**
* @typedef ModalDialogFormElements
*
* A dictionary of names of form elements to those form elements.
*
* @type {Object.<string, (HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement)>}
*/

/**
* @typedef ModalDialogButtonsData
* @property {ModalDialogButtonData} [action] configuration data for the main action button
* @property {ModalDialogButtonData} [cancel] configuration data for the cancel button
*/

/**
* @typedef ModalDialogButtonData
* @property {string} [title] the caption of the button
* @property {string[]} [classList=[]] CSS class to be applied to the button
* @property {Object.<string, string>} [attributes={}] a dictionary of arbitrary HTML attributes and their values
* @property {ModalDialogButtonCB} fn callback to be called upon an "on-click" event
*/

/**
* @callback ModalDialogButtonCB
* @param {ModalDialogResult} values an associative object with the values of
* all HTML input elements; see {@link getValues}
* @returns {void}
*/

/**
* A dictionary that maps names of form elements to their values.
*
* The properties of the returned object correspond to the `name` attribute
* of the `input` and `select` elements.
* @typedef ModalDialogResult
* @type {Object.<string,(number|string|boolean|FileList)>}
*/

/**
* @typedef ModalDialogException
* @property {string} name
* @property {string} message
*/

/**
* Returns an associative object containing the values from all HTML form
* elements.
*
* @function getValues
* @memberOf basicModal
* @returns {Object}
* @returns {ModalDialogResult}
*/

/**
* Constructs and shows a modal dialog.
*
* After the dialog has become ready, the callback `data.callback` is
* After the dialog has become ready, the callback `confData.readyCB` is
* invoked.
*
* @function show
* @memberOf basicModal
* @param {ModalDialogData} data configuration data for the dialog
* @returns {boolean} `true` if the dialog became visible
* @param {ModalDialogConfiguration} confData configuration data for the dialog
* @returns {void}
* @throws {ModalDialogException}
*/

/**
* Scans the dialog for any named form elements and caches them in an internal
* dictionary to avoid repeated DOM queries with CSS selectors for efficiency
* reasons.
*
* The found form elements are those which are included into the dialog result
* set and are enabled/disabled automatically.
*
* Normally, it is not necessary to call this method manually from outside the
* modal dialog as this method is automatically called as part of the dialog
* building process inside `show`.
* However, if the dialog is dynamically modified after `show` has been called
* (e.g. if form elements are removed or added on the fly), then this method
* must be called.
*
* @function cacheFormElements
* @memberOf basicModal
* @returns {void}
*/

/**
* Removes (potentially) old error indicators and highlights the indicated
* input element.
*
* @function error
* @function focusError
* @memberOf basicModal
* @param {string} [nameAttribute] the name of the HTML input element which
* caused the error and shall be highlighted
* @param {string} [name] the name of the HTML input element which
* caused the error and shall be highlighted
* @returns {void}
*/

/**
* Determines whether a modal dialog is visible or not.
*
* @function visible
* @function isVisible
* @memberOf basicModal
* @returns {boolean}
*/
Expand Down Expand Up @@ -74,11 +160,12 @@
*/

/**
* Removes any (potential) error indicator from the input elements.
* Reactivates buttons and removes any (potential) error indicator from the
* input elements.
*
* @function reset
* @memberOf basicModal
* @returns {boolean} always `true`
* @returns {void}
*/

/**
Expand All @@ -87,48 +174,140 @@
* @function close
* @memberOf basicModal
* @param {boolean} [force=false]
* @returns {boolean} `true`, if the dialog has been visible before and has
* been closed;
* `false`, if no dialog has been visible which could be
* closed
* @param {ModalDialogClosedCB} [onClosedCB]
* @returns {void}
*/

/**
* @typedef ModalDialogData
* @property {string} [body=''] HTML snippet to be inserted into the content
* area of the dialog
* @property {string} [class=''] CSS class to be applied to the content area
* of the dialog
* @property {boolean} [closable=true] indicates whether the dialog can be closed
* via {@link basicModal.close}
* @property {ModalDialogButtonsData} buttons configuration data for the main action and
* cancel button
* @property {ModalDialogReadyCB} [callback=null] callback to be called after the dialog
* has become visible and ready for user input
* @function isActionButtonBusy
* @memberOf basicModal
* @returns {boolean}
*/

/**
* @callback ModalDialogReadyCB
* @param {ModalDialogData} data the configuration data which has been used to construct the dialog
* @function markActionButtonAsBusy
* @memberOf basicModal
* @returns {void}
*/

/**
* @typedef ModalDialogButtonsData
* @property {ModalDialogButtonData} [action] configuration data for the main action button
* @property {ModalDialogButtonData} [cancel] configuration data for the cancel button
* @function markActionButtonAsIdle
* @memberOf basicModal
* @returns {void}
*/

/**
* @typedef ModalDialogButtonData
* @property {string} [title] the caption of the button
* @property {string} [class] CSS class to be applied to the button
* @property {ModalDialogButtonCB} fn callback to be called upon an "on-click" event
* Returns `true`, if the Action button is visible.
*
* @function isActionButtonVisible
* @memberOf basicModal
* @returns {boolean}
*/

/**
* @callback ModalDialogButtonCB
* @param {Object} [values] an associative object with the values of all HTML
* input elements; see {@link basicModal.getValues}
* Returns `true`, if the Action button is hidden.
*
* Note, this method is not exactly the opposite of
* {@link basicModal#isActionButtonVisible}.
* This method only returns `true` if the dialog owns an Action button which
* can be hidden.
* In other words, both {@link basicModal#isActionButtonVisible} and this method may
* return `false` simultaneously, if there is no Action button at all.
*
* @function isActionButtonHidden
* @memberOf basicModal
* @returns {boolean}
*/

/**
* Hides the Action button
*
* Note: This does not hide the button by setting the `display` property to
* `none`, but completely removes the button from the DOM.
* This is necessary, as an element which is not displayed is still considered
* when it comes to calculating the first or last child and hence rounding
* of the first/last button does not work as expected, if the button is still
* part of the DOM.
*
* @function hideActionButton
* @memberOf basicModal
* @returns {void}
*/

/**
* Shows the Action button, if one has been defined
*
* Note: This re-inserts the Action button into the DOM, but only if an Action
* button has previously been defined during the dialog construction.
*
* @function showActionButton
* @memberOf basicModal
* @returns {void}
*/

/**
* @function isCancelButtonBusy
* @memberOf basicModal
* @returns {boolean}
*/

/**
* @function markCancelButtonAsBusy
* @memberOf basicModal
* @returns {void}
*/

/**
* @function markCancelButtonAsIdle
* @memberOf basicModal
* @returns {void}
*/

/**
* Returns `true`, if the Cancel button is visible.
*
* @function isCancelButtonVisible
* @memberOf basicModal
* @returns {boolean}
*/

/**
* Returns `true`, if the Cancel button is hidden.
*
* Note, this method is not exactly the opposite of
* {@link basicModal#isCancelButtonVisible}.
* This method only returns `true` if the dialog owns a Cancel button which
* can be hidden.
* In other words, both {@link basicModal#isCancelButtonVisible} and this method may
* return `false` simultaneously, if there is no Cancel button at all.
*
* @function isCancelButtonHidden
* @memberOf basicModal
* @returns {boolean}
*/

/**
* Hides the Cancel button
*
* Note: This does not hide the button by setting the `display` property to
* `none`, but completely removes the button from the DOM.
* This is necessary, as an element which is not displayed is still considered
* when it comes to calculating the first or last child and hence rounding
* of the first/last button does not work as expected, if the button is still
* part of the DOM.
*
* @function hideCancelButton
* @memberOf basicModal
* @returns {void}
*/

/**
* Shows the Cancel button, if one has been defined
*
* Note: This re-inserts the Cancel button into the DOM, but only if a Cancel
* button has previously been defined during the dialog construction.
*
* @function showCancelButton
* @memberOf basicModal
* @returns {void}
*/
Loading