diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-04-07 15:47:29 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-04-07 17:17:29 +0300 |
commit | 03088552549ed1631bb16c1bf3d0bef3613ec793 (patch) | |
tree | 50996bfbef73056b04a74751552f016f9d554342 /app/views/projects/triggers | |
parent | 1ae1d85cdc835c8ed7907e83f3e371018c7c8fe6 (diff) |
Fix ref reference
Diffstat (limited to 'app/views/projects/triggers')
-rw-r--r-- | app/views/projects/triggers/_form.html.haml | 53 | ||||
-rw-r--r-- | app/views/projects/triggers/_trigger.html.haml | 4 |
2 files changed, 36 insertions, 21 deletions
diff --git a/app/views/projects/triggers/_form.html.haml b/app/views/projects/triggers/_form.html.haml index c56ee3a1130..410caeeecd4 100644 --- a/app/views/projects/triggers/_form.html.haml +++ b/app/views/projects/triggers/_form.html.haml @@ -6,24 +6,39 @@ %label.label-light Token %p.form-control-static= @trigger.token .form-group - = f.label :key, "Description (For extenral trigger and scheduled trigger)", class: "label-light" + = f.label :key, "Description", class: "label-light" = f.text_field :description, class: "form-control", required: true, title: 'Trigger description is required.', placeholder: "Trigger description" - = f.fields_for :trigger_schedule do |schedule_fields| - .form-group - = schedule_fields.label :cron, "Cron (For scheduled trigger)", class: "label-light" - = schedule_fields.text_field :cron, class: "form-control", title: 'Trigger Schedule cron is required.', placeholder: "0 1 * * *" - .form-group - = schedule_fields.label :cron_timezone, "Cron timezone (For scheduled trigger)", class: "label-light" - = schedule_fields.text_field :cron_timezone, class: "form-control", title: 'Trigger Schedule cron_timezone is required.', placeholder: "UTC" - .form-group - = f.label :ref, "Ref (For scheduled trigger)", class: "label-light" - = f.text_field :ref, class: "form-control", title: 'Trigger Schedule Ref is required.', placeholder: "master" - .form-group - .checkbox - = schedule_fields.label :_destroy do - = schedule_fields.check_box :_destroy, { checked: (@trigger.trigger_schedule.id.present?) }, 0, 1 - %strong Register as scheduled trigger - .help-block - If checked, this trigger will be executed periodically according to `cron`, `cron_timezone` and `ref` - = link_to icon('question-circle'), help_page_path('user/project/pipelines/settings', anchor: 'visibility-of-pipelines') + - if @trigger.persisted? + %hr + = f.fields_for :trigger_schedule do |schedule_fields| + = schedule_fields.hidden_field :id + .form-group + .checkbox + = schedule_fields.label :active do + = schedule_fields.check_box :active + %strong Schedule trigger + .help-block + If checked, this trigger will be executed periodically according to `cron`, `cron_timezone` and `ref` + = link_to icon('question-circle'), help_page_path('user/project/pipelines/settings', anchor: 'visibility-of-pipelines') + .form-group + = schedule_fields.label :cron, "Cron", class: "label-light" + = schedule_fields.text_field :cron, class: "form-control", title: 'Trigger Schedule cron is required.', placeholder: "0 1 * * *" + .form-group + = schedule_fields.label :cron, "Timezone", class: "label-light" + = schedule_fields.text_field :cron_timezone, class: "form-control", title: 'Trigger Schedule cron_timezone is required.', placeholder: "UTC" + .form-group + - schedule_ref = @trigger.trigger_schedule.ref || @project.default_branch + = schedule_fields.label :ref, "Branch or tag", class: "label-light" + = hidden_field_tag 'trigger[trigger_schedule_attributes][ref]', schedule_ref + = dropdown_tag(schedule_ref, + options: { toggle_class: 'js-branch-select wide', + filter: true, dropdown_class: "dropdown-menu-selectable", placeholder: "Search branches", + data: { selected: schedule_ref, field_name: 'trigger[trigger_schedule_attributes][ref]' } }) + .help-block Existing branch name, tag = f.submit btn_text, class: "btn btn-save" + + +:javascript + var availableRefs = #{@project.repository.ref_names.to_json}; + + new NewBranchForm($('.js-new-pipeline-form'), availableRefs) diff --git a/app/views/projects/triggers/_trigger.html.haml b/app/views/projects/triggers/_trigger.html.haml index 3ed1fc9ac23..71fb37928fe 100644 --- a/app/views/projects/triggers/_trigger.html.haml +++ b/app/views/projects/triggers/_trigger.html.haml @@ -30,10 +30,10 @@ Never %td - - if trigger.trigger_schedule.persisted? + - if trigger.trigger_schedule.present? && trigger.trigger_schedule.active? = trigger.trigger_schedule.real_next_run - else - None (External trigger) + None %td.text-right.trigger-actions - take_ownership_confirmation = "By taking ownership you will bind this trigger to your user account. With this the trigger will have access to all your projects as if it was you. Are you sure?" |