<div class="motion-toolbar" ng-if="motion.isParagraphBasedAmendment()">
    <div class="toolbar-left {{ lineNumberMode }}">
        <div class="btn-group pull-right" data-toggle="buttons">
            <label class="btn btn-sm btn-default" ng-class="{active: showAmendmentContext}" ng-click="setShowAmendmentContext($event)">
                <input type="checkbox" autocomplete="off" ng-model="showAmendmentContext" ng-checked="showAmendmentContext">
                <translate>Show entire motion text</translate>
            </label>
        </div>
        <ng-include src="'static/templates/motions/motion-detail/toolbar-line-numbering.html'"></ng-include>
    </div>
</div>

<div ng-class="{'col-sm-8': (lineNumberMode != 'outside'), 'col-sm-12': (lineNumberMode == 'outside')}"
     ng-if="motion.isParagraphBasedAmendment()">
    <section class="motion-text-holder">
        <div class="alert alert-info" ng-if="amendment_diff_paragraphs.length === 0">
            <translate>No changes at the text.</translate>
        </div>
        <div ng-repeat="paragraph in amendment_diff_paragraphs" class="motion-text motion-text-diff line-numbers-{{ lineNumberMode }}"
             ng-class="{'amendment-context': showAmendmentContext}">

            <div class="amendment-context" ng-if="showAmendmentContext">
                <div ng-bind-html="motion.getParentMotion().getTextInLineRange(null, 1, paragraph.paragraphLineFrom) | trusted"
                     class="context"></div>
            </div>

            <h3 ng-if="paragraph.diffLineTo == paragraph.diffLineFrom + 1 && !showAmendmentContext" class="amendment-line-header">
               <translate>Line</translate> {{ paragraph.diffLineFrom }}:
            </h3>
            <h3 ng-if="paragraph.diffLineTo != paragraph.diffLineFrom + 1 && !showAmendmentContext" class="amendment-line-header">
                <translate>Line</translate> {{ paragraph.diffLineFrom }} - {{ paragraph.diffLineTo - 1 }}:
            </h3>

            <div class="paragraph-context" ng-bind-html="paragraph.textPre | trusted"></div>
            <div ng-bind-html="paragraph.text | trusted"></div>
            <div class="paragraph-context" ng-bind-html="paragraph.textPost | trusted"></div>

            <div class="amendment-context" ng-if="showAmendmentContext">
                <div ng-bind-html="motion.getParentMotion().getTextInLineRange(null, paragraph.paragraphLineTo, null) | trusted"></div>
            </div>
        </div>
    </section>
</div>
