def jack(): app = Angular('jack') app.scripts += [ "https://maps.googleapis.com/maps/api/js?key=%s&v=3.exp&libraries=geometry" % current_app.config.get('GOOGLE_MAPS_API_KEY'), "https://cdn.firebase.com/js/client/2.2.6/firebase.js", "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js", ] app.setupFolder('/static/jack') return app.render()
def get_project(name, path=None): staticFilesUrl = current_app.config.get('API_URL') name = name.lower() # Try and find a project for this app? project = Project.query.filter( func.lower(Project.name) == name ).first() print(project) app = Angular(name) app.base = '/projects/%s/' % name app.styles = [ # Login + login templates. '%slogin/app.css' % staticFilesUrl, '%s%s/app.css' % (staticFilesUrl, name), ] app.scripts = [ # Include pieces from the app. '%s%s/app.js' % (staticFilesUrl, name), '%s%s/templates.js' % (staticFilesUrl, name), ] # TODO should look at dependencies and add all scripts for those too? app.scripts += [ # Login + login templates. '%slogin/app.js' % staticFilesUrl, '%slogin/templates.js' % staticFilesUrl, '%sjs/api.js' % staticFilesUrl, '%sjs/api-templates.js' % staticFilesUrl, ] # Handle project for f in project.css_files: app.styles.append(f.name) for f in project.js_files: app.scripts.append(f.name) if name in ['8i']: app.require = 'websites/8i/8i' app.scripts += [ '/static/js/three.js/84/three.min.js', '/static/js/three.js/OBJLoader.js', '/static/js/eighti/eighti.min.js', ] app.async_scripts = [ # TODO load the lib '/static/js/eighti/eighti.lib.js', ] return app.render()
def get_projects(): staticFilesUrl = current_app.config.get('API_URL') # Build a list of projects? app = Angular('projects') app.scripts = [ '%sprojects/app.js' % (staticFilesUrl), '%sprojects/templates.js' % (staticFilesUrl), # Add login and api js. '%slogin/app.js' % staticFilesUrl, '%slogin/templates.js' % staticFilesUrl, '%sjs/api.js' % staticFilesUrl, '%sjs/api-templates.js' % staticFilesUrl, ] app.styles = [ '%slogin/app.css' % staticFilesUrl, '%sprojects/app.css' % (staticFilesUrl), ] return app.render()
def web_director(): app = Angular('director') app.base = '/8i/web-director/' app.scripts = [ 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js', url_for('static', filename="js/three.min.js"), url_for('static', filename="js/three.js/DeviceOrientationControls.js"), url_for('static', filename='js/three.js/OBJLoader.js'), url_for('static', filename="8i/scene_player/8iscene.controls.js"), url_for('static', filename='8i/js/eighti/eighti.min.js'), url_for('static', filename='8i/js/eighti/dahparser.js'), url_for('static', filename='8i/scene_player/player2Service.js'), url_for('static', filename='8i/scene_player/skyBackground.js'), url_for('static', filename='8i/scene_player/OBJObject.js'), url_for('static', filename='8i/director/Director3dControls.js'), url_for('static', filename='8i/director/OBJHelper.js'), url_for('static', filename='8i/director/director.js'), ] app.styles = [ url_for('static', filename='8i/rfonts/SimpleLine/simple-line-icons.css'), url_for('static', filename='8i/director/director.css'), url_for('static', filename='8i/new_site/fonts.css'), ] return app.render()
def new_8i_site(page=None): app = Angular('8i') app.base = '/8i/new_site/' app.scripts = [ 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js', url_for('static', filename="js/three.min.js"), url_for('static', filename="js/three.js/OBJLoader.js"), url_for('static', filename='8i/new_site/8i.controls.js'), url_for('static', filename="js/three.js/DeviceOrientationControls.js"), url_for('static', filename='8i/js/eighti/eighti.min.js'), url_for('static', filename='8i/new_site/playerControls.js'), url_for('static', filename='8i/js/eighti/eighti.lib.js'), url_for('static', filename='8i/new_site/holo.js'), url_for('static', filename='8i/new_site/8iTemplate.js'), url_for('static', filename='8i/new_site/8i.js'), ] app.styles = [ url_for('static', filename='8i/new_site/8iTemplate.css'), url_for('static', filename='8i/new_site/main.css'), url_for('static', filename='8i/new_site/holo.css'), url_for('static', filename='8i/new_site/fonts.css'), ] return app.render()
def get(self, app_name, path=None): logger = current_app.logger if apps.get(app_name) is None: logger.info('Missing app for %s %s' % (app_name, path)) return abort(404) logger.info("loading app %s %s" % (app_name, path)) app = Angular(app_name) app.base = '/projects/%s/' % app_name if app_name == 'trail': # Need a better way than this? if current_app.config.get('ENV') != 'dev': # Enable sentry. app.sentry = True conf = apps.get(app_name) if conf: tags = conf.get('tags', []) extra_tags = request.args.get('tags') if extra_tags: extra_tags = ','.split(extra_tags) print(extra_tags) tags += extra_tags if 'gmaps' in tags: app.scripts += [gmaps()] for tag in tags: if tag in scripts: app.scripts += scripts[tag] if tag in styles: app.styles += styles[tag] app.title = conf.get('title', app_name) for s in conf.get('scripts', []): app.scripts.append(s + "?v=" + app.version) app.styles += conf.get('styles', []) for t in conf.get('templates', []): app.addTemplate(t) if conf.get('img'): app.meta['image'] = '/static/img/projects/%s' % conf.get('img') # Add app files last? app_path = '/static/%s' % app_name # if path: # print("Path = %s and %s" % (app_path, path)) # This was adding /static/trail and login which made a bad path. # app_path += '/' + path logger.info("folder setup %s" % app_path) app.setupFolder(app_path) return app.render()
def login(): app = Angular('user') app.setupFolder('static/user') app.addLogin() return app.render()