Skip to content

Commit

Permalink
Merge pull request #108 from danielberkompas/cpj/fix_disabled_inputs
Browse files Browse the repository at this point in the history
Fix disabled inputs and prep for 2.0.0-rc2
  • Loading branch information
cpjolicoeur authored Sep 12, 2019
2 parents 7d32d6f + e496c9c commit 3acfcf2
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 906 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ torch-*.tar

.elixir_ls/*
node_modules/
.DS_Store
.DS_Store

.dir-locals.el
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: elixir
services:
- postgresql
cache:
directories:
- $HOME/.mix
Expand All @@ -7,4 +9,8 @@ elixir:
otp_release:
- 20.1
script:
- bin/setup
- bin/setup
before_script:
- psql -c 'create database example_test;' -U postgres
env:
- DATABASE_POSTGRESQL_USERNAME=postgres
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Change Log

## [v2.0.0-rc.2](https://github.com/danielberkompas/torch/tree/v2.0.0-rc.2) (2019-09-12)
[Full Changelog](https://github.com/danielberkompas/torch/compare/v2.0.0-rc.1...v2.0.0-rc.2)

**Enahancements:**

- Updated how the active navigation link is calculated [\#106](https://github.com/danielberkompas/torch/pull/106)
- Added test cases for the mix install task and views
- Added TravisCI integration

**Fixed bugs:**

- Fix issue where date inputs were disabled after a validation failure
- Fixed a typo in an alert dialog

**Closed issues:**

- Improve test coverage [\#85](https://github.com/danielberkompas/torch/issues/85)
- Improve documentation [\#86](https://github.com/danielberkompas/torch/issues/86)
- Install coveralls [\#88](https://github.com/danielberkompas/torch/issues/88)
- Filter by has_one association field [\#96](https://github.com/danielberkompas/torch/pull/96)
- Add I18N support [\#101](https://github.com/danielberkompas/torch/pull/101)

**Merged Pull Requests**

- Improve tests [\#87](https://github.com/danielberkompas/torch/pull/87)
- Install coveralls [\#88](https://github.com/danielberkompas/torch/pull/88)
- Modernize webpack [\#95](https://github.com/danielberkompas/torch/pull/95)
- Add custom has_many filter association example to README [\#97](https://github.com/danielberkompas/torch/pull/97)
- Add I18N support [\#102](https://github.com/danielberkompas/torch/pull/102)
- Set active nav link based on link target, not text [\#106](https://github.com/danielberkompas/torch/pull/106)

## [v2.0.0-rc.1](https://github.com/danielberkompas/torch/tree/v2.0.0-rc.1) (2018-04-13)
[Full Changelog](https://github.com/danielberkompas/torch/compare/v1.0.0-rc.6...v2.0.0-rc.1)

Expand Down Expand Up @@ -148,4 +179,4 @@
## [v0.1.0](https://github.com/danielberkompas/torch/tree/v0.1.0) (2016-06-27)


\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![Hex.pm](https://img.shields.io/hexpm/v/torch.svg)](https://hex.pm/packages/torch)
[![Build Status](https://travis-ci.org/danielberkompas/torch.svg?branch=master)](https://travis-ci.org/danielberkompas/torch)
[![Deps Status](https://beta.hexfaktor.org/badge/all/github/danielberkompas/torch.svg)](https://beta.hexfaktor.org/github/danielberkompas/torch)

<p align="center">
<img width="489" alt="phoenix_torch_logo" src="https://user-images.githubusercontent.com/7085617/37124853-ef17cec8-221e-11e8-97b9-bb6d13188500.png">
Expand Down Expand Up @@ -167,4 +166,4 @@ The base styles are basically bare bones, and the theme styles look like the scr
above. Just change the stylesheet link in the `torch.html.eex` layout.

If you want to use the theme, but override the colors, you'll need to include your
own stylesheet with the specific overrides.
own stylesheet with the specific overrides.
20 changes: 10 additions & 10 deletions assets/js/torch.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ window.onload = () => {
formFilters.addEventListener('submit', function (e) {
e.preventDefault()

let disableFields = false
let canSubmit = true

slice.call(this.querySelectorAll('.field'), 0).forEach((field) => {
let text = field.getElementsByTagName('label')[0].textContent
Expand All @@ -92,21 +92,21 @@ window.onload = () => {
if (start && end) {
if (start.value === '' && end.value !== '') {
window.alert(`Please select a start date for the ${text} field`)
disableFields = true
canSubmit = false
} else if (end.value === '' && start.value !== '') {
window.alert(`Please select a end at date for the ${text} field`)
disableFields = true
window.alert(`Please select an end at date for the ${text} field`)
canSubmit = false
}
}
})

slice.call(this.querySelectorAll('input, select'), 0).forEach((field) => {
if (field.value === '') {
field.disabled = true
}
})
if (canSubmit) {
slice.call(this.querySelectorAll('input, select'), 0).forEach((field) => {
if (field.value === '') {
field.disabled = true
}
})

if (!disableFields) {
e.target.submit()
}
})
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Torch.MixProject do

defp package do
[
maintainers: ["Mojotech"],
maintainers: ["MojoTech"],
licenses: ["MIT"],
links: %{
"Github" => "https://github.com/danielberkompas/torch"
Expand Down
234 changes: 2 additions & 232 deletions priv/static/base.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3acfcf2

Please sign in to comment.