diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index f8118c796..e15edf86a 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -143,11 +143,14 @@ class VersionsController < ApplicationController
# @version = @project.versions.build
# @version.safe_attributes = params[:version]
#
- # respond_to do |format|
- # format.html
- # format.js
- # end
- redirect_to settings_project_url(@project, :tab => 'versions')
+ respond_to do |format|
+ @is_create = params[:is_create]
+ format.js{
+ unless @is_create
+ redirect_to settings_project_url(@project, :tab => 'versions')
+ end
+ }
+ end
end
def create
@@ -157,7 +160,6 @@ class VersionsController < ApplicationController
attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing'])
@version.safe_attributes = attributes
end
-
if request.post?
if @version.save
respond_to do |format|
diff --git a/app/views/projects/settings/_new_versions.html.erb b/app/views/projects/settings/_new_versions.html.erb
index c6ca489bf..a67b2f91e 100644
--- a/app/views/projects/settings/_new_versions.html.erb
+++ b/app/views/projects/settings/_new_versions.html.erb
@@ -3,32 +3,7 @@
<% end %>
新建里程碑
- <%= form_for :version, :url => project_versions_path(@project, :is_setting => true),:html=>{:id=>"new_project_version_form", :remote => true} do |f| %>
-
-
-
- * <%= l(:field_name) %> :
- <%= f.text_field :name, :maxlength => 60, :class=>"w650 fl", :style=>"height: 28px;", :id => "setting_version_name" %>
- 标题不能为空
-
-
- <%= l(:label_version_description) %> :
- <%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;", :id => "setting_version_description" %>
-
-
- <%= l(:milestone_date_closed) %> :
- <%= f.text_field :effective_date, :size => 10, :readonly => true, :class=>"issues_calendar_input fl", :placeholder=>"结束日期", :style=>"height:28px;", :id => "setting_version_effective_date" %>
- <%= calendar_for('setting_version_effective_date') %>
-
-
- <%= l(:field_status) %> :
- <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{},{:style=>"height:28px"} %>
-
-
-
-
取消 保存
-
- <% end %>
+ <%= render :partial => 'projects/settings/new_versions_form', :locals => {:project => @project} %>
<% if @project.shared_versions.any? %>
diff --git a/app/views/projects/settings/_new_versions_form.html.erb b/app/views/projects/settings/_new_versions_form.html.erb
new file mode 100644
index 000000000..cc61b1993
--- /dev/null
+++ b/app/views/projects/settings/_new_versions_form.html.erb
@@ -0,0 +1,31 @@
+<%= form_for :version, :url => project_versions_path(@project, :is_setting => true),:html=>{:id=>"new_project_version_form", :remote => true} do |f| %>
+
+
+
+ * <%= l(:field_name) %> :
+ <%= f.text_field :name, :maxlength => 60, :class=>"w650 fl", :style=>"height: 28px;", :id => "setting_version_name" %>
+ 标题不能为空
+
+
+ <%= l(:label_version_description) %> :
+ <%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;", :id => "setting_version_description" %>
+
+
+ <%= l(:milestone_date_closed) %> :
+ <%= f.text_field :effective_date, :size => 10, :readonly => true, :class=>"issues_calendar_input fl", :placeholder=>"结束日期", :style=>"height:28px;", :id => "setting_version_effective_date" %>
+ <%= calendar_for('setting_version_effective_date') %>
+
+
+ <%= l(:field_status) %> :
+ <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{},{:style=>"height:28px"} %>
+
+
+
+
取消 保存
+
+<% end %>
+
\ No newline at end of file
diff --git a/app/views/versions/_new_milestone.html.erb b/app/views/versions/_new_milestone.html.erb
new file mode 100644
index 000000000..2a7a88511
--- /dev/null
+++ b/app/views/versions/_new_milestone.html.erb
@@ -0,0 +1,69 @@
+
+
+
diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb
index 478d983e4..e53925ed7 100644
--- a/app/views/versions/index.html.erb
+++ b/app/views/versions/index.html.erb
@@ -15,7 +15,8 @@
<%= link_to "关闭#{@versions_closed_count} ".html_safe, project_roadmap_path(@project, :type => "4"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_4" %>
- 新建
+
+ <%= link_to "新建", new_project_version_path(@project, :is_create => true), :class => 'btn btn-green fr mr15 mt10', :remote => true %>
<%= render :partial => "versions/list" %>
diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb
index 114b9c7c5..20992a66f 100644
--- a/app/views/versions/new.js.erb
+++ b/app/views/versions/new.js.erb
@@ -1,2 +1,7 @@
+<% if @is_create %>
+var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>";
+pop_box_new(htmlvalue,820,316);
+<% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'versions/new_modal') %>');
showModal('ajax-modal', '600px');
+<% end %>
\ No newline at end of file