-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎁 🧹 add missing file and format with semicolons
The previous build revealed that admin_color_select.js was missing. It also complained about missing semicolons.
- Loading branch information
1 parent
1899175
commit 2ac4625
Showing
2 changed files
with
49 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$(document).on("turbolinks:load", function () { | ||
$("div.defaultable-colors a.restore-default-color").click(function (e) { | ||
e.preventDefault(); | ||
|
||
var defaultTarget = $(e.target).data("default-target"); | ||
var input = $("input[name='admin_appearance[" + defaultTarget + "]']"); | ||
|
||
input.val(input.data("default-value")); | ||
}); | ||
|
||
$(".panel-footer a.restore-all-default-colors").click(function (e) { | ||
e.preventDefault(); | ||
|
||
var allColorInputs = $("input[name*='color']"); | ||
|
||
allColorInputs.each(function () { | ||
$(this).val($(this).data("default-value")); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
Blacklight.onLoad(function() { | ||
if($("#admin_appearance_body_font").length > 0){ | ||
$("#admin_appearance_body_font").fontselect({lookahead: 20}) | ||
$("#admin_appearance_headline_font").fontselect({lookahead: 20}) | ||
Blacklight.onLoad(function () { | ||
if ($("#admin_appearance_body_font").length > 0) { | ||
$("#admin_appearance_body_font").fontselect({ lookahead: 20 }); | ||
$("#admin_appearance_headline_font").fontselect({ lookahead: 20 }); | ||
} | ||
}); | ||
|
||
$('div.defaultable-fonts a.restore-default-font').click(function(e) { | ||
e.preventDefault() | ||
var defaultTarget = $(e.target).data('default-target') | ||
var input = $("input[name='admin_appearance["+ defaultTarget +"]']") | ||
var defaultValue = input.data('default-value').replace(';', '') | ||
var inputDisplay = $("div[class$='"+ defaultTarget +"']").find('div.font-select span') | ||
$("div.defaultable-fonts a.restore-default-font").click(function (e) { | ||
e.preventDefault(); | ||
var defaultTarget = $(e.target).data("default-target"); | ||
var input = $("input[name='admin_appearance[" + defaultTarget + "]']"); | ||
var defaultValue = input.data("default-value").replace(";", ""); | ||
var inputDisplay = $("div[class$='" + defaultTarget + "']").find( | ||
"div.font-select span" | ||
); | ||
|
||
input.val(defaultValue) | ||
inputDisplay.css("font-family", defaultValue) | ||
inputDisplay.text(defaultValue) | ||
}) | ||
input.val(defaultValue); | ||
inputDisplay.css("font-family", defaultValue); | ||
inputDisplay.text(defaultValue); | ||
}); | ||
|
||
$('.panel-footer a.restore-all-default-fonts').click(function(e) { | ||
e.preventDefault() | ||
$(".panel-footer a.restore-all-default-fonts").click(function (e) { | ||
e.preventDefault(); | ||
|
||
var allFontInputs = $("input[name*='font']") | ||
var allFontInputs = $("input[name*='font']"); | ||
|
||
allFontInputs.each(function() { | ||
var thisTarget = $(this).attr('id').replace('admin_appearance_', '') | ||
var defaultValue = $(this).data('default-value').replace(';', '') | ||
var inputDisplay = $("div[class$='"+ thisTarget +"']").find('div.font-select span') | ||
allFontInputs.each(function () { | ||
var thisTarget = $(this).attr("id").replace("admin_appearance_", ""); | ||
var defaultValue = $(this).data("default-value").replace(";", ""); | ||
var inputDisplay = $("div[class$='" + thisTarget + "']").find( | ||
"div.font-select span" | ||
); | ||
|
||
$(this).val(defaultValue) | ||
inputDisplay.css("font-family", defaultValue) | ||
inputDisplay.text(defaultValue) | ||
}) | ||
$(this).val(defaultValue); | ||
inputDisplay.css("font-family", defaultValue); | ||
inputDisplay.text(defaultValue); | ||
}); | ||
}); |