-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
114 additions
and
7 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
36 changes: 36 additions & 0 deletions
36
src/main/java/com/viglet/shiohara/widget/ShHiddenWidget.java
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,36 @@ | ||
package com.viglet.shiohara.widget; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.json.JSONObject; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.thymeleaf.context.Context; | ||
import org.thymeleaf.spring5.SpringTemplateEngine; | ||
|
||
import com.viglet.shiohara.persistence.model.post.type.ShPostTypeAttr; | ||
|
||
@Component | ||
public class ShHiddenWidget implements ShWidgetImplementation { | ||
@Autowired | ||
private SpringTemplateEngine templateEngine; | ||
|
||
public String render(ShPostTypeAttr shPostTypeAttr) { | ||
|
||
String widgetSettings = shPostTypeAttr.getWidgetSettings(); | ||
JSONObject settings = new JSONObject(widgetSettings); | ||
String defaultValue = settings.getString("defaultValue"); | ||
|
||
final Context ctx = new Context(); | ||
ctx.setVariable("shPostTypeAttr", shPostTypeAttr); | ||
ctx.setVariable("defaultValue", defaultValue); | ||
|
||
return templateEngine.process("widget/hidden/hidden-widget", ctx); | ||
} | ||
|
||
@Override | ||
public boolean validateForm(HttpServletRequest request, ShPostTypeAttr shPostTypeAttr) { | ||
// TODO Auto-generated method stub | ||
return true; | ||
} | ||
} |
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
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 @@ | ||
<input type='hidden' ng-model="shPostAttr.strValue"></input> |
10 changes: 10 additions & 0 deletions
10
src/main/resources/public/template/widget/hidden/setting/hidden-setting.html
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,10 @@ | ||
<table class="table" style="margin: 0px;"> | ||
<tr> | ||
<td style="background: #F9F9F9; width: 20%;"> | ||
<p> | ||
<b>Default Value</b> | ||
</p> | ||
</td> | ||
<td><input type="text" class="form-control" ng-model="shPostTypeAttr.widgetSettingsObject.defaultValue"></td> | ||
</tr> | ||
</table> |
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 @@ | ||
<input type="hidden" th:name="${'__sh-post-type-attr-' + shPostTypeAttr.name}" th:value="${defaultValue}"> |
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