Ariel Weinberger pushed to branch feature/CC-CHANNELMGR-1634 at cms-community / 
hippo-addon-channel-manager


Commits:
a762c750 by Ariel Weinberger at 2017-12-29T12:39:10+01:00
CHANNELMGR-1634 Insert name url fields in converted step 1

- - - - -
b670150c by Ariel Weinberger at 2017-12-29T12:51:02+01:00
CHANNELMGR-1634 Insert document type selection field, without error handling yet

- - - - -


4 changed files:

- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/nameUrlFields/nameUrlFields.component.js
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.html
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js


Changes:

=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/nameUrlFields/nameUrlFields.component.js
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/nameUrlFields/nameUrlFields.component.js
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/nameUrlFields/nameUrlFields.component.js
@@ -25,7 +25,6 @@ const nameUrlFieldsComponent = {
     locale: '<',
     nameField: '=',
     urlField: '=',
-    urlUpdate: '=',
   },
 };
 


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js
@@ -14,20 +14,49 @@
  * limitations under the License.
  */
 
+import { Observable } from 'rxjs';
+
 class RightSidePanelCtrl {
-  constructor() {
+  constructor(CreateContentService) {
     'ngInject';
 
+    this.CreateContentService = CreateContentService;
+
     this.isFullWidth = false;
+    this.urlUpdate = false;
+    this.documentType = null;
   }
 
   $onInit() {
-    console.log(this);
+    if (!this.options) {
+      throw new Error('Input "options" is required');
+    }
+
+    if (!this.options.templateQuery) {
+      throw new Error('Configuration option "templateQuery" is required');
+    }
+
+    
Observable.fromPromise(this.CreateContentService.getTemplateQuery(this.options.templateQuery)).subscribe(
+      (templateQuery) => 
this._onLoadDocumentTypes(templateQuery.documentTypes),
+      (error) => this._onErrorLoadingTemplateQuery(error)
+    );
   }
 
   setWidthState(state) {
     this.isFullWidth = state;
     this.onFullWidth({ state });
   }
+
+  _onLoadDocumentTypes(types) {
+    this.documentTypes = types;
+
+    if (this.documentTypes.length === 1) {
+      this.documentType = this.documentTypes[0].id;
+    }
+  }
+
+  _onErrorLoadingTemplateQuery(error) {
+    // TODO: implement
+  }
 }
 export default RightSidePanelCtrl;


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.html
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.html
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.html
@@ -36,4 +36,38 @@
       </md-button>
     </div>
   </md-toolbar>
+
+  <!-- Name and URL fields (as a separate component) -->
+  <name-url-fields name-field="$ctrl.nameField"
+                   url-field="$ctrl.urlField"
+                   url-update="$ctrl.urlUpdate"
+                   locale="$ctrl.locale">
+  </name-url-fields>
+
+  <md-select ng-model="$ctrl.documentType" name="documentType" required
+              placeholder="Document type" 
ng-disabled="$ctrl.documentTypes.length === 1"
+              class="input-document-type create-content-field 
qa-document-type-select"
+              ng-class="{ 'hide-select-arrow': documentTypes.length === 1 }">
+    <md-option ng-repeat="documentType in $ctrl.documentTypes"
+                value="{{ documentType.id }}">{{ documentType.displayName 
}}</md-option>
+  </md-select>
+
+  <!-- Footer -->
+  <md-toolbar>
+    <div class="md-toolbar-tools">
+      <span flex></span>
+
+      <md-button class="qa-close"
+                 ng-click="$ctrl.close()">
+        {{ 'CANCEL' | translate }}
+      </md-button>
+
+      <md-button class="qa-continue"
+                 ng-click="$ctrl.submit()"
+                 ng-disabled="true">
+        {{ 'CONTINUE' | translate }}
+      </md-button>
+    </div>
+  </md-toolbar>
+
 </div>


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/rightSidePanel.controller.js
@@ -154,7 +154,6 @@ class RightSidePanelCtrl {
   }
 
   setFullWidth(state) {
-    console.log('state', state);
     if (state === true) {
       this.$element.addClass('fullwidth');
       this.ChannelService.setToolbarDisplayed(false);



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/b4b4460e7bf1c0451dd3eb043446ef94a8b14f9d...b670150cf4ce4be5b67895199fb2da57fb73a9d8

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/b4b4460e7bf1c0451dd3eb043446ef94a8b14f9d...b670150cf4ce4be5b67895199fb2da57fb73a9d8
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to