diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 2b44d51de..be6543be2 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -7,7 +7,7 @@ class ForumsController < ApplicationController before_filter :find_forum_if_available before_filter :authenticate_user_edit, :only => [:edit, :update] before_filter :authenticate_user_destroy, :only => [:destroy] - before_filter :require_login, :only => [:new, :create] + before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit] helper :sort include SortHelper @@ -97,7 +97,24 @@ class ForumsController < ApplicationController def index @offset, @limit = api_offset_and_limit({:limit => 10}) - @forums_all = Forum.reorder("sticky DESC") + if(params[:reorder_complex]) + @type="reorder_complex" + @str=params[:reorder_complex] + @forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}") + elsif(params[:reorder_popu]) + @type="reorder_popu" + @str=params[:reorder_popu] + @forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}") + elsif(params[:reorder_time]) + @type="reorder_time" + @str=params[:reorder_time] + @forums_all = Forum.reorder("updated_at #{params[:reorder_time]}") + else + params[:reorder_complex] = "desc" + @type="reorder_complex" + @str=params[:reorder_complex] + @forums_all = Forum.reorder("topic_count desc,updated_at desc") + end @forums_count = @forums_all.count @forums_pages = Paginator.new @forums_count, @limit, params['page'] @@ -106,6 +123,7 @@ class ForumsController < ApplicationController #@forums = Forum.all respond_to do |format| format.html # index.html.erb + format.js format.json { render json: @forums } end end @@ -113,11 +131,25 @@ class ForumsController < ApplicationController # GET /forums/1 # GET /forums/1.json def show - sort_init 'updated_at', 'desc' - sort_update 'created_at' => "#{Memo.table_name}.created_at", - 'replies' => "#{Memo.table_name}.replies_count", - 'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)" - + # sort_init 'updated_at', 'desc' + # sort_update 'created_at' => "#{Memo.table_name}.created_at", + # 'replies' => "#{Memo.table_name}.replies_count", + # 'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)" + order = "" + @order_str = "" + if(params[:reorder_complex]) + order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" + @order_str = "reorder_complex="+params[:reorder_complex] + elsif(params[:reorder_popu]) + order = "replies_count #{params[:reorder_popu]}" + @order_str = "reorder_popu="+params[:reorder_popu] + elsif(params[:reorder_time]) + order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}" + @order_str = "reorder_time="+params[:reorder_time] + else + order = "last_replies_memos.created_at desc, #{Memo.table_name}.created_at desc" + @order_str = "reorder_complex=desc" + end @memo = Memo.new(:forum => @forum) @topic_count = @forum.topics.count @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] @@ -126,19 +158,15 @@ class ForumsController < ApplicationController includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). - order(sort_clause). + reorder(order). preload(:author, {:last_reply => :author}). all @memos - # @offset, @limit = api_offset_and_limit({:limit => 10}) - # @forum = Forum.find(params[:id]) - # @memos_all = @forum.topics - # @topic_count = @memos_all.count - # @topic_pages = Paginator.new @topic_count, @limit, params['page'] - - # @offset ||= @topic_pages.offset - # @memos = @memos_all.offset(@offset).limit(@limit).all + @my_topic_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is not null").count + @errors = params[:errors] respond_to do |format| + format.js format.html { render :layout => 'base_forums' }# show.html.erb @@ -172,20 +200,23 @@ class ForumsController < ApplicationController # Author lizanle # Description after save后需要进行资源记录的更新 # owner_type = 2 对应的是 forum + @save_flag=true if params[:asset_id] ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM end #end respond_to do |format| - + format.js format.html { redirect_to @forum, notice: l(:label_forum_create_succ) } format.json { render json: @forum, status: :created, location: @forum } end else + @save_flag=false respond_to do |format| flash.now[:error] = "#{l :label_forum_create_fail}: #{@forum.errors.full_messages[0]}" + format.js format.html { render action: "new" } format.json { render json: @forum.errors, status: :unprocessable_entity } end @@ -199,10 +230,12 @@ class ForumsController < ApplicationController respond_to do |format| if @forum.update_attributes(params[:forum]) + format.js {render :text=> true} format.html { redirect_to @forum, notice: l(:label_forum_update_succ) } format.json { head :no_content } else flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}" + format.js { render :text=> false} format.html { render action: "edit" } format.json { render json: @forum.errors, status: :unprocessable_entity } end @@ -261,6 +294,47 @@ class ForumsController < ApplicationController end end + #检查forum的名字 + def check_forum_name + forum_name_exist = Forum.where("name = '#{params[:forum_name]}'").count >= 1 ? true : false + render :text => forum_name_exist + end + + #添加论坛tag + def add_forum_tag + @forum = Forum.find(params[:id]) + unless @forum.nil? + @forum.tag_list.add(params[:tag_str].split(',')) + @forum.save + end + respond_to do |format| + format.js {render :delete_forum_tag} + end + end + + #删除forum的tag + def delete_forum_tag + @tag_id = (ActsAsTaggableOn::Tag.find_by_name(params[:tag_name])).id + #forum的taggable_type = 5 + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,params[:id],'Forum') + + unless @taggings.nil? + @taggings.delete + end + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id) + # 如果taggings表中记录已经不存在 ,那么检查tags表 作删除动作 + if @tagging.nil? + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.delete unless @tag.nil? + end + @forum = Forum.find(params[:id]) + respond_to do |format| + format.js + end + end + private def find_forum_if_available diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 27e0d472f..4181090a5 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -11,7 +11,7 @@ class MemosController < ApplicationController include AttachmentsHelper include ApplicationHelper - layout 'base_memos' + # layout 'base_memos' def quote @subject = @memo.subject @@ -73,41 +73,14 @@ class MemosController < ApplicationController end end #end - format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } - format.json { render json: @memo, status: :created, location: @memo } + format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } + format.json { render json: @memo, status: :created, location: @memo } else flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" - # back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id) - pre_count = REPLIES_PER_PAGE - - @memo_new = @memo.dup - @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 - unless @memo.new_record? - @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1)) - end - - - page = params[:page] - if params[:r] && page.nil? - offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count - page = 1 + offset / pre_count - else - - end - @reply_count = @memo.children.count - @reply_pages = Paginator.new @reply_count, pre_count, page - @replies = @memo.children. - includes(:author, :attachments). - reorder("#{Memo.table_name}.created_at DESC"). - limit(@reply_pages.per_page). - offset(@reply_pages.offset). - all - if @memo.new_record? - format.html { render :new,:layout=>'base'} - else - format.html { render action: :show } + format.js + format.html { redirect_to( forum_path(Forum.find(params[:forum_id]),:errors=>@memo.errors.full_messages[0])) } format.json { render json: @memo.errors, status: :unprocessable_entity } - end + #end end end @@ -115,6 +88,7 @@ class MemosController < ApplicationController REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) def show + # 更新贴吧帖子留言对应的memo_messages的viewed字段 unless @memo.children.blank? @memo.children.each do |child| @@ -154,21 +128,27 @@ class MemosController < ApplicationController @memo_new = Memo.new - + @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count # @memo = Memo.find_by_id(params[:id]) # @forum = Forum.find(params[:forum_id]) # @replies = @memo.replies # @mome_new = Memo.new respond_to do |format| - format.html # show.html.erb + format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums', format.json { render json: @memo } format.xml { render xml: @memo } end end def edit + @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count @replying = false + respond_to do |format| + format.html {render :layout=>'base_forums'} + end end def update @@ -176,7 +156,8 @@ class MemosController < ApplicationController if( #@memo.update_column(:subject, params[:memo][:subject]) && @memo.update_column(:content, params[:memo][:content]) && @memo.update_column(:sticky, params[:memo][:sticky]) && - @memo.update_column(:lock, params[:memo][:lock])) + @memo.update_column(:lock, params[:memo][:lock]) && + @memo.update_column(:subject,params[:memo][:subject])) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) @memo.save # @memo.root.update_attribute(:updated_at, @memo.updated_at) @@ -227,7 +208,7 @@ class MemosController < ApplicationController end def back_memo_url - forum_memo_path(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)) + forum_memo_path(@forum, (@memo.root.nil? ? @memo : @memo.root)) end def back_memo_or_forum_url diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 8d2cb63aa..2c7df84cf 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -160,7 +160,7 @@ class MessagesController < ApplicationController @reply.safe_attributes = params[:reply] @reply.content = @quote + @reply.content @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] - @reply.reply_id = @message.author + # @reply.reply_id = params[:id] @topic.children << @reply user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first user_activity.updated_at = Time.now diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index e0cb8af8e..0ffa334c2 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -15,6 +15,7 @@ class TagsController < ApplicationController include ContestsHelper include ActsAsTaggableOn::TagsHelper include TagsHelper + include FilesHelper helper :projects helper :courses helper :tags @@ -236,47 +237,91 @@ class TagsController < ApplicationController @rename_tag_name = params[:renameName] @taggable_id = params[:taggableId] @taggable_type = numbers_to_object_type(params[:taggableType]) - + @course_id = params[:courseId] @rename_tag = (ActsAsTaggableOn::Tag.find_by_name(@rename_tag_name)) #查找重命名后的tag @tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id #重命名前的tag_id - @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) - @obj = get_object(@taggable_id,params[:taggableType]) - if(@rename_tag.nil?) #这次命名的是新的tag - - # 是否还有其他记录 引用了 tag_id - @tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}") - # 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字 - if @tagging.count == 1 - @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) - @tag.update_attributes({:name=>@rename_tag_name}) - else #如果tagging表中的记录大于1,那么就要新增tag记录 - - unless @obj.nil? - @obj.tag_list.add(@rename_tag_name.split(",")) - @obj.save - end - #删除原来的对应的taggings的记录 - unless @taggings.nil? - @taggings.delete - end - end - else #这是已有的tag - # 更改taggings记录里的tag_id - unless @taggings.nil? + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) unless @taggable_id.blank? + @obj = get_object(@taggable_id,params[:taggableType]) unless @taggable_id.blank? + if @taggable_id.blank? #如果没有传tag_id,那么直接更新tag_name就好了。但是要防止 重命名后的tag存在。 + #看重命名后的tag是否存在。如果存在的话,只需要更改taggings里边的id即可 + if @rename_tag + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) @taggings.update_attributes({:tag_id=>@rename_tag.id}) + else #如果不存在,那么就直接更新该tag名称为新的名称 + (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).update_attributes(:name=>@rename_tag_name) + end + else + if(@rename_tag.nil?) #这次命名的是新的tag + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}") + # 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字 + if @tagging.count == 1 + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.update_attributes({:name=>@rename_tag_name}) + else #如果tagging表中的记录大于1,那么就要新增tag记录 + + unless @obj.nil? + @obj.tag_list.add(@rename_tag_name.split(",")) + @obj.save + end + #删除原来的对应的taggings的记录 + unless @taggings.nil? + @taggings.delete + end + end + else #这是已有的tag + # 更改taggings记录里的tag_id + unless @taggings.nil? + @taggings.update_attributes({:tag_id=>@rename_tag.id}) + end end end + @obj_flag = params[:taggableType] if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course) @course = @obj.container @tag_list = @tag_list = get_course_tag_list @course + elsif @course_id + @course = Course.find(@course_id) + @tag_list = get_course_tag_list @course + + #这里要引用FilesController里的逻辑了。将资源库当前的文件列表刷新一遍。 + @flag = params[:flag] || false + sort = "" + @sort = "" + @order = "" + @is_remote = false + @isproject = false + + sort = "#{Attachment.table_name}.created_on desc" + + @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] + + show_attachments @containers + elsif @obj && @obj_flag == '5' + @forum = @obj end respond_to do |format| format.js end end + def show_attachments obj + @attachments = [] + obj.each do |container| + @attachments += container.attachments + end + @all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments) + @limit = 10 + @feedback_count = @all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @obj_attachments = paginateHelper @all_attachments,10 + end + def tag_save @select_tag_name = params[:tag_for_save][:tag_name] @tags = params[:tag_for_save][:name] diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 284ee8c43..2e8b98a2d 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -1,5 +1,6 @@ module TagsHelper include StoresHelper + include CoursesHelper # 通过 id和type获取对象 def get_object(obj_id,obj_type) @obj = nil @@ -62,6 +63,27 @@ module TagsHelper end +#判断课程course中是否包含课件attachment,course中引用了attachment也算作包含 +def course_contains_attachment? course,attachment + course.attachments.each do |att| + if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from + return true + end + end + false +end + +#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期 +def has_course? user,file + result = false + user.courses.each do |course| + if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course) + return true + end + end + result +end + # 判断用户是否是贴吧的管理员 # add by chenmin def is_forum_manager?(user_id,forum_id) diff --git a/app/models/forum.rb b/app/models/forum.rb index 530639f81..9fa1b7dfd 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -14,7 +14,7 @@ class Forum < ActiveRecord::Base 'sticky', 'locked' validates_presence_of :name, :creator_id, :description - validates_length_of :name, maximum: 50 + validates_length_of :name, maximum: 160 #validates_length_of :description, maximum: 255 validates :name, :uniqueness => true after_destroy :delete_kindeditor_assets diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 353d19dab..e31eea960 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -3,13 +3,13 @@

