Skip to content

Commit

Permalink
created a styles admin to allow user to set background, text and star…
Browse files Browse the repository at this point in the history
… color
  • Loading branch information
mikeyferg committed Mar 18, 2016
1 parent 0415c76 commit 71eec36
Show file tree
Hide file tree
Showing 469 changed files with 12,189 additions and 37 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ $(document).ready(function(){
});



});
5 changes: 0 additions & 5 deletions app/assets/javascripts/main_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ $('.fade_2').delay(8000).fadeIn(1000)
$('.fade_2b').delay(12000).fadeIn(1000)
$('.fade_3').delay(16000).fadeIn(1000)

$('.fade_1a').delay(4000).fadeIn(1000)
// $("imgInp").filestyle();
$('.fade_2a').delay(8000).fadeIn(1000)
$('.fade_2ba').delay(12000).fadeIn(1000)
$('.fade_3a').delay(16000).fadeIn(1000)

$("#imgInp").on("click", function(){
$("video").removeClass('hidden');
Expand Down
9 changes: 9 additions & 0 deletions app/assets/javascripts/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

$(document).ready(function(){
// console.log(backgroundColor)
// $('.styles_submit').on('click', function(){
// $('body').css('background-color', backgroundColor)
// })


});
3 changes: 3 additions & 0 deletions app/assets/javascripts/styles.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
1 change: 0 additions & 1 deletion app/assets/stylesheets/application.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
*= require_contractor
*= require_self
*/
58 changes: 30 additions & 28 deletions app/assets/stylesheets/freelancer.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ a:focus,
a:active,
a.active {
outline: 0;
color: #18bc9c;
/*color: #18bc9c;*/
}

h1,
Expand Down Expand Up @@ -52,32 +52,30 @@ hr.star-primary:after {
font-size: 2em;
}

hr.star-light {
/*hr.star-light {
border-color: #fff;
}

hr.star-light:after {
color: #fff;
background-color: red;
}
}*/

hr.star-primary {
/*hr.star-primary {
border-color: #2c3e50;
}
hr.star-primary:after {
color: #2c3e50;
background-color: #fff;
}
}*/

.img-centered {
margin: 0 auto;
}

header {
text-align: center;
color: #fff;
background: #18bc9c;
/*color: #fff;*/
/*background: #18bc9c;*/
}

header .container {
Expand Down Expand Up @@ -175,7 +173,7 @@ section h2 {
}

section.success {
color: #fff;
/*color: #fff;*/
background: #18bc9c;
}

Expand All @@ -185,7 +183,7 @@ section.success a:focus,
section.success a:active,
section.success a.active {
outline: 0;
color: #2c3e50;
/*color: #2c3e50;*/
}

@media(max-width:767px) {
Expand Down Expand Up @@ -233,7 +231,7 @@ section.success a.active {
margin-top: -12px;
text-align: center;
font-size: 20px;
color: #fff;
/*color: #fff;*/
}

#portfolio .portfolio-item .portfolio-link .caption .caption-content i {
Expand All @@ -259,7 +257,7 @@ section.success a.active {
margin-top: 15px;
border: solid 2px #fff;
font-size: 20px;
color: #fff;
/*color: #fff;*/
background: 0 0;
transition: all .3s ease-in-out;
}
Expand All @@ -269,7 +267,7 @@ section.success a.active {
.btn-outline:active,
.btn-outline.active {
border: solid 2px #fff;
color: #18bc9c;
/*color: #18bc9c;*/
background: #fff;
}

Expand Down Expand Up @@ -322,15 +320,15 @@ section.success a.active {
}

.floating-label-form-group-with-focus label {
color: #18bc9c;
/*color: #18bc9c;*/
}

form .row:first-child .floating-label-form-group {
border-top: 1px solid #eee;
}

footer {
color: #fff;
/*color: #fff;*/
}

footer h3 {
Expand All @@ -339,7 +337,7 @@ footer h3 {

footer .footer-above {
padding-top: 50px;
background-color: #2c3e50;
/*background-color: #2c3e50;*/
}

footer .footer-col {
Expand All @@ -348,7 +346,7 @@ footer .footer-col {

footer .footer-below {
padding: 25px 0;
background-color: #233140;
/*background-color: #233140;*/
}

.btn-social {
Expand Down Expand Up @@ -432,7 +430,7 @@ footer .footer-below {
width: 1px;
height: 75px;
margin-left: 35px;
background-color: #2c3e50;
/*background-color: #2c3e50;*/
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
Expand All @@ -442,7 +440,7 @@ footer .footer-below {
z-index: 1052;
width: 1px;
height: 75px;
background-color: #2c3e50;
/*background-color: #2c3e50;*/
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
Expand All @@ -453,10 +451,10 @@ footer .footer-below {
opacity: 0;
}

.test {
/*.test {
color: black;
}
}*/
p {
font-family: "Lato","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
Expand All @@ -483,15 +481,19 @@ p {
header {
padding-top: 20px;
margin-bottom: 5px;
background-color: black;
/*background-color: black;*/
}
body {
/*body {
background-color: black;
}
.test{
}*/
/*.test{
color: white;
}
}*/

.fade_1, .fade_2, .fade_2b, .fade_3 {
display:none;
}

body {
color:#fff
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the styles controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
6 changes: 4 additions & 2 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class StaticPagesController < ApplicationController
def mainPage

def main_page
@style_background = Style.last.header_background_color
@style_text = Style.last.body_text_color
@style_star = Style.last.header_background_star_color
end
end
35 changes: 35 additions & 0 deletions app/controllers/styles_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class StylesController < ApplicationController


def show
@style = find_style
@style_background = Style.last.header_background_color
@style_text = Style.last.body_text_color
@style_star = Style.last.header_background_star_color
end

def new
@style_background = Style.last.header_background_color
@style_text = Style.last.body_text_color
@style_star = Style.last.header_background_star_color
@style = Style.new

end

def create
@style = Style.new(video_params)
if @style.save
redirect_to style_path(@style)
else
render 'new'
end
end

private
def find_style
Style.find(params[:id])
end
def video_params
params.require(:style).permit(:header_background_color, :header_text_color, :header_background_star_color, :body_background_color, :body_text_color)
end
end
9 changes: 9 additions & 0 deletions app/controllers/videos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@ class VideosController < ApplicationController
include Transloadit::Rails::ParamsDecoder
def index
@videos = Video.all
@style_text = Style.last.body_text_color
@style_background = Style.last.header_background_color
@style_star = Style.last.header_background_star_color
end

def show
@video = find_video
@style_background = Style.last.header_background_color
@style_text = Style.last.body_text_color
@style_star = Style.last.header_background_star_color
end

def new
@video = Video.new
@style_background = Style.last.header_background_color
@style_text = Style.last.body_text_color
@style_star = Style.last.header_background_star_color
end

def create
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/styles_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module StylesHelper
end
2 changes: 2 additions & 0 deletions app/models/style.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Style < ActiveRecord::Base
end
12 changes: 12 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<style>
body {
background-color: <%= @style_background %>;
color: <%= @style_text %>
}
hr.star-light {
border-color: <%= @style_star %>;
}
hr.star-light:after {
color: <%= @style_star %>;
}
</style>
<body>

<%= yield %>
Expand Down
13 changes: 13 additions & 0 deletions app/views/styles/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

<section class="styles">
<h1>Admin Tools</h1>


<%= simple_form_for @style do |f| %>
<%= f.input :header_background_color, label:'Background Color' %>
<%= f.input :body_text_color, label:'Text Color' %>
<%= f.input :header_background_star_color, label: 'Star Color' %>
<%= f.button :submit, class:"styles_submit" %>
<% end %>

</section>
1 change: 1 addition & 0 deletions app/views/styles/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Styles Updated!</h1>
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
root 'static_pages#main_page'

resources :videos
resources :styles
resources :static_pages
# Example of regular route:
# get 'products/:id' => 'catalog#view'
get 'admin' => 'static_pages#admin'
Expand Down
13 changes: 13 additions & 0 deletions db/migrate/20160318171125_create_styles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateStyles < ActiveRecord::Migration
def change
create_table :styles do |t|
t.string :header_background_color
t.string :header_text_color
t.string :header_background_star_color
t.string :body_background_color
t.string :body_text_color

t.timestamps null: false
end
end
end
12 changes: 11 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20160318163030) do
ActiveRecord::Schema.define(version: 20160318171125) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "styles", force: :cascade do |t|
t.string "header_background_color"
t.string "header_text_color"
t.string "header_background_star_color"
t.string "body_background_color"
t.string "body_text_color"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "videos", force: :cascade do |t|
t.string "url"
t.string "thumbnail"
Expand Down
Loading

0 comments on commit 71eec36

Please sign in to comment.