Skip to content

Commit

Permalink
Eventedit pattern: Use more specific CSS selectors, so that switching…
Browse files Browse the repository at this point in the history
… whole_day on and off doesn't hide the publication date's time component. Refs: plone/plone.app.event#169 / Depend on newer  version.
  • Loading branch information
thet committed Nov 10, 2014
1 parent c3a5288 commit 8c93978
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Changelog
- File label cannot be used as path.
[ebrehault]

- Eventedit pattern: Use more specific CSS selectors, so that switching
whole_day on and off doesn't hide the publication date's time component.
Refs: https://github.com/plone/plone.app.event/pull/169
[thet]

- Depend on newer `mockup-core` version.
[thet]

- Fix tests to run within reorganized folder structure from 1.8.2.
[thet]

Expand Down
2 changes: 1 addition & 1 deletion mockup/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"jquery-form": "3.46.0",
"jquery.cookie": "1.4.1",
"lodash": "2.4.1",
"mockup-core": "1.2.12",
"mockup-core": "1.2.14",
"moment": "2.8.3",
"pickadate": "3.4.0",
"requirejs-text": "2.0.12",
Expand Down
38 changes: 25 additions & 13 deletions mockup/patterns/eventedit/pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define([
'jquery',
'mockup-patterns-base',
'mockup-patterns-pickadate',
], function ($, Base, pickadate, undefined) {
], function ($, Base, pickadate) {
'use strict';

var EventEdit = Base.extend({
Expand All @@ -82,19 +82,31 @@ define([
errorClass: 'error'
},
init: function () {
var self = this, $el = self.$el, jq_whole_day, jq_open_end, jq_end, jq_start;
var self = this, $el = self.$el, jq_open_end, jq_end, jq_start;

// WHOLE DAY INIT
jq_whole_day = self.aOrB(
$('#formfield-form-widgets-IEventBasic-whole_day input', $el),
$('#archetypes-fieldname-wholeDay input#wholeDay', $el)
);
if (jq_whole_day.length > 0) {
jq_whole_day.bind('change', function (e) {
self.showHideWidget($('.pattern-pickadate-time-wrapper', $el), e.target.checked, true);
});
self.showHideWidget($('.pattern-pickadate-time-wrapper', $el), jq_whole_day.get(0).checked, false);
}
$(document).on('scan-completed.registry.mockup-core', function(event) {
// Wait for the registry scan to be finished, because we depend on DOM
// structures from pickadate, which are not ready yet.
var jq_whole_day, jq_time;

jq_whole_day = self.aOrB(
$('#formfield-form-widgets-IEventBasic-whole_day input', $el),
$('#archetypes-fieldname-wholeDay input#wholeDay', $el)
);

jq_time = self.aOrB(
$('#formfield-form-widgets-IEventBasic-start .pattern-pickadate-time-wrapper, #formfield-form-widgets-IEventBasic-end .pattern-pickadate-time-wrapper', $el),
$('#archetypes-fieldname-startDate .pattern-pickadate-time-wrapper, #archetypes-fieldname-endDate .pattern-pickadate-time-wrapper', $el)
);

if (jq_whole_day.length > 0 && jq_time.length > 0) {
jq_whole_day.bind('change', function (e) {
self.showHideWidget(jq_time, e.target.checked, true);
});
self.showHideWidget(jq_time, jq_whole_day.get(0).checked, false);
}

});

// OPEN END INIT
jq_open_end = self.aOrB(
Expand Down

1 comment on commit 8c93978

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS PASSED
Mr.Roboto url : http://jenkins.plone.org/roboto/get_info?push=41e425ab68954fa898f7fbbd579b8171
plone-5.0-python-2.7 [SUCCESS]

Please sign in to comment.