diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 7fb0b50da..f59fba784 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -160,6 +160,9 @@ class IssuesController < ApplicationController end def show + # 顶部导航 + @project_menu_type = 2 + # 打开编辑内容 @is_edit = true unless params[:edit].nil? @@ -217,6 +220,9 @@ class IssuesController < ApplicationController # Add a new issue # The new issue will be created from an existing one if copy_from parameter is given def new + # 顶部导航 + @project_menu_type = 2 + respond_to do |format| format.html { render :action => 'new', :layout => 'base_projects' } end diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 0c5057a40..b7d9c5ffc 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -35,7 +35,6 @@ class VersionsController < ApplicationController # 顶部导航 @project_menu_type = 7 type = params[:type] - version_all_count = Version.where(:project_id => @project.id).order("created_on desc") case type when nil,"1" @versions = @project.versions @@ -147,14 +146,12 @@ class VersionsController < ApplicationController # @version.safe_attributes = params[:version] # respond_to do |format| - @is_issue = params[:is_issue] + @is_setting = params[:is_setting] @is_create = params[:is_create] + @is_issue = params[:is_issue] + @issue_project_id = params[:issue_project_id] #@@issue = Issue.find(params[:issue].to_i) - format.js{ - unless @is_create - redirect_to settings_project_url(@project, :tab => 'versions') - end - } + format.js end end @@ -163,6 +160,8 @@ class VersionsController < ApplicationController @is_setting = params[:is_setting] @is_issue = params[:is_issue] @is_create = params[:is_create] + @issue_project_id = params[:issue_project_id] + # @issue = current_issue @version = @project.versions.build @@ -174,10 +173,13 @@ class VersionsController < ApplicationController if request.post? if @version.save respond_to do |format| - format.html do - flash[:notice] = l(:notice_successful_create) - redirect_to settings_project_url(@project, :tab => 'versions') - end + format.html{ + if @is_create + redirect_to project_versions_path(@project) + elsif @is_issue + redirect_to new_project_issue_path(@project) + end + } format.js format.api do render :action => 'show', :status => :created, :location => version_url(@version) diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index ed6d5e9fd..c8883bd78 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -103,8 +103,9 @@
  • <%= @issue.fixed_version.nil? ? "无里程碑" : "已指派里程碑" %> - <%= link_to "", new_project_version_path(@project, :is_issue => true, :issue => @issue), :class => "pic_add mt5 ml5 fr", :remote => true %> - + <% if params[:action] == "new" %> + <%= link_to "", new_project_version_path(@project, :is_issue => true, :issue_project_id => @project.id), :class => "pic_add mt5 ml5 fr", :remote => true %> + <% end %>
  • <% if @issue.safe_attribute? 'start_date' %> diff --git a/app/views/versions/_new_milestone.html.erb b/app/views/versions/_new_milestone.html.erb index 902f4b912..33c2fb9ad 100644 --- a/app/views/versions/_new_milestone.html.erb +++ b/app/views/versions/_new_milestone.html.erb @@ -8,7 +8,7 @@
    <%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true, :is_index => @is_index), :remote => true, :id => 'project_applied_form') do %> - <%= form_for :version, :url => project_versions_path(@project, :is_setting => true, :is_issue => @is_issue, :is_create => @is_create),:html => {:id=>"popub_new_project_version_form", :remote => true} do |f| %> + <%= form_for :version, :url => project_versions_path(@project, :is_setting => @is_setting, :is_issue => @is_issue, :is_create => @is_create, :issue_project_id => @issue_project_id),:html => {:id=>"popub_new_project_version_form", :remote => @is_setting ? true : false} do |f| %> <%#= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, :is_index => params[:is_index] } do |f| %>
    • @@ -20,18 +20,17 @@ <%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;", :no_label => true %>
    • -
    • - - <%= f.text_field :effective_date, :size => 10, :readonly => true, :class => "issues_calendar_input fl", :id => "version_effective_date", :placeholder=>"结束日期", :style=>"height:28px;", :no_label => true %> - <%= calendar_for('version_effective_date') %> - - -
    • + + + + + + +
    • <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{:no_label => true },{:style=>"height:28px;"} %>
    • -
    取消 保存 diff --git a/app/views/versions/create.js.erb b/app/views/versions/create.js.erb index 799b2cd43..20dd95cea 100644 --- a/app/views/versions/create.js.erb +++ b/app/views/versions/create.js.erb @@ -1,2 +1 @@ -$("#versions_choise_id").html('<%= escape_javascript( render :partial => 'issues/versions_choise', :locals => {:issue => @issue}) %>'); -// $("#pro_st_tbc_04").html('<%#= escape_javascript( render :partial => 'projects/settings/new_versions') %>'); +$("#pro_st_tbc_04").html('<%= escape_javascript( render :partial => 'projects/settings/new_versions') %>'); diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb index 86ada5f4f..ab5ad83aa 100644 --- a/app/views/versions/new.js.erb +++ b/app/views/versions/new.js.erb @@ -1,7 +1,2 @@ -<% if !@is_create.nil? && !@is_issue.nil? %> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'versions/new_modal') %>'); -showModal('ajax-modal', '600px'); -<% else %> var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>"; pop_box_new(htmlvalue,820,316); -<% end %> \ No newline at end of file