billy_cms 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1bd2fe688e2063e17a055b093f7689889ccf54ae
4
- data.tar.gz: e56b33bfaa311d9a8c21de6c4f3a3aec553e5969
3
+ metadata.gz: dc0d73ca7fa60d20059fdae6eac48d43e9a2eedc
4
+ data.tar.gz: 6f57aa43b042cf96b1fe6e9bc0b6d1f1f5ee9797
5
5
  SHA512:
6
- metadata.gz: 53d22f4150eae15af88babc99dece061da9fb66cd2244af3439ea8d3cd749156834b6ced5b142060c5fad7093cd2053793bd655f5e7bfee9220c0cf37632709e
7
- data.tar.gz: 48e5140891e499bff5be367bedacaa8651652e0b4f004b2cf0b522b95f1d53dac8dfcdf18773dfc1fccf9bc1173713087edeee99a2cb89518fee0088baf3493d
6
+ metadata.gz: 4f2e2f83dda8d78dc19aa59325b4d7f4bd27e98c02c37c80e1222ffec9a8805c59e072d73efe36237c516772fddbb4ec3af5d2d589ad74eb8f471877e311394e
7
+ data.tar.gz: 6bb6213c04a9a30e542131c0e9b0dec191ebec900c544923b8b2cfb1c2f991f038b5ca9e2b38e8f70cd5f1d01d46c526493541ffb43b1647e801e029c557f3ba
@@ -5,13 +5,13 @@ angular.module('BillyCmsBackend').controller('AttributesCtrl', ['$scope', '$http
5
5
 
6
6
  this.selectedTabIndex = 0;
7
7
 
8
- this.resetNewAttribute = function() {
9
- this.newAttribute = new AdditionalAttribute();
8
+ this.resetNewPageType = function() {
9
+ this.newPageType = new AdditionalAttribute();
10
10
  };
11
- this.resetNewAttribute();
11
+ this.resetNewPageType();
12
12
 
13
13
  this.createAttribute = function() {
14
- $http.post('/billy_cms/api/attributes.json', this.newAttribute)
14
+ $http.post('/billy_cms/api/attributes.json', this.newPageType)
15
15
  .then(function(result) {
16
16
  var attribute = new AdditionalAttribute(result.data.attribute);
17
17
  $scope.app.allAdditionalAttributes.push(attribute);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- window.angular.module('BillyCmsBackend').controller('PageTypesCtrl', ['$scope', function($scope) {
3
+ window.angular.module('BillyCmsBackend').controller('PageTypesCtrl', ['$scope', '$http', 'PageType', function($scope, $http, PageType) {
4
4
  var self = this;
5
5
  $scope.$watch(
6
6
  function() { return $scope.app.allPageTypes; },
@@ -35,6 +35,28 @@ window.angular.module('BillyCmsBackend').controller('PageTypesCtrl', ['$scope',
35
35
  });
36
36
  };
37
37
 
38
+ this.newPageType = new PageType({});
39
+
40
+ this.selectedTabIndex = 0;
41
+
42
+ this.resetNewPageType = function() {
43
+ this.newPageType = new PageType();
44
+ };
45
+ this.resetNewPageType();
46
+
47
+ this.createPageType = function() {
48
+ $http.post('/billy_cms/api/page_types.json', this.newPageType)
49
+ .then(function(result) {
50
+ var pageType = new PageType(result.data.page_type);
51
+ $scope.app.allPageTypes.push(pageType);
52
+
53
+ self.selectedTabIndex = 0;
54
+ })
55
+ .catch(function(err) {
56
+ alert(err);
57
+ })
58
+ };
59
+
38
60
  this.removeAttribute = function(attribute) {
39
61
  return this.selectedPageType.removeAdditionalAttribute(attribute).catch(function(err) {
40
62
  alert(err);
@@ -2,6 +2,7 @@
2
2
 
3
3
  angular.module('BillyCmsBackend').factory('PageType', ['AdditionalAttribute', '$http', function(AdditionalAttribute, $http) {
4
4
  var PageType = function(options) {
5
+ if (!options) { options = {} }
5
6
  this.applyOptions(options);
6
7
  };
7
8