mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Handle custom css overrides as external stylesheets on slideshow.
This commit is contained in:
parent
b0c992f9cc
commit
85b3840ebb
|
@ -376,6 +376,24 @@ public class PitchController extends Controller {
|
||||||
|
|
||||||
} // offline action
|
} // offline action
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CustomCSS returns text/css overrides for a slideshow.
|
||||||
|
*/
|
||||||
|
public Result customCSS(String grs,
|
||||||
|
String user,
|
||||||
|
String repo,
|
||||||
|
String branch) {
|
||||||
|
|
||||||
|
PitchParams pp =
|
||||||
|
PitchParams.build(grsOnCall(grs), user, repo, branch);
|
||||||
|
Optional<SlideshowModel> ssmo = pitchService.cachedYAML(pp);
|
||||||
|
String customStyle = CUSTOM_CSS_NOT_FOUND;
|
||||||
|
if(ssmo.isPresent()) {
|
||||||
|
customStyle = ssmo.get().fetchThemeOverride();
|
||||||
|
}
|
||||||
|
return ok(customStyle).as("text/css");
|
||||||
|
} // customCss action
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gist generates and renders GitHub-Gist HTML for
|
* Gist generates and renders GitHub-Gist HTML for
|
||||||
* embedding within slideshows.
|
* embedding within slideshows.
|
||||||
|
@ -395,4 +413,7 @@ public class PitchController extends Controller {
|
||||||
"GitPitch Slideshow print service temporarily unavailable.";
|
"GitPitch Slideshow print service temporarily unavailable.";
|
||||||
private static final String PITCHME_OFFLINE_ERROR =
|
private static final String PITCHME_OFFLINE_ERROR =
|
||||||
"GitPitch Slideshow offline service temporarily unavailable.";
|
"GitPitch Slideshow offline service temporarily unavailable.";
|
||||||
|
|
||||||
|
private static final String CUSTOM_CSS_NOT_FOUND =
|
||||||
|
"// Custom CSS not found.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,17 @@ public class SlideshowModel {
|
||||||
return customCSS;
|
return customCSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return theme override css for slideshow.
|
||||||
|
*/
|
||||||
|
public String fetchThemeOverrideCSS() {
|
||||||
|
|
||||||
|
return com.gitpitch.controllers.routes.PitchController.customCSS(_pp.grs,
|
||||||
|
_pp.user,
|
||||||
|
_pp.repo,
|
||||||
|
_pp.branch).url();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return active theme font for slideshow.
|
* Return active theme font for slideshow.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,13 +19,9 @@
|
||||||
<link href="@deps.highlightjs(offline)/@ssm.fetchHighlightCSS()" rel="stylesheet" type="text/css"/>
|
<link href="@deps.highlightjs(offline)/@ssm.fetchHighlightCSS()" rel="stylesheet" type="text/css"/>
|
||||||
<link href="@deps.octicons(offline)/octicons.css" rel="stylesheet" type="text/css"/>
|
<link href="@deps.octicons(offline)/octicons.css" rel="stylesheet" type="text/css"/>
|
||||||
<link href="@deps.fontawesome(offline)/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
|
<link href="@deps.fontawesome(offline)/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
|
||||||
|
|
||||||
@SlideshowStyle()
|
@SlideshowStyle()
|
||||||
|
|
||||||
@if(ssm.hasThemeOverride()) {
|
@if(ssm.hasThemeOverride()) {
|
||||||
<style>
|
<link href="@ssm.fetchThemeOverrideCSS()" rel="stylesheet" type="text/css"/>
|
||||||
@ssm.fetchThemeOverride()
|
|
||||||
</style>
|
|
||||||
}
|
}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -20,6 +20,9 @@ GET /pitchme/offline/:grs/:user/:repo/:b/:t/PITCHME.zip com.gitpitch.cont
|
||||||
# Handle GitHub OAuth Callback
|
# Handle GitHub OAuth Callback
|
||||||
# GET /pitchme/authorized com.gitpitch.controllers.AuthController.authorized(code:String ?= null, state:String ?= null)
|
# GET /pitchme/authorized com.gitpitch.controllers.AuthController.authorized(code:String ?= null, state:String ?= null)
|
||||||
|
|
||||||
|
# Serve PITCHME.css custom theme styling.
|
||||||
|
GET /pitchme/custom-css/:grs/:user/:repo/:b/PITCHME.css com.gitpitch.controllers.PitchController.customCSS(grs:String, user:String, repo:String, b:String)
|
||||||
|
|
||||||
# Serve PITCHME.md markdown.
|
# Serve PITCHME.md markdown.
|
||||||
GET /pitchme/markdown/:grs/:user/:repo/:b/PITCHME.md com.gitpitch.controllers.PitchController.markdown(grs:String, user:String, repo:String, b:String)
|
GET /pitchme/markdown/:grs/:user/:repo/:b/PITCHME.md com.gitpitch.controllers.PitchController.markdown(grs:String, user:String, repo:String, b:String)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user