Skip to content

Commit 7526a48

Browse files
rajatkhurana-adobeci-build
authored andcommitted
logic updated
1 parent ecff277 commit 7526a48

File tree

32 files changed

+1958
-2
lines changed

32 files changed

+1958
-2
lines changed

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ private FormConstants() {
6262
/** The resource type for file input v1 */
6363
public static final String RT_FD_FORM_FILE_INPUT_V1 = RT_FD_FORM_PREFIX + "fileinput/v1/fileinput";
6464

65+
/** The resource type for file input v2 */
66+
public static final String RT_FD_FORM_FILE_INPUT_V2 = RT_FD_FORM_PREFIX + "fileinput/v2/fileinput";
67+
6568
/** The resource type for check box group v1 */
6669
public static final String RT_FD_FORM_CHECKBOX_GROUP_V1 = RT_FD_FORM_PREFIX + "checkboxgroup/v1/checkboxgroup";
6770

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
* ~ Copyright 2023 Adobe
4+
* ~
5+
* ~ Licensed under the Apache License, Version 2.0 (the "License");
6+
* ~ you may not use this file except in compliance with the License.
7+
* ~ You may obtain a copy of the License at
8+
* ~
9+
* ~ http://www.apache.org/licenses/LICENSE-2.0
10+
* ~
11+
* ~ Unless required by applicable law or agreed to in writing, software
12+
* ~ distributed under the License is distributed on an "AS IS" BASIS,
13+
* ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* ~ See the License for the specific language governing permissions and
15+
* ~ limitations under the License.
16+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
*/
18+
19+
package com.adobe.cq.forms.core.components.internal.models.v2.form;
20+
21+
import java.util.Map;
22+
23+
import org.apache.sling.api.SlingHttpServletRequest;
24+
import org.apache.sling.api.resource.Resource;
25+
import org.apache.sling.models.annotations.Default;
26+
import org.apache.sling.models.annotations.Exporter;
27+
import org.apache.sling.models.annotations.Model;
28+
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
29+
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
30+
import org.jetbrains.annotations.NotNull;
31+
32+
import com.adobe.cq.export.json.ComponentExporter;
33+
import com.adobe.cq.export.json.ExporterConstants;
34+
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
35+
import com.adobe.cq.forms.core.components.internal.models.v1.form.FileInputImpl;
36+
import com.adobe.cq.forms.core.components.models.form.FileInput;
37+
import com.fasterxml.jackson.annotation.JsonIgnore;
38+
39+
@Model(
40+
adaptables = { SlingHttpServletRequest.class, Resource.class },
41+
adapters = { FileInput.class,
42+
ComponentExporter.class },
43+
resourceType = { FormConstants.RT_FD_FORM_FILE_INPUT_V2 })
44+
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
45+
public class FileInputImplV2 extends FileInputImpl {
46+
47+
private static final String FILE_INPUT_DRAG_DROP_TEXT = "fileInputDragDropText";
48+
49+
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "fileInputDragDropText")
50+
@Default(values = FileInput.DEFAULT_FILE_DRAGDROP_TEXT)
51+
protected String fileInputDragDropText;
52+
53+
@JsonIgnore
54+
public String getFileInputDragDropText() {
55+
return fileInputDragDropText;
56+
}
57+
58+
@Override
59+
public @NotNull Map<String, Object> getProperties() {
60+
Map<String, Object> customProperties = super.getProperties();
61+
customProperties.put(FILE_INPUT_DRAG_DROP_TEXT, getFileInputDragDropText());
62+
return customProperties;
63+
}
64+
}

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FileInput.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
public interface FileInput extends Field, FileConstraint, ContainerConstraint {
2929
String DEFAULT_BUTTON_TEXT = "Attach";
3030

31+
String DEFAULT_FILE_DRAGDROP_TEXT = "Drag and Drop To Upload";
32+
3133
/**
3234
* Returns {@code true} if multiple files can be selected, {@code false} otherwise
3335
*

0 commit comments

Comments
 (0)