Improve detection of theme-specific JavaScript
This commit is contained in:
parent
6e627893a9
commit
100bec753f
|
@ -273,42 +273,49 @@
|
|||
- (NSString *) pageJavaScriptURL
|
||||
{
|
||||
WOComponent *page;
|
||||
NSString *theme, *filename;
|
||||
NSString *theme, *filename, *url;
|
||||
|
||||
url = nil;
|
||||
page = [context page];
|
||||
theme = [context objectForKey: @"theme"];
|
||||
if ([theme length])
|
||||
{
|
||||
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, NSStringFromClass([page class])];
|
||||
url = [self urlForResourceFilename: filename];
|
||||
}
|
||||
else
|
||||
if ([url length] == 0)
|
||||
{
|
||||
// No theme defined or no specific JavaScript for the theme; rollback to default JavaScript
|
||||
filename = [NSString stringWithFormat: @"js/%@.js", NSStringFromClass([page class])];
|
||||
url = [self urlForResourceFilename: filename];
|
||||
}
|
||||
NSLog(@"pageJavaScript => %@", filename);
|
||||
|
||||
return [self urlForResourceFilename: filename];
|
||||
return url;
|
||||
}
|
||||
|
||||
- (NSString *) productJavaScriptURL
|
||||
{
|
||||
WOComponent *page;
|
||||
NSString *theme, *filename;
|
||||
NSString *theme, *filename, *url;
|
||||
|
||||
url = nil;
|
||||
page = [context page];
|
||||
[context resourceLookupLanguages];
|
||||
theme = [context objectForKey: @"theme"];
|
||||
if ([theme length])
|
||||
{
|
||||
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, [page frameworkName]];
|
||||
url = [self urlForResourceFilename: filename];
|
||||
}
|
||||
else
|
||||
if ([url length] == 0)
|
||||
{
|
||||
filename = [NSString stringWithFormat: @"js/%@.js", [page frameworkName]];
|
||||
url = [self urlForResourceFilename: filename];
|
||||
}
|
||||
NSLog(@"productJavaScript => %@", filename);
|
||||
|
||||
return [self urlForResourceFilename: filename];
|
||||
return url;
|
||||
}
|
||||
|
||||
- (BOOL) hasPageSpecificJavaScript
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<p><var:string label:value="AboutBox" const:escapeHTML="NO"/></p>
|
||||
<img class="full-image" const:alt="Inverse" rsrc:src="img/inverse.png"/>
|
||||
<a class="button button-positive button-block button-clear" href="http://inverse.ca/" target="_new">inverse.ca</a>
|
||||
<a class="button button-small button-outline button-stable button-block" href="#" data-ng-href="{{ApplicationBaseURL}}"><var:string label:value="Desktop Version"/></a>
|
||||
<a data-ng-href="{{ApplicationBaseURL}}?theme=desktop" class="button button-small button-outline button-stable button-block"><var:string label:value="Desktop Version"/></a>
|
||||
</ion-content>
|
||||
</ion-side-menu>
|
||||
</ion-side-menus>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
$urlRouterProvider.otherwise('/app/login');
|
||||
})
|
||||
|
||||
.controller('AppCtrl', ['$scope', 'sgSettings', function(Settings, $scope) {
|
||||
.controller('AppCtrl', ['$scope', 'sgSettings', function($scope, Settings) {
|
||||
$scope.ApplicationBaseURL = Settings.baseURL;
|
||||
}])
|
||||
|
||||
|
|
Loading…
Reference in a new issue