You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							66 lines
						
					
					
						
							2.5 KiB
						
					
					
				
			
		
		
	
	
							66 lines
						
					
					
						
							2.5 KiB
						
					
					
				| #  fq
 | |
| module BidsHelper
 | |
|   def render_notes(bid, journal, options={})
 | |
|     content = ''
 | |
|     removable = User.current == journal.user || User.current == bid.author
 | |
|     links = []
 | |
|     if !journal.notes.blank?
 | |
|       links << link_to(image_tag('comment.png'),
 | |
|                        {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
 | |
|                        :remote => true,
 | |
|                        :method => 'post',
 | |
|                        :title => l(:button_quote)) if options[:reply_links]
 | |
|       if removable
 | |
|         url = {:controller => 'bids',
 | |
|           :action => 'destroy',
 | |
|           :object_id => journal,
 | |
|           :id => bid}
 | |
|         links << ' '
 | |
|         links << link_to(image_tag('delete.png'), url,
 | |
|                      :remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
 | |
|       end                                                     
 | |
|     end
 | |
|     content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
 | |
|     content << textilizable(journal.notes)
 | |
|     css_classes = "wiki"
 | |
|     content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
 | |
|   end
 | |
|   
 | |
|   def link_to_in_place_notes_editor(text, field_id, url, options={})
 | |
|     onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;"
 | |
|     link_to text, '#', options.merge(:onclick => onclick)
 | |
|   end
 | |
|   
 | |
|   # this method is used to get all projects that tagged one tag
 | |
|   # added by william
 | |
|   def get_bids_by_tag(tag_name)
 | |
|     Bid.tagged_with(tag_name).order('updated_on desc')
 | |
|   end
 | |
|   
 | |
|   def sort_bid(state)
 | |
|     content = ''.html_safe
 | |
|     case state
 | |
|     when 0
 | |
|       content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1')))
 | |
|       content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0'), :class=>"selected"), :class=>"selected")
 | |
|       
 | |
|     when 1
 | |
|       content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1'), :class=>"selected"), :class=>"selected")
 | |
|       content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0')))
 | |
|     end
 | |
|     content = content_tag('ul', content)
 | |
|     content_tag('div', content, :class => "tabs")
 | |
|   end
 | |
|   
 | |
|   def course_options_for_select(courses)
 | |
|     # <option value = '0'>#{l(:label_choose_reward)}</option>
 | |
|     html = ''
 | |
|     courses.each do |course|
 | |
|       html << "<option value = #{course.id}>"
 | |
|       html << course.name
 | |
|       html << "</option>"
 | |
|     end
 | |
|     html.html_safe
 | |
|   end
 | |
|   
 | |
| end |