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

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,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
#新建评价
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
#新建评价
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
@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

View File

@ -1608,4 +1608,13 @@ module ApplicationHelper
User.current
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

View File

@ -196,32 +196,37 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3 style="margin-left: 5px; color: #e8770d;"><strong>最新参赛应用</strong></h3>
<div class="d-p-projectlist-box">
<div class="d-p-projectlist">
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
<% if Softapplication.count > 0%>
<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") %>'>
<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>
<% end %>
</div>
</div>