diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index a434fcc5..ee3db741 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -74,7 +74,7 @@ class NewsController < ApplicationController def new @news = News.new(:project => @project, :author => User.current) - @course_tag = @project.project_type + @course_tag = @project.project_type if @course_tag render :layout => 'base_courses' end @@ -89,7 +89,8 @@ class NewsController < ApplicationController flash[:notice] = l(:notice_successful_create) redirect_to project_news_index_path(@project) else - render :action => 'new' + layout_file = (@project.project_type == 1) ? 'base_courses' : 'base_projects' + render :action => 'new', :layout => layout_file end end diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb index cb3a8f78..bd39d6c2 100644 --- a/app/helpers/bids_helper.rb +++ b/app/helpers/bids_helper.rb @@ -129,8 +129,16 @@ module BidsHelper def im_watching_student_id? bid people = [] people << bid.author - bid.join_in_contests.each do |jic| - people << jic.user + case bid.reward_type # 天煞的bid分了三用途,里面各种hasmany还不定能用! + when 1 + when 2 + bid.join_in_contests.each do |jic| + people << jic.user + end + when 3 + people += bid.courses.first.users.to_a + else + raise 'bids_helper: unknow bid type' # 出了错看这里!不知道的抛异常,省的找不到出错的地方! end people.include?(User.current) end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 329f8474..69b06aa1 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -74,17 +74,31 @@ module WelcomeHelper def show_user_content event str = ' '.html_safe case event.event_type - when 'news' , 'issue', 'message' , 'bid' , 'wiki-page' , 'document' - str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url, :target => "_blank" ) + when 'news' + str << content_tag("span", "发表了") << + content_tag("span", find_all_event_type(event)) << + ': '.html_safe << + link_to(truncate(strip_tags(event.event_description).gsub(/ /,''), length: 30, omission:'...'), event.event_url) + when 'issue', 'message' , 'bid' , 'wiki-page' , 'document' + str << content_tag("span", "发表了") << + content_tag("span", find_all_event_type(event)) << + ': '.html_safe << + link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) when 'reply' ,'Reply', 'Memo' str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << - link_to(truncate(strip_tags(event.event_description).gsub(/ /,''), length: 30, omission:'...'), event.event_url, :target => "_blank" ) + link_to(truncate(strip_tags(event.event_description).gsub(/ /,''), length: 30, omission:'...'), event.event_url) when 'attachment' - str << content_tag('span', '上传了') << content_tag('span', find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) << link_to((' ['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container), :class => "attachments_list_color") + str << content_tag('span', '上传了') << + content_tag('span', find_all_event_type(event)) << + ': '.html_safe << + link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) << + link_to((' ['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container), :class => "attachments_list_color") else - str << content_tag("span", "更新了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url, :target => "_blank" ) + str << content_tag("span", "更新了") << + content_tag("span", find_all_event_type(event)) << + ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) end str rescue Exception => e @@ -94,10 +108,12 @@ module WelcomeHelper def show_event_reply event str = "回复(" case event.event_type + when 'news' + str << link_to( event.comments.count, news_path(event)) << ")" when "issue" - str << link_to(cal_issues_count(event), issue_path(event), :target => "_blank" ) << ")" + str << link_to(cal_issues_count(event), issue_path(event)) << ")" when "Memo" - str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id), :target => "_blank" ) << ")" + str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id)) << ")" else str = "" end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 55019788..9ca8236d 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -28,7 +28,15 @@ class JournalsForMessage < ActiveRecord::Base # default_scope { where('m_parent_id IS NULL') } - def remove_by_user? user + def self.create_by_user? user + if user.anonymous? + return false + else + return true + end + end + + def self.remove_by_user? user if( self.user == user || ( self.jour.kind_of?(User) && self.jour== user ) ) diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index b5b2f949..e8fced1f 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -1,3 +1,4 @@ +<% reply_allow = JournalsForMessage.create_by_user? User.current %> <% tip1 = (@bid.reward_type == 3) ? l(:label_student_response) : l(:label_user_response) %>

<%=tip1%>

