diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 44d68de26..c58cd3f82 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -79,7 +79,7 @@ class AttachmentsController < ApplicationController else candown = @attachment.is_public == 1 end - if candown || User.current.admin? + if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index be27a71ea..047f7103e 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -488,6 +488,11 @@ class BidsController < ApplicationController if @bid.homework_type @homework = HomeworkAttach.new + if @bid.proportion + teacher_proportion = @bid.proportion * 1.0 / 100 + else + teacher_proportion = 1.0 + end #@homework_list = @bid.homeworks #增加作业按评分排序, #@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC") @@ -495,7 +500,7 @@ class BidsController < ApplicationController (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY - (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC") + (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC") if params[:student_id].present? @temp = [] @homework_list.each do |pro| diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c80ce6d69..666c39d30 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -38,6 +38,17 @@ class FilesController < ApplicationController @isproject = true @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + all_attachments = [] + @containers.each do |container| + all_attachments += container.attachments + end + @limit = 10 + @feedback_count = all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = all_attachments[@offset, @limit] + render :layout => !request.xhr? elsif params[:course_id] @isproject = false @@ -67,6 +78,18 @@ class FilesController < ApplicationController else @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)] end + + all_attachments = [] + @containers.each do |container| + all_attachments += container.attachments + end + + @limit = 10 + @feedback_count = all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = all_attachments[@offset, @limit] + render :layout => 'base_courses' end end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index e840664b4..cdeb17e54 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -103,7 +103,11 @@ class MessagesController < ApplicationController # Edit a message def edit - (render_403; return false) unless @message.editable_by?(User.current) + if @project + (render_403; return false) unless @message.editable_by?(User.current) + else + (render_403; return false) unless @message.course_editable_by?(User.current) + end @message.safe_attributes = params[:message] if request.post? && @message.save attachments = Attachment.attach_files(@message, params[:attachments]) @@ -124,7 +128,11 @@ class MessagesController < ApplicationController # Delete a messages def destroy - (render_403; return false) unless @message.destroyable_by?(User.current) + if @project + (render_403; return false) unless @message.destroyable_by?(User.current) + else + (render_403; return false) unless @message.course_destroyable_by?(User.current) + end r = @message.to_param @message.destroy # modify by nwb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1dba60a6d..1c78c54a1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -403,21 +403,35 @@ class ProjectsController < ApplicationController #Ended by young def feedback - page = params[:page] + @page = params[:page] + @page = @page.to_i # Find the page of the requested reply @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 10 - if params[:r] && page.nil? - offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) - page = 1 + offset / @limit + @limit = 3 + + offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) + page = 1 + offset / @limit + if params[:r] && @page.nil? + @page = page end - + + puts @page + if @page < 0 + @page = 1 + end + if @page > page + @page = page + end + + @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, page + @feedback_pages = Paginator.new @feedback_count, @limit, @page @offset ||= @feedback_pages.offset @jour = @jours[@offset, @limit] @state = false @base_courses_tag = @project.project_type + + respond_to do |format| format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.api diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 110f81537..e31bb2738 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -88,7 +88,44 @@ class WordsController < ApplicationController #format.api { render_api_ok } end end - + + def destroyJournal + + @journalP=JournalsForMessage.find(params[:object_id]) + @journalP.destroy + + @page = params[:page] + @page = @page.to_i + @project = Project.find params[:project_id] + # Find the page of the requested reply + @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @limit = 3 + + offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) + page = 1 + offset / @limit + if params[:r] && @page.nil? + @page = page + end + + if @page < 0 + @page = 1 + end + if @page > page + @page = page + end + + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, @page + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + @state = false + @base_courses_tag = @project.project_type + + respond_to do |format| + format.js + end + end + def new @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] if @jour diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8f3d68d02..e25434e6e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -29,9 +29,9 @@ class Attachment < ActiveRecord::Base include UserScoreHelper validates_presence_of :filename, :author - validates_length_of :filename, :maximum => 255 - validates_length_of :disk_filename, :maximum => 255 - validates_length_of :description, :maximum => 255 + validates_length_of :filename, :maximum => 254 + validates_length_of :disk_filename, :maximum => 254 + validates_length_of :description, :maximum => 254 validate :validate_max_file_size diff --git a/app/models/message.rb b/app/models/message.rb index 62bfb34a5..0fdfc5b15 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -127,6 +127,14 @@ class Message < ActiveRecord::Base board.course end + def course_editable_by?(usr) + usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course))) + end + + def course_destroyable_by?(usr) + usr && usr.logged? && (usr.allowed_to?(:delete_messages, course) || (self.author == usr && usr.allowed_to?(:delete_own_messages, course))) + end + def editable_by?(usr) usr && usr.logged? && (usr.allowed_to?(:edit_messages, project) || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))) end diff --git a/app/views/courses/_course_resources_html.erb b/app/views/courses/_course_resources_html.erb new file mode 100644 index 000000000..8f706725d --- /dev/null +++ b/app/views/courses/_course_resources_html.erb @@ -0,0 +1,32 @@ +<% id = "course_resources_ul_" + obj.id.to_s%> + \ No newline at end of file diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index d7d579dd1..366ec0c39 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,8 +1,8 @@ <% if @events_by_day != nil && @events_by_day.size >0 %>
- +

