You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

apply_project_masters_controller.rb 3.5 kB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. class ApplyProjectMastersController < ApplicationController
  2. before_filter :require_login, :find_apply, :only => [:create, :delete]
  3. # GET /apply_project_masters
  4. # GET /apply_project_masters.json
  5. def index
  6. @apply_project_masters = ApplyProjectMaster.all
  7. respond_to do |format|
  8. format.html # index.html.erb
  9. format.json { render json: @apply_project_masters }
  10. end
  11. end
  12. # GET /apply_project_masters/1
  13. # GET /apply_project_masters/1.json
  14. def show
  15. @apply_project_master = ApplyProjectMaster.find(params[:id])
  16. respond_to do |format|
  17. format.html # show.html.erb
  18. format.json { render json: @apply_project_master }
  19. end
  20. end
  21. # GET /apply_project_masters/new
  22. # GET /apply_project_masters/new.json
  23. def new
  24. @apply_project_master = ApplyProjectMaster.new
  25. respond_to do |format|
  26. format.html # new.html.erb
  27. format.json { render json: @apply_project_master }
  28. end
  29. end
  30. # GET /apply_project_masters/1/edit
  31. def edit
  32. @apply_project_master = ApplyProjectMaster.find(params[:id])
  33. end
  34. # POST /apply_project_masters
  35. # POST /apply_project_masters.json
  36. def create
  37. # @apply_project_master = ApplyProjectMaster.new(params[:apply_project_master])
  38. #
  39. # respond_to do |format|
  40. # if @apply_project_master.save
  41. # format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully created.' }
  42. # format.json { render json: @apply_project_master, status: :created, location: @apply_project_master }
  43. # else
  44. # format.html { render action: "new" }
  45. # format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
  46. # end
  47. # end
  48. set_apply(@apply, User.current, true)
  49. end
  50. # PUT /apply_project_masters/1
  51. # PUT /apply_project_masters/1.json
  52. def update
  53. @apply_project_master = ApplyProjectMaster.find(params[:id])
  54. respond_to do |format|
  55. if @apply_project_master.update_attributes(params[:apply_project_master])
  56. format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully updated.' }
  57. format.json { head :no_content }
  58. else
  59. format.html { render action: "edit" }
  60. format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
  61. end
  62. end
  63. end
  64. # DELETE /apply_project_masters/1
  65. # DELETE /apply_project_masters/1.json
  66. def destroy
  67. @apply_project_master = ApplyProjectMaster.find(params[:id])
  68. @apply_project_master.destroy
  69. respond_to do |format|
  70. format.html { redirect_to apply_project_masters_url }
  71. format.json { head :no_content }
  72. end
  73. end
  74. def delete
  75. set_apply(@apply, User.current, false)
  76. end
  77. private
  78. def find_apply
  79. klass = Object.const_get(params[:object_type].camelcase) rescue nil
  80. if klass && klass.respond_to?('applied_by')
  81. @apply = klass.find_all_by_id(Array.wrap(params[:object_id]))
  82. end
  83. render_404 unless @apply.present?
  84. end
  85. #flag标注功能,为1时设置‘申请版主’,为0时设置取消
  86. def set_apply(objects, user, flag)
  87. objects.each do |object|
  88. object.set_apply(user, flag)
  89. end
  90. respond_to do |format|
  91. format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
  92. format.js { render :partial => 'set_apply', :locals => {:user => user, :objects => objects} }
  93. end
  94. end
  95. end

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...