POST /translations/1/vote
481900
def vote
      @translation = Translation.find(params[:translation_id])
      current_user.likes(@translation)
      respond_to do |format|
        format.js
      end
    end
697036
public function getVoteLanguages($mode = null)
    {
        arsort($this->votes, SORT_NUMERIC);

        if (self::VOTED_HIGH === $mode) {
            if (!count($this->votes)) {
                return $this->votes;
            }

            $languages = array();

            // Get first item
            list ($language, $highVote) = each($this->votes);
            $languages[] = $language;

            while ($item = each($this->votes)) {
                list ($language, $votes) = $item;
                if ($highVote === $votes) {
                    $languages[] = $language;
                } else {
                    break;
                }
            }

            return $languages;

        }

        return $this->votes;
    }
668431
function (text, arg1, arg2, arg3) {
    text = translateWord(text);

    var pos = text.indexOf('%s');
    if (pos !== -1) {
        text = text.replace('%s', arg1);
    } else {
        return text;
    }

    pos = text.indexOf('%s');
    if (pos !== -1)  {
        text = text.replace('%s', arg2);
    } else {
        return text;
    }

    pos = text.indexOf('%s');
    if (pos !== -1)  {
        text = text.replace('%s', arg3);
    }

    return text;
}
538964
protected function _commandVote($command)
    {
        $entity = $this->getController()->getItem();
        $voted = $entity->votedUp(get_viewer());

        $action = $voted ? 'unvote' : 'vote';
        $class = 'action-'.$action;

        if (is($entity, 'ComBaseDomainEntityComment')) {
            $action .= 'comment';
            $class .= 'comment';
        }

        $label = $voted ? AnTranslator::_('LIB-AN-ACTION-UNVOTE') : AnTranslator::_('LIB-AN-ACTION-VOTE');

        $command
        ->setName($action)
        ->append(array('label' => $label))
        ->href(route($entity->getURL()))
        ->class($class)
        ->setAttribute('data-action', $action)
        ->setAttribute('data-nodeid', $entity->id);
    }
1152944
def help_center_article_comment_votes(self, article_id, comment_id, locale=None, **kwargs):
        ""
        api_path = "/api/v2/help_center/articles/{article_id}/comments/{comment_id}/votes.json"
        api_path = api_path.format(article_id=article_id, comment_id=comment_id)
        if locale:
            api_opt_path = "/api/v2/help_center/{locale}/articles/{article_id}/comments/{comment_id}/votes.json"
            api_path = api_opt_path.format(article_id=article_id, comment_id=comment_id, locale=locale)
        return self.call(api_path, **kwargs)
842152
function translate( $context, $source, $comment = null )
    {
        if ( !is_string( $context ) or $context == "" )
            $context = "default";
        $trans = null;
        for ( $i = 0; $i < count( $this->Handlers ) and $trans === null; ++$i )
        {
            $handler = $this->Handlers[$i];
            $trans = $handler->translate( $context, $source, $comment );
        }
        return $trans;
    }
91437
public function onTranslationList()
    {
        $this->breadcrumbs->register('translations', function($breadcrumbs) {
            $breadcrumbs->push('Translations', handles('antares::translations/index/' . area()));
        });

        $this->shareOnView('translations');
    }
94064
protected function submitEditLanguage()
    {
        if ($this->isPosted('delete')) {
            $this->deleteLanguage();
        } else if ($this->isPosted('save') && $this->validateLanguage()) {
            if (isset($this->data_language['code'])) {
                $this->updateLanguage();
            } else {
                $this->addLanguage();
            }
        }
    }
296434
public function vote($vote = 0, $user_id = 0, $ip = null)
	{
		if (!$this->get('id'))
		{
			$this->addError(Lang::txt('No record found'));
			return false;
		}

		if (!$vote)
		{
			$this->addError(Lang::txt('No vote provided'));
			return false;
		}

		$ip = $ip ?: Request::ip();

		$al = $this->ballot($user_id, $ip);
		$al->set('item_type', 'comment');
		$al->set('item_id', $this->get('id'));
		$al->set('created_by', $user_id);
		if ($ip)
		{
			$al->set('ip', $ip);
		}

		$vote = $al->automaticVote(['vote' => $vote]);

		if ($this->get('created_by') == $user_id)
		{
			$this->addError(Lang::txt('Cannot vote for your own entry'));
			return false;
		}

		if ($vote != $al->get('vote', 0))
		{
			if ($vote > 0)
			{
				$this->set('positive', (int) $this->get('positive') + 1);
				if ($al->get('id'))
				{
					$this->set('negative', (int) $this->get('negative') - 1);
				}
			}
			else
			{
				if ($al->get('id'))
				{
					$this->set('positive', (int) $this->get('positive') - 1);
				}
				$this->set('negative', (int) $this->get('negative') + 1);
			}

			if (!$this->save())
			{
				return false;
			}

			$al->set('vote', $vote);

			if (!$al->save())
			{
				$this->addError($al->getError());
				return false;
			}
		}

		return true;
	}
