Skip to content

Commit

Permalink
Fix paths to node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
zberkom committed Nov 11, 2016
1 parent 27c4bbd commit 1028e9a
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 14 deletions.
3 changes: 1 addition & 2 deletions brunch-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ exports.config = {

plugins: {
sass: {
mode: 'native',
includePaths: ['node_modules']
mode: 'native'
},
cleancss: {
keepSpecialComments: 0,
Expand Down
8 changes: 4 additions & 4 deletions lib/torch/views/filter_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ defmodule Torch.FilterView do
field = to_string(field)
{:safe, start} =
date_input("#{prefix}[#{field}_between][start]",
get_in(params, [prefix, "#{field}_between", "start"]))
get_in(params, [prefix, "#{field}_between", "start"]), "start")
{:safe, ending} =
date_input("#{prefix}[#{field}_between][end]",
get_in(params, [prefix, "#{field}_between", "end"]))
get_in(params, [prefix, "#{field}_between", "end"]), "end")
raw(start <> ending)
end

Expand All @@ -99,8 +99,8 @@ defmodule Torch.FilterView do
select(prefix, "#{field}_equals", [{"True", true}, {"False", false}], value: value, prompt: "Choose one")
end

defp date_input(name, value) do
tag :input, type: "text", class: "datepicker", name: name, value: value
defp date_input(name, value, class) do
tag :input, type: "text", class: "datepicker #{class}", name: name, value: value
end

defp find_param(params, pattern) do
Expand Down
2 changes: 1 addition & 1 deletion priv/static/torch.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions priv/static/torch.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/static/css/base/_grid-settings.sass
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../../../../../node_modules/bourbon-neat/app/assets/stylesheets/neat-helpers"
@import "./node_modules/bourbon-neat/app/assets/stylesheets/neat-helpers"

$torch-grid-columns : 12 !default
$torch-gutter : 30px !default
Expand Down
6 changes: 3 additions & 3 deletions web/static/css/torch.sass
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "../../../../bourbon/app/assets/stylesheets/bourbon"
@import "../../../../bourbon-neat/app/assets/stylesheets/neat"
@import "../../../../pikaday/scss/pikaday.scss"
@import "./node_modules/bourbon/app/assets/stylesheets/bourbon"
@import "./node_modules/bourbon-neat/app/assets/stylesheets/neat"
@import "./node_modules/pikaday/scss/pikaday.scss"
@import "vendor/vendor"
@import "base/base"
@import "components/components"
Expand Down
19 changes: 18 additions & 1 deletion web/static/js/torch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ window.onload = () => {
/*
* Prevent empty fields from being submitted, since this breaks Filtrex.
*/

document.querySelector('form#filters').addEventListener('submit', function (e) {
e.preventDefault()

Expand All @@ -14,7 +15,23 @@ window.onload = () => {
}
})

e.target.submit()
slice.call(this.querySelectorAll('field'), 0).forEach((field) => {
let text = field.textContent
let start = field.getElements('.start')[0]
let end = field.getElements('.end')[0]

console.log(text)
console.log(start)
console.log(end)

if (start.value === '' && end.value !== '') {
alert(`Please select a start date for the ${text} field`)
} else if (end.value === '' && start.value !== '') {
alert(`Please select a end at date for the ${text} field`)
}
})

// e.target.submit()
})

slice.call(document.querySelectorAll('select.filter-type'), 0).forEach((field) => {
Expand Down

0 comments on commit 1028e9a

Please sign in to comment.