+sub action_ajax_flag {
+ my ($self) = @_;
+
+ $self->text_block->update_attributes(is_flagged => !$self->text_block->is_flagged);
+
+ my $current_where = $self->output_position_from_id($::form->{current_content_id}, $::form->{current_content_type});
+
+ SL::ClientJS->new
+ ->action_if($current_where == $self->text_block->output_position, 'toggleClass', '#text-block-' . $self->text_block->id, 'flagged')
+ ->toggleClass('#tb-' . $self->text_block->id, 'flagged')
+ ->render($self);
+}
+