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/projects_controller.rb b/app/controllers/projects_controller.rb index ea37766b6..3fea454de 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -403,17 +403,29 @@ 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 diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index af850d626..e31bb2738 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -90,8 +90,37 @@ class WordsController < ApplicationController 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 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/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/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 3bc9b6943..ad91c72f8 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -156,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/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 13e123b35..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/show.html.erb b/app/views/softapplications/show.html.erb index b5e3e951c..34e254f3d 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -9,8 +9,8 @@ - - + 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 @@ + <%= textilizable membership.course.short_description %> +

+
<%= @softapplication.name %> + <%= @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 %>

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

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 %> +
    + <% for journal in @jour%> +
  • + <%= image_tag(url_to_avatar(journal.user), :class => "avatar") %> + + <%= link_to journal.user, user_path(journal.user)%> + <%= textilizable journal.notes%> + <%= l :label_update_time %>: <%= format_time journal.created_on %> + <% id = 'project_respond_form_'+journal.id.to_s%> + + <% if reply_allow %> + <%= link_to l(:label_projects_feedback_respond),'#', + {:focus => 'project_respond', + :onclick => "toggleAndSettingWordsVal($('##{id}'), + $('##{id} textarea'), + '#{l(:label_reply_plural)} #{journal.user.name}: '); + return false;"} %> + <% end %> + + <% if User.current.logged? %> + <% if journal.user_id==User.current.id|| User.current.admin? %> + <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page}, + :remote => true, :title => l(:button_delete)) %> + <% end %> + <% end %> + + +
    + <% if reply_allow %> +
    + <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> +
    + <% end %> +
    +
    + <%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> +
    +
  • + <% end %> +
+<% end %> + + \ No newline at end of file diff --git a/app/views/words/destroyJournal.js.erb b/app/views/words/destroyJournal.js.erb index 5c91c6053..3600c3fd6 100644 --- a/app/views/words/destroyJournal.js.erb +++ b/app/views/words/destroyJournal.js.erb @@ -1,3 +1,5 @@ + <% if @journalP!=nil %> - $(".message-for-user").children("#word_li_<%=@journalP.id%>").remove(); + //$(".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/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|