-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from wearefuturegov/develop
TOP-203 regular schedules
- Loading branch information
Showing
23 changed files
with
1,943 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 28 additions & 28 deletions
56
app/assets/stylesheets/outpost-design-library/_errors.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
.error { | ||
padding: 25px; | ||
margin-bottom: 40px; | ||
background: transparentize($error, 0.9); | ||
border-left: 5px solid $error; | ||
|
||
.error{ | ||
padding: 25px; | ||
margin-bottom: 40px; | ||
background: transparentize($error, 0.9); | ||
border-left: 5px solid $error; | ||
@media screen and (min-width: $breakpoint-m) { | ||
margin-bottom: 50px; | ||
} | ||
|
||
@media screen and (min-width: $breakpoint-m) { | ||
margin-bottom: 50px; | ||
} | ||
|
||
&__title{ | ||
margin-top: 0px; | ||
margin-bottom: 20px; | ||
line-height: 1.1; | ||
} | ||
&__title { | ||
margin-top: 0px; | ||
margin-bottom: 0px; | ||
line-height: 1.1; | ||
} | ||
|
||
&__list { | ||
list-style: none; | ||
margin-bottom: 0px; | ||
padding-left: 0; | ||
&__list { | ||
list-style: none; | ||
margin-bottom: 0px; | ||
margin-top: 20px; | ||
padding-left: 0; | ||
|
||
li{ | ||
padding-left: 0; | ||
margin-bottom: 10px; | ||
} | ||
*{ | ||
@media screen and (min-width: $breakpoint-m) { | ||
font-size: 1.1rem; | ||
} | ||
} | ||
li { | ||
padding-left: 0; | ||
margin-bottom: 10px; | ||
} | ||
* { | ||
@media screen and (min-width: $breakpoint-m) { | ||
font-size: 1.1rem; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 40 additions & 35 deletions
75
app/assets/stylesheets/outpost-design-library/_repeaters.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
.repeater{ | ||
.repeater { | ||
&__panels { | ||
list-style: none; | ||
padding-left: 0px; | ||
margin-top: 0; | ||
} | ||
|
||
&__panels{ | ||
list-style: none; | ||
padding-left: 0px; | ||
margin-top: 0; | ||
} | ||
&__panel { | ||
background: $pale; | ||
border: 1px solid $grey4; | ||
position: relative; | ||
padding: 35px 25px; | ||
|
||
&__panel{ | ||
background: $pale; | ||
border: 1px solid $grey4; | ||
position: relative; | ||
padding: 35px 25px; | ||
&[hidden] { | ||
display: none; | ||
} | ||
|
||
&[hidden]{ | ||
display: none; | ||
} | ||
&--error { | ||
border-color: $error; | ||
// border-width: 5px; | ||
// background: transparentize($error, 0.9); | ||
} | ||
} | ||
|
||
&__closer{ | ||
cursor: pointer; | ||
font-size: 0; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
height: 37px; | ||
width: 37px; | ||
border: none; | ||
background: none; | ||
background-image: url(asset_path("clear.svg")); | ||
background-size: 32px; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
&__closer { | ||
cursor: pointer; | ||
font-size: 0; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
height: 37px; | ||
width: 37px; | ||
border: none; | ||
background: none; | ||
background-image: url(asset_path("clear.svg")); | ||
background-size: 32px; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
|
||
&:hover{ | ||
background-color: $grey4; | ||
} | ||
&:hover { | ||
background-color: $grey4; | ||
} | ||
|
||
&:focus{ | ||
outline: 3px solid $focus; | ||
} | ||
&:focus { | ||
outline: 3px solid $focus; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
module ServicePreprocessing | ||
extend ActiveSupport::Concern | ||
|
||
private | ||
|
||
# we do a lot of form processing this method is used to clean up the params hash before saving | ||
def preprocess_regular_schedules(params) | ||
|
||
if params['service']['regular_schedules_attributes'] | ||
params['service']['regular_schedules_attributes'].each do |key, schedule| | ||
if schedule['time_type'] == 'event_time' | ||
|
||
# if dtstart is present, use event_opens_at as opens_at and event_closes_at as closes_at | ||
if schedule['dtstart'].present? | ||
schedule['opens_at'] = schedule['event_opens_at'] if schedule['event_opens_at'].present? | ||
schedule['closes_at'] = schedule['event_closes_at'] if schedule['event_closes_at'].present? | ||
end | ||
|
||
# if its a repeated event, make sure the correct repeated event fields are present and formatted right | ||
if schedule['repeats'] | ||
# puts "Repeats #{schedule['repeats']}, #{schedule['freq']}" | ||
if schedule['freq'] == 'week' | ||
# uses byday only, joins byday array into a string | ||
schedule['byday'] = schedule['byday'].to_unsafe_h.values.reject(&:blank?).join(',') if schedule['byday'].present? | ||
%w[bymonthday byday_month].each do |key| | ||
schedule[key] = nil | ||
end | ||
elsif schedule['freq'] == 'month' | ||
# uses bymonthday, byday, byday_month and weekofmonth | ||
# form validation takes care of both being set | ||
schedule['byday'] = nil | ||
# set byday to the correct format | ||
if schedule['byday_month'].present? | ||
schedule['byday'] = schedule['byday_month'].map { |entry| "#{entry['occurrence']}#{entry['byday']}" }.join(',') | ||
end | ||
|
||
end | ||
end | ||
|
||
elsif schedule['time_type'] == 'opening_time' | ||
# if its an opening time we dont want dtstart, until or count coming through | ||
%w[dtstart until count repeats].each do |key| | ||
schedule[key] = nil | ||
end | ||
|
||
end | ||
|
||
|
||
# if its not a repeated event make sure the repeated event fields are empty | ||
if !schedule['repeats'] | ||
%w[interval freq byday bymonthday byday_month until count].each do |key| | ||
schedule[key] = nil | ||
end | ||
end | ||
|
||
# remove unpermitted fields | ||
%w[time_type event_opens_at event_closes_at repeats byday_month].each do |key| | ||
schedule.delete(key) | ||
end | ||
end | ||
end | ||
|
||
params | ||
end | ||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.