001/* 002 * Stallion Core: A Modern Web Framework 003 * 004 * Copyright (C) 2015 - 2016 Stallion Software LLC. 005 * 006 * This program is free software: you can redistribute it and/or modify it under the terms of the 007 * GNU General Public License as published by the Free Software Foundation, either version 2 of 008 * the License, or (at your option) any later version. This program is distributed in the hope that 009 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 011 * License for more details. You should have received a copy of the GNU General Public License 012 * along with this program. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>. 013 * 014 * 015 * 016 */ 017 018package io.stallion.settings.childSections; 019 020import io.stallion.settings.SettingMeta; 021import io.stallion.settings.Settings; 022 023import static io.stallion.utils.Literals.*; 024 025 026public class StyleSettings implements SettingsSection { 027 @SettingMeta 028 private String logoImage; 029 030 @SettingMeta(val="#F9F9F9") 031 private String backgroundColor; 032 033 @SettingMeta(val="#FFFFFF") 034 private String mainBodyColor; 035 036 @SettingMeta(val="#333333") 037 private String highlightColor; 038 039 @SettingMeta(useField="highlightColor") 040 private String linkColor; 041 042 @SettingMeta(useField="highlightColor") 043 private String logoTextColor; 044 045 046 @SettingMeta(useField="highlightColor") 047 private String primaryButtonColor; 048 049 050 @SettingMeta(val="'Helvetica Neue', Helvetica, Arial, sans-serif") 051 private String headerFont; 052 053 @SettingMeta(val="'Helvetica Neue', Helvetica, Arial, sans-serif") 054 private String bodyFont; 055 056 @SettingMeta 057 private String customCss; 058 059 @SettingMeta 060 private String footer; 061 062 063 064 065 public String getLogoImageUrl() { 066 String url = getLogoImage(); 067 if (empty(url)) { 068 return url; 069 } 070 if (url.contains("{cdnUrl}")) { 071 url = url.replace("{cdnUrl}", Settings.instance().getCdnUrl()); 072 } 073 if (url.contains("{port}")) { 074 075 url = url.replace("{port}", Settings.instance().getPort().toString()); 076 } 077 if (!url.contains("//")) { 078 if (!url.startsWith("/")) { 079 url = "/st-assets/" + url; 080 } 081 } 082 if (!url.contains("://")) { 083 url = Settings.instance().getSiteUrl() + url; 084 } 085 086 return url; 087 } 088 089 public String getLogoImage() { 090 return logoImage; 091 } 092 093 public StyleSettings setLogoImage(String logoImage) { 094 this.logoImage = logoImage; 095 return this; 096 } 097 098 099 public String getBackgroundColor() { 100 return backgroundColor; 101 } 102 103 public StyleSettings setBackgroundColor(String backgroundColor) { 104 this.backgroundColor = backgroundColor; 105 return this; 106 } 107 108 public String getLogoTextColor() { 109 return logoTextColor; 110 } 111 112 public StyleSettings setLogoTextColor(String logoTextColor) { 113 this.logoTextColor = logoTextColor; 114 return this; 115 } 116 117 public String getMainBodyColor() { 118 return mainBodyColor; 119 } 120 121 public StyleSettings setMainBodyColor(String mainBodyColor) { 122 this.mainBodyColor = mainBodyColor; 123 return this; 124 } 125 126 public String getHighlightColor() { 127 return highlightColor; 128 } 129 130 public StyleSettings setHighlightColor(String highlightColor) { 131 this.highlightColor = highlightColor; 132 return this; 133 } 134 135 public String getLinkColor() { 136 return linkColor; 137 } 138 139 public StyleSettings setLinkColor(String linkColor) { 140 this.linkColor = linkColor; 141 return this; 142 } 143 144 public String getPrimaryButtonColor() { 145 return primaryButtonColor; 146 } 147 148 public StyleSettings setPrimaryButtonColor(String primaryButtonColor) { 149 this.primaryButtonColor = primaryButtonColor; 150 return this; 151 } 152 153 public String getHeaderFont() { 154 return headerFont; 155 } 156 157 public StyleSettings setHeaderFont(String headerFont) { 158 this.headerFont = headerFont; 159 return this; 160 } 161 162 public String getBodyFont() { 163 return bodyFont; 164 } 165 166 public StyleSettings setBodyFont(String bodyFont) { 167 this.bodyFont = bodyFont; 168 return this; 169 } 170 171 public String getCustomCss() { 172 return customCss; 173 } 174 175 public StyleSettings setCustomCss(String customCss) { 176 this.customCss = customCss; 177 return this; 178 } 179 180 public String getFooter() { 181 return footer; 182 } 183 184 public StyleSettings setFooter(String footer) { 185 this.footer = footer; 186 return this; 187 } 188}