[#369] commits index page

This commit is contained in:
Alexander Machehin 2014-07-09 22:21:03 +06:00
parent f1b6192c5c
commit 0c1d0fc133
10 changed files with 53 additions and 44 deletions

View File

@ -1,4 +1,6 @@
class Projects::Git::CommitsController < Projects::Git::BaseController class Projects::Git::CommitsController < Projects::Git::BaseController
layout 'bootstrap', only: [:index]
def index def index
if @path.present? if @path.present?
@commits = @project.repo.log(@treeish, @path) @commits = @project.repo.log(@treeish, @path)

View File

@ -56,6 +56,13 @@ module ApplicationHelper
end end
def alert_class(type) def alert_class(type)
"alert-#{type.to_s == 'error' ? 'danger' : type}" case type
when 'error'
'alert-danger'
when 'notice'
'alert-success'
else
"alert-#{type}"
end
end end
end end

View File

@ -6,6 +6,7 @@
= display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-'
- if user_signed_in? - if user_signed_in?
= auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name'])
= stylesheet_link_tag 'new_application'
%body{ 'ng-app' => 'RosaABF', 'ng-controller' => 'RosaABFController', %body{ 'ng-app' => 'RosaABF', 'ng-controller' => 'RosaABFController',
'ng-init' => "init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" } 'ng-init' => "init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})" }
@ -26,7 +27,6 @@
%article.container-fluid.offset20 %article.container-fluid.offset20
= yield = yield
= render 'layouts/menu/new_bottom' = render 'layouts/menu/new_bottom'
= stylesheet_link_tag 'new_application'
= javascript_include_tag 'new_application' = javascript_include_tag 'new_application'
- if I18n.locale == :ru - if I18n.locale == :ru
= javascript_include_tag 'moment/ru.js' = javascript_include_tag 'moment/ru.js'

View File

@ -6,24 +6,7 @@
%h3= t 'layout.projects.last_commit' %h3= t 'layout.projects.last_commit'
- GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter| - GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter|
=# render 'shared/feed_message', presenter: presenter, item_no: 1
.panel.panel-default .panel.panel-default
.panel-body .panel-body= render 'shared/feed_commit', presenter: presenter, item_no: 1
.pull-left.roffset5
%img{ alt: 'avatar', src: presenter.image }
.pull-left
%strong= presenter.header
= "(#{datetime_moment(presenter.date, tag: :strong)})".html_safe
.clearfix
%span= presenter.caption
- if presenter.expandable? and presenter.content?
%span.glyphicon.glyphicon-chevron-down{ 'data-toggle' => 'collapse', 'data-target' => '#commit_message' }
.clearfix
- if presenter.content?
#commit_message.collapse
= preserve do
= markdown(presenter.content)
.clearfix .clearfix
= yield = yield

View File

@ -3,16 +3,14 @@
- counter = 1 - counter = 1
- commits.each_pair do |year, by_month| - commits.each_pair do |year, by_month|
- if year != cur_year
.year= "#{year} #{t("layout.year")}"
- by_month.each_pair do |month, by_day| - by_month.each_pair do |month, by_day|
- by_day.each_pair do |day, commits| - by_day.each_pair do |day, commits|
.date-block .panel.panel-info
.date= raw l(commits.first.authored_date, format: :date_block_format) .panel-heading
.messages %h3.panel-title= raw l(commits.first.authored_date, format: :date_block_format)
%ul.list-group
- commits.each_with_index do |commit| - commits.each_with_index do |commit|
%li.list-group-item
- GitPresenters::CommitAsMessagePresenter.present(commit, project: @project) do |presenter| - GitPresenters::CommitAsMessagePresenter.present(commit, project: @project) do |presenter|
= render 'shared/feed_message', presenter: presenter, item_no: counter = render 'shared/feed_commit', presenter: presenter, item_no: counter
- counter += 1 - counter += 1
.both

View File

@ -1,10 +1,13 @@
.pagination.tmargin30 - prev_text, next_text = t('will_paginate.previous_label'), t('will_paginate.next_label')
%ul.pager
- if @page == 1 - if @page == 1
%span.previous_page.disabled= t('will_paginate.previous_label') %li.disabled
%a= prev_text
- else - else
%a.previous_page{rel: "prev", href: commits_path(@project, treeish: @treeish, page: (@page - 1))}= t('will_paginate.previous_label') %li
%a{ href: commits_path(@project, treeish: @treeish, page: (@page - 1))}= prev_text
%li
- if @last_page - if @last_page
%span.next_page.disabled= t('will_paginate.next_label') %a= next_text
- else - else
%a.next_page{rel: "next", href: commits_path(@project, treeish: @treeish, page: (@page + 1))}= t('will_paginate.next_label') %a{ href: commits_path(@project, treeish: @treeish, page: (@page + 1))}= next_text

View File

@ -1,6 +1,8 @@
-set_meta_tags title: [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"] -set_meta_tags title: [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"]
= render 'submenu' = render 'submenu'
= render 'repo_block', project: @project .container
.row
= render partial: 'commits', object: @commits = render 'repo_block', project: @project
= render 'paginate' if @path.blank? .offset20
= render partial: 'commits', object: @commits
= render 'paginate' if @path.blank?

View File

@ -0,0 +1,14 @@
.pull-left.roffset5
%img{ alt: 'avatar', src: presenter.image }
.pull-left
%strong= presenter.header
= "(#{datetime_moment(presenter.date, tag: :strong)})".html_safe
.clearfix
%span= presenter.caption
- if presenter.expandable? and presenter.content?
%span.glyphicon.glyphicon-chevron-down{ 'data-toggle' => 'collapse', 'data-target' => "#commit_message_#{item_no}" }
.clearfix
- if presenter.content?
.collapse{ id: "commit_message_#{item_no}" }
= preserve do
= markdown(presenter.content)

View File

@ -1,4 +1,4 @@
en: en:
time: time:
formats: formats:
date_block_format: "%B<br />%d" date_block_format: "%B %d, %Y"

View File

@ -1,4 +1,4 @@
ru: ru:
time: time:
formats: formats:
date_block_format: "%d<br />%B" date_block_format: "%d %B, %Y"