Commit 62a60f75 authored by Mostafa Barmshory's avatar Mostafa Barmshory
Browse files

Update feature settings to support image editing.

parent d730b5db
Pipeline #8976435 passed with stage
in 10 minutes and 14 seconds
......@@ -29,7 +29,7 @@ angular.module('ngMaterialWeburgerCommon')
/**
*
*/
.controller('AmWbCommonFeaturesCtrl', function($scope, $wbUi, $window) {
.controller('AmWbCommonFeaturesCtrl', function($scope, $wbUi, $window, $resource) {
var ngModel = $scope.wbModel;
function addFeature(){
......@@ -101,6 +101,19 @@ angular.module('ngMaterialWeburgerCommon')
return;
}
}
/**
* Selects featrue image
*
* @param feature
* @returns
*/
function selectImage(feature) {
return $resource.get('image')//
.then(function(value){
feature.image = value;
});
}
/*
* Listen model
......@@ -122,4 +135,5 @@ angular.module('ngMaterialWeburgerCommon')
$scope.moveUpFeature = moveUpFeature;
$scope.moveDownFeature = moveDownFeature;
$scope.runAction = runAction;
$scope.selectImage = selectImage;
});
......@@ -17,10 +17,10 @@
<md-tab label="Context">
<md-content layout="column">
<!-- Submit form -->
<md-input-container>
<label translate>Image</label>
<input ng-model="model.image">
</md-input-container>
<wb-ui-setting-image
title="Image"
value="model.image">
</wb-ui-setting-image>
<md-input-container>
<label translate>Title</label>
<input ng-model="model.title">
......
......@@ -18,23 +18,30 @@
ng-repeat="feature in wbModel.features"
ng-click="editFeature(feature, $event)"
class="noright">
<wb-icon>link</wb-icon>
<img
ng-src="{{feature.image}}"
width="32px" height="32px"
class="md-avatar-icon"/>
<p>{{ feature.title }}</p>
<!-- <md-checkbox class="md-secondary" ng-model="person.selected"></md-checkbox> -->
<wb-icon
ng-show="$index<wbModel.features.length-1"
ng-click="moveDownFeature(feature, $event)"
class="md-secondary md-hue-3"
aria-label="Move up" >wb-common-movedown</wd-icon>
aria-label="Move up" >wb-common-movedown</wb-icon>
<wb-icon
ng-show="$index>0"
ng-click="moveUpFeature(feature, $event)"
class="md-secondary md-hue-3"
aria-label="Move up" >wb-common-moveup</wd-icon>
aria-label="Move up" >wb-common-moveup</wb-icon>
<wb-icon
class="md-secondary"
ng-click="removeFeature(feature, $event)"
aria-label="Chat">delete</wd-icon>
aria-label="Delete">delete</wb-icon>
<wb-icon
class="md-secondary"
ng-click="selectImage(feature)"
aria-label="Set image">add_a_photo</wb-icon>
</md-list-item>
</md-list>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment