superdesk/superdesk-client-core

View on GitHub
scripts/apps/search/views/saved-search-subscribe.html

Summary

Maintainability
Test Coverage
<div sd-modal class="modal--large" ng-if="savedSearch != null" data-model="true">
    <div class="modal__header">
        <a href="" class="close" ng-click="closeModal()"><i class="icon-close-small"></i></a>
        <h3 class="modal__heading">
            <span ng-if="isAlreadySubscribed()" translate>Manage subscription</span>
            <span ng-if="!isAlreadySubscribed()" translate>New subscription</span>
        </h3>
    </div>

    <div class="modal__body">
        <div class="sd-alert sd-alert--hollow sd-alert--primary">
            <p><span translate>You have chosen to subscribe to</span> <strong>{{savedSearch.name}}</strong>. <span translate>Please define the frequency and time of your email notifications below.</span></p>
        </div>

        <div
            sd-edit-time-interval
            data-initial-value="ownSubscription == null ? '' : ownSubscription.scheduling"
            on-change="handleIntervalChange"></div>

        <p ng-if="ownSubscription != null" style="margin: 0;">
            <span translate>Last report sent on: </span>
            <span ng-if="ownSubscription.last_report != null" sd-absdate datetime="ownSubscription.last_report"></span>
            <span ng-if="ownSubscription.last_report == null" translate>never</span>
        </p>
        
    </div>

    <div class="modal__footer">
        <button ng-if="isAlreadySubscribed()" class="btn btn--hollow pull-left" ng-click="unsubscribeUser()" translate>Unsubscribe</button>

        <button class="btn" ng-click="closeModal()" translate>Cancel</button>
        <button class="btn btn--primary" ng-click="saveOrUpdate()" ng-disabled="savingEnabled() !== true">
            <span ng-if="isAlreadySubscribed()" translate>Update subscription</span>
            <span ng-if="!isAlreadySubscribed()" translate>Subscribe</span>
        </button>
    </div>
</div>