From b141db6624379a4674502342ff5f2acf64303848 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 5 Nov 2014 10:41:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=95=99=E8=A8=80=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 10 ++-- app/controllers/words_controller.rb | 6 +-- app/views/projects/_project_jours.html.erb | 2 +- app/views/users/_history.html.erb | 55 ++++++++++++++++++++++ app/views/users/_user_jours.html.erb | 14 ++++++ app/views/users/user_newfeedback.html.erb | 21 ++------- app/views/words/_message.html.erb | 4 +- app/views/words/create.js.erb | 4 +- 8 files changed, 86 insertions(+), 30 deletions(-) create mode 100644 app/views/users/_history.html.erb create mode 100644 app/views/users/_user_jours.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7e6e3d04a..9b2e5990a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -280,11 +280,11 @@ class UsersController < ApplicationController fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) end - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] + #@limit = 10 + #@feedback_count = @jours.count + #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + #@offset ||= @feedback_pages.offset + @jour = paginateHelper @jours,10 @state = false end # end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index b4bc52eab..89fa0e1dc 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -27,11 +27,7 @@ class WordsController < ApplicationController end end @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] + @jour = paginateHelper @jours,10 respond_to do |format| # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} diff --git a/app/views/projects/_project_jours.html.erb b/app/views/projects/_project_jours.html.erb index 2462d57ef..be1550000 100644 --- a/app/views/projects/_project_jours.html.erb +++ b/app/views/projects/_project_jours.html.erb @@ -25,7 +25,7 @@
- <%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> + <%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %>
diff --git a/app/views/users/_history.html.erb b/app/views/users/_history.html.erb new file mode 100644 index 000000000..60289c420 --- /dev/null +++ b/app/views/users/_history.html.erb @@ -0,0 +1,55 @@ +<% reply_allow = JournalsForMessage.create_by_user? User.current %> + +
+
+ <% if journals.size > 0 %> + <% for journal in journals %> +
+ +
+
+ + <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= format_time(journal.created_on) %> +
+

<%= textilizable journal.notes%>

+
+
+ <% ids = 'project_respond_form_'+ journal.id.to_s%> + + <% if journal.user == User.current|| User.current.admin? %> + <%= link_to(l(:label_bid_respond_delete), + {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', + :class => "delete", :title => l(:button_delete)) %> + <% end %> + <% if reply_allow %> + <%= link_to l(:label_bid_respond_quote),'', + {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} %> + + <% end %> + + + <%= l(:label_bids_published) %>  + <%= time_tag(journal.created_on).html_safe %>  + <%= l(:label_bids_published_ago) %> + +
+
+ <% ids = 'project_respond_form_'+ journal.id.to_s%> + <% if reply_allow %> +
+ <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %> +
+ <% end %> +
+
+ <%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %> +
+
+
+
+ <% end %> + <% end %> +
+
+ diff --git a/app/views/users/_user_jours.html.erb b/app/views/users/_user_jours.html.erb new file mode 100644 index 000000000..e62505722 --- /dev/null +++ b/app/views/users/_user_jours.html.erb @@ -0,0 +1,14 @@ +
+
+ <% reply_allow = JournalsForMessage.create_by_user? User.current %> + +

<%= l(:label_user_response) %>(<%= @obj_count%>

+ + <%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %> + +
+
+ <%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> +
+ +
diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index c20d9717d..deb360efd 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,18 +1,7 @@ -
-
- <%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %> -
-
-<%= l(:label_newfeedback_message) %>(<%= @feedback_count%>) -
+<% reply_allow = JournalsForMessage.create_by_user? User.current %> +<%= stylesheet_link_tag 'css', :media => 'all' %> -
- <%= render :partial => 'words/message', :locals => {:jour => @jour, :state => @state, :user => @user, :feedback_pages => @feedback_pages} %> -
- -
+<%= render :partial => 'user_jours', + :locals => { :journals => @jour, :state => false} +%> <% html_title(l(:label_responses)) -%> \ No newline at end of file diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index 743f65231..ea14be1a6 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -64,12 +64,12 @@ function checkMaxLength() {
<% if reply_allow %> - <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> + <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => show_name} %> <% end %>
- <%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> + <%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => show_name } %>
<% end %> diff --git a/app/views/words/create.js.erb b/app/views/words/create.js.erb index 923d0a23c..4bf7fb244 100644 --- a/app/views/words/create.js.erb +++ b/app/views/words/create.js.erb @@ -1,4 +1,6 @@ -$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); +//$('#message').html('<#%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages,:show_name => true})) %>'); +$('#history').html('<%= escape_javascript(render(:partial => 'users/history',:locals => { :journals => @jour, :state => false})) %>') +$('#jour_count').html('<%= @obj_count%>') $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#new_form_user_message').val(""); $('#new_form_reference_user_id').val(""); \ No newline at end of file