-
Notifications
You must be signed in to change notification settings - Fork 1
/
_feature_import.html.erb
47 lines (46 loc) · 2.17 KB
/
_feature_import.html.erb
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
<h3>Feature: <%=h file[:file].sub(/\.feature/,"").gsub(/_/,' ') %></h3>
<%- form_for file[:feature], :html => {:id => "new_feature",:class => "new_feature hidden", :method => :post} do |f|%>
<fieldset class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<%= hidden_field_tag :commit, 'Import' %>
<%= hidden_field_tag :current_project_id, current_project.id %>
<%= f.hidden_field :title %>
<%= f.hidden_field :in_order %>
<%= f.hidden_field :as_a %>
<%= f.hidden_field :i_want %>
<%= f.hidden_field :path %>
<p id="title"><%=h file[:feature].title%></p>
<p>
In order <%=h file[:feature].in_order %><br />
As <%=h file[:feature].as_a %><br />
I want <%=h file[:feature].i_want %>
</p>
<%= f.label :tag_list %>
<%= f.text_field :tag_list %><br/>
<% if !Project.all.empty? %>
<p>
<% for project in Project.find :all %>
<%= check_box_tag "feature[project_ids][]", project.id, feature.projects.include?(project), {:id=>"feature_project_id_#{project.id}"} %>
<%=h project.title%><br/>
<% end %>
</p>
<% f.fields_for :stories, {:class => 'hidden'} do |stories_f| -%>
<%= stories_f.hidden_field :scenario %>
<%= render :partial => '/common/forms/story_steps', :locals => { :f => stories_f } %>
<%= render :partial => '/common/forms/story_examples', :locals => { :f => stories_f } %>
<% end -%>
<% end %>
<br />
<% if has_duplicate_feature_name?(file[:feature].path, @imported) %>
<p id="error">Feature already exists in <%= has_duplicate_feature_name?(file[:feature].path, @imported) %></p>
<% end %>
<% if invalid_import? file[:feature] %>
<p id="error">Invalid feature</p>
<% elsif has_duplicate_feature? file[:file], @imported %>
<p id="error">Feature has duplicate scenario</p>
<% elsif has_no_stories? file[:feature] %>
<p id="error">No Scenario's found</p>
<% else %>
<button type="submit" class="button positive"><%= "Import #{file[:file].sub(/\.feature/,"").gsub(/_/," ")}" %></button>
<% end %>
</fieldset>
<% end %>