Create seperate directive

This commit is contained in:
Ian Minoso 2016-10-14 11:40:13 -04:00
parent 6d375e33bf
commit 67e466ee11
7 changed files with 37 additions and 20621 deletions

View file

@ -162,15 +162,6 @@ def render_page_template(name, route_data=None, **kwargs):
library_scripts = [] library_scripts = []
main_scripts = ['dist/quay-frontend.min.js'] main_scripts = ['dist/quay-frontend.min.js']
# TODO(Ian): Ordering of library script matters?
library_scripts.remove('lib/ngReact.min.js')
library_scripts.remove('lib/react.js')
library_scripts.remove('lib/react-dom.js')
library_scripts.append('lib/react.js')
library_scripts.append('lib/react-dom.js')
library_scripts.append('lib/ngReact.min.js')
use_cdn = app.config.get('USE_CDN', True) use_cdn = app.config.get('USE_CDN', True)
if request.args.get('use_cdn') is not None: if request.args.get('use_cdn') is not None:
use_cdn = request.args.get('use_cdn') == 'true' use_cdn = request.args.get('use_cdn') == 'true'

View file

@ -0,0 +1,21 @@
/**
* A react component implemented using the ngReact library
*/
var testComponent = React.createClass({
propTypes: {
prop1: React.PropTypes.string.isRequired,
prop2: React.PropTypes.string.isRequired
},
render: function() {
return React.DOM.span(null,
'This is a react component: ' + this.props.prop1 + ' ' + this.props.prop2
);
}
});
angular.module('quayPages')
.value('TestComponent', testComponent)
.directive('testComponent', function(reactDirective) {
return reactDirective(testComponent);
});

View file

@ -2,19 +2,6 @@
/** /**
* Repository view page. * Repository view page.
*/ */
var testComponent = React.createClass({
propTypes: {
prop1: React.PropTypes.string.isRequired,
prop2: React.PropTypes.string.isRequired
},
render: function() {
return React.DOM.span( null,
'This is a react component: ' + this.props.prop1 + ' ' + this.props.prop2
);
}
});
angular.module('quayPages') angular.module('quayPages')
.config(['pages', function(pages) { .config(['pages', function(pages) {
pages.create('repo-view', 'repo-view.html', RepoViewCtrl, { pages.create('repo-view', 'repo-view.html', RepoViewCtrl, {
@ -23,10 +10,6 @@
'description': 'Repository {{ namespace }}/{{ name }}' 'description': 'Repository {{ namespace }}/{{ name }}'
}); });
}]) }])
.value('TestComponent', testComponent)
.directive('testComponent', function(reactDirective) {
return reactDirective(testComponent);
});
function RepoViewCtrl($scope, $routeParams, $location, $timeout, ApiService, UserService, AngularPollChannel, ImageLoaderService, CookieService) { function RepoViewCtrl($scope, $routeParams, $location, $timeout, ApiService, UserService, AngularPollChannel, ImageLoaderService, CookieService) {
$scope.reactProps = { $scope.reactProps = {

16
static/lib/ngReact/react-min.js vendored Normal file

File diff suppressed because one or more lines are too long

20595
static/lib/react.js vendored

File diff suppressed because it is too large Load diff