Commit a399f495 authored by Simon Knox's avatar Simon Knox Committed by Heinrich Lee Yu

Add boilerplate for iteration cadences form

parent be405a39
......@@ -2,6 +2,7 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { parseBoolean } from '~/lib/utils/common_utils';
import IterationCadenceForm from './components/iteration_cadence_form.vue';
import IterationForm from './components/iteration_form.vue';
import IterationReport from './components/iteration_report.vue';
import Iterations from './components/iterations.vue';
......@@ -89,3 +90,27 @@ export function initIterationReport({ namespaceType, initiallyEditing } = {}) {
},
});
}
export function initCadenceForm() {
const el = document.querySelector('.js-iteration-cadence-form');
if (!el) {
return null;
}
const { groupFullPath: groupPath, cadenceId, cadenceListPath } = el;
return new Vue({
el,
apolloProvider,
render(createElement) {
return createElement(IterationCadenceForm, {
props: {
groupPath,
cadenceId,
cadenceListPath,
},
});
},
});
}
import { initCadenceForm } from 'ee/iterations';
initCadenceForm();
# frozen_string_literal: true
class Groups::IterationCadencesController < Groups::ApplicationController
before_action :check_cadences_available!
before_action :authorize_show_cadence!, only: [:index]
before_action :authorize_admin_cadence!, only: [:edit]
before_action :authorize_create_cadence!, only: [:new]
feature_category :issue_tracking
def new; end
def edit; end
def index; end
private
def check_cadences_available!
render_404 unless group.iteration_cadences_feature_flag_enabled?
end
def authorize_admin_cadence!
render_404 unless can?(current_user, :admin_iteration_cadence, group)
end
def authorize_create_cadence!
render_404 unless can?(current_user, :create_iteration_cadence, group)
end
def authorize_show_cadence!
render_404 unless can?(current_user, :read_iteration_cadence, group)
end
end
- add_to_breadcrumbs _("Iteration cadences"), group_iteration_cadences_path(@group)
- breadcrumb_title params[:id]
- page_title _("Edit iteration cadence")
.js-iteration-cadence-form{ data: { group_full_path: @group.full_path,
cadence_id: params[:id],
cadences_list_path: group_iteration_cadences_path(@group) } }
- add_to_breadcrumbs _("Iteration cadences"), group_iteration_cadences_path(@group)
- breadcrumb_title _("New")
- page_title _("New iteration cadence")
.js-iteration-cadence-form{ data: { group_full_path: @group.full_path, cadences_list_path: group_iteration_cadences_path(@group) } }
......@@ -124,6 +124,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resources :iterations, only: [:index, :new, :edit, :show], constraints: { id: /\d+/ }
resources :iteration_cadences, only: [:index, :new, :edit], path: 'cadences', constraints: { id: /\d+/ }
resources :issues, only: [] do
collection do
post :bulk_update
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::IterationCadencesController do
using RSpec::Parameterized::TableSyntax
let_it_be(:group) { create(:group, :private) }
let_it_be(:cadence) { create(:iterations_cadence, group: group) }
let_it_be(:user) { create(:user) }
before do
stub_feature_flags(iteration_cadences: feature_flag_available)
group.add_user(user, role) unless role == :none
sign_in(user)
end
describe 'new' do
subject { get :new, params: { group_id: group } }
where(:feature_flag_available, :role, :status) do
false | :developer | :not_found
true | :none | :not_found
true | :guest | :not_found
true | :developer | :success
end
with_them do
it_behaves_like 'returning response status', params[:status]
end
end
describe 'edit' do
subject { get :edit, params: { group_id: group, id: cadence } }
where(:feature_flag_available, :role, :status) do
false | :developer | :not_found
true | :none | :not_found
true | :guest | :not_found
true | :developer | :success
end
with_them do
it_behaves_like 'returning response status', params[:status]
end
end
end
......@@ -11636,6 +11636,9 @@ msgstr ""
msgid "Edit iteration"
msgstr ""
msgid "Edit iteration cadence"
msgstr ""
msgid "Edit public deploy key"
msgstr ""
......@@ -17842,6 +17845,9 @@ msgstr ""
msgid "Iteration"
msgstr ""
msgid "Iteration cadences"
msgstr ""
msgid "Iteration changed to"
msgstr ""
......@@ -21226,6 +21232,9 @@ msgstr ""
msgid "New iteration"
msgstr ""
msgid "New iteration cadence"
msgstr ""
msgid "New iteration created"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment