mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-03-09 23:38:54 +00:00
Initial Commit
This commit is contained in:
commit
c92f737237
273 changed files with 16964 additions and 0 deletions
48
client/app/services/editor/editor.service.js
Normal file
48
client/app/services/editor/editor.service.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
const angular = require('angular');
|
||||
|
||||
/*@ngInject*/
|
||||
export function editorService() {
|
||||
// Service logic
|
||||
// ...
|
||||
|
||||
var ui_ace_doctype_map = {
|
||||
'': 'ini',
|
||||
'txt': 'text',
|
||||
'text': 'text',
|
||||
'yml': 'yaml',
|
||||
'yaml': 'yaml',
|
||||
'json': 'json',
|
||||
'md': 'markdown',
|
||||
'html': 'html',
|
||||
'py': 'python',
|
||||
'j2': 'ini'
|
||||
};
|
||||
|
||||
var setContentAndType = function (data, file, selectedFile) {
|
||||
if (typeof data == 'object') {
|
||||
selectedFile.content = JSON.stringify(data, null, '\t');
|
||||
} else {
|
||||
selectedFile.content = data;
|
||||
}
|
||||
|
||||
selectedFile.docType = ui_ace_doctype_map[file.extension.replace('.', '')];
|
||||
selectedFile.showSource = true;
|
||||
|
||||
if (selectedFile.docType == 'markdown') {
|
||||
selectedFile.markdownContent = selectedFile.content;
|
||||
selectedFile.showSource = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Public API here
|
||||
return {
|
||||
ui_ace_doctype_map: ui_ace_doctype_map,
|
||||
setContentAndType: setContentAndType
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export default angular.module('webAppApp.editor', [])
|
||||
.factory('editor', editorService)
|
||||
.name;
|
16
client/app/services/editor/editor.service.spec.js
Normal file
16
client/app/services/editor/editor.service.spec.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
describe('Service: editor', function() {
|
||||
// load the service's module
|
||||
beforeEach(module('webAppApp.editor'));
|
||||
|
||||
// instantiate service
|
||||
var editor;
|
||||
beforeEach(inject(function(_editor_) {
|
||||
editor = _editor_;
|
||||
}));
|
||||
|
||||
it('should do something', function() {
|
||||
expect(!!editor).to.be.true;
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue