Commit d7e6511a authored by hadi's avatar hadi
Browse files

Merge branch 'release/0.2.2' into develop

parents b5c30f0d 840f2962
Pipeline #8993323 passed with stage
in 7 minutes and 52 seconds
{
"name": "angular-material-weburger-common",
"version": "0.2.1",
"version": "0.2.2",
"authors": [
"Mostafa Barmshory <mostafa.barmshory@dpq.co.ir>",
"Hadi mansouri <mohammad.hadi.mansouri@dpq.co.ir>",
......@@ -19,7 +19,7 @@
"dist/angular-material-weburger-common.css"
],
"dependencies": {
"angular-material-weburger": "^0.2.0"
"angular-material-weburger": "^0.2.2"
},
"devDependencies": {
"angular-mocks": "^1.6.0"
......
......@@ -25,6 +25,41 @@
angular.module('ngMaterialWeburgerCommon', [ 'ngMaterialWeburger' ]);
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 weburger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
'use strict';
/**
*
*/
angular.module('ngMaterialWeburgerCommon')
.filter("trueOrUndefined", function() {
return function(value) {
var res = (value === true || value === 'true');
return res ? res : undefined;
};
});
/*
* The MIT License (MIT)
......@@ -66,6 +101,60 @@ angular.module('ngMaterialWeburgerCommon')
.addShape('wb-common-html', ' <path id="path2" d="M12,0C9.694,0,7.781,1.758,7.53,4L7.5,5c0,2.2,1.8,4,4,4h1h3h2l2-4h12l-1.961,3.921 C29.521,8.958,29.548,9,29.588,9h0.211H50.5V0H12z" style="fill:#EAD8BB;" /><path id="path4" d="M29.5,9v26.201c0,0.505-0.665,0.69-0.925,0.256L23.5,27l-5.075,8.458 c-0.26,0.433-0.925,0.249-0.925-0.256V9h-6c-2.2,0-4-1.8-4-4v48.958C7.5,56.19,9.31,58,11.542,58H50.5V9H29.5z" style="fill:#6B4842;" /><path id="path6" d="M12.5,9h-1c-2.2,0-4-1.8-4-4v48.958C7.5,56.19,9.31,58,11.542,58H12.5V9z" style="fill:#513531;" /><path id="path8" d="M50.5,2h-9c-0.553,0-1,0.447-1,1s0.447,1,1,1h9V2z" style="fill:#D3BEA1;" /><path id="path10" d="M50.5,5h-8c-0.553,0-1,0.447-1,1s0.447,1,1,1h8V5z" style="fill:#D3BEA1;" /><path id="path12" d="M19.5,5l-2,4v26.201c0,0.505,0.666,0.69,0.925,0.256L23.5,27l5.075,8.458 c0.26,0.433,0.925,0.249,0.925-0.256V9l2-4H19.5z" style="fill:#DD352E;" /><polygon id="polygon14" points="19.5,5 17.5,9 29.5,9 31.5,5 " style="fill:#B02721;" /> ')
;
}])
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 weburger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
'use strict';
/**
*
*/
angular.module('ngMaterialWeburgerCommon')
/**
*
*/
.controller('AmWbCommonAudioCtrl', function($scope, $rootScope, $wbUi) {
var ngModel = $scope.wbModel;
/*
* Listen model
*/
$scope.$watch('wbModel', function() {
if (angular.isDefined($scope.wbModel)) {
ngModel = $scope.wbModel;
if (!angular
.isDefined(ngModel.file)) {
ngModel.content = {};
ngModel.content.url = 'https://www.w3schools.com/html/mov_bbb.ogg';
ngModel.content.mimeType = 'audio/mpeg';
ngModel.setting = {};
ngModel.setting.autoplay = 'false';
ngModel.setting.controls = 'true';
ngModel.setting.preload = 'auto';
}
}
});
// Global functions
});
'use strict';
angular.module('ngMaterialWeburgerCommon')
......@@ -119,7 +208,7 @@ angular.module('ngMaterialWeburgerCommon')
/**
*
*/
.controller('AmWbCommonFeaturesCtrl', function($scope, $wbUi, $window) {
.controller('AmWbCommonFeaturesCtrl', function($scope, $wbUi, $window, $resource) {
var ngModel = $scope.wbModel;
function addFeature(){
......@@ -191,6 +280,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
......@@ -212,8 +314,64 @@ angular.module('ngMaterialWeburgerCommon')
$scope.moveUpFeature = moveUpFeature;
$scope.moveDownFeature = moveDownFeature;
$scope.runAction = runAction;
$scope.selectImage = selectImage;
});
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 weburger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
'use strict';
/**
*
*/
angular.module('ngMaterialWeburgerCommon')
/**
*
*/
.controller('AmWbCommonVideoCtrl', function($scope, $rootScope, $wbUi) {
var ngModel = $scope.wbModel;
/*
* Listen model
*/
$scope.$watch('wbModel', function() {
if (angular.isDefined($scope.wbModel)) {
ngModel = $scope.wbModel;
if (!angular.isDefined(ngModel.content)) {
ngModel.content = {};
ngModel.content.url = 'https://www.w3schools.com/html/mov_bbb.ogg';
ngModel.content.mimeType = 'video/ogg';
ngModel.setting = {};
ngModel.setting.autoplay = 'false';
ngModel.setting.controls = 'true';
ngModel.setting.preload = 'auto';
ngModel.setting.width = '90%';
ngModel.setting.height = '90%';
}
}
});
// Global functions
});
/*
* The MIT License (MIT)
*
......@@ -261,6 +419,20 @@ angular.module('ngMaterialWeburgerCommon')
icon : 'settings',
templateUrl : 'views/am-wb-common-settings/features.html'
});
$settings.newPage({
type: 'common-audio-player',
label : 'Audio Player',
description : 'Manage playing audio in the current widget.',
icon : 'settings',
templateUrl : 'views/am-wb-common-settings/audio-player.html'
});
$settings.newPage({
type: 'common-video-player',
label : 'Video Player',
description : 'Manage showing video in the current widget.',
icon : 'settings',
templateUrl : 'views/am-wb-common-settings/video-player.html'
});
});
/*
......@@ -347,13 +519,32 @@ angular.module('ngMaterialWeburgerCommon')
controller: 'AmWbCommonFeaturesCtrl',
setting:['description','common-features',],
});
$widget.newWidget({
type: 'CommonVideoPlayer',
templateUrl : 'views/am-wb-common-widgets/video-player.html',
label : 'Video Player',
description : 'A player to show video contents.',
help : 'https://gitlab.com/weburger/am-wb-common/wikis/video-player',
controller: 'AmWbCommonVideoCtrl',
setting:['common-video-player'],
});
$widget.newWidget({
type: 'CommonAudioPlayer',
templateUrl : 'views/am-wb-common-widgets/audio-player.html',
label : 'Audio Player',
description : 'A player to play audio contents.',
help : 'https://gitlab.com/weburger/am-wb-common/wikis/audio-player',
controller: 'AmWbCommonAudioCtrl',
setting:['common-audio-player'],
});
});
angular.module('ngMaterialWeburgerCommon').run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/am-wb-common-dialogs/feature.html',
"<md-dialog aria-label=\"Feature item config\" ng-cloak> <md-toolbar> <div class=md-toolbar-tools> <h2 translate>Feature list item</h2> <span flex></span> <md-button class=md-icon-button ng-click=cancel()> <wb-icon aria-label=\"Close dialog\">close</wb-icon> </md-button> </div> </md-toolbar> <md-dialog-content> <md-tabs md-dynamic-height md-border-bottom> <md-tab label=Context> <md-content layout=column> <md-input-container> <label translate>Image</label> <input ng-model=model.image> </md-input-container> <md-input-container> <label translate>Title</label> <input ng-model=model.title> </md-input-container> <md-input-container> <label translate>Text</label> <input ng-model=model.text> </md-input-container> </md-content> </md-tab> <md-tab label=Action> <md-content layout=column> <md-input-container> <label translate>Type</label> <input ng-model=model.action.type> </md-input-container> <md-input-container> <label translate>Link (URL)</label> <input ng-model=model.action.link> </md-input-container> <md-input-container> <label translate>Label</label> <input ng-model=model.action.label> </md-input-container> </md-content> </md-tab> </md-tabs> </md-dialog-content> </md-dialog>"
"<md-dialog aria-label=\"Feature item config\" ng-cloak> <md-toolbar> <div class=md-toolbar-tools> <h2 translate>Feature list item</h2> <span flex></span> <md-button class=md-icon-button ng-click=cancel()> <wb-icon aria-label=\"Close dialog\">close</wb-icon> </md-button> </div> </md-toolbar> <md-dialog-content> <md-tabs md-dynamic-height md-border-bottom> <md-tab label=Context> <md-content layout=column> <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> </md-input-container> <md-input-container> <label translate>Text</label> <input ng-model=model.text> </md-input-container> </md-content> </md-tab> <md-tab label=Action> <md-content layout=column> <md-input-container> <label translate>Type</label> <input ng-model=model.action.type> </md-input-container> <md-input-container> <label translate>Link (URL)</label> <input ng-model=model.action.link> </md-input-container> <md-input-container> <label translate>Label</label> <input ng-model=model.action.label> </md-input-container> </md-content> </md-tab> </md-tabs> </md-dialog-content> </md-dialog>"
);
......@@ -362,8 +553,26 @@ angular.module('ngMaterialWeburgerCommon').run(['$templateCache', function($temp
);
$templateCache.put('views/am-wb-common-settings/audio-player.html',
"<md-list class=wb-setting-panel> <wb-ui-setting-audio title=Source value=wbModel.content.url> </wb-ui-setting-audio> <md-input-container class=\"md-icon-float md-block\"> <label>Type</label> <input ng-model=wbModel.content.mimeType aria-label=\"MIME Type\"> </md-input-container> <wb-ui-setting-on-off-switch title=Autoplay? icon=play_arrow value=wbModel.setting.autoplay> </wb-ui-setting-on-off-switch> <wb-ui-setting-on-off-switch title=Controls? icon=swap_horiz value=wbModel.setting.controls> </wb-ui-setting-on-off-switch> <wb-ui-setting-on-off-switch title=Loop? icon=replay value=wbModel.setting.loop> </wb-ui-setting-on-off-switch> <wb-ui-setting-dropdown title=Preload icon=cached items=\"[\n" +
"\t\t\t\t{'title':'auto','value':'auto'},\n" +
"\t\t\t\t{'title':'metadata','value':'metadata'},\n" +
"\t\t\t\t{'title':'none','value':'none'}\n" +
"\t\t\t]\" value=wbModel.setting.preload> </wb-ui-setting-dropdown> </md-list>"
);
$templateCache.put('views/am-wb-common-settings/features.html',
"<div class=md-toolbar-tools> <span flex></span> <md-button ng-click=addFeature() class=md-icon-button aria-label=\"Add featrue\"> <wb-icon>add</wb-icon> </md-button> <md-button ng-click=removeAllFeatures() class=md-icon-button aria-label=\"Add featrue\"> <wb-icon>clear</wb-icon> </md-button> </div> <md-list> <md-list-item ng-repeat=\"feature in wbModel.features\" ng-click=\"editFeature(feature, $event)\" class=noright> <wb-icon>link</wb-icon> <p>{{ feature.title }}</p> <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 <wb-icon ng-show=\"$index>0\" ng-click=\"moveUpFeature(feature, $event)\" class=\"md-secondary md-hue-3\" aria-label=\"Move up\">wb-common-moveup <wb-icon class=md-secondary ng-click=\"removeFeature(feature, $event)\" aria-label=Chat>delete </wb-icon></wb-icon></wb-icon></md-list-item> </md-list>"
"<div class=md-toolbar-tools> <span flex></span> <md-button ng-click=addFeature() class=md-icon-button aria-label=\"Add featrue\"> <wb-icon>add</wb-icon> </md-button> <md-button ng-click=removeAllFeatures() class=md-icon-button aria-label=\"Add featrue\"> <wb-icon>clear</wb-icon> </md-button> </div> <md-list> <md-list-item ng-repeat=\"feature in wbModel.features\" ng-click=\"editFeature(feature, $event)\" class=noright> <img ng-src={{feature.image}} width=32px height=32px class=\"md-avatar-icon\"> <p>{{ feature.title }}</p> <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</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</wb-icon> <wb-icon class=md-secondary ng-click=\"removeFeature(feature, $event)\" 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>"
);
$templateCache.put('views/am-wb-common-settings/video-player.html',
"<md-list class=wb-setting-panel> <wb-ui-setting-video title=Source value=wbModel.content.url> </wb-ui-setting-video> <md-input-container class=\"md-icon-float md-block\"> <label>Type</label> <input ng-model=wbModel.content.mimeType aria-label=\"MIME Type\"> </md-input-container> <wb-ui-setting-image title=Poster value=wbModel.setting.poster> </wb-ui-setting-image> <wb-ui-setting-on-off-switch title=Autoplay? icon=play_arrow value=wbModel.setting.autoplay> </wb-ui-setting-on-off-switch> <wb-ui-setting-on-off-switch title=Controls? icon=swap_horiz value=wbModel.setting.controls> </wb-ui-setting-on-off-switch> <wb-ui-setting-on-off-switch title=Loop? icon=replay value=wbModel.setting.loop> </wb-ui-setting-on-off-switch> <wb-ui-setting-dropdown title=Preload icon=cached items=\"[\n" +
"\t\t\t\t{'title':'auto','value':'auto'},\n" +
"\t\t\t\t{'title':'metadata','value':'metadata'},\n" +
"\t\t\t\t{'title':'none','value':'none'}\n" +
"\t\t\t]\" value=wbModel.setting.preload> </wb-ui-setting-dropdown> </md-list>"
);
......@@ -372,6 +581,11 @@ angular.module('ngMaterialWeburgerCommon').run(['$templateCache', function($temp
);
$templateCache.put('views/am-wb-common-widgets/audio-player.html',
" <div layout=row layout-wrap layout-align=\"center center\"> <audio style=width:90% ng-attr-autoplay=\"{{wbModel.setting.autoplay | trueOrUndefined}}\" ng-attr-controls=\"{{wbModel.setting.controls | trueOrUndefined}}\" ng-attr-loop=\"{{wbModel.setting.loop | trueOrUndefined}}\" poster=images/wallpaper.jpg preload={{wbModel.setting.preload}}> <source src={{wbModel.content.url}} type=\"{{wbModel.content.mimeType}}\"> Your browser does not support the video tag. It seems your browser is too old! </audio> </div>"
);
$templateCache.put('views/am-wb-common-widgets/feature-links.html',
" <div layout=column> <div ng-repeat=\"link in wbModel.features\"> <md-button class=md-primary ng-click=runAction(link) ng-href={{link.action.link}}> <md-icon ng-if=link.action.icon>{{link.icon}}</md-icon> {{link.title}} </md-button> <md-button ng-if=wbEditable class=md-icon-button ng-click=editFeature(link)> <md-icon ng-style=\"{ 'color': wbModel.style.color }\">edit</md-icon> </md-button> <md-button ng-if=wbEditable class=md-icon-button ng-click=deleteFeature(link)> <md-icon ng-style=\"{ 'color': wbModel.style.color }\">delete</md-icon> </md-button> </div> <div> <md-button ng-if=wbEditable aria-label=\"add feature\" ng-click=addFeature(wbModel)> <md-icon ng-style=\"{ 'color': wbModel.style.color }\">add</md-icon> </md-button> </div> </div>"
);
......@@ -391,4 +605,9 @@ angular.module('ngMaterialWeburgerCommon').run(['$templateCache', function($temp
"<md-toolbar layout=row layout-align=\"center center\"> <md-truncate ng-if=wbModel.label> {{ wbModel.label }}</md-truncate> <md-button hide show-gt-md ng-repeat=\"feature in wbModel.features | limitTo: 8\" aria-label=menu ng-click=\"toggleSidenav('mainSidenav')\" class=md-icon-button> <wb-icon>{{ feature.image }}</wb-icon> </md-button> <span flex></span> <md-menu ng-show=wbModel.features> <md-button aria-label=\"Open demo menu\" class=md-icon-button ng-click=$mdMenu.open($event)> <wb-icon>more_vert</wb-icon> </md-button> <md-menu-content> <md-menu-item ng-repeat=\"feature in wbModel.features\"> <md-button show-gt-md aria-label=menu ng-click=runAction(feature)> <wb-icon>{{ feature.image }}</wb-icon> {{ feature.title }} </md-button> </md-menu-item> </md-menu-content> </md-menu> </md-toolbar>"
);
$templateCache.put('views/am-wb-common-widgets/video-player.html',
" <div layout=row layout-wrap layout-align=\"center center\"> <video width={{wbModel.setting.width}} height={{wbModel.setting.height}} ng-attr-autoplay=\"{{wbModel.setting.autoplay | trueOrUndefined}}\" ng-attr-controls=\"{{wbModel.setting.controls | trueOrUndefined}}\" ng-attr-loop=\"{{wbModel.setting.loop | trueOrUndefined}}\" poster={{wbModel.setting.poster}} preload={{wbModel.setting.preload}}> <source src={{wbModel.content.url}} type=\"{{wbModel.content.mimeType}}\"> Your browser does not support the video tag. It seems your browser is too old! </video> </div>"
);
}]);
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