superdesk/superdesk-client-core

View on GitHub
scripts/apps/search-providers/views/search-provider-config.html

Summary

Maintainability
Test Coverage
<div class="sd-page__flex-helper" ng-hide="hideList">
    <div class="sd-page__header">
        <span class="sd-page__element-grow"></span>
        <button id="addSearchProvider" class="btn btn--primary" ng-click="edit()" ng-disabled="noProvidersAllowed" title="{{ addProviderLabel }}">
            <i class="icon-plus-sign icon--white"></i> <span translate>Add New</span>
        </button>
    </div>

    <div class="sd-page__content">
        <ul class="pills-list provider-list">
            <li ng-repeat="provider in providers track by provider._id" class="clearfix">
                <div class="header">
                    <h6 id="providerType">{{ provider.name }} <small>({{ providerLabels[provider.search_provider] }})</small></h6>
                    <span class="label offProvider" ng-if="provider.is_closed" translate>Closed</span>
                    <div class="actions">
                        <button ng-click="edit(provider)" title="{{ 'Edit Search Provider' | translate }}"><i class="icon-pencil"></i></button>
                        <button ng-click="remove(provider)" ng-show="!provider.last_item_update" title="{{ 'Remove Search Provider' | translate }}"><i class="icon-trash"></i></button>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>

<div sd-modal data-model="provider" data-close="cancel()" class="subscriber-modal">
    <div class="modal__header"> <a href="" class="modal__close pull-right" ng-click="cancel()"><i class="icon-close-small"></i></a>
        <h3 class="modal__heading" ng-show="provider._id"><span translate>Edit Search Provider</span> "{{ origProvider.search_provider }}"</h3>
        <h3 class="modal__heading" translate ng-hide="provider._id">Add New Search Provider</h3>
    </div>
    <div class="modal__body">
        <form name="editForm">
            <fieldset>
                <div sd-form-switch-inverted
                    id="provider-status"
                    label="{{ 'Status' | translate }}"
                    title="{{ getStatusLabel(provider) }}"
                    model="provider.is_closed">
                ></div>

                <div sd-form-checkbox
                    label="{{ 'Is Default' | translate }}"
                    title="{{ getIsDefaultLabel(provider) }}"
                    model="provider.is_default"
                ></div>

                <div sd-form-checkbox
                    label="{{ 'Open advanced search panel by default' | translate }}"
                    model="provider.advanced_search"
                ></div>

                <div class="form__row">
                    <div class="form__row-item">
                        <label class="form-label form-label--marg-b10" translate>Default view</label>
                        <div>
                            <sd-check
                                ng-repeat="(viewId, view) in availableListViews"
                                type="radio"
                                label-position="inside"
                                ng-model="provider.config.default_list_view"
                                ng-click="provider.config.default_list_view = viewId"
                                ng-value="{{viewId}}"
                                data-icon="{{view.icon}}"
                                >
                                {{ view.label }}
                            </sd-check>
                        </div>
                    </div>
                </div>

                <div sd-form-select
                    id="provider-type"
                    label="{{ 'Provider Type' | translate }}"
                    model="provider.search_provider"
                    options="providerTypesOptions"
                    option-label="label"
                    option-value="value"
                    required="true"
                ></div>

                <div sd-form-input
                    id="provider-name"
                    label="{{ 'Name' | translate }}"
                    model="provider.name"
                    required="true"
                ></div>

                <div sd-form-input ng-if="!provider.search_provider.startsWith('scanpix')"
                    id="provider-source"
                    label="{{ 'Source' | translate }}"
                    placeholder="{{ 'source of the search provider' | translate }}"
                    model="provider.source"
                    required="true"
                ></div>

                <div sd-form-input ng-if="!provider.search_provider.startsWith('scanpix')"
                    id="provider-url"
                    label="{{ 'URL' | translate }}"
                    placeholder="{{ 'url of the search provider' | translate }}"
                    model="provider.config.url"
                    required="true"
                ></div>

                <div ng-if="provider.search_provider.startsWith('scanpix')">
                    <span ng-init="provider.source=provider.search_provider">
                </div>

                <div sd-form-input
                    id="provider-username"
                    label="{{ 'Username' | translate }}"
                    placeholder="{{ 'search provider username' | translate }}"
                    model="provider.config.username"
                ></div>

                <div sd-form-input
                    type="password"
                    id="provider-password"
                    label="{{ 'Password' | translate }}"
                    placeholder="{{ 'search provider password' | translate }}"
                    model="provider.config.password"
                ></div>
            </fieldset>
        </form>
    </div>
    <div class="modal__footer">
        <button class="btn" ng-click="cancel()" translate>Cancel</button>
        <button class="btn btn--primary" ng-click="save()" ng-disabled="editForm.$invalid || !editForm.$dirty" translate>Save</button>
    </div>
</div>