diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 08c7adf10..ce02f4249 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -228,6 +228,18 @@ module Mobile present :status, 0 end + desc '课程课件' + params do + requires :token, type: String + requires :course_id,type: Integer,desc: '课程id' + end + get ":course_id/attachments" do + cs = CoursesService.new + count = cs.course_attachments params + present :data, count, with: Mobile::Entities::Attachment + present :status, 0 + end + end end end diff --git a/app/api/mobile/entities/attachment.rb b/app/api/mobile/entities/attachment.rb index 510db89be..080b24558 100644 --- a/app/api/mobile/entities/attachment.rb +++ b/app/api/mobile/entities/attachment.rb @@ -16,8 +16,11 @@ module Mobile end end end + attachment_expose :id attachment_expose :filename attachment_expose :description + attachment_expose :downloads + attachment_expose :quotes end end end \ No newline at end of file diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 94a5a8194..06d69f72e 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -180,17 +180,14 @@ class ZipdownController < ApplicationController def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) - ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE') - rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip" zipfile_name = "#{output_path}/#{rename_zipfile}" - Zip.unicode_names = true Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name)) Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| files_paths.each do |filename| - rename_file = ic.iconv( (File.basename(filename)) ).to_s - rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment + rename_file = File.basename(filename) + rename_file = filename_to_real( File.basename(filename)) if is_attachment begin zipfile.add(rename_file, filename) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index e91883bee..b992665d3 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -428,6 +428,17 @@ class CoursesService result end + # 课程课件 + def course_attachments params + result = [] + @course = Course.find(params[:course_id]) + @attachments = @course.attachments.order("created_on desc") + @attachments.each do |atta| + result << {:filename => atta.filename,:description => atta.description,:downloads => atta.downloads,:quotes => atta.quotes.nil? ? 0 :atta.quotes } + end + result + end + private def show_homework_info course,bid,current_user,is_course_teacher author_real_name = bid.author.lastname + bid.author.firstname diff --git a/app/views/bids/_alert_anonyoms.html.erb b/app/views/bids/_alert_anonyoms.html.erb index 2f1c443f4..4da6e0a10 100644 --- a/app/views/bids/_alert_anonyoms.html.erb +++ b/app/views/bids/_alert_anonyoms.html.erb @@ -66,10 +66,10 @@

<% end %>
- + 确  定 - + 取  消
diff --git a/app/views/bids/alert_anonymous_comment.js.erb b/app/views/bids/alert_anonymous_comment.js.erb index 5cb4018a6..66c36e223 100644 --- a/app/views/bids/alert_anonymous_comment.js.erb +++ b/app/views/bids/alert_anonymous_comment.js.erb @@ -1,6 +1,6 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>'); showModal('ajax-modal', '500px'); -$('#ajax-modal').css('height','180px'); +//$('#ajax-modal').css('height','180px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 7c6594006..410648c15 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -1,12 +1,3 @@ -

<% if User.current.language == "zh"%> @@ -16,20 +7,6 @@ <% end %>

-
- <% if User.current.logged? %> - <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> -

<%= l(:project_module_boards_post) %>

- <%= render :partial => 'messages/form_project', :locals => {:f => f} %> -

- <%= l(:button_submit)%> - <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'grey_btn ml10 fl' %> -

- <% end %> -
-

- <% end %> -
<% if !User.current.logged? %> diff --git a/app/views/files/_show_quote_resource_project.html.erb b/app/views/files/_show_quote_resource_project.html.erb index 9ea9126fb..09a553038 100644 --- a/app/views/files/_show_quote_resource_project.html.erb +++ b/app/views/files/_show_quote_resource_project.html.erb @@ -1,6 +1,6 @@
-

将此文件件引入我的资源库

+

将此文件引入我的资源库

