Improve detection of theme-specific JavaScript
This commit is contained in:
parent
a70287870b
commit
c8ea3da5bc
|
@ -273,42 +273,49 @@
|
||||||
- (NSString *) pageJavaScriptURL
|
- (NSString *) pageJavaScriptURL
|
||||||
{
|
{
|
||||||
WOComponent *page;
|
WOComponent *page;
|
||||||
NSString *theme, *filename;
|
NSString *theme, *filename, *url;
|
||||||
|
|
||||||
|
url = nil;
|
||||||
page = [context page];
|
page = [context page];
|
||||||
theme = [context objectForKey: @"theme"];
|
theme = [context objectForKey: @"theme"];
|
||||||
if ([theme length])
|
if ([theme length])
|
||||||
{
|
{
|
||||||
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, NSStringFromClass([page class])];
|
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])];
|
filename = [NSString stringWithFormat: @"js/%@.js", NSStringFromClass([page class])];
|
||||||
|
url = [self urlForResourceFilename: filename];
|
||||||
}
|
}
|
||||||
NSLog(@"pageJavaScript => %@", filename);
|
NSLog(@"pageJavaScript => %@", filename);
|
||||||
|
|
||||||
return [self urlForResourceFilename: filename];
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) productJavaScriptURL
|
- (NSString *) productJavaScriptURL
|
||||||
{
|
{
|
||||||
WOComponent *page;
|
WOComponent *page;
|
||||||
NSString *theme, *filename;
|
NSString *theme, *filename, *url;
|
||||||
|
|
||||||
|
url = nil;
|
||||||
page = [context page];
|
page = [context page];
|
||||||
[context resourceLookupLanguages];
|
[context resourceLookupLanguages];
|
||||||
theme = [context objectForKey: @"theme"];
|
theme = [context objectForKey: @"theme"];
|
||||||
if ([theme length])
|
if ([theme length])
|
||||||
{
|
{
|
||||||
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, [page frameworkName]];
|
filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, [page frameworkName]];
|
||||||
|
url = [self urlForResourceFilename: filename];
|
||||||
}
|
}
|
||||||
else
|
if ([url length] == 0)
|
||||||
{
|
{
|
||||||
filename = [NSString stringWithFormat: @"js/%@.js", [page frameworkName]];
|
filename = [NSString stringWithFormat: @"js/%@.js", [page frameworkName]];
|
||||||
|
url = [self urlForResourceFilename: filename];
|
||||||
}
|
}
|
||||||
NSLog(@"productJavaScript => %@", filename);
|
NSLog(@"productJavaScript => %@", filename);
|
||||||
|
|
||||||
return [self urlForResourceFilename: filename];
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) hasPageSpecificJavaScript
|
- (BOOL) hasPageSpecificJavaScript
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<p><var:string label:value="AboutBox" const:escapeHTML="NO"/></p>
|
<p><var:string label:value="AboutBox" const:escapeHTML="NO"/></p>
|
||||||
<img class="full-image" const:alt="Inverse" rsrc:src="img/inverse.png"/>
|
<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-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-content>
|
||||||
</ion-side-menu>
|
</ion-side-menu>
|
||||||
</ion-side-menus>
|
</ion-side-menus>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
$urlRouterProvider.otherwise('/app/login');
|
$urlRouterProvider.otherwise('/app/login');
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('AppCtrl', ['$scope', 'sgSettings', function(Settings, $scope) {
|
.controller('AppCtrl', ['$scope', 'sgSettings', function($scope, Settings) {
|
||||||
$scope.ApplicationBaseURL = Settings.baseURL;
|
$scope.ApplicationBaseURL = Settings.baseURL;
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue