This commit is contained in:
BoHung Chiu 2021-04-11 22:37:50 +08:00
parent d5e03a1fd9
commit f1b71aa9b7
3 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,5 @@
class AnnouncementsController < ApplicationController
include AnnouncementsHelper
helper_method :complementaryColor,:lighten_color
def comment
@bulletin = Bulletin.where(:uid=>params[:uid]).first
comment_val = params['comment']

View File

@ -1,5 +1,5 @@
module AnnouncementsHelper
def complementaryColor(my_hex)
def self.complementaryColor(my_hex)
if my_hex[0] == '#'
my_hex = my_hex[1..-1]
end
@ -7,7 +7,7 @@ module AnnouncementsHelper
comp = rgb.map{|a| (255 - a.to_i(16)).to_s(16).rjust(2,'0')}
'#'+comp.join
end
def lighten_color(my_hex,percent)
def self.lighten_color(my_hex,percent)
if my_hex[0] == '#'
my_hex = my_hex[1..-1]
end

View File

@ -1,5 +1,4 @@
<%
require 'announcements_helper'
params = OrbitHelper.params
page = Page.where(url:params['url']).first
@show_back_and_next_flag = 0
@ -78,9 +77,9 @@
hover_color = site.orbit_bar_background_hover_color rescue nil
hover_color = '#0095CF' if hover_color.blank?
bg_color = site.orbit_bar_background_color rescue nil
bg_color = bg_color.blank? ? '#3a3b3c' : lighten_color(bg_color,-40)
color1 = lighten_color(bg_color,-40)
color2 = lighten_color(complementaryColor(bg_color),40)
bg_color = bg_color.blank? ? '#3a3b3c' : AnnouncementsHelper.lighten_color(bg_color,-40)
color1 = AnnouncementsHelper.lighten_color(bg_color,-40)
color2 = AnnouncementsHelper.lighten_color(AnnouncementsHelper.complementaryColor(bg_color),40)
%>
<style type="text/css">
div[contentEditable=true]:empty:before{