Use different approach for background image

This commit is contained in:
Robin Ward 2014-07-01 13:39:54 -04:00
parent f683bda062
commit 288bb5588f
5 changed files with 20 additions and 10 deletions

View File

@ -1,9 +1,3 @@
export default Ember.Controller.extend({
styleCategory: null,
backgroundClass: function() {
var id = this.get('styleCategory.id');
if (Em.isNone(id)) { return; }
return "category-" + this.get('styleCategory.id');
}.property('styleCategory')
});

View File

@ -0,0 +1,15 @@
export default Ember.View.extend({
_appendCategoryClass: function(obj, key) {
var newClass = Em.get(obj, key);
if (newClass) {
$('body').addClass('category-' + newClass);
}
}.observes('controller.styleCategory.id'),
_removeOldClass: function(obj, key) {
var oldClass = Em.get(obj, key);
if (oldClass) {
$('body').removeClass('category-' + oldClass);
}
}.observesBefore('controller.styleCategory.id')
});

View File

@ -22,7 +22,10 @@ a.no-href {
}
body {
button.ok {
background-attachment: fixed;
background-size: cover;
button.ok {
background: $success;
color: $secondary;
@include hover {

View File

@ -30,8 +30,6 @@
#main-outlet {
padding-top: 82px;
background-repeat: no-repeat;
background-position: 0 0;
}
// Dropdowns

View File

@ -50,7 +50,7 @@ class DiscourseSassImporter < Sass::Importers::Filesystem
contents = ""
Category.where('background_url IS NOT NULL').each do |c|
if c.background_url.present?
contents << "#main-outlet.category-#{c.id} { background-image: url(#{c.background_url}) }\n"
contents << "body.category-#{c.id} { background-image: url(#{c.background_url}) }\n"
end
end
return Sass::Engine.new(contents, options.merge(