- <%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %> + <%#= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>

<% @events_by_day.keys.sort.reverse.each do |day| %> @@ -29,7 +29,7 @@ <%= l(:label_new_activity) %> - <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url %> + <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:style => "word-break:break-all;" %> diff --git a/app/views/files/_course_show_all_attachment.html.erb b/app/views/files/_course_show_all_attachment.html.erb index 76112bc78..f70142a05 100644 --- a/app/views/files/_course_show_all_attachment.html.erb +++ b/app/views/files/_course_show_all_attachment.html.erb @@ -25,60 +25,70 @@ - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - + <%# @containers.each do |container| %> + <%# next if container.attachments.empty? -%> + <%# if container.is_a?(Version) -%> + - <%= number_to_human_size(file.filesize) %> - - <%= file.attachmentstype.typeName unless file.attachmentstype.nil? %> + --> + <%# end -%> + <% if @curse_attachments != nil %> + <% @curse_attachments.each do |file| %> + <%if file.is_public == 0 && !User.current.member_of_course?(@course)%> + <%next%> + <%end%> + "> + <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> + + <%= number_to_human_size(file.filesize) %> + + <%= file.attachmentstype.typeName unless file.attachmentstype.nil? %> <%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %> - - <%= file.show_suffix_type %> - - <%= file.file_dense_str %> -   + + <%= file.show_suffix_type %> + + <%= file.file_dense_str %> +   <%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list, :attachment => file} %> - - <%= file.downloads %> - - - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - - - - -
- <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> -
-
- - - - <% end -%> - <% reset_cycle %> + + <%= file.downloads %> + + + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> + + + + +
+ <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
+
+ + + <% end -%> + <% end %> + <%# reset_cycle %> + <%# end -%> + + + + diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index 838153c78..043fe1183 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -25,16 +25,17 @@ - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - + <%# @containers.each do |container| %> + <%# next if container.attachments.empty? -%> + <%# if container.is_a?(Version) -%> + + <%# end -%> + <% if @curse_attachments != nil %> + <% @curse_attachments.each do |file| %> <%if file.is_public == 0 && !User.current.member_of?(@project)%> <%next%> <%end%> @@ -75,10 +76,17 @@ <% end -%> - <% reset_cycle %> + <%# reset_cycle %> <% end -%> + + + diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 990a6d3c8..46fc0debd 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -10,7 +10,7 @@ <%=l(:label_organizers)%> <%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%> <%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %> - <%=l(:label_copyright)%>@2007~2014 + <%=l(:label_copyright)%>©2007~2014 <%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %> <%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %> diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 3116a9a68..b943cf565 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -44,6 +44,13 @@ <% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%> <% hasCourse=true%> + <% _bool=false %> + <% User.current.courses.each do |course| %> + <% if !course_endTime_timeout?(course) %> + <% _bool=true %> + <% end %> + <% end %> + <% if _bool %>
  • <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
  • + <% end %> <% end -%> <% end %> -
  • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> + <% if User.current.projects.count>0 %> +
  • + <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> <% if hasCourse %>
  • + <% end %>
  • <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
  • diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 4db903b88..5b8b629d4 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -148,7 +148,7 @@ "编辑", {:action => 'edit', :id => message}, :title => l(:button_edit) - ) if message.editable_by?(User.current) %> + ) if message.course_editable_by?(User.current) %> <%= link_to( #image_tag('delete.png'), "删除", @@ -156,7 +156,7 @@ :method => :post, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if message.destroyable_by?(User.current) %> + ) if message.course_destroyable_by?(User.current) %>
    diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index bb879e213..ad91c72f8 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -30,13 +30,14 @@ border-bottom: 1px dashed rgb(204, 204, 204); } .memo-content { + width: 82%; padding: 1%; margin: 1%; margin-bottom: 40px; background-color: #F6F6F6; white-space: normal; - /*word-break: break-all; */ - word-wrap: break-word; + word-break: break-all; + /*word-wrap: break-word;*/ } .memo-timestamp { position: absolute; @@ -155,10 +156,10 @@ :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) ) if message.destroyable_by?(User.current) %> - + + -
    <%= textAreailizable message,:content,:attachments => message.attachments %> diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 1f2198a3b..ad2c7835c 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -5,7 +5,7 @@

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

    - +

    <%= 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/_form.html.erb b/app/views/news/_form.html.erb index 0601ee25b..f92559903 100644 --- a/app/views/news/_form.html.erb +++ b/app/views/news/_form.html.erb @@ -1,11 +1,10 @@ <%= error_messages_for @news %>
    - <% str = @project ? l(:bale_news_notice) : l(:label_news_new) %> - <%= str %> + <%= @project ? l(:label_news_new) : l(:bale_news_notice) %>

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

    - +

    <%= 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/_news.html.erb b/app/views/news/_news.html.erb index 704e0eef3..7684a5949 100644 --- a/app/views/news/_news.html.erb +++ b/app/views/news/_news.html.erb @@ -1,9 +1,9 @@ - + <%# unless news.summary.blank? %><%#=h news.summary %><%# end %> +<%#= authoring news.created_on, news.author %>

    --> diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 68fad17f2..836d3b6ed 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -1,4 +1,4 @@ - + <% if @project %> <%= labelled_form_for @news, :url => project_news_index_path(@project), :html => {:id => 'news-form', :multipart => true} do |f| %> diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 5de3ceb4a..8e36b8c59 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -36,7 +36,8 @@ function checkMaxLength() { -<% reply_allow = JournalsForMessage.create_by_user? User.current %> + +

    <%= l(:label_user_response) %>

    @@ -59,6 +60,8 @@ function checkMaxLength() { <% end %>
    +
    + <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% if @jour.size >0 %>
    \ No newline at end of file diff --git a/app/views/softapplications/_list.html.erb b/app/views/softapplications/_list.html.erb index 4f99519b5..e31aedda7 100644 --- a/app/views/softapplications/_list.html.erb +++ b/app/views/softapplications/_list.html.erb @@ -9,9 +9,30 @@
    <%= softapplication.description.truncate(95, omission: '...') %>
    <%contest = softapplication.contests.first%> + + + + + + + + + + + + + + + + + + + +

    <%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

    -

    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(10, omission: '...') %>

    -

    <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= softapplication.android_min_version_available %>

    +

    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(14, omission: '...') %>

    + <%strTitle = softapplication.android_min_version_available%> +

    <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= strTitle.truncate(10,omisiion:'...') %>

    <%=l(:label_attendingcontestwork_developers)%>:<%= softapplication.application_developers %> diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index b5e3e951c..2863d5bfd 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -3,51 +3,54 @@
    -
    - - - +
    - - - - - - - - - <% contest = @softapplication.contests.first %> - - - - - - - - - - - - - - - - - - -
    <%= @softapplication.name %> - <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  - <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> -
    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
    <%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %>
    - <%=l(:label_attendingcontestwork_download)%>: - - <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> - - <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %>
    <%=l(:label_attendingcontestwork_average_scores)%>: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %>
    - <% if @project %> - <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %> - <% end %> -
    -
    + + + + +
    <%= @softapplication.name %> + <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  + <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> +
    + + +
    + + + + + <% contest = @softapplication.contests.first %> + + + + + + + + + + + + + + + + + + + + + + + + +
    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
    <%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %>
    <%=l(:label_attendingcontestwork_download)%>: + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> + <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %>
    <%=l(:label_attendingcontestwork_average_scores)%>:<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %>
    + <% if @project %> + <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %> + <% end %> +
    @@ -56,7 +59,7 @@
    <%=l(:label_work_description)%>:
    -
    <%= @softapplication.description %>
    +
    <%= @softapplication.description %>
    diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index d6ea964b8..2e9b3d217 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -34,42 +34,18 @@ <% elsif object_flag == '6' %> - <%#= image_tag("/images/sidebar/tags.png") %> + <%#= image_tag("/images/sidebar/tags.png") %> <%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %> - <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %> + <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %> -    -
    - <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> -
    - +    +
    + <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    + <% else %> <%= image_tag("/images/sidebar/tags.png") %> diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 71a44f3c9..055dd7d6b 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -32,8 +32,9 @@

    - <%= membership.course.short_description %> -

    + <%= textilizable membership.course.short_description %> +

    + diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index f590cf868..8d31f7c4c 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -6,11 +6,8 @@
    - <% if (course.school == nil) %> -               - <% else %> - <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> - <% end %> + <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> @@ -19,7 +16,11 @@
    [<%= get_course_term course %>] - <%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <% if (course.school == nil) %> +               + <% else %> + <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> + <% end %> (<%= course.members.count %>人) <%# files_count = course.attachments.count.to_s %> (<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料) diff --git a/app/views/words/_feedback.html.erb b/app/views/words/_feedback.html.erb new file mode 100644 index 000000000..774ee3b64 --- /dev/null +++ b/app/views/words/_feedback.html.erb @@ -0,0 +1,50 @@ +<% reply_allow = JournalsForMessage.create_by_user? User.current %> +<% if @jour.size >0 %> + +<% end %> + + \ No newline at end of file diff --git a/app/views/words/destroyJournal.js.erb b/app/views/words/destroyJournal.js.erb new file mode 100644 index 000000000..3600c3fd6 --- /dev/null +++ b/app/views/words/destroyJournal.js.erb @@ -0,0 +1,5 @@ + +<% if @journalP!=nil %> + //$(".message-for-user").children("#word_li_<%#=@journalP.id%>").remove(); + $("#project_feedback").html("<%= escape_javascript(render :partial => 'words/feedback') %>"); +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9d9b9d13b..f93318c7d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do delete 'words/destroy', :to => 'words#destroy' get 'words/more', :to => 'words#more' get 'words/back', :to=> 'words#back' + get 'words/destroyJournal', :to => 'words#destroyJournal' ############## fq post 'calls/create', :to => 'bids#create' delete 'calls/destroy', :to => 'bids#destroy' @@ -746,6 +747,7 @@ RedmineApp::Application.routes.draw do match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution' + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| file = File.join(plugin_dir, "config/routes.rb") if File.exists?(file) diff --git a/db/schema.rb b/db/schema.rb index 7d908db6f..cdedc6a2c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140814062455) do +ActiveRecord::Schema.define(:version => 20140812065417) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -448,14 +448,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do end create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" + t.string "name", :null => false + t.string "description", :default => "" t.integer "topic_count", :default => 0 t.integer "memo_count", :default => 0 t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "groups_users", :id => false, :force => true do |t| diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 9f85dc49f..3059c23c9 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -43,8 +43,13 @@ module Redmine end def attachments_visible?(user=User.current) - (respond_to?(:visible?) ? visible?(user) : true) && - user.allowed_to?(self.class.attachable_options[:view_permission], self.project) + if self.respond_to?(:project) + (respond_to?(:visible?) ? visible?(user) : true) && + user.allowed_to?(self.class.attachable_options[:view_permission], self.project) + else + return true + end + end def attachments_deletable?(user=User.current) diff --git a/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb b/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb index e60198fff..480119ca7 100644 --- a/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb +++ b/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb @@ -46,8 +46,8 @@ review = issue.code_review %> <%= l(:label_revision) + " "%> <%= link_to_revision(assignment.revision, repo) %> - <% elsif assignment.attachment %> - <%= link_to(assignment.attachment.filename, :controller => 'attachments', :action => 'show', :id => attachment.id) %> + <% elsif assignment.respond_to?("attachment") && assignment.attachment %> + <%= link_to(assignment.attachment.filename.to_s, :controller => 'attachments', :action => 'show', :id => assignment.attachment.id) %> <% end %> diff --git a/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb b/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb index 81feda16e..79d0e6f9f 100644 --- a/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb +++ b/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb @@ -107,7 +107,7 @@ <% submit_url = url_for(:controller => 'code_review', :action => 'new', :id=>@project) %> - <%= button_to_function l(:button_apply), "$('#review-form').load('#{submit_url}', $('#review_form').serialize2json())" %> + <%= button_to_function l(:label_button_ok), "$('#review-form').load('#{submit_url}', $('#review_form').serialize2json())" %> <%= preview_link({ :controller => 'code_review', :action => 'preview', :id => @project}, 'review_form') %>