diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 01c35ce7..c4f350fc 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -40,13 +40,18 @@ class BidsController < ApplicationController end def show - @state = false @user = @bid.author - @jour = @bid.journals_for_messages - @jour.each_with_index {|j,i| j.indice = i+1} + @jours = @bid.journals_for_messages.reverse + @limit = 10 + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + @state = false + # # @journals = @bid.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all - #@journals.each_with_index {|j,i| j.indice = i+1} + # @journals.each_with_index {|j,i| j.indice = i+1} respond_to do |format| format.html { render :layout => 'base_bids' @@ -99,8 +104,12 @@ class BidsController < ApplicationController ## 新建留言 def create - if params[:bid_message].size>0 - message = params[:bid_message][:message] + if params[:bid_message][:message].size>0 + if params[:reference_content] + message = params[:reference_content] + params[:bid_message][:message] + else + message = params[:bid_message][:message] + end refer_user_id = params[:bid_message][:reference_user_id].to_i @bid.add_jour(User.current, message, refer_user_id) # if a_message.size > 5 @@ -110,9 +119,14 @@ class BidsController < ApplicationController # end # @message_count = a_message.count end - @jour = @bid.journals_for_messages - @jour.each_with_index {|j,i| j.indice = i+1} - @bid.set_commit(@jour.count) + @user = @bid.author + @jours = @bid.journals_for_messages.reverse + @limit = 10 + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + @bid.set_commit(@feedback_count) respond_to do |format| format.js @@ -124,9 +138,15 @@ class BidsController < ApplicationController ##删除留言 def destroy JournalsForMessage.delete_message(params[:object_id]) - @jour = @bid.journals_for_messages - @jour.each_with_index {|j,i| j.indice = i+1} - @bid.set_commit(@jour.count) + @user = @bid.author + @jours = @bid.journals_for_messages.reverse + @limit = 10 + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + + @bid.set_commit(@feedback_count) # if a_message.size > 5 # @message = a_message[-5, 5] # else @@ -153,7 +173,7 @@ class BidsController < ApplicationController end # Replaces pre blocks with [...] text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') - @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> " + @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" @id = user.id rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 24784d26..1908213c 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -67,7 +67,7 @@ class JournalsController < ApplicationController end # Replaces pre blocks with [...] text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') - @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> " + @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" @id = user.id rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index b67deb89..5ae6d3bb 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -112,7 +112,7 @@ class MessagesController < ApplicationController @subject = @message.subject @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') - @content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " + @content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " @content << @message.content.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" end diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index a123f3b5..e668a234 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -9,27 +9,27 @@ def index # @message.each do |m| # Activity.create(:act_id => m.id, :act_type => 'Message', :user_id => m.author_id) # end - activity = Message.all - activity += News.all - activity += Journal.all - activity += Issue.all - activity += Bid.all - @activity = activity.sort {|x,y| x.created_on <=> y.created_on} - @activity.each do |act| - if act.instance_of?(Bid) - act.acts << Activity.new(:user_id => act.author_id) - elsif act.instance_of?(News) - act.acts << Activity.new(:user_id => act.author_id) - elsif act.instance_of?(Message) - act.acts << Activity.new(:user_id => act.author_id) - elsif act.instance_of?(Journal) - act.acts << Activity.new(:user_id => act.user_id) - elsif act.instance_of?(Issue) - act.acts << Activity.new(:user_id => act.author_id) - elsif act.instance_of?(Changeset) - act.acts << Activity.new(:user_id => act.user_id) - end - end + # activity = Message.all + # activity += News.all + # activity += Journal.all + # activity += Issue.all + # activity += Bid.all + # @activity = activity.sort {|x,y| x.created_on <=> y.created_on} + # @activity.each do |act| + # if act.instance_of?(Bid) + # act.acts << Activity.new(:user_id => act.author_id) + # elsif act.instance_of?(News) + # act.acts << Activity.new(:user_id => act.author_id) + # elsif act.instance_of?(Message) + # act.acts << Activity.new(:user_id => act.author_id) + # elsif act.instance_of?(Journal) + # act.acts << Activity.new(:user_id => act.user_id) + # elsif act.instance_of?(Issue) + # act.acts << Activity.new(:user_id => act.author_id) + # elsif act.instance_of?(Changeset) + # act.acts << Activity.new(:user_id => act.user_id) + # end + # end #@watchers_of_projects = WatchersOfProjects.new diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 1f05b0e8..60b7d8bd 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -5,7 +5,11 @@ class WordsController < ApplicationController def create if params[:new_form][:user_message].size>0 unless params[:user_id].nil? - message = params[:new_form][:user_message] + if params[:reference_content] + message = params[:reference_content] + params[:new_form][:user_message] + else + message = params[:new_form][:user_message] + end refer_user_id = params[:new_form][:reference_user_id].to_i @user.add_jour(User.current, message, refer_user_id) @@ -64,7 +68,7 @@ class WordsController < ApplicationController end # Replaces pre blocks with [...] text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') - @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> " + @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" @id = user.id rescue ActiveRecord::RecordNotFound diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index c33013d9..00ad850f 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -1,24 +1,7 @@ - -
<%=l(:label_user_response)%>(<%= journals.count%>)<% if journals.size > 5 %> -<% unless state%> -
-<%= link_to l(:button_more), - {:controller => 'bids', :action => 'more', :id => bid}, - :remote => true, - :method => 'get' %> -
-<% else %> -
-<%= link_to l(:button_back), - {:controller => 'bids', :action => 'back', :id => bid}, - :remote => true, - :method => 'get' %> -
-<% end %> -<% end %>
+ <%=l(:label_user_response)%>
@@ -26,11 +9,6 @@ <%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %> -<% unless state%> - <% if journals.size > 5 %> - <% journals = journals[0, 5] %> - <% end %> -<% end %> <% if journals.size >0 %> <% remove_allowed = (User.current.id == journals.first.jour_id) %> diff --git a/app/views/bids/_new.html.erb b/app/views/bids/_new.html.erb index b8839fef..ad48a979 100644 --- a/app/views/bids/_new.html.erb +++ b/app/views/bids/_new.html.erb @@ -57,6 +57,11 @@ :action => 'create', :id => bid, :sta => sta}) do |f|%> + +
+ <%= render :partial => 'pre_show', :locals => {:content => @content} %> +
+ <% if User.current.logged? %> diff --git a/app/views/bids/_pre_show.html.erb b/app/views/bids/_pre_show.html.erb new file mode 100644 index 00000000..887530cf --- /dev/null +++ b/app/views/bids/_pre_show.html.erb @@ -0,0 +1,11 @@ + +<% unless content.nil?%> +
+ + + + + + +
<%= textilizable content %>
<%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%>
+<% end %> diff --git a/app/views/bids/create.js.erb b/app/views/bids/create.js.erb index d601d75b..ee58e8c4 100644 --- a/app/views/bids/create.js.erb +++ b/app/views/bids/create.js.erb @@ -1,3 +1,4 @@ $('#history').html('<%= escape_javascript(render(:partial => 'bids/history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>'); +$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#bid_message_message').val(""); $('#bid_message_reference_user_id').val(""); diff --git a/app/views/bids/new.js.erb b/app/views/bids/new.js.erb index 5a74ec22..cc8a4026 100644 --- a/app/views/bids/new.js.erb +++ b/app/views/bids/new.js.erb @@ -1,3 +1,3 @@ -$('#bid_message_message').val("<%= raw escape_javascript(@content) %>"); +$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>'); $('#bid_message_reference_user_id').val("<%= @id%>"); -showAndScrollTo("bid_message", "bid_message"); +showAndScrollTo("pre_show", "bid_message_reference_user_id"); diff --git a/app/views/bids/show.html.erb b/app/views/bids/show.html.erb index 6417472d..92a0be26 100644 --- a/app/views/bids/show.html.erb +++ b/app/views/bids/show.html.erb @@ -27,5 +27,10 @@ <%= render :partial => 'history', :locals => { :bid => @bid, :journals => @jour, :state => false} %> + diff --git a/app/views/words/_new.html.erb b/app/views/words/_new.html.erb index 2b5d148b..0553059e 100644 --- a/app/views/words/_new.html.erb +++ b/app/views/words/_new.html.erb @@ -57,6 +57,11 @@ :action => 'create', :user_id => user.id, :sta => sta}) do |f|%> + +
+ <%= render :partial => 'words/pre_show', :locals => {:content => @content} %> +
+ <% if User.current.logged? %> diff --git a/app/views/words/_pre_show.html.erb b/app/views/words/_pre_show.html.erb new file mode 100644 index 00000000..887530cf --- /dev/null +++ b/app/views/words/_pre_show.html.erb @@ -0,0 +1,11 @@ + +<% unless content.nil?%> +
+ + + + + + +
<%= textilizable content %>
<%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%>
+<% end %> diff --git a/app/views/words/create.js.erb b/app/views/words/create.js.erb index 7bb849b5..923d0a23 100644 --- a/app/views/words/create.js.erb +++ b/app/views/words/create.js.erb @@ -1,3 +1,4 @@ $('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); +$('#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 diff --git a/app/views/words/new.js.erb b/app/views/words/new.js.erb index dc8290a0..e08615fc 100644 --- a/app/views/words/new.js.erb +++ b/app/views/words/new.js.erb @@ -1,3 +1,3 @@ -$('#new_form_user_message').val("<%= raw escape_javascript(@content)%>"); +$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>'); $('#new_form_reference_user_id').val("<%= @id %>"); -showAndScrollTo("new_form_user_message", "new_form_user_message"); +showAndScrollTo("pre_show", "new_form_user_message"); diff --git a/public/images/requirements/reference - 副本 - 副本.jpg b/public/images/requirements/reference - 副本 - 副本.jpg new file mode 100644 index 00000000..6114b4c6 Binary files /dev/null and b/public/images/requirements/reference - 副本 - 副本.jpg differ diff --git a/public/images/requirements/reference.jpg b/public/images/requirements/reference.jpg new file mode 100644 index 00000000..603bf9b4 Binary files /dev/null and b/public/images/requirements/reference.jpg differ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 2025b5d1..d599860f 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -974,7 +974,22 @@ input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;} fieldset {border: 1px solid #e4e4e4; margin:0;} legend {color: #484848;} hr { width: 100%; height: 1px; background: #ccc; border: 0; color:#000000;} -blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0.6em; margin-left: 2.4em;} +blockquote { + /*font-style: italic; */ + border-left: 1px solid #e0e0e0; + border-right: 1px solid #e0e0e0; + border-top: 1px solid #e0e0e0; + border-bottom: 1px solid #e0e0e0; + padding-left: 0.6em; + padding-top: 0.6em; + padding-right: 0.6em; + padding-bottom: 0.6em; + margin-left: 1.4em; + margin-right: 0.4em; + font-family: 微软雅黑; + background: url(/images/requirements/reference.jpg) +} + blockquote blockquote { margin-left: 0;} acronym { border-bottom: 1px dotted; cursor: help; } textarea.wiki-edit {width:99%; resize:vertical;}