966094
def upvote
      begin
        client.post("/cards/#{id}/membersVoted", {
          value: me.id
        })
      rescue Trello::Error => e
        fail e unless e.message =~ /has already voted/i
      end

      self
    end
1049413
public void voteFor(WeightedItem<T> weightedItem) {
        reorganizationCounter++;
        weightedItem.vote();
        if (reorganizationCounter == maxVotesBeforeReorganization) {
            reorganizationCounter = 0;
            organizeAndAdd(null);
        }
    }
1146854
public function vote($language, $index = 1)
    {
        if (in_array($language, $this->detectedLanguages)) {
            if (!isset($this->votes[$language])) {
                $this->votes[$language] = 0;
            }

            $this->votes[$language] += $index;
        }

        return $this;
    }
153343
def post_vote(self, post_id, score):
        
        return self._get('posts/{0}/votes.json'.format(post_id),
                         {'score': score}, 'POST', auth=True)
557151
def view_all(request, language, filter=None):
	

	# Is there any filter?
	if request.method == "POST":
		data = request.POST.dict()

		if not data["search"] or data["search"]=="":
			return HttpResponseRedirect(reverse("modeltranslation:view_all_url",args=(data["language"],data["filter"])))

		return HttpResponseRedirect(reverse("modeltranslation:view_all_url",args=(data["language"],data["filter"]))+"?search="+data["search"])

	LANGUAGES = dict(lang for lang in settings.LANGUAGES)
	if language not in LANGUAGES.keys():
		raise Http404(u"Language {0} does not exist".format(language))
	
	if language == settings.LANGUAGE_CODE:
		raise Http404(u"El idioma {0} es el idioma por defecto".format(language))

	# Translation filter
	trans_filter = {"lang":language}
	if filter == "all" or filter is None:
		pass
	elif filter == "fuzzy":
		trans_filter["is_fuzzy"] = True
	elif filter == "completed":
		trans_filter["is_fuzzy"] = False
	
	search_query = ""
	if request.GET and "search" in request.GET and request.GET.get("search")!="":
		search_query = request.GET.get("search")
		trans_filter["source_text__icontains"] = search_query

	translations = FieldTranslation.objects.filter(**trans_filter)
	
	# Update translations
	active_translations = []
	for translation in translations:
		source_model = translation.get_source_model()
		if not translation.field in source_model._meta.translatable_fields:
			translation.delete()
		else:
			active_translations.append(translation)
	
	replacements = {"translations":active_translations, "filter":filter, "lang":language, "language":LANGUAGES[language], "search_query":search_query}
	return render_to_response('modeltranslation/admin/list.html',replacements, RequestContext(request))
749129
def community_post_votes(self, post_id, **kwargs):
        ""
        api_path = "/api/v2/community/posts/{post_id}/votes.json"
        api_path = api_path.format(post_id=post_id)
        return self.call(api_path, **kwargs)
822534
public function vote(DataObject $post, $dir = 1) {
		$member = $this->securityContext->getMember();
		
		if ($this->requireVoteBalance && $member->VotesToGive <= 0) {
			$post->RemainingVotes = 0;
			return $post;
		}

		// we allow multiple votes - as many as the user has to give! unless
		// configured not to...
		$currentVote = null; 
		
		if ($this->singleVotes) {
			$votes = $post->currentVotesByUser();
			if (count($votes)) {
				$currentVote = $votes[0];
			}
		}
		
		if (!$currentVote) {
			$currentVote = MicroPostVote::create();
			$currentVote->UserID = $member->ID;
			$currentVote->PostID = $post->ID;
		}
		
		$currentVote->Direction = $dir > 0 ? 1 : -1;
		$currentVote->write();
		
		$list = DataList::create('MicroPostVote');
		
		$upList = $list->filter(array('PostID' => $post->ID, 'Direction' => 1));
		$post->Up = $upList->count();
		
		$downList = $list->filter(array('PostID' => $post->ID, 'Direction' => -1));
		$post->Down = $downList->count();
		
		$owner = $post->Owner();
		if (!$post->OwnerID || !$owner || !$owner->exists()) {
			$owner = Security::findAnAdministrator();
		}

		// write the post as the owner, and calculate some changes for the author
		$this->transactionManager->run(function () use ($post, $currentVote, $member) {
			$author = $post->Owner();
			if ($author && $author->exists() && $author->ID != $member->ID) {
				if ($currentVote->Direction > 0) {
					$author->Up += 1;
				} else {
					$author->Down += 1;
				}
				$author->write();
			}
			$post->write();
		}, $owner);

		$this->rewardMember($member, -1);
		$post->RemainingVotes = $member->VotesToGive;

		return $post;
	}
208325
def vote(cls):
        """"""
        url = configuration.VoteUrl + 'count/'
        uid = get_system_uid()
        data = {"name": cls.getName().replace('/', '_'), "uid": uid}
        page = urlopen(url, cls.session, data=data)
        return page.text