From 46dd54a1d7e898428a9563501f4c2d80a111af7b Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 23 Oct 2015 23:34:18 +0800 Subject: [PATCH] asset_path in css erb files --- app/assets/stylesheets/application.css.erb | 6 +++--- .../stylesheets/{base.css => base.css.erb} | 4 ++-- app/assets/stylesheets/clean.css.erb | 20 +++++++++---------- app/controllers/synapses_controller.rb | 1 + app/models/synapse.rb | 2 ++ 5 files changed, 18 insertions(+), 15 deletions(-) rename app/assets/stylesheets/{base.css => base.css.erb} (94%) diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index dfb5aa78..ed4ec2ac 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -2352,15 +2352,15 @@ and it won't be important on password protected instances */ opacity: 0.7; } #chromeIcon { - background: url(/assets/browser_icons.png) no-repeat; + background: url(<%= asset_data_uri 'browser_icons.png' %>) no-repeat; } #fireFoxIcon { - background: url(/assets/browser_icons.png) no-repeat -105px 0; + background: url(<%= asset_data_uri 'browser_icons.png' %>) no-repeat -105px 0; } #safariIcon { - background: url(/assets/browser_icons.png) no-repeat -220px 0; + background: url(<%= asset_data_uri 'browser_icons.png' %>) no-repeat -220px 0; } #chromeIcon:hover{ diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css.erb similarity index 94% rename from app/assets/stylesheets/base.css rename to app/assets/stylesheets/base.css.erb index 2e0073a0..858163ad 100644 --- a/app/assets/stylesheets/base.css +++ b/app/assets/stylesheets/base.css.erb @@ -740,7 +740,7 @@ font-family: 'din-regular', helvetica, sans-serif; } #linkremove { - background-image: url(/assets/remove.png); + background-image: url(<%= asset_data_uri 'remove.png' %>); background-repeat: no-repeat; background-position: center center; width: 24px; @@ -1126,4 +1126,4 @@ font-family: 'din-regular', helvetica, sans-serif; } .mapperMetadata .metadataSynapses { color: #DAB539; -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/clean.css.erb b/app/assets/stylesheets/clean.css.erb index 793e328c..456c6afc 100644 --- a/app/assets/stylesheets/clean.css.erb +++ b/app/assets/stylesheets/clean.css.erb @@ -1,20 +1,20 @@ @font-face { font-family: 'din-medium'; - src: url('/assets/Fonts/din.eot'); - src: url('/assets/Fonts/din.eot?#iefix') format('embedded-opentype'), - url('/assets/Fonts/din.woff') format('woff'), - url('/assets/Fonts/din.ttf') format('truetype'), - url('/assets/Fonts/din.svg#din-medium') format('svg'); + src: url(<%= asset_path 'Fonts/din.eot' %>); + src: url(<%= asset_path 'Fonts/din.eot?#iefix' %>) format('embedded-opentype'), + url(<%= asset_path 'Fonts/din.woff' %>) format('woff'), + url(<%= asset_path 'Fonts/din.ttf' %>) format('truetype'), + url(<%= asset_path 'Fonts/din.svg#din-medium' %>) format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'din-regular'; - src: url('/assets/Fonts/din-reg.eot'); - src: url('/assets/Fonts/din-reg.eot?#iefix') format('embedded-opentype'), - url('/assets/Fonts/din-reg.woff') format('woff'), - url('/assets/Fonts/din-reg.ttf') format('truetype'), - url('/assets/Fonts/din-reg.svg#din-reg') format('svg'); + src: url(<%= asset_path 'Fonts/din-reg.eot' %>); + src: url(<%= asset_path 'Fonts/din-reg.eot?#iefix' %>) format('embedded-opentype'), + url(<%= asset_path 'Fonts/din-reg.woff' %>) format('woff'), + url(<%= asset_path 'Fonts/din-reg.ttf' %>) format('truetype'), + url(<%= asset_path 'Fonts/din-reg.svg#din-reg' %>) format('svg'); font-weight: normal; font-style: normal; } diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index dc36ff28..db30a058 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -21,6 +21,7 @@ class SynapsesController < ApplicationController # POST /synapses # POST /synapses.json def create + binding.pry @synapse = Synapse.new(synapse_params) @synapse.update_attribute :desc, "" if @synapse.desc.nil? diff --git a/app/models/synapse.rb b/app/models/synapse.rb index 2711c1c5..2745106f 100644 --- a/app/models/synapse.rb +++ b/app/models/synapse.rb @@ -8,6 +8,8 @@ class Synapse < ActiveRecord::Base has_many :mappings, as: :mappable, dependent: :destroy has_many :maps, :through => :mappings + validates :desc, length: { minimum: 0, allow_nil: false } + def user_name self.user.name end