共有 <%= all_attachments.count%> 个资源

<% if order == "asc" %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 <% end %>

diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 9db34ece4..b2c7ab79f 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -3,7 +3,7 @@ <% if tag_name && tag_name == k%> <%= k%>×<%= v%> <% else%> - <%= k%>×<%= v%> + <%= k%>×<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index fa15c1fc7..489c0357d 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -229,6 +229,9 @@ var ele; //当前双击的链接 var tagId; //标签的id var taggableType; //被标签的类型 + //这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名 + //第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。 + //目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况 function rename_tag(domEle,name,id,type){ if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动 return; @@ -239,7 +242,8 @@ ele = domEle; tagId = id; taggableType = type; - domEle.html(''); + width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100 + domEle.html(''); domEle.parent().css("border","1px solid #ffffff"); $("#renameTagName").focus(); } @@ -256,14 +260,10 @@ }else{ //否则就要更新tag名称了 if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ - $.post( - '<%= update_tag_name_path %>', - {"taggableId":tagId,"taggableType":taggableType,"tagName":tagName,"renameName":$("#renameTagName").val().trim()} -// function(data){ -// ele.parent().css("border",""); -// ele.parent().html(tagNameHtml); -// } - ) + $.post( + '<%= update_tag_name_path %>', + {"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>} + ) }else{ ele.parent().css("border",""); ele.parent().html(tagNameHtml); diff --git a/app/views/forums/_file_form.html.erb b/app/views/forums/_file_form.html.erb new file mode 100644 index 000000000..030c8ff0e --- /dev/null +++ b/app/views/forums/_file_form.html.erb @@ -0,0 +1,79 @@ + +
+ +<% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><%= l(:field_is_public) %>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %> + <%= l(:field_is_public) %>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> +<% end %> +
+ <% project = project %> +
+ + <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + + <%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %> + 上传附件 + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '' : 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js', :project => project), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all) + } %> + + + + + <%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %> + + + + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
\ No newline at end of file diff --git a/app/views/forums/_form_edit_mode.html.erb b/app/views/forums/_form_edit_mode.html.erb index a9bb05f79..9c0ec27bd 100644 --- a/app/views/forums/_form_edit_mode.html.erb +++ b/app/views/forums/_form_edit_mode.html.erb @@ -1,49 +1,26 @@ - - -
- <%= labelled_form_for(@forum) do |f| %> - <% if @forum.errors.any? %> - - <% end %> -
-
- <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> -
-
- <% if User.current.logged? && User.current.admin? %> - <% if @forum.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'message_sticky', l(:label_board_sticky) %> - <% end %> - <% if @forum.safe_attribute? 'locked' %> - <%= f.check_box :locked %> - <%= label_tag 'message_locked', l(:label_board_locked) %> - <% end %> +
+ <%= labelled_form_for(@forum) do |f| %> + +
+ +
+
+ +
+
+ + +
+
<% end %>
-
-

