-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jkmarx/pass refinery intro config (#3132)
* Add new user config setting for intro paragraph. * Add intro paragraph to landing page. * Add markdown library. * Show intro paragraph. * Fix unit tests. * Add unit test. * Fix duplicate. * Correct default paragraph. * Fix another typo. * Empty string as default. * Adjust paragraph for clarity.
- Loading branch information
Showing
19 changed files
with
108 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Home Ctrl | ||
* @namespace HomeCtrl | ||
* @desc Main ctrl for the home view | ||
* @memberOf refineryApp.refineryHome | ||
*/ | ||
(function () { | ||
'use strict'; | ||
angular | ||
.module('refineryHome') | ||
.controller('HomeCtrl', HomeCtrl); | ||
|
||
HomeCtrl.$inject = ['MarkdownJS', '$window']; | ||
|
||
function HomeCtrl (MarkdownJS, $window) { | ||
var vm = this; | ||
|
||
vm.$onInit = function () { | ||
if ($window.djangoApp && $window.djangoApp.refineryIntro.length) { | ||
var introParagraphs = $window.djangoApp.refineryIntro.split(' '); | ||
vm.htmlIntros = []; | ||
for (var i = 0; i < introParagraphs.length; i++) { | ||
vm.htmlIntros[i] = MarkdownJS.toHTML(introParagraphs[i]); | ||
} | ||
} | ||
}; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
describe('Controller: Home Ctrl', function () { | ||
var ctrl; | ||
var markdown; | ||
var scope; | ||
var window; | ||
|
||
beforeEach(module('refineryApp')); | ||
beforeEach(module('refineryHome')); | ||
beforeEach(inject(function ( | ||
$controller, | ||
MarkdownJS, | ||
$rootScope, | ||
$window | ||
) { | ||
scope = $rootScope.$new(); | ||
ctrl = $controller('HomeCtrl', { | ||
$scope: scope | ||
}); | ||
markdown = MarkdownJS; | ||
window = $window; | ||
window.djangoApp = { | ||
refineryIntro: 'Test text for the refinery intro paragraph. Contact.' | ||
}; | ||
})); | ||
|
||
it('HomeCtrl ctrl should exist', function () { | ||
expect(ctrl).toBeDefined(); | ||
}); | ||
|
||
it('sets intro paragraph', function () { | ||
ctrl.$onInit(); | ||
expect(ctrl.htmlIntros[0]).toEqual( | ||
markdown.toHTML(window.djangoApp.refineryIntro.split(' ')[0]) | ||
); | ||
expect(ctrl.htmlIntros[1]).toEqual( | ||
markdown.toHTML(window.djangoApp.refineryIntro.split(' ')[1]) | ||
); | ||
}); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters