rest.diff

Markus Knittig, 2008-07-05 21:49

Download (6.1 KB)

 
app/controllers/issues_controller.rb (working copy)
53 53
      limit = per_page_option
54 54
      respond_to do |format|
55 55
        format.html { }
56
        format.xml  { }
57 56
        format.atom { }
58 57
        format.csv  { limit = Setting.issues_export_limit.to_i }
59 58
        format.pdf  { limit = Setting.issues_export_limit.to_i }
......
67 66
                           :offset =>  @issue_pages.current.offset
68 67
      respond_to do |format|
69 68
        format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
70
        format.xml  { render :xml => @issues.to_xml }
71 69
        format.atom { render_feed(@issues, :title => l(:label_issue_plural)) }
72 70
        format.csv  { send_data(issues_to_csv(@issues, @project).read, :type => 'text/csv; header=present', :filename => 'export.csv') }
73 71
        format.pdf  { send_data(render(:template => 'issues/index.rfpdf', :layout => false), :type => 'application/pdf', :filename => 'export.pdf') }
......
106 104
    @time_entry = TimeEntry.new
107 105
    respond_to do |format|
108 106
      format.html { render :template => 'issues/show.rhtml' }
109
      format.xml  { render :xml => @journals.to_xml }
110 107
      format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
111 108
      format.pdf  { send_data(render(:template => 'issues/show.rfpdf', :layout => false), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
112 109
    end
113 110
  end
114 111
  def new
......
174 171
      @issue.attributes = attrs
175 172
    end
176 173

  
174
    if request.post?
177
    if request.post? || request.put?
178 175
      @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today)
179 176
      @time_entry.attributes = params[:time_entry]
180 177
      attachments = attach_files(@issue, params[:attachments])
......
224 216
  
225 217
  # Bulk edit a set of issues
226 218
  def bulk_edit
219
    if request.post?
227
    if request.post? || request.put?
228 220
      status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id])
229 221
      priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id])
230 222
      assigned_to = (params[:assigned_to_id].blank? || params[:assigned_to_id] == 'none') ? nil : User.find_by_id(params[:assigned_to_id])
......
275 267
    @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
276 268
    @target_project ||= @project    
277 269
    @trackers = @target_project.trackers
270
    if request.post?
278
    if request.post? || request.put?
279 271
      new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
280 272
      unsaved_issue_ids = []
281 273
      @issues.each do |issue|
app/controllers/messages_controller.rb (working copy)
64 64

  
65 65
  # Edit a message
66 66
  def edit
67
    if params[:message] && User.current.allowed_to?(:edit_messages, @project)
67
    if params[:message] && User.current.allowed_to?(:edit_messages, @project))
68 68
      @message.locked = params[:message]['locked']
69 69
      @message.sticky = params[:message]['sticky']
70 70
    end
app/controllers/admin_controller.rb (working copy)
23 23
  include SortHelper	
24 24

  
25 25
  def index
26
    @no_configuration_data = Redmine::DefaultData::Loader::no_data?
26
    if request.delete? and User.current.admin
27
      @project.destroy
28
      respond_to do |format|
29
        format.xml  { head :ok }
30
      end
31
    else
32
      @no_configuration_data = Redmine::DefaultData::Loader::no_data?
33
    end
34 27
  end
35 28
	
36 29
  def projects
......
62 58
        render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i), 
63 59
                                  :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
64 60
      }
65
      format.xml  { render :xml => projects.to_xml }
66 61
    end
67 62
  end
68 63
  
......
82 77
      @project.enabled_module_names = params[:enabled_modules]
83 78
      if @project.save
84 79
        flash[:notice] = l(:notice_successful_create)
80
        redirect_to :controller => 'admin', :action => 'projects'
81
	  end		
85
        respond_to do |format|
86
          format.html { redirect_to :controller => 'admin', :action => 'projects' }
87
          format.xml  { head :ok }
88
	end
89
      end		
90 82
    end	
91 83
  end
92 84
	
......
112 104
                                   :conditions => cond).to_f
113 105
    end
114 106
    @key = User.current.rss_key
115

  
116
    respond_to do |format|
117
      format.html
118
      format.xml  { render :xml => @project.to_xml }
119
    end
120 107
  end
121 108

  
122 109
  def settings
......
143 130
        render :action => 'settings'
144 131
      end
145 132
    end
146

  
147
    respond_to do |format|
148
      format.html
149
      format.xml  { render :xml => @project.to_xml }
150
    end
151 133
  end
152 134
  
153 135
  def modules
......
168 150
  # Delete @project
169 151
  def destroy
170 152
    @project_to_destroy = @project
153
    if request.post? and params[:confirm]
171
    if request.delete? and params[:confirm]
172 154
      @project_to_destroy.destroy
155
      redirect_to :controller => 'admin', :action => 'projects'
173
      respond_to do |format|
174
        format.html { redirect_to :controller => 'admin', :action => 'projects' }
175
        format.xml  { head :ok }
176
      end
177
      #redirect_to :controller => 'admin', :action => 'projects'
178 156
    end
179 157
    # hide project in layout
180 158
    @project = nil
......
183 161
  # Add a new issue category to @project
184 162
  def add_issue_category
185 163
    @category = @project.issue_categories.build(params[:category])
164
    if request.post? and @category.save
186
    if request.delete? and @category.save
187 165
  	  respond_to do |format|
188 166
        format.html do
189 167
          flash[:notice] = l(:notice_successful_create)
190 168