- <%= f.kindeditor :description, :required => true,:owner_id => @forum.id,:owner_type => 2 %> -

- -

- (<%= l(:label_forums_max_length) %>) -

-
-
- <%= submit_tag l(:button_submit) %> - <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> -
- <% end %> -
+
\ No newline at end of file diff --git a/app/views/forums/_forum_form.html.erb b/app/views/forums/_forum_form.html.erb new file mode 100644 index 000000000..9888b674e --- /dev/null +++ b/app/views/forums/_forum_form.html.erb @@ -0,0 +1,15 @@ +
贴吧图片 + 上传图片 +
+
+
+ +
+
+ +
+
+
确定
+
取消
+
+
\ No newline at end of file diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index ac27235eb..fbbe023a0 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -1,57 +1,38 @@ - -
+ <% if forums.any? %> <% forums.each do |forum| %> -
-
- <%= forum.creator.nil? ? (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar")) : (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator)) %> -
-
- - - - - - - - - - -
-

- <%= link_to h(forum.name), forum_path(forum) %> -

-
-

- <%= textAreailizable forum.description%> -

-
-

- <%= authoring forum.created_at, forum.creator %> -

-
-
-
- - - - - - - - - -
- <%= link_to (forum.memo_count), forum_path(forum) %> - - <%= link_to (forum.topic_count), forum_path(forum) %> -
回答帖子
-
-
+
+ + +
+
+ + <%= link_to ( forum.topic_count), forum_path(forum),:class=>"linkGrey5 fb" %> +
+
帖子
+
+
+
+
+ + <%= link_to (forum.memo_count), forum_path(forum),:class=>"linkGrey5 fb" %> +
+
回答
+
+
+
<% end %> - + <% else %> -<% end %> -
\ No newline at end of file + <%= render :partial => "layouts/no_content" %> +<% end %> \ No newline at end of file diff --git a/app/views/forums/_forum_tag_list.html.erb b/app/views/forums/_forum_tag_list.html.erb new file mode 100644 index 000000000..2a0257d63 --- /dev/null +++ b/app/views/forums/_forum_tag_list.html.erb @@ -0,0 +1,8 @@ +<% forum.tag_list.each do |tag|%> + + <%= tag %> + <%if forum.creator.id == User.current.id%> + × + <% end %> + +<% end %> \ No newline at end of file diff --git a/app/views/forums/_post_banner.html.erb b/app/views/forums/_post_banner.html.erb new file mode 100644 index 000000000..797b43245 --- /dev/null +++ b/app/views/forums/_post_banner.html.erb @@ -0,0 +1,33 @@ + + +
综合 + <% if order_type=='reorder_complex' && order_str == 'desc' %> + + <% elsif order_type=='reorder_complex' && order_str == 'asc' %> + + <% else %> + + <% end %> +
+
人气 + <% if order_type=='reorder_popu' && order_str == 'desc' %> + + <% elsif order_type=='reorder_popu' && order_str == 'asc' %> + + <% else %> + + <% end %> +
+
时间 + <% if order_type=='reorder_time' && order_str == 'desc' %> + + <% elsif order_type=='reorder_time' && order_str == 'asc' %> + + <% else %> + + <% end %> +
+
+ 新建贴吧
+
\ No newline at end of file diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index f8679cefa..d6e3f607b 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -1,47 +1,31 @@ - -
共有 <%=link_to @forum.memos.count %> 个贴子
<% if memos.any? %> <% memos.each do |topic| %> - - - - - -
- <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> - - - - - - - - - - - - -
<%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %> - - - - - - - -
<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %>
回答
<%= authoring topic.created_at, topic.author %> - - <% author = topic.last_reply.try(:author)%> - <% if author%> - 最后回复:<%=link_to_user author %> - <% end%> - -
-
-
+
+
+ + <%= link_to image_tag(url_to_avatar(topic.author), :width => 50,:height => 50,:alt => '贴吧图片'), user_path(topic.author) if topic.author%> +
+
+ +
<%= topic.content.html_safe%> + +
+ <% author = topic.last_reply.try(:author)%> + <% if author%> +
最后回复:<%= author.name%>
+
<%= format_date(topic.last_reply.created_at)%>
+ <% end%> + +
+
+ + <%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %> +
+
+
<% end %> - + <% else %>

<%= l(:label_no_data) %>

<% end %> diff --git a/app/views/forums/create.js.erb b/app/views/forums/create.js.erb new file mode 100644 index 000000000..be99d724a --- /dev/null +++ b/app/views/forums/create.js.erb @@ -0,0 +1,6 @@ +<%if @save_flag%> +$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle(); +$('#reorder_time').click(); +<%else%> + $("#error").html("<%= @forum.errors.full_messages[0]%>").show(); +<%end %> \ No newline at end of file diff --git a/app/views/forums/delete_forum_tag.js.erb b/app/views/forums/delete_forum_tag.js.erb new file mode 100644 index 000000000..5080b3bdd --- /dev/null +++ b/app/views/forums/delete_forum_tag.js.erb @@ -0,0 +1,2 @@ +$("#forum_tag_list").html("<%= escape_javascript( render :partial=>'forum_tag_list',:locals=>{:forum=>@forum}) %>"); +$('#add_tag01').hide(); \ No newline at end of file diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index 0a40120c7..24130e727 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -1,4 +1,72 @@ - -

编辑讨论区

-<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'new_user' %> + <%= render 'form_edit_mode' %> + \ No newline at end of file diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 85cab957a..8f5cb15cc 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -1,48 +1,170 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> - -
- - - - - - - - - - - -
公共贴吧 - - <%= l(:label_user_location) %> : - - - <% if User.current.logged? %> - <%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %> - <% end %> - - -
- - <%= link_to request.host()+"/forums", forums_path %> - - - <%= link_to l(:field_homepage), home_path %> > - <%= link_to "公共贴吧", forums_path %> -
-
-<% if @forums.size > 0 %> - <%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> -<% else %> - <%= render :partial => "layouts/no_content" %> -<% end %> +<%= javascript_include_tag 'new_user' %> +<%= stylesheet_link_tag 'public'%> + + +
+
+
+ +
+ <%= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str}%> + + + + + + +
+
+ <%= render :partial => 'forum_list',:locals => {:forums=>@forums}%> +
+
    + <%= pagination_links_full @forums_pages, @forums_count ,:per_page_links => true,:remote =>true,:flag=>true%> +
