Merge branch 'master' of github.com:warpc/rosa-build

This commit is contained in:
Vladimir Sharshov 2012-11-28 20:45:28 +04:00
commit 3f4fc254e1
10 changed files with 17 additions and 19 deletions

View File

@ -52,11 +52,14 @@ class Api::V1::BuildListsController < Api::V1::BaseController
private
def render_json(action_name)
if @build_list.send(action_name)
render :json => {:"is_#{action_name}ed" => true, :url => api_v1_build_list_path(@build_list, :format => :json), :message => t("layout.build_lists.#{action_name}_success")}
else
render :json => {:"is_#{action_name}ed" => false, :url => api_v1_build_list_path(@build_list, :format => :json), :message => t("layout.build_lists.#{action_name}_fail")}
end
end
res, message = if !@build_list.send "can_#{action_name}?"
[false, "Incorrect action for current build list"]
elsif @build_list.send(action_name)
[true, t("layout.build_lists.#{action_name}_success")]
else
[false, t("layout.build_lists.#{action_name}_fail")]
end
render :json => {:"is_#{action_name}ed" => res, :url => api_v1_build_list_path(@build_list, :format => :json), :message => message}
end
end

View File

@ -7,15 +7,12 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
def initialize(commit, opts = {})
@commit = commit
@options = opts#[:branch] if opts[:branch]
@options = opts
prepare_message
end
def header
@header ||= if options[:branch].present?
I18n.t("layout.messages.commits.header_with_branch",
:committer => committer_link, :commit => commit_link, :branch => options[:branch].name)
elsif options[:project].present?
@header ||= if options[:project].present?
I18n.t("layout.messages.commits.header",
:committer => committer_link, :commit => commit_link, :project => options[:project].name)
end.html_safe

View File

@ -3,7 +3,7 @@
= render 'about_block', :project => @project
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|
- GitPresenters::CommitAsMessagePresenter.present(@commit, :project => @project) do |presenter|
= render 'shared/feed_message', :presenter => presenter, :item_no => 1
.both

View File

@ -5,7 +5,7 @@
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|
- GitPresenters::CommitAsMessagePresenter.present(@commit, :project => @project) do |presenter|
= render 'shared/feed_message', :presenter => presenter, :item_no => 1
.both

View File

@ -12,7 +12,7 @@
.date= raw l(commits.first.authored_date, :format => :date_block_format)
.messages
- commits.each_with_index do |commit|
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
- GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project) do |presenter|
= render 'shared/feed_message', :presenter => presenter, :item_no => counter
- counter += 1
.both

View File

@ -3,7 +3,7 @@
%tbody
- commits.each do |commit|
- item_no = commit.id
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
- GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project) do |presenter|
%tr
%td
%img{:height => 16, :alt => "avatar", :src => presenter.image}

View File

@ -3,7 +3,7 @@
= render 'about_block', :project => @project
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|
- GitPresenters::CommitAsMessagePresenter.present(@commit, :project => @project) do |presenter|
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1}
.both

View File

@ -2,5 +2,4 @@ en:
layout:
messages:
commits:
header_with_branch: "%{committer} has added %{commit} into %{branch} branch"
header: "%{committer} has added %{commit}"

View File

@ -2,5 +2,4 @@ ru:
layout:
messages:
commits:
header_with_branch: "%{committer} добавил коммит %{commit} в ветку %{branch}"
header: "%{committer} добавил коммит %{commit}"

View File

@ -1,7 +1,7 @@
ru:
title_editing:
'Редактирование'
at: at
at: в
users:
settings:
profile: