diff --git a/app/assets/javascripts/admins.js b/app/assets/javascripts/admins.js
index 4d5da355..71b7cad1 100644
--- a/app/assets/javascripts/admins.js
+++ b/app/assets/javascripts/admins.js
@@ -31,32 +31,45 @@ $(document).on('turbolinks:load', function(){
$("#delete-confirm").parent().attr("action", url)
})
- $('.colorinput').ColorPicker({
- onHide: function (colpkr) {
- var colour = $("#user-colour").val();
+ /* COLOR SELECTORS */
- // Update the color in the database and reload the page
- $.post($("#coloring-path").val(), {color: colour}).done(function(data) {
- location.reload()
- });
- },
-
- onSubmit: function(hsb, hex, rgb, el) {
- $.post($("#coloring-path").val(), {color: '#' + hex}).done(function(data) {
- location.reload()
- });
- },
-
+ $('#colorinput-regular').ColorPicker({
onBeforeShow: function () {
- var colour = $("#user-colour").val();
+ var colour = rgb2hex($("#colorinput-regular").css("background-color"))
$(this).ColorPickerSetColor(colour);
},
+ onSubmit: function(_hsb, hex, _rgb, _el) {
+ $.post($("#coloring-path-regular").val(), {color: '#' + hex}).done(function(data) {
+ location.reload()
+ });
+ },
+ });
- onChange: function (hsb, hex, rgb) {
- $('.colorinput span').css('backgroundColor', '#' + hex);
- $("#user-colour").val('#' + hex);
- }
+ $('#colorinput-lighten').ColorPicker({
+ onBeforeShow: function () {
+ var colour = rgb2hex($("#colorinput-lighten").css("background-color"))
+
+ $(this).ColorPickerSetColor(colour);
+ },
+ onSubmit: function(_hsb, hex, _rgb, _el) {
+ $.post($("#coloring-path-lighten").val(), {color: '#' + hex}).done(function(data) {
+ location.reload()
+ });
+ },
+ });
+
+ $('#colorinput-darken').ColorPicker({
+ onBeforeShow: function () {
+ var colour = rgb2hex($("#colorinput-darken").css("background-color"))
+
+ $(this).ColorPickerSetColor(colour);
+ },
+ onSubmit: function(_hsb, hex, _rgb, _el) {
+ $.post($("#coloring-path-darken").val(), {color: '#' + hex}).done(function(data) {
+ location.reload()
+ });
+ },
});
}
@@ -79,3 +92,11 @@ function changeBrandingImage(path) {
var url = $("#branding-url").val()
$.post(path, {url: url})
}
+
+function rgb2hex(rgb) {
+ rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
+ function hex(x) {
+ return ("0" + parseInt(x).toString(16)).slice(-2);
+ }
+ return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
+}
diff --git a/app/assets/stylesheets/utilities/_primary_themes.scss b/app/assets/stylesheets/utilities/_primary_themes.scss
index 12ae6fe0..2a6cabc4 100644
--- a/app/assets/stylesheets/utilities/_primary_themes.scss
+++ b/app/assets/stylesheets/utilities/_primary_themes.scss
@@ -1,3 +1,9 @@
+.btn {
+ &:focus {
+ box-shadow: 0 0 0 2px $primary-color-lighten;
+ }
+}
+
.btn-primary,
.btn-primary:visited,
.btn-primary i {
@@ -97,6 +103,7 @@ input:focus, select:focus {
.bg-primary {
background-color: $primary-color !important;
+ color: white !important;
}
.btn-danger {
@@ -129,3 +136,21 @@ input:focus, select:focus {
}
}
}
+
+.primary-regular {
+ background-color: $primary-color !important;
+ border-color: $primary-color !important;
+ color: white !important;
+}
+
+.primary-lighten {
+ background-color: $primary-color-lighten !important;
+ border-color: $primary-color-lighten !important;
+ color: $primary-color !important;
+}
+
+.primary-darken {
+ background-color: $primary-color-darken !important;
+ border-color: $primary-color-darken !important;
+ color: white !important;
+}
\ No newline at end of file
diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb
index 6e206b49..97b03f0d 100644
--- a/app/controllers/admins_controller.rb
+++ b/app/controllers/admins_controller.rb
@@ -18,10 +18,11 @@
class AdminsController < ApplicationController
include Pagy::Backend
+ include Themer
include Emailer
manage_users = [:edit_user, :promote, :demote, :ban_user, :unban_user, :approve]
- site_settings = [:branding, :coloring, :registration_method]
+ site_settings = [:branding, :coloring, :coloring_lighten, :coloring_darken, :registration_method]
authorize_resource class: false
before_action :find_user, only: manage_users
@@ -107,6 +108,18 @@ class AdminsController < ApplicationController
# POST /admins/color
def coloring
@settings.update_value("Primary Color", params[:color])
+ @settings.update_value("Primary Color Lighten", color_lighten(params[:color]))
+ @settings.update_value("Primary Color Darken", color_darken(params[:color]))
+ redirect_to admins_path
+ end
+
+ def coloring_lighten
+ @settings.update_value("Primary Color Lighten", params[:color])
+ redirect_to admins_path
+ end
+
+ def coloring_darken
+ @settings.update_value("Primary Color Darken", params[:color])
redirect_to admins_path
end
diff --git a/app/controllers/concerns/themer.rb b/app/controllers/concerns/themer.rb
new file mode 100644
index 00000000..45e5a615
--- /dev/null
+++ b/app/controllers/concerns/themer.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
+#
+# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
+#
+# This program is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 3.0 of the License, or (at your option) any later
+# version.
+#
+# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with BigBlueButton; if not, see