-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library: date exceptions #151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure that you've thought about the following points, but my comments on the UI are:
- On the detailed view, I would put color (X in red, ✔️ in green).
- In the exception list view, I wouldn't display "unique", but only if it's yearly, monthly, etc. The interval value isn't easy to understand.
- When editing, I couldn't select yearly and put a value. After saving it's always "unique".
- Period days → Days period
Otherwise, I find the UI nice to use. Cool.
And, is this PR up to date with the master branch? I don't see the admin layout commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impossible to add an exception to a library. You can add an exception only for a library that has exceptions.
other than that --- cool raoul
dc0688d
to
13f95d4
Compare
* NEW: add date exceptions in the library JSON schema * NEW: update editor to manage library Co-Authored-by: Bertrand Zuchuat <[email protected]> Co-Authored-by: Nicolas Labat <[email protected] Signed-off-by: Peter Weber <[email protected]>
13f95d4
to
54737b9
Compare
@@ -66,6 +66,16 @@ def save_library(data, record_type, record_class, parent_pid=None): | |||
library = record_class.get_record_by_pid(pid) | |||
library.update(data, dbcommit=False, reindex=False) | |||
else: | |||
if 'opening_hours' not in data: | |||
data['opening_hours'] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be replaced by a comprehension list such as [{"day": day, "is_open": False, "times": []} for day in ['monday', 'thuesday', etc]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be deleted with task #743
[bsValue]="bsValue" | ||
[bsConfig]="{ containerClass: 'theme-default' }"> | ||
<div class="input-group-append"> | ||
<span class="input-group-text" id="basic-addon2" (click)="dp.toggle()"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad id value
onPeriodChange(period) { | ||
this.form.is_period.setValue(period); | ||
if (period) { | ||
for (let i = 0; i < this.form.times.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it means this.form.times = []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it means count of time in times
} | ||
} | ||
|
||
onIsOpenChange(isopen) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed
} | ||
|
||
get title() { return this.form.title; } | ||
get is_period() { return this.form.is_period; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_period
=> isPeriod
, if you agree check all the code
|
||
sortExceptions() { | ||
this.exception_dates.sort(function(a, b) { | ||
const keyA = new Date(a.start_date); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moment can be used. Something like: return moment(a.start_date).substract(moment(b.start_date))
Co-Authored-by: Bertrand Zuchuat [email protected]
Co-Authored-by: Nicolas Labat <[email protected]
Signed-off-by: Peter Weber [email protected]
How to test:
Run the scripts
bootstrap
andsetup
The library "Bibliothèque cantonale valdôtaine, site de Pont-Saint-Martin"
has predefined exception dates.