mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Support for PITCHME.yaml layout setting.
This commit is contained in:
parent
90aa721581
commit
dff755f869
|
@ -213,6 +213,20 @@ public class SlideshowModel {
|
|||
return PitchParams.isDarkTheme(fetchTheme());
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if "layout" in *-left.
|
||||
*/
|
||||
public boolean isLeftLayout() {
|
||||
return (_yOpts != null) ? _yOpts.isLeftLayout(params()) : false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if "layout" in *-right.
|
||||
*/
|
||||
public boolean isRightLayout() {
|
||||
return (_yOpts != null) ? _yOpts.isRightLayout(params()) : false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if "logo" defined in PITCHME.yaml.
|
||||
*/
|
||||
|
@ -305,8 +319,18 @@ public class SlideshowModel {
|
|||
* Return "vertical-center" defined in PITCHME.yaml.
|
||||
*/
|
||||
public boolean fetchVerticalCenter() {
|
||||
return (_yOpts != null) ?
|
||||
_yOpts.fetchVerticalCenter(params()) : true;
|
||||
|
||||
boolean vc = true;
|
||||
|
||||
if(_yOpts == null) {
|
||||
vc = true;
|
||||
} else
|
||||
if(_yOpts.isTopLayout(params())) {
|
||||
vc = false;
|
||||
} else {
|
||||
vc = _yOpts.fetchVerticalCenter(params());
|
||||
}
|
||||
return vc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -113,6 +113,27 @@ public final class YAMLOptions {
|
|||
return pp.isValidTheme(theme) ? theme : pp.theme;
|
||||
}
|
||||
|
||||
public String fetchLayout(PitchParams pp) {
|
||||
String layout = _yProps.get(LAYOUT_OPTION);
|
||||
return isValidLayout(layout) ? layout : DEFAULT_LAYOUT;
|
||||
}
|
||||
|
||||
private boolean isValidLayout(String layoutName) {
|
||||
return DEFAULT_LAYOUTS.contains(layoutName);
|
||||
}
|
||||
|
||||
public boolean isLeftLayout(PitchParams pp) {
|
||||
return fetchLayout(pp).contains(LEFT);
|
||||
}
|
||||
|
||||
public boolean isRightLayout(PitchParams pp) {
|
||||
return fetchLayout(pp).contains(RIGHT);
|
||||
}
|
||||
|
||||
public boolean isTopLayout(PitchParams pp) {
|
||||
return fetchLayout(pp).contains(TOP);
|
||||
}
|
||||
|
||||
public String fetchThemeCSS(PitchParams pp) {
|
||||
|
||||
return new StringBuffer(fetchTheme(pp)).append(DOT_CSS)
|
||||
|
@ -424,4 +445,12 @@ public final class YAMLOptions {
|
|||
"Accessible");
|
||||
private static final String ABS_HTTP = "http";
|
||||
private static final String DOT_CSS = ".css";
|
||||
|
||||
private static final String LAYOUT_OPTION = "layout";
|
||||
private static final String DEFAULT_LAYOUT = "center";
|
||||
private static final List<String> DEFAULT_LAYOUTS =
|
||||
Arrays.asList("center", "center-left", "center-right", "top", "top-left", "top-right");
|
||||
private static final String LEFT = "left";
|
||||
private static final String RIGHT = "right";
|
||||
private static final String TOP = "top";
|
||||
}
|
||||
|
|
|
@ -27,4 +27,24 @@
|
|||
color: gray !important;
|
||||
background-color: inherit !important;
|
||||
}
|
||||
@if(ssm.options() != null &&
|
||||
ssm.options().isLeftLayout(ssm.params())) {
|
||||
.reveal .slides {
|
||||
text-align: left;
|
||||
}
|
||||
.reveal .slides section>* {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
@if(ssm.options() != null &&
|
||||
ssm.options().isRightLayout(ssm.params())) {
|
||||
.reveal .slides {
|
||||
text-align: right;
|
||||
}
|
||||
.reveal .slides section>* {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue
Block a user