<% if error == '403' %>
您没有权限引用此资源
diff --git a/app/views/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb index 9055b9a1b..6550ed874 100644 --- a/app/views/layouts/_base_development_group.html.erb +++ b/app/views/layouts/_base_development_group.html.erb @@ -23,7 +23,7 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> + <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %> <% end %>
<% end%> diff --git a/app/views/layouts/_base_friend_group.html.erb b/app/views/layouts/_base_friend_group.html.erb index 71d375501..16ccc09e5 100644 --- a/app/views/layouts/_base_friend_group.html.erb +++ b/app/views/layouts/_base_friend_group.html.erb @@ -12,7 +12,7 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> + <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %> <% end %>
<% end%> diff --git a/app/views/layouts/_base_research_team.html.erb b/app/views/layouts/_base_research_team.html.erb index 3f942bc40..17bf65b15 100644 --- a/app/views/layouts/_base_research_team.html.erb +++ b/app/views/layouts/_base_research_team.html.erb @@ -23,7 +23,7 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> + <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %> <% end %>
<% end%> diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 9cd376c60..ba3300d44 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -16,8 +16,8 @@ <%= link_to "#{text}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%> <% end %> - <% if (User.current.member_of? @project) && User.current.login? && - Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s != "Manager" %> + <% if (User.current.member_of? @project) && User.current.login? && !User.current.admin && + !Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s.include?("Manager") %> <%= exit_project_link(@project) %> <% end %> diff --git a/app/views/messages/_project_new_topic.html.erb b/app/views/messages/_project_new_topic.html.erb new file mode 100644 index 000000000..a8a8644c3 --- /dev/null +++ b/app/views/messages/_project_new_topic.html.erb @@ -0,0 +1,28 @@ +
+

+ <% if User.current.language == "zh"%> + <%= h @board.name %> + <% else %> + <%= l(:project_module_boards) %> + <% end %> +

+
+
+<% if User.current.logged? %> + <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> +

<%= l(:project_module_boards_post) %>

+ <%= render :partial => 'messages/form_project', :locals => {:f => f} %> +

+ <%= l(:button_submit)%> + <%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn ml10 fl' %> +

+ <% end %> +
+

+<% else %> +
+ <%= l(:label_user_login_project_board) %> + <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %> +
+<% end %> +
\ No newline at end of file diff --git a/app/views/messages/new.html.erb b/app/views/messages/new.html.erb index ec95b0df0..09a714850 100644 --- a/app/views/messages/new.html.erb +++ b/app/views/messages/new.html.erb @@ -1,16 +1,5 @@ <% if @project %> -

- <%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> - » - <%= l(:label_message_new) %> -

- <%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> - <%= render :partial => 'form', :locals => {:f => f,:is_new => true} %> - <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> - <% end %> - -
+ <%= render :partial => 'project_new_topic' %> <% elsif @course %> <%= render :partial => 'course_new' %> <% end %> \ No newline at end of file diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index 5e2c9f603..7abe6198c 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -18,19 +18,19 @@
  • <%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %> - <%= h member.roles.sort.collect(&:to_s).join(', ') %> - <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), - :method => :put, - :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} + <%= h member.roles.sort.collect(&:to_s).join(', ') %> + <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), + :method => :put, + :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} ) do |f| %> - <% roles.each do |role| %> + <% roles.each do |role| %> - <% end %> + <% end %> <%= hidden_field_tag 'membership[role_ids][]', '' %>
    @@ -41,7 +41,7 @@
    <% end %> -
    + <% unless member.user_id == @project.user_id %> 编辑 <%= delete_link membership_path(member), diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index c3d339685..43da9a7d8 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,7 +1,7 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> - <% if @bid && @@jours_count %> + <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); <% elsif @course && @jours_count%> $('#course_jour_count').html("(<%= @jours_count %>)"); diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 795a56dd4..c2c4ab784 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -306,4 +306,13 @@ $(document).ready(function () { $("pre").addClass("break_word"); } - }); \ No newline at end of file + }); + +//论坛提交 +function submitProjectBoard() +{ + if(regexSubject()&®exContent()) + { + $("#message-form").submit(); + } +} \ No newline at end of file