Skip to content

Commit

Permalink
Display and edit Event Name #12, Display and edit Event Visibility #25
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorwolf committed Oct 31, 2016
1 parent 9e96e5f commit b133194
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
16 changes: 14 additions & 2 deletions webapp/controller/CreateEntity.controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
sap.ui.define([
"com/sap/sapmentors/sitreg/events/controller/BaseController",
"sap/ui/model/json/JSONModel",
"com/sap/sapmentors/sitreg/events/model/formatter",
"sap/m/MessageBox"

], function(BaseController, JSONModel, MessageBox) {
], function(BaseController, JSONModel, formatter, MessageBox) {
"use strict";

return BaseController.extend("com.sap.sapmentors.sitreg.events.controller.CreateEntity", {

formatter: formatter,

_oBinding: {},

Expand Down Expand Up @@ -53,8 +56,17 @@ sap.ui.define([
*/
onSave: function() {
var that = this,
oModel = this.getModel();
oModel = this.getModel(),
oView = this.getView();

var oContext = oView.getBindingContext();
var sPathVisible = oContext.getPath() + "/Visible";
var bVisible = oView.byId("Visible_id").getState();
if(bVisible) {
oModel.setProperty(sPathVisible, "Y");
} else {
oModel.setProperty(sPathVisible, "N");
}
// abort if the model has not been changed
if (!oModel.hasPendingChanges()) {
MessageBox.information(
Expand Down
13 changes: 12 additions & 1 deletion webapp/view/CreateEntity.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
enabled="{= ${viewModel>/mode} === 'edit'? false: true}" visible="true"
value="{ path: 'ID', type: 'sap.ui.model.odata.type.Int32' , constraints:{ nullable:false } }"/>
<Label text="{i18n>Location}" required="false"/>
<Input name="Location" id="Location_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="true" visible="true"
<Input name="Location" id="Location_id" valueLiveUpdate="true"
liveChange="_validateSaveEnablement" enabled="true" visible="true"
value="{ path: 'Location', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:100 } }"/>
<Label text="{i18n>Description}" required="false"/>
<Input name="Description" id="Description_id" valueLiveUpdate="true"
liveChange="_validateSaveEnablement" enabled="true" visible="true"
value="{ path: 'Description', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:100 } }"/>
<Label text="{i18n>EventDate}" required="false"/>
<DatePicker name="EventDate" value="{ path: 'EventDate', type: 'sap.ui.model.type.Date'}" id="EventDate_id" enabled="true"
visible="true" valueFormat="yyyy-MM-dd" displayFormat="long"/>
Expand All @@ -29,6 +34,12 @@
<Label text="{i18n>HomepageURL}" required="false"/>
<Input name="HomepageURL" id="HomepageURL_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="true" visible="true"
value="{ path: 'HomepageURL', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:256 } }"/>
<Label text="{i18n>Visible}" required="false"/>
<Switch
id="Visible_id"
state="{= ${Visible} === 'Y' ? true : false }"
customTextOn="Yes"
customTextOff="No"/>
</f:content>
</f:SimpleForm>
</semantic:content>
Expand Down
6 changes: 4 additions & 2 deletions webapp/view/Detail.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
busyIndicatorDelay="{detailView>/delay}">
<semantic:content>
<ObjectHeader id="objectHeader"
title="{Location}"
title="{Description}"
numberUnit="{i18n>detailEventID}: {ID}"
number="{ path: 'EventDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }" />
number="{ path: 'EventDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }">
<ObjectAttribute text="{Location}" />
</ObjectHeader>
<IconTabBar id="iconTabBar" class="sapUiResponsiveContentPadding">
<items>
<IconTabFilter id="iconTabBarFilter1"
Expand Down
4 changes: 4 additions & 0 deletions webapp/view/EventForm.fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<Text text="{History.ChangedBy}"/>
<Label text="{i18n>HistoryChangedAt}"/>
<Text text="{ path: 'History.ChangedAt', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }"/>
<Label text="{i18n>Visible}" required="false"/>
<Switch state="{= ${Visible} === 'Y' ? true : false }"
customTextOn="Yes"
customTextOff="No"/>
<Label text="{i18n>EventChangeable}"/>
<Text text="{EventChangeable/Changeable}"/>
</f:content>
Expand Down

0 comments on commit b133194

Please sign in to comment.