+
+
+
+
diff --git a/app/views/forums/index.js.erb b/app/views/forums/index.js.erb new file mode 100644 index 000000000..642c3c20a --- /dev/null +++ b/app/views/forums/index.js.erb @@ -0,0 +1,4 @@ +//$("#postBanner").html("<%#= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str }%>"); +$("#forum_list").html("<%= escape_javascript(render :partial => 'forum_list',:locals => {:forums=>@forums}) %>"); +//这里出现一个问题竟然是单双引号引起的。注意!! +$("#pages").html('<%= pagination_links_full @forums_pages, @forums_count,:per_page_links => false,:remote =>true,:flag=>true%>'); \ No newline at end of file diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 24aa74c23..34c7d6e64 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -1,42 +1,144 @@ - -
-

- <%=l(:label_memo_new)%> -

- <% if User.current.logged? %> - <%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %> -
- <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> -

- <%= f.text_field :subject, :required => true, :maxlength => 50%> -

-

- <%= f.kindeditor :content, :required => true %> -

- -

- (<%= l(:label_memos_max_length) %>) -

-

- <%= l(:label_attachment_plural) %> -
- <%= render :partial => 'attachments/form', :locals => {:container => @memo} %> -

-
- <%= f.submit :value => l(:label_memo_create) %> - <%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %> -
- <% end %> - <% end %> +<%= javascript_include_tag 'new_user' %> + +
+ + +
+ <%= render :partial => 'show_topics',:locals => {:memos=>@memos}%> +
+
    + <%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %> +
