From 54c8ee9d4d29ab264c3baa3deebd345ca0aabe3a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 21 Jan 2015 17:51:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E7=AD=94=E5=AE=8C=E9=97=AE=E5=8D=B7=E4=B9=8B=E5=90=8E=E3=80=82?= =?UTF-8?q?=E8=83=BD=E7=9C=8B=E5=88=B0=E8=87=AA=E5=B7=B1=E7=AD=94=E9=A2=98?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 12 +++++-- app/helpers/poll_helper.rb | 2 +- app/views/poll/_poll.html.erb | 11 +++---- app/views/poll/_show_MCQ_result.html.erb | 26 +++++++++++++++ app/views/poll/_show_MC_result.html.erb | 27 ++++++++++++++++ app/views/poll/_show_mulit_result.html.erb | 20 ++++++++++++ app/views/poll/_show_single_result.html.erb | 18 +++++++++++ app/views/poll/poll_result.html.erb | 36 +++++++++++++++++++++ config/routes.rb | 1 + 9 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 app/views/poll/_show_MCQ_result.html.erb create mode 100644 app/views/poll/_show_MC_result.html.erb create mode 100644 app/views/poll/_show_mulit_result.html.erb create mode 100644 app/views/poll/_show_single_result.html.erb create mode 100644 app/views/poll/poll_result.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 42ab98e10..4abddaa5e 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,7 +1,7 @@ class PollController < ApplicationController - before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll] + before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result] before_filter :find_container, :only => [:new,:create, :index] - before_filter :is_member_of_course, :only => [:index,:show] + before_filter :is_member_of_course, :only => [:index,:show,:poll_result] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll] include PollHelper def index @@ -330,6 +330,14 @@ class PollController < ApplicationController end end + #显示某个学生某份问卷的填写结果 + def poll_result + @poll_questions = paginateHelper @poll.poll_questions,5 + respond_to do |format| + format.html{render :layout => 'base_courses'} + end + end + private def find_poll_and_course @poll = Poll.find params[:id] diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 17ef02a36..60d82c096 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -73,5 +73,5 @@ module PollHelper "多行主观题" end end - + end \ No newline at end of file diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 3290ff2dc..c53f09361 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -1,20 +1,19 @@ <% has_commit = has_commit_poll?(poll.id ,User.current)%> +<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
  • <% if @is_teacher %> <% if has_commit %> - <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%> + <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %> <% else %> - <%= link_to (poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name), poll_path(poll.id), :class => "polls_title polls_title_w fl" %> + <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl" %> <% end %> <% else %> <% if has_commit && poll.polls_status == 2 %> - - <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name %> - + <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 500px;width: auto;" %> <% elsif !has_commit && poll.polls_status == 2 %> - <%= link_to (poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name), poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %> + <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %> <% end %> <% end %>
  • diff --git a/app/views/poll/_show_MCQ_result.html.erb b/app/views/poll/_show_MCQ_result.html.erb new file mode 100644 index 000000000..f46882881 --- /dev/null +++ b/app/views/poll/_show_MCQ_result.html.erb @@ -0,0 +1,26 @@ +
  • +
    + + 第<%= poll_question.question_number%>题: + + <%= poll_question.question_title %> + [多选题] + <%if poll_question.is_necessary == 1%> + * + <%end%> +
    +
    +
    + + + <% poll_question.poll_votes.where("user_id = #{User.current.id}").each do |answer|%> + + + + <% end%> + +
    + <%= answer.poll_answer.answer_text %> +
    +
    +
  • \ No newline at end of file diff --git a/app/views/poll/_show_MC_result.html.erb b/app/views/poll/_show_MC_result.html.erb new file mode 100644 index 000000000..7f2cbbd83 --- /dev/null +++ b/app/views/poll/_show_MC_result.html.erb @@ -0,0 +1,27 @@ +
  • +
    + + 第<%= poll_question.question_number%>题: + + <%= poll_question.question_title %> + [单选题] + <%if poll_question.is_necessary == 1%> + * + <%end%> +
    +
    +
    + + + <% poll_question.poll_votes.where("user_id = #{User.current.id}").each do |answer|%> + + + + <% end%> + + +
    + <%= answer.poll_answer.answer_text %> +
    +
    +
  • \ No newline at end of file diff --git a/app/views/poll/_show_mulit_result.html.erb b/app/views/poll/_show_mulit_result.html.erb new file mode 100644 index 000000000..e54cca505 --- /dev/null +++ b/app/views/poll/_show_mulit_result.html.erb @@ -0,0 +1,20 @@ +
  • +
    +
    + + 第<%= poll_question.question_number%>题: + + <%= poll_question.question_title %> + [多行主观] + <%if poll_question.is_necessary == 1%> + * + <%end%> +
    +
    +
    +

    + <%= get_anwser_vote_text poll_question.id,User.current.id%> +

    +
    +
    +
  • \ No newline at end of file diff --git a/app/views/poll/_show_single_result.html.erb b/app/views/poll/_show_single_result.html.erb new file mode 100644 index 000000000..07559773d --- /dev/null +++ b/app/views/poll/_show_single_result.html.erb @@ -0,0 +1,18 @@ +
  • +
    + + 第<%= poll_question.question_number%>题: + + <%= poll_question.question_title %> + [单行主观] + <%if poll_question.is_necessary == 1%> + * + <%end%> +
    +
    +
    +

    + <%= get_anwser_vote_text poll_question.id,User.current.id%> +

    +
    +
  • \ No newline at end of file diff --git a/app/views/poll/poll_result.html.erb b/app/views/poll/poll_result.html.erb new file mode 100644 index 000000000..a7cb415b3 --- /dev/null +++ b/app/views/poll/poll_result.html.erb @@ -0,0 +1,36 @@ +<%= stylesheet_link_tag 'polls', :media => 'all' %> +
    +
    +

    + <%= @poll.polls_name.empty? ? l(:label_poll_new) : @poll.polls_name %> +

    +

    + <%= @poll.polls_description%> +

    +
    +
    +
      + <% @poll_questions.each do |poll_question|%> + <% if poll_question.question_type == 1%> + <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 2%> + <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 3%> + <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 4%> + <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %> + <% end%> + <% end%> +
    +
    +
    + + +
    + +
    +
    +
    + diff --git a/config/routes.rb b/config/routes.rb index 67b0118b0..524373378 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,6 +66,7 @@ RedmineApp::Application.routes.draw do post 'commit_poll' get 'publish_poll' get 'republish_poll' + get 'poll_result' end collection do delete 'delete_poll_question' From e72ed1054e8fc36119eb3ccca726e4f7643375f5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 22 Jan 2015 09:39:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E8=B0=83=E6=9F=A5=E6=8C=89=E9=92=AE=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 17 +++++++++++++---- public/stylesheets/polls.css | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index f0204f7ee..466e711c2 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -300,13 +300,22 @@
    +
    - <%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id)%> +
    +

    N

    +
    +
    diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index e601d231d..863ee5864 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -14,9 +14,9 @@ div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margi #polls .fr{ float:right;} /*问卷按钮*/ -.polls_btn{ height:33px;border-top:1px solid #15bed1; border-bottom:1px solid #15bed1;border-right:1px solid #cee6e6; width:225px; padding:7px 0 0 15px; } -.polls_btn a{font-size:14px; color:#444444;font-weight:bold;} -.polls_btn span{ color:#15bed1; font-size:12px; font-weight:normal;} +/*.polls_btn{ height:33px;border-top:1px solid #15bed1; border-bottom:1px solid #15bed1;border-right:1px solid #cee6e6; width:225px; padding:7px 0 0 15px; }*/ +/*.polls_btn a{font-size:14px; color:#444444;font-weight:bold;}*/ +/*.polls_btn span{ color:#15bed1; font-size:12px; font-weight:normal;}*/ /*问卷列表*/ .polls_content{ width:615px;padding-left: 6px;} From 683625066ea24bde979ff44705024dd424634d79 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 22 Jan 2015 15:16:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E6=9C=AA=E6=89=B9=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=90=8E=EF=BC=8C=E8=80=81=E5=B8=88=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=AF=84=E5=88=86=E4=B9=8B=E5=90=8E=E6=8E=92=E5=BA=8F=E4=BC=9A?= =?UTF-8?q?=E5=9B=9E=E5=88=B0=E9=BB=98=E8=AE=A4=E6=8E=92=E5=BA=8F=E9=A2=9D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 5 +++-- app/views/homework_attach/_addjour.html.erb | 2 +- app/views/homework_attach/_homework.html.erb | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 8b9bf9099..8e69d1d72 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -26,6 +26,7 @@ class HomeworkAttachController < ApplicationController get_not_batch_homework_list sort,direction, @bid.id @cur_page = params[:page] || 1 @cur_type = 1 + @cur_sort,@cur_direction = params[:sort] || "s_socre", params[:direction] || "desc" @direction = direction == 'asc'? 'desc' : 'asc' respond_to do |format| format.js @@ -433,7 +434,7 @@ class HomeworkAttachController < ApplicationController #添加留言 def addjours @is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value] - @cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5 + @cur_page,@cur_type = params[:page] || 1,params[:cur_type] || 5 @homework = HomeworkAttach.find(params[:homework_id]) @stars_reates = @homework.rates(:quality) homework = @homework @@ -479,7 +480,7 @@ class HomeworkAttachController < ApplicationController if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面 @bid = @homework.bid - get_not_batch_homework_list "s_socre","desc",@homework.bid_id + get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id elsif @cur_type == "2" #老师已批列表 @result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb index 48beebdf8..78514daca 100644 --- a/app/views/homework_attach/_addjour.html.erb +++ b/app/views/homework_attach/_addjour.html.erb @@ -31,7 +31,7 @@ :url => {:controller => 'homework_attach', :action => 'addjours', :homework_id => homework_attach.id, - :cur_page => cur_page, + :page => cur_page, :cur_type => cur_type, :is_anonymous_comments => @is_anonymous_comments, :is_teacher => @is_teacher diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index c2b87832c..fca25e8ee 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -19,7 +19,7 @@ <% else %> <% homework_filename = homework.name %> <% end %> - <%= link_to homework_filename , homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type), :title => homework_filename, :remote => true%> + <%= link_to homework_filename , homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type,:cur_sort => @cur_sort, :cur_direction => @cur_direction), :title => homework_filename, :remote => true%> 提交时间: <%= format_time homework.created_at%> @@ -46,7 +46,7 @@ <% if is_teacher %>
  • - <%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %> + <%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type,:cur_sort => @cur_sort, :cur_direction => @cur_direction),:remote => true %> <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %> From 90a81ee1f17d204bf5afc9da8d4c7bc3c102cf21 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 22 Jan 2015 17:03:01 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A6=96=E9=A1=B5=E5=8A=A0=E5=85=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 10 ++- app/views/projects/_join_project.html.erb | 83 +++++++++++++++++++++++ app/views/projects/join_project.js.erb | 9 +++ app/views/welcome/index.html.erb | 3 + config/locales/zh.yml | 1 + config/routes.rb | 4 ++ 6 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 app/views/projects/_join_project.html.erb create mode 100644 app/views/projects/join_project.js.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 24a3ff19f..a2e793a10 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -35,7 +35,7 @@ class ProjectsController < ApplicationController # edit before_filter :authorize1, :only => [:show] # - before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] @@ -917,6 +917,14 @@ class ProjectsController < ApplicationController end end end + + #加入私有项目 + def join_project + respond_to do |format| + format.js + end + end + private def memberAccess diff --git a/app/views/projects/_join_project.html.erb b/app/views/projects/_join_project.html.erb new file mode 100644 index 000000000..c7ce29dae --- /dev/null +++ b/app/views/projects/_join_project.html.erb @@ -0,0 +1,83 @@ + + + + + 快速进入项目通道 + + + + + +
    +
    +
    +

    快速进入项目通道

    +

    只要持有项目的ID,就可快速申请加入所在项目。项目页面搜索不到的私有项目只能从此通道进入哦!

    +
    +
    + <%= form_tag({:controller => 'applied_project', + :action => 'applied_join_project'}, + :remote => true, + :method => :post, + :id => 'new-watcher-form') do %> + + <% end%> +
    +
    +
    + + + diff --git a/app/views/projects/join_project.js.erb b/app/views/projects/join_project.js.erb new file mode 100644 index 000000000..f3bdfb50a --- /dev/null +++ b/app/views/projects/join_project.js.erb @@ -0,0 +1,9 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); +showModal('ajax-modal', '510px'); +$('#ajax-modal').css('height','260px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("alert_box"); diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 0dc62c6a3..3e341bd27 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -66,6 +66,9 @@ :course => 0, :project_type =>( @project_type||=0)}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> +      + <%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %> +      <% end %>
    diff --git a/config/locales/zh.yml b/config/locales/zh.yml index bd6c6dc22..fbdee1d1f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2282,4 +2282,5 @@ zh: label_answer: 答案: label_poll_answer_valid_result: 以上为有效问答题答案! label_answer_total: 总计: + label_join_project: 加入项目 diff --git a/config/routes.rb b/config/routes.rb index 524373378..65498e4ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -377,6 +377,10 @@ RedmineApp::Application.routes.draw do match 'copy', :via => [:get, :post] end + collection do + match 'join_project', :via => [:get, :post] + end + #by young match '/member', :to => 'projects#member', :as => 'member', :via => :get match '/file', :to => 'projects#file', :as => 'file', :via => :get