mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Use different approach for background image
This commit is contained in:
parent
f683bda062
commit
288bb5588f
@ -1,9 +1,3 @@
|
|||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
styleCategory: null,
|
styleCategory: null,
|
||||||
|
|
||||||
backgroundClass: function() {
|
|
||||||
var id = this.get('styleCategory.id');
|
|
||||||
if (Em.isNone(id)) { return; }
|
|
||||||
return "category-" + this.get('styleCategory.id');
|
|
||||||
}.property('styleCategory')
|
|
||||||
});
|
});
|
||||||
|
15
app/assets/javascripts/discourse/views/application.js.es6
Normal file
15
app/assets/javascripts/discourse/views/application.js.es6
Normal 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')
|
||||||
|
});
|
@ -22,6 +22,9 @@ a.no-href {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
background-attachment: fixed;
|
||||||
|
background-size: cover;
|
||||||
|
|
||||||
button.ok {
|
button.ok {
|
||||||
background: $success;
|
background: $success;
|
||||||
color: $secondary;
|
color: $secondary;
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#main-outlet {
|
#main-outlet {
|
||||||
padding-top: 82px;
|
padding-top: 82px;
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: 0 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dropdowns
|
// Dropdowns
|
||||||
|
@ -50,7 +50,7 @@ class DiscourseSassImporter < Sass::Importers::Filesystem
|
|||||||
contents = ""
|
contents = ""
|
||||||
Category.where('background_url IS NOT NULL').each do |c|
|
Category.where('background_url IS NOT NULL').each do |c|
|
||||||
if c.background_url.present?
|
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
|
||||||
end
|
end
|
||||||
return Sass::Engine.new(contents, options.merge(
|
return Sass::Engine.new(contents, options.merge(
|
||||||
|
Loading…
Reference in New Issue
Block a user