ensure pikaday respects our color scheme

This commit is contained in:
Régis Hanol 2016-04-21 20:56:12 +02:00
parent ee7ef46b9e
commit ded03a1aa4
5 changed files with 62 additions and 38 deletions

View File

@ -9,11 +9,14 @@ export default Em.Component.extend({
@on("didInsertElement") @on("didInsertElement")
_loadDatePicker() { _loadDatePicker() {
const input = this.$(".date-picker")[0]; const input = this.$(".date-picker")[0];
const container = $("#" + this.get("containerId"))[0];
loadScript("/javascripts/pikaday.js").then(() => { loadScript("/javascripts/pikaday.js").then(() => {
Ember.run.next(() => {
let default_opts = { let default_opts = {
field: input, field: input,
container: this.$()[0], container: container || this.$()[0],
bound: container === undefined,
format: "YYYY-MM-DD", format: "YYYY-MM-DD",
firstDay: moment.localeData().firstDayOfWeek(), firstDay: moment.localeData().firstDayOfWeek(),
i18n: { i18n: {
@ -28,6 +31,7 @@ export default Em.Component.extend({
this._picker = new Pikaday(_.merge(default_opts, this._opts())); this._picker = new Pikaday(_.merge(default_opts, this._opts()));
}); });
});
}, },
@on("willDestroyElement") @on("willDestroyElement")

View File

@ -1 +1 @@
<input class="date-picker"> <input type="text" class="date-picker">

View File

@ -1,4 +1,4 @@
<div class="modal-body"> <div class="modal-body change-timestamp">
<p> <p>
{{i18n 'topic.change_timestamp.instructions'}} {{i18n 'topic.change_timestamp.instructions'}}
</p> </p>
@ -8,9 +8,11 @@
</p> </p>
<form> <form>
{{input type="date" value=date}} {{date-picker-past value=date containerId="date-container"}}
{{input type="time" value=time}} {{input type="time" value=time}}
</form> </form>
<div id="date-container" />
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View File

@ -196,3 +196,19 @@
width: 400px; width: 400px;
} }
} }
.change-timestamp {
min-height: 300px;
.date-picker {
width: 10em;
}
input[type=time] {
width: 6em;
}
form {
margin: 0;
}
}

View File

@ -1,3 +1,5 @@
@import "common/foundation/variables";
/*! /*!
* Pikaday * Pikaday
* Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/ * Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/
@ -8,24 +10,24 @@
// Variables are namespaced with the pd (pikaday) prefix // Variables are namespaced with the pd (pikaday) prefix
// Colours // Colours
$pd-text-color: #333 !default; $pd-text-color: $primary !default;
$pd-title-color: #333 !default; $pd-title-color: $primary !default;
$pd-title-bg: #fff !default; $pd-title-bg: $secondary !default;
$pd-picker-bg: #fff !default; $pd-picker-bg: $secondary !default;
$pd-picker-border: #ccc !default; $pd-picker-border: dark-light-diff($secondary, $primary, -20%, 20%) !default;
$pd-picker-border-bottom: #bbb !default; $pd-picker-border-bottom: dark-light-diff($secondary, $primary, -30%, 30%) !default;
$pd-picker-shadow: rgba(0,0,0,.5) !default; $pd-picker-shadow: rgba(0,0,0,.5) !default;
$pd-th-color: #999 !default; $pd-th-color: dark-light-diff($primary, $secondary, -20%, 20%) !default;
$pd-day-color: #666 !default; $pd-day-color: dark-light-diff($primary, $secondary, -30%, 30%) !default;
$pd-day-bg: #f5f5f5 !default; $pd-day-bg: dark-light-diff($primary, $secondary, 90%, -90%) !default;
$pd-day-hover-color: #fff !default; $pd-day-hover-color: $secondary !default;
$pd-day-hover-bg: #ff8000 !default; $pd-day-hover-bg: dark-light-diff($tertiary, $secondary, 30%, -30%) !default;
$pd-day-today-color: #33aaff !default; $pd-day-today-color: $tertiary !default;
$pd-day-selected-color: #fff !default; $pd-day-selected-color: $secondary !default;
$pd-day-selected-bg: #33aaff !default; $pd-day-selected-bg: $tertiary !default;
$pd-day-selected-shadow: #178fe5 !default; $pd-day-selected-shadow: dark-light-diff($tertiary, $secondary, 50%, -50%) !default;
$pd-day-disabled-color: #999 !default; $pd-day-disabled-color: dark-light-diff($primary, $secondary, -20%, 20%) !default;
$pd-week-color: #999 !default; $pd-week-color: dark-light-diff($primary, $secondary, -20%, 20%) !default;
// Font // Font
$pd-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !default; $pd-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !default;
@ -233,15 +235,15 @@ $pd-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !default;
} }
.is-startrange .pika-button { .is-startrange .pika-button {
color: #fff; color: $secondary;
background: #6CB31D; background: #6CB31D;
box-shadow: none; box-shadow: none;
border-radius: 3px; border-radius: 3px;
} }
.is-endrange .pika-button { .is-endrange .pika-button {
color: #fff; color: $secondary;
background: #33aaff; background: $tertiary;
box-shadow: none; box-shadow: none;
border-radius: 3px; border-radius: 3px;
} }