@@ -29,23 +30,27 @@ <%= l(:label_bids_published) %> <%= time_tag(journal.created_on).html_safe %> <%= l(:label_bids_published_ago) %> <% ids = 'project_respond_form_'+ journal.id.to_s%> + <% if reply_allow %> <%= link_to(l(:button_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%> <%= link_to l(:label_bid_respond_quote),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); $('##{ids} textarea') ;return false;"} %> + <% end %> <% if @user==User.current|| User.current.admin? %> <%#= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm), :remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> - <%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> + <%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> <% end %>
<% ids = 'project_respond_form_'+ journal.id.to_s%> + <% if reply_allow %>
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
+ <% end %>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 0fd2bf20..bae83f14 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -13,6 +13,7 @@
<% end %> +<% display_id = im_watching_student_id? @bid%> <% @homework_list.each do |homework|%> <% if homework.attachments.any?%> @@ -24,7 +25,11 @@ - + diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 8c270eea..8d31a043 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -9,14 +9,14 @@ - @@ -16,12 +16,12 @@ <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> - +
<%= form_tag({ :controller => 'issues', :action => 'index', :project_id => @project }, :method => :get, :id => 'query_form', :class => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %>
----<%= l :label_query_new %>--- + ---<%= l :label_query_new %>---
"> @@ -59,6 +59,7 @@
<% end %> +
<%= error_messages_for 'query' %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 9bd47d41..7166f306 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -101,7 +101,7 @@ end %> <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> -<% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> +<% if false # !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 31d89e7f..418480e6 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -7,7 +7,7 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index a3b51dfd..8ca518a7 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -1,10 +1,13 @@ <%= error_messages_for 'message' %> +
+ <%= l(:label_message_new) %> +
<% replying ||= false %> -
+


-<%= f.text_field :subject, :style => "width:658px;", :id => "message_subject" %> +<%= f.text_field :subject,:size => 60, :style => "width:490px;", :id => "message_subject" %> <% unless replying %> <% if @message.safe_attribute? 'sticky' %> @@ -23,7 +26,7 @@

<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> -<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'message_content' %>

+<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %>

<%= wikitoolbar_for 'message_content' %> diff --git a/app/views/news/_form.html.erb b/app/views/news/_form.html.erb index df80a748..bfdfeaa3 100644 --- a/app/views/news/_form.html.erb +++ b/app/views/news/_form.html.erb @@ -1,9 +1,12 @@ <%= error_messages_for @news %> - +
+ <% str = (@project.project_type == 1) ? l(:bale_news_notice) : l(:label_news_new) %> + <%= str %> +

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

-

<%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit', :style => "width:490px;" %>

+

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

<%= render :partial => 'attachments/form', :locals => {:container => @news} %>

diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 80576e43..de734ef9 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -1,34 +1,34 @@ +<% + if @project.project_type == 1 + btn_tips = l(:label_news_notice) + label_tips = l(:label_course_news) + else + btn_tips = l(:label_news_new) + label_tips = l(:label_news) + end +%> +<% if @project && User.current.allowed_to?(:manage_news, @project) %>
- <% if @project.project_type == 1%> - <%= link_to(l(:label_news_notice), + <%= link_to(btn_tips, new_project_news_path(@project), :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %> - <% else %> - <%= link_to(l(:label_news_new), - new_project_news_path(@project), - :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %> - <% end %> + :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
-
+ <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> <% end %> @@ -85,3 +85,16 @@ <% html_title(l(:label_news_plural)) -%> + diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 42dbcae8..feaf7540 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -1,9 +1,9 @@ -

<%=l(:label_news_new)%>

+ <%= labelled_form_for @news, :url => project_news_index_path(@project), :html => { :id => 'news-form', :multipart => true } do |f| %> <%= render :partial => 'news/form', :locals => { :f => f } %> - <%= submit_tag l(:button_create), :class => "enterprise" %> - <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> + <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> + <%= preview_link preview_news_path(:project_id => @project), 'news-form' ,target='preview',{:class => 'whiteButton m3p10'}%> <% end %>
diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index 3c7d0ada..970e228e 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -16,7 +16,7 @@ :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> - <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> | + <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => ''} %> | <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;' %> <% end %>
diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 7e1c4077..a4e0a3a7 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -36,17 +36,27 @@ function checkMaxLength() { +<% reply_allow = JournalsForMessage.create_by_user? User.current %> +

<%= l(:label_user_response) %>

+<% if !User.current.logged?%> +
+ <%= l(:label_user_login_tips) %> + <%= link_to l(:label_user_login_new), signin_path %> +
+
+<% else %>
-<%= form_for('new_form', :method => :post, - :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> - <%= f.text_area 'project_message', :rows => 3, :cols => 65, - :placeholder => "#{l(:label_welcome_my_respond)}", - :style => "resize: none; width: 98%", - :class => 'noline'%> - <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%> -<% end %> + <%= form_for('new_form', :method => :post, + :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> + <%= f.text_area 'project_message', :rows => 3, :cols => 65, + :placeholder => "#{l(:label_welcome_my_respond)}", + :style => "resize: none; width: 98%", + :class => 'noline'%> + <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%> + <% end %>
+<% end %>
<% if @jour.size >0 %>
<%= link_to homework.user, user_path(homework.user)%> 提交了作业
<%= l(:label_bidding_user_studentcode) %> :<%= homework.user.user_extensions.student_id%>  + <% if display_id %> + <%= l(:label_bidding_user_studentcode) %> :<%= homework.user.user_extensions.student_id%> + <% end %> +
diff --git a/app/views/bids/show.html.erb b/app/views/bids/show.html.erb index aec3bb7e..46b05c29 100644 --- a/app/views/bids/show.html.erb +++ b/app/views/bids/show.html.erb @@ -1,3 +1,4 @@ +<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<%= image_tag(url_to_avatar(@bid.author), :class => "avatar")%> diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index 502d07d4..4b4d7040 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -75,7 +75,7 @@

- <%= link_to '创建项目', new_project_path, :target=>'_blank'%> + <%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%>

<%= link_to_user(news.author)if news.respond_to?(:author) %><%= l(:label_project_newshare)%> <%= link_to h(news.title), news_path(news) %> - <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %>