parent
344e51105a
commit
825b1e7fd7
@ -1,128 +1,128 @@
|
|||||||
#enconding:utf-8
|
#enconding:utf-8
|
||||||
# fq
|
# fq
|
||||||
module BidsHelper
|
module BidsHelper
|
||||||
|
|
||||||
def render_notes(bid, journal, options={})
|
def render_notes(bid, journal, options={})
|
||||||
content = ''
|
content = ''
|
||||||
removable = User.current == journal.user || User.current == bid.author
|
removable = User.current == journal.user || User.current == bid.author
|
||||||
links = []
|
links = []
|
||||||
if !journal.notes.blank?
|
if !journal.notes.blank?
|
||||||
links << link_to(image_tag('comment.png'),
|
links << link_to(image_tag('comment.png'),
|
||||||
{:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
|
{:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => 'post',
|
:method => 'post',
|
||||||
:title => l(:button_quote)) if options[:reply_links]
|
:title => l(:button_quote)) if options[:reply_links]
|
||||||
if removable
|
if removable
|
||||||
url = {:controller => 'bids',
|
url = {:controller => 'bids',
|
||||||
:action => 'destroy',
|
:action => 'destroy',
|
||||||
:object_id => journal,
|
:object_id => journal,
|
||||||
:id => bid}
|
:id => bid}
|
||||||
links << ' '
|
links << ' '
|
||||||
links << link_to(image_tag('delete.png'), url,
|
links << link_to(image_tag('delete.png'), url,
|
||||||
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
|
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
|
content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
|
||||||
content << textilizable(journal.notes)
|
content << textilizable(journal.notes)
|
||||||
css_classes = "wiki"
|
css_classes = "wiki"
|
||||||
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
|
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_in_place_notes_editor(text, field_id, url, options={})
|
def link_to_in_place_notes_editor(text, field_id, url, options={})
|
||||||
onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;"
|
onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;"
|
||||||
link_to text, '#', options.merge(:onclick => onclick)
|
link_to text, '#', options.merge(:onclick => onclick)
|
||||||
end
|
end
|
||||||
|
|
||||||
# this method is used to get all projects that tagged one tag
|
# this method is used to get all projects that tagged one tag
|
||||||
# added by william
|
# added by william
|
||||||
def get_bids_by_tag(tag_name)
|
def get_bids_by_tag(tag_name)
|
||||||
Bid.tagged_with(tag_name).order('updated_on desc')
|
Bid.tagged_with(tag_name).order('updated_on desc')
|
||||||
end
|
end
|
||||||
|
|
||||||
#added by huang
|
#added by huang
|
||||||
def sort_bid_enterprise(state, project_type)
|
def sort_bid_enterprise(state, project_type)
|
||||||
content = ''.html_safe
|
content = ''.html_safe
|
||||||
case state
|
case state
|
||||||
when 0
|
when 0
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||||
|
|
||||||
when 1
|
when 1
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
|
||||||
end
|
end
|
||||||
content = content_tag('ul', content)
|
content = content_tag('ul', content)
|
||||||
content_tag('div', content, :class => "tabs_enterprise")
|
content_tag('div', content, :class => "tabs_enterprise")
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
def sort_bid(state, project_type)
|
def sort_bid(state, project_type)
|
||||||
content = ''.html_safe
|
content = ''.html_safe
|
||||||
case state
|
case state
|
||||||
when 0
|
when 0
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||||
|
|
||||||
when 1
|
when 1
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
|
||||||
end
|
end
|
||||||
content = content_tag('ul', content)
|
content = content_tag('ul', content)
|
||||||
content_tag('div', content, :class => "tabs")
|
content_tag('div', content, :class => "tabs")
|
||||||
end
|
end
|
||||||
|
|
||||||
#huang
|
#huang
|
||||||
def sort_contest(state)
|
def sort_contest(state)
|
||||||
content = ''.html_safe
|
content = ''.html_safe
|
||||||
case state
|
case state
|
||||||
when 0
|
when 0
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), contest_path(:contest_sort_type => '1')))
|
content << content_tag('li', link_to(l(:label_sort_by_active), contest_path(:contest_sort_type => '1')))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), contest_path(:contest_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_time), contest_path(:contest_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||||
|
|
||||||
when 1
|
when 1
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), contest_path(:contest_sort_type => '1'), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_active), contest_path(:contest_sort_type => '1'), :class=>"selected"), :class=>"selected")
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), contest_path(:contest_sort_type => '0')))
|
content << content_tag('li', link_to(l(:label_sort_by_time), contest_path(:contest_sort_type => '0')))
|
||||||
end
|
end
|
||||||
content = content_tag('ul', content)
|
content = content_tag('ul', content)
|
||||||
content_tag('div', content, :class => "tabs")
|
content_tag('div', content, :class => "tabs")
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
def course_options_for_select(courses)
|
def course_options_for_select(courses)
|
||||||
# <option value = '0'>#{l(:label_choose_reward)}</option>
|
# <option value = '0'>#{l(:label_choose_reward)}</option>
|
||||||
html = ''
|
html = ''
|
||||||
courses.each do |course|
|
courses.each do |course|
|
||||||
html << "<option value = #{course.id}>"
|
html << "<option value = #{course.id}>"
|
||||||
html << course.name
|
html << course.name
|
||||||
html << "</option>"
|
html << "</option>"
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# used to get the reward and handle the value which can be used to display in views
|
# used to get the reward and handle the value which can be used to display in views
|
||||||
# added by william
|
# added by william
|
||||||
def get_prize(b_project)
|
def get_prize(b_project)
|
||||||
b_project.get_reward
|
b_project.get_reward
|
||||||
end
|
end
|
||||||
|
|
||||||
def count_bid_project
|
def count_bid_project
|
||||||
bids = Bid.where('parent_id = ?', @bid.id)
|
bids = Bid.where('parent_id = ?', @bid.id)
|
||||||
@projects = []
|
@projects = []
|
||||||
for bid in bids
|
for bid in bids
|
||||||
@projects += bid.biding_projects
|
@projects += bid.biding_projects
|
||||||
end
|
end
|
||||||
@projects.count
|
@projects.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def count_bid_user
|
def count_bid_user
|
||||||
bids = Bid.where('parent_id = ?', @bid.id)
|
bids = Bid.where('parent_id = ?', @bid.id)
|
||||||
@users = []
|
@users = []
|
||||||
for bid in bids
|
for bid in bids
|
||||||
for project in bid.projects
|
for project in bid.projects
|
||||||
@users += project.users
|
@users += project.users
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@users.count
|
@users.count
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
<div id="issues">
|
||||||
|
<% if forums_results.size > 0 %>
|
||||||
|
<hr />
|
||||||
|
<% forums_results.each do |forum| %>
|
||||||
|
<p class="font_description2">
|
||||||
|
<strong><%= l(:label_tags_forum) %>:<%= link_to "#{forum.name}",
|
||||||
|
:controller => "forums",:action => "show",:id => forum.id %></strong>
|
||||||
|
<br />
|
||||||
|
<strong><%= l(:label_tags_forum_description) %>:</strong><%= forum.description %>
|
||||||
|
<%= forum.updated_at %>
|
||||||
|
</p>
|
||||||
|
<div class="line_under"></div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
Loading…
Reference in new issue