FIX: staff action logs not logging all changes

This commit is contained in:
Régis Hanol 2015-02-25 15:54:57 +01:00
parent 3de5b1799e
commit 8c5d8715cd
3 changed files with 89 additions and 24 deletions

View file

@ -1,5 +1,4 @@
import ModalFunctionality from 'discourse/mixins/modal-functionality';
import ObjectController from 'discourse/controllers/object';
export default ObjectController.extend(ModalFunctionality, {
@ -7,14 +6,16 @@ export default ObjectController.extend(ModalFunctionality, {
newSelected: Ember.computed.equal('selectedTab', 'new'),
onShow: function() {
this.selectNew();
this.send("selectNew");
},
selectNew: function() {
this.set('selectedTab', 'new');
},
actions: {
selectNew: function() {
this.set('selectedTab', 'new');
},
selectPrevious: function() {
this.set('selectedTab', 'previous');
selectPrevious: function() {
this.set('selectedTab', 'previous');
}
}
});

View file

@ -1,19 +1,73 @@
<section class="field">
<b>{{i18n 'admin.customize.css'}}</b>:
{{#if stylesheet}}
({{i18n 'character_count' count=stylesheet.length}})
{{/if}}
<br/>
{{textarea value=stylesheet class="plain"}}
</section>
<section class="field">
<b>{{i18n 'admin.customize.header'}}</b>:
{{#if header}}
({{i18n 'character_count' count=header.length}})
{{/if}}
<br/>
{{textarea value=header class="plain"}}
</section>
<section class="field">
<b>{{i18n 'admin.customize.enabled'}}</b>: {{enabled}}
</section>
{{#if stylesheet}}
<section class="field">
<b>{{i18n 'admin.customize.css'}}</b>: ({{i18n 'character_count' count=stylesheet.length}})
<br/>
{{textarea value=stylesheet class="plain"}}
</section>
{{/if}}
{{#if mobile_stylesheet}}
<section class="field">
<b>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.css'}}</b>: ({{i18n 'character_count' count=mobile_stylesheet.length}})
<br/>
{{textarea value=mobile_stylesheet class="plain"}}
</section>
{{/if}}
{{#if header}}
<section class="field">
<b>{{i18n 'admin.customize.header'}}</b>: ({{i18n 'character_count' count=header.length}})
<br/>
{{textarea value=header class="plain"}}
</section>
{{/if}}
{{#if mobile_header}}
<section class="field">
<b>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.header'}}</b>: ({{i18n 'character_count' count=mobile_header.length}})
<br/>
{{textarea value=mobile_header class="plain"}}
</section>
{{/if}}
{{#if top}}
<section class="field">
<b>{{i18n 'admin.customize.top'}}</b>: ({{i18n 'character_count' count=top.length}})
<br/>
{{textarea value=top class="plain"}}
</section>
{{/if}}
{{#if mobile_top}}
<section class="field">
<b>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.top'}}</b>: ({{i18n 'character_count' count=mobile_top.length}})
<br/>
{{textarea value=mobile_top class="plain"}}
</section>
{{/if}}
{{#if footer}}
<section class="field">
<b>{{i18n 'admin.customize.footer'}}</b>: ({{i18n 'character_count' count=footer.length}})
<br/>
{{textarea value=footer class="plain"}}
</section>
{{/if}}
{{#if mobile_footer}}
<section class="field">
<b>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.footer'}}</b>: ({{i18n 'character_count' count=mobile_footer.length}})
<br/>
{{textarea value=mobile_footer class="plain"}}
</section>
{{/if}}
{{#if head_tag}}
<section class="field">
<b>{{fa-icon "file-text-o"}}&nbsp;{{i18n 'admin.customize.head_tag.text'}}</b>: ({{i18n 'character_count' count=head_tag.length}})
<br/>
{{textarea value=head_tag class="plain"}}
</section>
{{/if}}
{{#if body_tag}}
<section class="field">
<b>{{fa-icon "file-text-o"}}&nbsp;{{i18n 'admin.customize.body_tag.text'}}</b>: ({{i18n 'character_count' count=body_tag.length}})
<br/>
{{textarea value=body_tag class="plain"}}
</section>
{{/if}}

View file

@ -100,7 +100,17 @@ class StaffActionLogger
}))
end
SITE_CUSTOMIZATION_LOGGED_ATTRS = ['stylesheet', 'header', 'position', 'enabled', 'key']
SITE_CUSTOMIZATION_LOGGED_ATTRS = [
'stylesheet', 'mobile_stylesheet',
'header', 'mobile_header',
'top', 'mobile_top',
'footer', 'mobile_footer',
'head_tag',
'body_tag',
'position',
'enabled',
'key'
]
def log_site_customization_change(old_record, site_customization_params, opts={})
raise Discourse::InvalidParameters.new(:site_customization_params) unless site_customization_params