所以我有一个rails管理系统,允许用户选择一个主题,基本上是一组SASS颜色变量,它们将使用新颜色重新编译application.css.scss.当用户从下拉列表中选择并提交时,如何才能更改此更改?我读了一些关于缓存和重新编译的问题,但我并不完全清楚如何设置它.
目前我有..
application.css.scss
@import "themes/whatever_theme";
@import "common";
@import "reset";
@import "base";
Run Code Online (Sandbox Code Playgroud)
主题/ _whatever_theme
$theme_sprite_path: '/images/sprite_theme_name.png';
$main_color:#009DDD;
$secondary_color:#b3d929;
$light_background:#f2f2f2;
$border_line:#e6e6e6;
$off_white:#f9f9f9;
$white:#ffffff;
$font_body:#565b59;
$font_headers:#363a36;
Run Code Online (Sandbox Code Playgroud)
假设我有5个不同的主题,用户将在它们之间切换,为Rails中的每个主题设置变量名称然后将它们传递给SASS并动态更改并重新编译将会很不错.这是解决这个问题的最好方法吗?
我已经非常接近,但我很难理解如何将多个用户提交的表单复选框值传递给Leaflet geoJSON过滤器函数并仅显示这些点.
到目前为止我有什么......
$('#map-filters').on("submit", function(e){
e.preventDefault();
map.spin(true,spinOpts);
submittedValues = $(this).serializeArray();
var filteredLocations = L.markerClusterGroup({ chunkedLoading: true }),
filteredLocationsAjax = new L.GeoJSON.AJAX(Routes.filtered_locations_path({format: 'json'}), {
style: style,
pointToLayer: pointToLayer,
onEachFeature: onEachFeature,
filter: function(feature, layer) {
if(submittedValues.length <= 1) {
return feature.properties[submittedValues[0].value];
} else {
How do I return multiple values?
}
}
});
filteredLocationsAjax.on('data:loaded', function () {
map.removeLayer(allLocations);
filteredLocations.addLayer(filteredLocationsAjax);
map.addLayer(filteredLocations);
map.spin(false);
});
});
Run Code Online (Sandbox Code Playgroud)
我的geoJSON的一个例子......
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [
"-76.286955",
"45.335969"
]
},
properties: {
id: 2,
name: …Run Code Online (Sandbox Code Playgroud)