+ + + + + + + + + + +
- - - <%= link_to(image_tag('edit.png')+l(:label_forum_edit),{:action => 'edit', :id => @forum}, :method => 'get', :title => l(:button_edit)) if @forum.editable_by?(User.current) %> - <%= link_to(image_tag('delete.png')+'删除讨论区', {:action => 'destroy', :id => @forum}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if @forum.destroyable_by?(User.current) %> - - - <%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %> - -<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %> +
\ No newline at end of file diff --git a/app/views/forums/show.js.erb b/app/views/forums/show.js.erb new file mode 100644 index 000000000..9e36215ac --- /dev/null +++ b/app/views/forums/show.js.erb @@ -0,0 +1,2 @@ +$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>") +$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count,:per_page_links => false,:remote =>true%>'); \ No newline at end of file diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 812873045..752853c60 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -5,7 +5,7 @@
  • 服务协议|
  • <%= l(:label_surpport_group)%>|
  • -
  • <%= l(:label_forums)%>
  • +
  • <%= l(:label_forums)%>
  • diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index c68e917f5..0a377b1e5 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -7,7 +7,7 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan','leftside', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %> @@ -15,7 +15,114 @@ <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - <%= stylesheet_link_tag 'base','header', :media => 'all'%> + <%= stylesheet_link_tag 'base','header','new_user', :media => 'all'%> + @@ -28,82 +135,77 @@ <% end%>
    +
    +
    +
    +
    +
    <%= link_to image_tag(url_to_avatar(@forum.creator),:width=>75,:height => 75,:alt=>'贴吧图像' ),user_path( @forum.creator) %> + +
    + +
    +
    <%= @forum.description%> + <%if @forum.creator.id == User.current.id%> + + + <%= image_tag('signature_edit.png',{:width=>12,:height=>12})%> + + <%end%> +
    +
    +
    + <%= render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum}%> +
    + <% if(@forum.creator.id == User.current.id)%> + + 添加标签 + <% end %> +
    +
    + <%if @forum.creator.id == User.current.id%> + + + 编辑贴吧 + 删除贴吧 + + <% end %> +
    +
    +
    <%= link_to image_tag(url_to_avatar(User.current),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path( User.current) %>
    +
    我在贴吧
    +
    +
    + +
    +
    + +
    发帖
    +
    -
    -
    -
    -
    -
    - - - - - - - - - - -
    <%= l(:label_projects_community)%><%= l(:label_user_location) %> : - -
    <%= link_to request.host()+"/forums", forums_path %>

    <%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %>

    -
    - -
    +
    +
    +
    +
    + + <%= yield %> + <%#= call_hook :view_layouts_base_content %> +
    +
    +
    - <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
    - -
    - <%#= render :partial => 'layouts/base_footer'%> -
    - - -
    -
    -
    <%= render :partial => 'layouts/footer' %>
    - <%= call_hook :view_layouts_base_body_bottom %> + <%#= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/layouts/users_base.html.erb b/app/views/layouts/users_base.html.erb index 0caa5e39b..6c1edbd1b 100644 --- a/app/views/layouts/users_base.html.erb +++ b/app/views/layouts/users_base.html.erb @@ -7,16 +7,16 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application', 'nyan','prettify', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> - <%= javascript_include_tag "jquery.leanModal.min" ,'prettify'%> + <%= javascript_include_tag "jquery.leanModal.min" ,'prettify','avatars'%> <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - <%= stylesheet_link_tag 'base','header', :media => 'all'%> + <%= stylesheet_link_tag 'base','header','new_user' ,:media => 'all'%>
    @@ -29,27 +29,27 @@
    -
    -
    -
    - <%#=render :partial => 'layouts/base_header'%> -
    -
    + + + + + + <%= render_flash_messages %> <%= yield %> <%= call_hook :view_layouts_base_content %>
    -
    + -
    -
    + + -
    -
    + +
    <%= render :partial => 'layouts/footer' %> diff --git a/app/views/memos/_attachments_links.html.erb b/app/views/memos/_attachments_links.html.erb new file mode 100644 index 000000000..15473e6e7 --- /dev/null +++ b/app/views/memos/_attachments_links.html.erb @@ -0,0 +1,71 @@ +
    + <% for attachment in attachments %> + + + + <% if options[:length] %> + + <%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true,:length => options[:length] -%> + (<%= number_to_human_size attachment.filesize , :precision => 0 %>) + <% if options[:deletable] %> + <%#= link_to image_tag('delete.png'), attachment_path(attachment), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :class => 'delete', + #:remote => true, + #:id => "attachments_" + attachment.id.to_s, + :title => l(:button_delete) %> + + <% end %> +
    + <% else %> + + <%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true, :length => 32 -%> + (<%= number_to_human_size attachment.filesize , :precision => 0 %>) + <% if options[:deletable] %> + <%#= link_to image_tag('delete.png'), attachment_path(attachment), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :class => 'delete', + #:remote => true, + #:id => "attachments_" + attachment.id.to_s, + :title => l(:button_delete) %> + + <% end %> +
    + <% end %> + + <%# if attachment.is_text? %> + <%#= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename%> + <%# end %> + + + + + + + + + + + <%#= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %> + + + + + <% end %> + <% if defined?(thumbnails) && thumbnails %> + <% images = attachments.select(&:thumbnailable?) %> + <% if images.any? %> +
    + <% images.each do |attachment| %> +
    <%= thumbnail_tag(attachment) %>
    + <% end %> +
    + <% end %> + <% end %> +
    diff --git a/app/views/memos/_praise_tread.html.erb b/app/views/memos/_praise_tread.html.erb new file mode 100644 index 000000000..17af4b090 --- /dev/null +++ b/app/views/memos/_praise_tread.html.erb @@ -0,0 +1,36 @@ + + <% if User.current.logged? %> + <% if horizontal %> + +
    + <% @is_valuate = is_praise_or_tread(obj,user_id)%> + <% if @is_valuate.size > 0 %> + <% @flag = @is_valuate.first.praise_or_tread %> + <% if @flag == 1 %> + <%= get_praise_num(obj)%> + <% end %> + <% else %> + <% if user_id == obj.author_id %> + + + <%= get_praise_num(obj)%> + + <% else %> + + <%# if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %> + + <%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), + :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> + <%= get_praise_num(obj)%> + + + + + + + + <% end %> + <% end %> +
    + <% end %> + <% end %> diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 487d923b5..0efa57ccc 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,55 +1,47 @@ - -<% @replying = !@memo.parent.nil? %> -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -

    <%=l(:label_memo_edit)%>

    -<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo)) do |f| %> - <% if @memo.errors.any? %> -
    -

    - <%= pluralize(@memo.errors.count, "error") %> - prohibited this memo from being saved: -

    - -
    - <% end %> -
    -

    - <% if @memo.parent.nil? && @memo.children.first.nil? %> - <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%> - <% else %> - <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%> - <% end %> -

    - <% if User.current.admin?%> -

    - <% unless @replying %> - <% if @memo.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'memo_sticky', l(:label_board_sticky) %> - <% end %> - <% if @memo.safe_attribute? 'lock' %> - <%= f.check_box :lock %> <%= label_tag 'memo_locked', l(:label_board_locked) %> - <% end %> - <% end %> -

    - <% end %> -

    - <%= f.kindeditor :content, :required => true, :size => 80,:owner_id => @memo.id,:owner_type => 1 %> -

    - -

    - <%= l(:label_attachment_plural) %> -
    - <%= render :partial => 'attachments/form', :locals => {:container => @memo} %> -

    -
    -
    - <%= f.submit :value => l(:button_change) %>  <%= link_to l(:button_back), back_url ,:class => "button-canel",:style => "color: #ffffff;"%> +<%= javascript_include_tag 'new_user'%> + +
    +
    编辑帖子
    +
    +
    + <%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %> + +
    + +
    -<% end %> +
    + + +
    +
    + + <%= render :partial => 'forums/file_form', :locals => {:container => @memo} %> + + +
    +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 586279504..81758ff97 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -1,188 +1,117 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor","forum" %> -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -
    - - - <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> - -
    -
    - <%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %> -
    -

    - <%=link_to @memo.author.name, user_path(@memo.author) %> -

    -
    -
    -
    - - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => @memo}, - :remote => true, - :method => 'get', - :title => l(:button_quote) - )if !@memo.locked? && User.current.logged? %> - - <%= link_to( - #image_tag('edit.png'), - l(:button_edit), - {:action => 'edit', :id => @memo}, - :method => 'get', - :title => l(:button_edit) - ) if @memo.editable_by?(User.current) %> - - <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => @memo}, - :method => :delete, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if @memo.destroyable_by?(User.current) %> -
    - -
     
    - -
    - <%= label_tag l(:field_subject) %>: - <%=h @memo.subject %> -
    -
    - <%= @memo.content.html_safe %> -

    - <% if @memo.attachments.any?%> - <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> - <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> - <% end %> -

    -
    -
    -
    - <%= authoring @memo.created_at, @memo.author %> -
    - -
    -
    -
    -
    -

    <%= l(:label_reply_plural) %> (<%= @replies.nil? ? 0 : @replies.size %>)

    - <% pages_count = @reply_pages.offset %> - <% @replies.each do |reply| %> -
    "> -

    -
    - - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => reply}, - :remote => true, - :method => 'get', - :title => l(:button_quote) - )if !@memo.locked? && User.current.logged? %> - - <%= link_to( - #image_tag('edit.png'), - l(:button_edit), - {:action => 'edit', :id => reply}, - :title => l(:button_edit) - ) if reply.editable_by?(User.current) %> - - <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => reply}, - :method => :delete, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if reply.destroyable_by?(User.current) %> - -
    -
    - - - - - - - - -
    - <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> - -
    - <%=h sanitize(reply.content.html_safe) %> -
    -

    - <% if reply.attachments.any?%> - <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> - <%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options, :is_float => true} %> - <% end %> -

    -
    - <%= authoring reply.created_at, reply.author %> -
    -
    - <% end %> - -
    - -<% if User.current.login? %> -
    - <%= render :partial => 'reply_box' %> -
    -<% else %> -
    - <%= l(:label_user_login_tips) %> - <%= link_to l(:label_user_login_new), signin_path %> -
    -
    -<% end %> - - - +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %> +
    +
    + <% if @memo.author.id == User.current.id%> +
    + +
    + <%end%> + + +
    <%= format_date( @memo.created_at)%>
    + + <%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> + +
    +
    + <%= @memo.content.html_safe%> +
    +
    +
    + <% if @memo.attachments.any?%> + <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> + <%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> + <% end %> +
    +
    +
    +
    +
    +
    +
    +
    回复(<%=@reply_count %>)
    +
    + +
    +
    + <% @replies.each_with_index do |reply,i| %> +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    <%= reply.author.name%><%= format_date(reply.created_at) %>
    +
    <%= reply.content.html_safe%>
    +
    +
    +
    + <% end %> +
    +
    +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    +
    +
    + <%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%> + <%= f.hidden_field :subject, :required => true, value: @memo.subject %> + <%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %> + <%= f.hidden_field :parent_id, :required => true, value: @memo.id %> + <%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %> + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/praise_tread/praise_plus.js.erb b/app/views/praise_tread/praise_plus.js.erb index d56ff0e68..30a53723e 100644 --- a/app/views/praise_tread/praise_plus.js.erb +++ b/app/views/praise_tread/praise_plus.js.erb @@ -1,4 +1,9 @@ - -$('#praise_tread_<%= @obj.id %>').html('<%= j( -render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} -)%>'); +<% if @obj_type == 'Memo'%> + $('#praise_tread_<%= @obj.id %>').html('<%= j( + render :partial => "/memos/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} + )%>'); +<% else %> + $('#praise_tread_<%= @obj.id %>').html('<%= j( + render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} + )%>'); +<% end %> diff --git a/app/views/tags/update_tag_name.js.erb b/app/views/tags/update_tag_name.js.erb index b72b0c33f..ec81e7cbc 100644 --- a/app/views/tags/update_tag_name.js.erb +++ b/app/views/tags/update_tag_name.js.erb @@ -14,24 +14,34 @@ $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project $('#tags_name2').val(""); <% elsif @obj_flag == '6'%> <%if @course%> -$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); -$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', - :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>'); + <% if @obj %> + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); + $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', + :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>'); + $("#tags_name_<%=@obj.id%>").val(""); + $("#add_tag_<%=@obj.id%>").hide(); + <% else %> + $("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list', + :locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments}) %>"); + <% end %> $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); <%else%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); -<%end%> - $("#tags_name_<%=@obj.id%>").val(""); $("#add_tag_<%=@obj.id%>").hide(); +<%end%> + + <% elsif @obj_flag == '9'%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); $('#tags_name').val(""); <% elsif @obj_flag == '10'%> //$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide(); +<% elsif @obj_flag == '5'%> + $('#forum_tag_list').html('<%= escape_javascript(render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum})%>') <% else%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 0a5b1a2e4..220a37a2b 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -354,10 +354,20 @@ <% end %> <% if ma.course_message_type == "StudentWorksScore" %>