首页:当无应用时,提示暂无应用

This commit is contained in:
wanglinchun 2014-04-21 19:36:05 +08:00
parent 87fdecdabd
commit 94a7bacdd2
3 changed files with 66 additions and 51 deletions

View File

@ -17,11 +17,11 @@ 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
@ -84,7 +84,6 @@ class SoftapplicationsController < ApplicationController
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])
@ -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,22 +117,21 @@ 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')
@ -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

View File

@ -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

View File

@ -198,30 +198,35 @@
<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") %>'> <li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px"> <div class="avatar-4"; style="float: left; margin-top: 7px">
<%= image_tag('/images/009.gif')%> <%= image_tag('/images/009.gif')%>
</div> </div>
<div style="float: left; margin-left: -8px; margin-top: 5px; width: 380px;"> <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") %> <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
</div> </div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: -8px; width: 380px;"> <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> <span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.truncate(50, omission: '...')%></span>
</div><br /> </div><br />
<div style="padding-left: 36px; clear: left;"> <div style="padding-left: 36px; clear: left;">
<span class="font_lighter">发布时间:<%=format_time softapplication.created_at %></span> <span class="font_lighter">发布时间:<%=format_time softapplication.created_at %></span>
</div> </div>
</li> </li>
<% end; reset_cycle %> <% end; reset_cycle %>
</div> </div>
<% else %>
<p class="font_lighter"><%= l(:label_no_bid_project) %></p>
<% end %>
</div> </div>
</div> </div>