|
|
|
@ -17,18 +17,18 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
@jours = @softapplication.journals_for_messages.order('created_on DESC')
|
|
|
|
|
@image_results = []
|
|
|
|
|
@softapplication.attachments.each do |f|
|
|
|
|
|
f.image? ? @image_results << f : @image_results
|
|
|
|
|
f.image? ? @image_results << f : @image_results
|
|
|
|
|
end
|
|
|
|
|
@app_items = []
|
|
|
|
|
@app_items = []
|
|
|
|
|
@softapplication.attachments.each do |f|
|
|
|
|
|
f.pack? ? @app_items << f : @app_items
|
|
|
|
|
f.pack? ? @app_items << f : @app_items
|
|
|
|
|
end
|
|
|
|
|
@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
|
|
|
|
|
@state = false
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html # show.html.erb
|
|
|
|
|
format.json { render json: @softapplication }
|
|
|
|
@ -83,11 +83,10 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_attach
|
|
|
|
|
@softapplication = Softapplication.find(params[:id])
|
|
|
|
|
@softapplication.save_attachments(params[:attachments])
|
|
|
|
|
@softapplication.save_attachments(params[:attachments])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# DELETE /softapplications/1
|
|
|
|
@ -101,15 +100,16 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
format.json { head :no_content }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#应用评价涉及到的方法
|
|
|
|
|
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> "
|
|
|
|
@ -117,25 +117,24 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
@id = user.id
|
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
|
render_404
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#新建评价
|
|
|
|
|
def create_message
|
|
|
|
|
def create_message
|
|
|
|
|
|
|
|
|
|
if params[:softapplication_message][:message].size>0
|
|
|
|
|
if params[:reference_content]
|
|
|
|
|
if params[:reference_content]
|
|
|
|
|
message = params[:softapplication_message][:message] + "\n" + params[:reference_content]
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
message = params[:softapplication_message][:message]
|
|
|
|
|
end
|
|
|
|
|
refer_user_id = params[:softapplication_message][:reference_user_id].to_i
|
|
|
|
|
@softapplication = Softapplication.find(params[:id])
|
|
|
|
|
@softapplication.add_jour(User.current, message, refer_user_id)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
refer_user_id = params[:softapplication_message][:reference_user_id].to_i
|
|
|
|
|
@softapplication = Softapplication.find(params[:id])
|
|
|
|
|
@softapplication.add_jour(User.current, message, refer_user_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user = @softapplication.user
|
|
|
|
|
@jours = @softapplication.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@limit = 10
|
|
|
|
|
@feedback_count = @jours.count
|
|
|
|
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
|
|
|
@ -167,6 +166,7 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
format.js
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
def more
|
|
|
|
|
@jour = @softapplication.journals_for_messages
|
|
|
|
@ -179,6 +179,7 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
|
#format.api { render_api_ok }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
def back
|
|
|
|
|
@jour = @softapplication.journals_for_messages
|
|
|
|
|