Created
December 28, 2014 20:15
-
-
Save josephrexme/4dfcd622260eeea4baab to your computer and use it in GitHub Desktop.
Changing themes in an application
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
// Variables | |
$hopbush: #c69; | |
$bouquet: #b37399; | |
$venus: #998099; | |
$patina: #699; | |
$nebula: #d2e1dd; | |
$wine: #B21F1F; | |
$dawn-pink: #f2ece4; | |
$wafer: #e1d7d2; | |
$skyblue: #9BC1F5; | |
$iron: #dadbdf; | |
$orange: #eba11e; | |
$regent-grey: #808c99; | |
$pale-sky: #6b717f; | |
$midnight-blue: #036; | |
$light-green: #98cbad; | |
$color-blue-link: #557FA8; | |
<% @preferences = Preference.find(1) %> | |
$color-vitabiotics: rgb(<%= @preferences.theme %>) !global; | |
$color-wine-fade: #c66; | |
$color-orange-1: #FAB782; | |
$color-light-green: #76E0A2; | |
$black: #000; | |
$white: #fff; | |
$red: #f00; | |
$blood: #7E0E0E; | |
$alphablack2: rgba(#eee, 0.2); | |
$borderline1: #3FCA82; | |
$myblue: #36a; | |
$reg_alpha: .2; | |
$rebeccapurple: #663399; | |
$background-cool-blue: #1bbae1; | |
$color-pure-orange: #e61; | |
$color-purple: #aa55cc; |
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
class PreferencesController < ApplicationController | |
def update | |
@preference = Preference.find(1) | |
uploaded_io = params[:preference][:header] | |
if uploaded_io.present? | |
File.open(Rails.root.join('public','uploads', uploaded_io.original_filename), 'wb') do |file| | |
file.write(uploaded_io.read) | |
end | |
end | |
@preference.company = params[:preference][:company] | |
@preference.website = params[:preference][:website] | |
@preference.theme = params[:preference][:theme] | |
@preference.header = uploaded_io.original_filename if uploaded_io.present? | |
if @preference.save | |
redirect_to :back, notice: 'Preferences updated' | |
else | |
redirect_to :back, notice: 'Preferences failed to update' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment