summaryrefslogtreecommitdiff
path: root/app/views/projects/pipeline_schedules/_form.html.haml
blob: 3857a59a0436272bd5df0f6fc3c97426f339737e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- content_for :page_specific_javascripts do
  = webpack_bundle_tag 'common_vue'
  = webpack_bundle_tag 'schedule_form'

= form_for [@project.namespace.becomes(Namespace), @project, @schedule], as: :schedule, html: { id: "new-pipeline-schedule-form", class: "form-horizontal js-pipeline-schedule-form" } do |f|
  = form_errors(@schedule)
  .form-group
    .col-md-9
      = f.label :description, _('Description'), class: 'label-light'
      = f.text_field :description, class: 'form-control', required: true, autofocus: true, placeholder: s_('PipelineSchedules|Provide a short description for this pipeline')
  .form-group
    .col-md-9
      = f.label :cron, _('Interval Pattern'), class: 'label-light'
      #interval-pattern-input{ data: { initial_interval: @schedule.cron } }
  .form-group
    .col-md-9
      = f.label :cron_timezone, _('Cron Timezone'), class: 'label-light'
      = dropdown_tag(_("Select a timezone"), options: { toggle_class: 'btn js-timezone-dropdown', title: _("Select a timezone"), filter: true, placeholder: s_("OfSearchInADropdown|Filter"), data: { data: timezone_data } } )
      = f.text_field :cron_timezone, value: @schedule.cron_timezone, id: 'schedule_cron_timezone', class: 'hidden', name: 'schedule[cron_timezone]', required: true
  .form-group
    .col-md-9
      = f.label :ref, _('Target Branch'), class: 'label-light'
      = dropdown_tag(_("Select target branch"), options: { toggle_class: 'btn js-target-branch-dropdown', dropdown_class: 'git-revision-dropdown', title: _("Select target branch"), filter: true, placeholder: s_("OfSearchInADropdown|Filter"), data: { data: @project.repository.branch_names, default_branch: @project.default_branch } } )
      = f.text_field :ref, value: @schedule.ref, id: 'schedule_ref', class: 'hidden', name: 'schedule[ref]', required: true
  -# TODO: Test code
  = @schedule.variables.inspect
  - if @schedule.variables.present?
    - @schedule.variables.each_with_index do |variable, i|
      .form-group
        .col-md-9
          %label.label-light Key
          %input.form-control{:name => "schedule[variables_attributes][#{i}][key]", :type => "text", :value => variable.key}/
          %p.gl-field-error.hide This field is required.
          %label.label-light Value
          %input.form-control{:name => "schedule[variables_attributes][#{i}][value]", :type => "text", :value => variable.value}/
          %p.gl-field-error.hide This field is required.
    - if @schedule.variables.count == 1
      - (1..1).each do |i|
        .form-group
          .col-md-9
            %label.label-light Key
            %input.form-control{:name => "schedule[variables_attributes][#{i}][key]", :type => "text"}/
            %p.gl-field-error.hide This field is required.
            %label.label-light Value
            %input.form-control{:name => "schedule[variables_attributes][#{i}][value]", :type => "text"}/
            %p.gl-field-error.hide This field is required.
  - else
    - (0..0).each do |i|
      .form-group
        .col-md-9
          %label.label-light Key
          %input.form-control{:name => "schedule[variables_attributes][#{i}][key]", :type => "text"}/
          %p.gl-field-error.hide This field is required.
          %label.label-light Value
          %input.form-control{:name => "schedule[variables_attributes][#{i}][value]", :type => "text"}/
          %p.gl-field-error.hide This field is required.
  .form-group
    .col-md-9
      %label.label-light
        #{ _('Variables') }
      %ul.js-pipeline-variable-list.pipeline-variable-list
        - @schedule.variables.each_with_index do |variable, i|
          = render 'variable_row', id: variable.id, key: variable.key, value: variable.value
        = render 'variable_row'
  .form-group
    .col-md-9
      = f.label  :active, s_('PipelineSchedules|Activated'), class: 'label-light'
      %div
        = f.check_box :active, required: false, value: @schedule.active?
        = _('Active')
  .footer-block.row-content-block
    = f.submit _('Save pipeline schedule'), class: 'btn btn-create', tabindex: 3
    = link_to _('Cancel'), pipeline_schedules_path(@project), class: 'btn btn-cancel'