'Update enabling of individual sr themes; refresh the page style'

@validatedForm(VUser(), VModhash(), sr_style_enabled=VBoolean('sr_style_enabled'))
def POST_set_sr_style_enabled(self, form, jquery, sr_style_enabled):

    if feature.is_enabled('stylesheets_everywhere'):
        c.user.set_subreddit_style(c.site, sr_style_enabled)
        c.can_apply_styles = True
        sr = DefaultSR()
        if sr_style_enabled:
            sr = c.site
        elif (c.user.pref_default_theme_sr and feature.is_enabled('stylesheets_everywhere')):
            sr = Subreddit._by_name(c.user.pref_default_theme_sr)
            if ((not sr.can_view(c.user)) or (not c.user.pref_enable_default_themes)):
                sr = DefaultSR()
        sr_stylesheet_url = Reddit.get_subreddit_stylesheet_url(sr)
        if (not sr_stylesheet_url):
            sr_stylesheet_url = ''
            c.can_apply_styles = False
        jquery.apply_stylesheet_url(sr_stylesheet_url, sr_style_enabled)
        if ((not sr.header) or (header_url(sr.header) == g.default_header_url)):
            jquery.remove_header_image()
        else:
            jquery.apply_header_image(header_url(sr.header), sr.header_size, sr.header_title)
