-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove photo button in attachments (#76)
* remove photo button in attachments * fix device test * fix tests. Add documentation
- Loading branch information
1 parent
fba63bc
commit 0c14c5f
Showing
14 changed files
with
79 additions
and
67 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
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
76 changes: 37 additions & 39 deletions
76
app/packs/src/decidim/reporting_proposals/user_camera_inputs.js
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,49 +1,47 @@ | ||
$(() => { | ||
$('input[type="file"]').each((_i, el) => { | ||
const $input = $(el); | ||
const $inputField = $input.closest(".row.column"); | ||
const $button = $inputField.find("button:first"); | ||
const $checkbox = $inputField.find("input:checkbox[name$='[has_no_image]']"); | ||
const $formError = $inputField.find("span.form-error") | ||
const $labelInput = $("label[for='proposal_add_photos']") | ||
const $input = $("#proposal_add_photos"); | ||
const $inputField = $input.closest(".row.column"); | ||
const $button = $inputField.find("button:first"); | ||
const $checkbox = $inputField.find("input:checkbox[name$='[has_no_image]']"); | ||
const $formError = $inputField.find("span.form-error") | ||
const $labelInput = $("label[for='proposal_add_photos']") | ||
|
||
const removeErrors = () => { | ||
$input.removeClass("is-invalid-input"); | ||
$formError.removeClass("is-visible"); | ||
$labelInput.removeClass("is-invalid-label"); | ||
}; | ||
const removeErrors = () => { | ||
$input.removeClass("is-invalid-input"); | ||
$formError.removeClass("is-visible"); | ||
$labelInput.removeClass("is-invalid-label"); | ||
}; | ||
|
||
const toggleInput = () => { | ||
if ($checkbox[0].checked) { | ||
removeErrors(); | ||
$input.prop("disabled", true); | ||
$button.prop("disabled", true); | ||
} else { | ||
$input.prop("disabled", false); | ||
$button.prop("disabled", false); | ||
} | ||
const toggleInput = () => { | ||
if ($checkbox[0].checked) { | ||
removeErrors(); | ||
$input.prop("disabled", true); | ||
$button.prop("disabled", true); | ||
} else { | ||
$input.prop("disabled", false); | ||
$button.prop("disabled", false); | ||
} | ||
} | ||
|
||
$input.attr("accept", "image/*"); | ||
$input.attr("accept", "image/*"); | ||
|
||
$button.on("click", () => { | ||
console.log("click button") | ||
$input.attr("capture", "camera"); | ||
$input.click(); | ||
$input.removeAttr("capture", "camera"); | ||
}); | ||
$button.on("click", () => { | ||
console.log("click button") | ||
$input.attr("capture", "camera"); | ||
$input.click(); | ||
$input.removeAttr("capture", "camera"); | ||
}); | ||
|
||
$input.on("click", () => { | ||
console.log("click", $input); | ||
$input.one("blur", () => { | ||
console.log("blur", $input); | ||
removeErrors(); | ||
}); | ||
$input.on("click", () => { | ||
console.log("click", $input); | ||
$input.one("blur", () => { | ||
console.log("blur", $input); | ||
removeErrors(); | ||
}); | ||
|
||
if ($checkbox.length > 0) { | ||
$checkbox.on("change", toggleInput); | ||
toggleInput(); | ||
} | ||
}); | ||
|
||
if ($checkbox.length > 0) { | ||
$checkbox.on("change", toggleInput); | ||
toggleInput(); | ||
} | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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