|
|
|
@ -19,20 +19,20 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#new added sort
|
|
|
|
|
if params[:softapplication_sort_type].present?
|
|
|
|
|
case params[:softapplication_sort_type]
|
|
|
|
|
case params[:softapplication_sort_type]
|
|
|
|
|
when '0'
|
|
|
|
|
@softapplications = @softapplications[@offset, @limit]
|
|
|
|
|
@softapplications = @softapplications[@offset, @limit]
|
|
|
|
|
@s_state = 0
|
|
|
|
|
when '1'
|
|
|
|
|
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
|
|
|
|
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
|
|
|
|
@s_state = 1
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
|
|
|
|
@s_state = 1
|
|
|
|
|
else
|
|
|
|
|
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
|
|
|
|
@s_state = 1
|
|
|
|
|
end
|
|
|
|
|
#new added end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html # index.html.erb
|
|
|
|
|
format.json { render json: @softapplications }
|
|
|
|
@ -216,19 +216,19 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
def new_message
|
|
|
|
|
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
|
|
|
|
if @jour
|
|
|
|
|
user = @jour.user
|
|
|
|
|
text = @jour.notes
|
|
|
|
|
user = @jour.user
|
|
|
|
|
text = @jour.notes
|
|
|
|
|
else
|
|
|
|
|
user = @softapplication.user
|
|
|
|
|
text = @softapplication.description
|
|
|
|
|
user = @softapplication.user
|
|
|
|
|
text = @softapplication.description
|
|
|
|
|
end
|
|
|
|
|
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
|
|
|
|
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
|
|
|
|
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
|
|
|
|
@id = user.id
|
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
|
render_404
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#新建评价
|
|
|
|
|
def create_message
|
|
|
|
|