首页:当无应用时,提示暂无应用
This commit is contained in:
parent
87fdecdabd
commit
94a7bacdd2
|
@ -17,18 +17,18 @@ class SoftapplicationsController < ApplicationController
|
||||||
@jours = @softapplication.journals_for_messages.order('created_on DESC')
|
@jours = @softapplication.journals_for_messages.order('created_on DESC')
|
||||||
@image_results = []
|
@image_results = []
|
||||||
@softapplication.attachments.each do |f|
|
@softapplication.attachments.each do |f|
|
||||||
f.image? ? @image_results << f : @image_results
|
f.image? ? @image_results << f : @image_results
|
||||||
end
|
end
|
||||||
@app_items = []
|
@app_items = []
|
||||||
@softapplication.attachments.each do |f|
|
@softapplication.attachments.each do |f|
|
||||||
f.pack? ? @app_items << f : @app_items
|
f.pack? ? @app_items << f : @app_items
|
||||||
end
|
end
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = @jours.count
|
@feedback_count = @jours.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
@offset ||= @feedback_pages.offset
|
@offset ||= @feedback_pages.offset
|
||||||
@jour = @jours[@offset, @limit]
|
@jour = @jours[@offset, @limit]
|
||||||
@state = false
|
@state = false
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # show.html.erb
|
format.html # show.html.erb
|
||||||
format.json { render json: @softapplication }
|
format.json { render json: @softapplication }
|
||||||
|
@ -83,11 +83,10 @@ class SoftapplicationsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def add_attach
|
def add_attach
|
||||||
@softapplication = Softapplication.find(params[:id])
|
@softapplication = Softapplication.find(params[:id])
|
||||||
@softapplication.save_attachments(params[:attachments])
|
@softapplication.save_attachments(params[:attachments])
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /softapplications/1
|
# DELETE /softapplications/1
|
||||||
|
@ -101,15 +100,16 @@ class SoftapplicationsController < ApplicationController
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#应用评价涉及到的方法
|
#应用评价涉及到的方法
|
||||||
def new_message
|
def new_message
|
||||||
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
||||||
if @jour
|
if @jour
|
||||||
user = @jour.user
|
user = @jour.user
|
||||||
text = @jour.notes
|
text = @jour.notes
|
||||||
else
|
else
|
||||||
user = @softapplication.user
|
user = @softapplication.user
|
||||||
text = @softapplication.description
|
text = @softapplication.description
|
||||||
end
|
end
|
||||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||||
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
||||||
|
@ -117,25 +117,24 @@ class SoftapplicationsController < ApplicationController
|
||||||
@id = user.id
|
@id = user.id
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
|
||||||
#新建评价
|
|
||||||
def create_message
|
|
||||||
|
|
||||||
if params[:softapplication_message][:message].size>0
|
|
||||||
if params[:reference_content]
|
|
||||||
message = params[:softapplication_message][:message] + "\n" + params[:reference_content]
|
|
||||||
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
|
end
|
||||||
|
|
||||||
|
#新建评价
|
||||||
|
def create_message
|
||||||
|
|
||||||
|
if params[:reference_content]
|
||||||
|
message = params[:softapplication_message][:message] + "\n" + params[:reference_content]
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
@user = @softapplication.user
|
@user = @softapplication.user
|
||||||
@jours = @softapplication.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
@jours = @softapplication.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||||
|
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = @jours.count
|
@feedback_count = @jours.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
|
@ -167,6 +166,7 @@ class SoftapplicationsController < ApplicationController
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
def more
|
def more
|
||||||
@jour = @softapplication.journals_for_messages
|
@jour = @softapplication.journals_for_messages
|
||||||
|
@ -179,6 +179,7 @@ class SoftapplicationsController < ApplicationController
|
||||||
#format.api { render_api_ok }
|
#format.api { render_api_ok }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
def back
|
def back
|
||||||
@jour = @softapplication.journals_for_messages
|
@jour = @softapplication.journals_for_messages
|
||||||
|
|
|
@ -1608,4 +1608,13 @@ module ApplicationHelper
|
||||||
User.current
|
User.current
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def hadcommittedforcontest(curu)
|
||||||
|
# message = JournalsForMessage.find_by_sql("select * from journals_for_messages where jour_type = 'Softapplication' ")
|
||||||
|
# message.each do |createmessage|
|
||||||
|
# if createmessage.user_id == curu
|
||||||
|
# return true
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -196,32 +196,37 @@
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||||
<h3 style="margin-left: 5px; color: #e8770d;"><strong>最新参赛应用</strong></h3>
|
<h3 style="margin-left: 5px; color: #e8770d;"><strong>最新参赛应用</strong></h3>
|
||||||
|
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<div class="d-p-projectlist">
|
<% if Softapplication.count > 0%>
|
||||||
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
|
<div class="d-p-projectlist">
|
||||||
|
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
|
||||||
|
|
||||||
|
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
|
||||||
|
<div class="avatar-4"; style="float: left; margin-top: 7px">
|
||||||
|
<%= image_tag('/images/009.gif')%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="float: left; margin-left: -8px; margin-top: 5px; width: 380px;">
|
||||||
|
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='text_nowrap' style="float: left;margin:5px; margin-left: -8px; width: 380px;">
|
||||||
|
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.truncate(50, omission: '...')%></span>
|
||||||
|
</div><br />
|
||||||
|
|
||||||
|
<div style="padding-left: 36px; clear: left;">
|
||||||
|
<span class="font_lighter">发布时间:<%=format_time softapplication.created_at %></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<% end; reset_cycle %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p class="font_lighter"><%= l(:label_no_bid_project) %></p>
|
||||||
|
|
||||||
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
|
<% end %>
|
||||||
<div class="avatar-4"; style="float: left; margin-top: 7px">
|
|
||||||
<%= image_tag('/images/009.gif')%>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="float: left; margin-left: -8px; margin-top: 5px; width: 380px;">
|
|
||||||
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='text_nowrap' style="float: left;margin:5px; margin-left: -8px; width: 380px;">
|
|
||||||
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.truncate(50, omission: '...')%></span>
|
|
||||||
</div><br />
|
|
||||||
|
|
||||||
<div style="padding-left: 36px; clear: left;">
|
|
||||||
<span class="font_lighter">发布时间:<%=format_time softapplication.created_at %></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<% end; reset_cycle %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue