fix tag plugin
This commit is contained in:
parent
d54a8428d3
commit
0aaaefeba2
9 changed files with 363 additions and 14 deletions
|
|
@ -22,7 +22,6 @@ class ConversationsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
params[:contact_ids] = params[:as_values_contact_ids]
|
||||
person_ids = Contact.where(:id => params[:contact_ids].split(',')).map! do |contact|
|
||||
contact.person_id
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ProfilesController < ApplicationController
|
|||
def update
|
||||
# upload and set new profile photo
|
||||
params[:profile] ||= {}
|
||||
params[:profile][:tag_string] = (params[:as_values_tags]) ? params[:as_values_tags].gsub(',',' ') : ""
|
||||
params[:profile][:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : ""
|
||||
params[:profile][:searchable] ||= false
|
||||
params[:profile][:photo] = Photo.where(:author_id => current_user.person.id,
|
||||
:id => params[:photo_id]).first if params[:photo_id]
|
||||
|
|
|
|||
|
|
@ -13,18 +13,17 @@ class TagsController < ApplicationController
|
|||
|
||||
def index
|
||||
params[:q].gsub!("#", "")
|
||||
params[:limit] = !params[:limit].blank? ? params[:limit].to_i : 10
|
||||
if params[:q].length > 1
|
||||
@tags = ActsAsTaggableOn::Tag.named_like(params[:q]).limit(params[:limit] || 10)
|
||||
@tags = ActsAsTaggableOn::Tag.named_like(params[:q]).limit(params[:limit] - 1)
|
||||
@array = []
|
||||
@tags.each do |obj|
|
||||
@array << { :name => ("#"+obj.name),
|
||||
:value => ("#"+obj.name)}
|
||||
end
|
||||
|
||||
if @array.empty?
|
||||
@array << { :name => params[:q],
|
||||
:value => ("#"+params[:q])}
|
||||
end
|
||||
@array << { :name => ('#' + params[:q]), :value => ("#" + params[:q])}
|
||||
@array.uniq!
|
||||
|
||||
respond_to do |format|
|
||||
format.json{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
minChars: 3,
|
||||
keyDelay: 0,
|
||||
startText: '',
|
||||
emptyText: '#{t('.no_results')}',
|
||||
emptyText: '#{t('no_results')}',
|
||||
preFill: [{ 'name' : "#{params[:name]}",
|
||||
'value' : "#{params[:contact_id]}"}]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@
|
|||
minChars: 2,
|
||||
keyDelay: 0,
|
||||
startText: "#{t('profiles.edit.your_tags_placeholder')}",
|
||||
emptyText: '#{t('.no_results')}',
|
||||
emptyText: '#{t('no_results')}',
|
||||
preFill: data
|
||||
});
|
||||
|
||||
autocompleteInput.bind('keydown', function(evt){
|
||||
if(evt.keyCode == 13 || evt.keyCode == 32){
|
||||
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
|
||||
if( $('li.as-result-item.active').length == 0 ){
|
||||
$('li.as-result-item').first().click();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ en:
|
|||
previous: "previous"
|
||||
_comments: "Comments"
|
||||
all_aspects: "All Aspects"
|
||||
no_results: "No Results Found"
|
||||
|
||||
|
||||
#for reference translation, the real activerecord english transations are actually
|
||||
|
|
@ -192,7 +193,6 @@ en:
|
|||
to: "to"
|
||||
subject: "subject"
|
||||
send: "Send"
|
||||
no_results: "No Results Found"
|
||||
helper:
|
||||
new_messages:
|
||||
zero: "no new messages"
|
||||
|
|
|
|||
353
public/javascripts/vendor/jquery.autoSuggest.js
vendored
353
public/javascripts/vendor/jquery.autoSuggest.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -46,7 +46,7 @@ describe ConversationsController do
|
|||
:conversation => {
|
||||
:subject => "secret stuff",
|
||||
:text => 'text'},
|
||||
:as_values_contact_ids => [@alice.contacts.first.id]
|
||||
:contact_ids => [@alice.contacts.first.id]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ describe ProfilesController do
|
|||
|
||||
it 'sets tags' do
|
||||
params = { :id => @user.person.id,
|
||||
:as_values_tags => '#apples #oranges'}
|
||||
:tags => '#apples #oranges'}
|
||||
|
||||
put :update, params
|
||||
@user.person(true).profile.tag_list.to_set.should == ['apples', 'oranges'].to_set
|
||||
|
|
|
|||
Loading…
Reference in a new issue