From 3929c4bb5744ac25b447b30c3c92061ce283a353 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 13 Feb 2013 14:25:09 +0400 Subject: [PATCH] #907: update #branches UI --- app/assets/stylesheets/design/custom.scss | 21 ++++++++++++++++--- .../projects/git/trees_controller.rb | 2 ++ .../projects/git/trees/_branch.html.haml | 10 +++++++++ .../projects/git/trees/_header.html.haml | 10 +++++++++ .../projects/git/trees/branches.html.haml | 8 ++++++- app/views/projects/git/trees/tags.html.haml | 3 ++- config/locales/models/project.en.yml | 9 ++++++++ config/locales/models/project.ru.yml | 9 ++++++++ 8 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 app/views/projects/git/trees/_branch.html.haml create mode 100644 app/views/projects/git/trees/_header.html.haml diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 5ba8d154e..5e93e7a02 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -53,16 +53,31 @@ header menu ul li a { display: inline-block; padding: 10px; margin: 0 5px; + border: 1px solid #a9c6dd; + border-bottom: none; } li.selected { background-color: #FFF; - border: 1px solid #a9c6dd; - border-bottom: none; } .tags { float: right; } } } - +#project-branches { + width: 100%; + border-spacing: 0; + margin-top: 20px; + tr.base { + background: #dcecfa; + } + td.actions ul { + float: right; + } + .text { font-size: 12px; } + td { + border-bottom: 1px solid #a9c6dd; + padding: 0 20px; + } +} article div.activity, .commits_activity { border: 1px solid #D6D6D6; border-radius: 5px 5px 5px 5px; diff --git a/app/controllers/projects/git/trees_controller.rb b/app/controllers/projects/git/trees_controller.rb index 11547fef5..a6820165c 100644 --- a/app/controllers/projects/git/trees_controller.rb +++ b/app/controllers/projects/git/trees_controller.rb @@ -25,9 +25,11 @@ class Projects::Git::TreesController < Projects::Git::BaseController end def tags + @tags = @project.repo.tags end def branches + @branches = @project.repo.branches end end diff --git a/app/views/projects/git/trees/_branch.html.haml b/app/views/projects/git/trees/_branch.html.haml new file mode 100644 index 000000000..2a0d49e07 --- /dev/null +++ b/app/views/projects/git/trees/_branch.html.haml @@ -0,0 +1,10 @@ +- base = branch.name == @branch.name +%tr{:class => (base ? 'base' : '')} + %td.name= link_to branch.name, tree_path(@project, branch.name) + %td.actions + %ul.actions + - if base + %li.text= t('layout.projects.base_branch') + - else + %li + = link_to t('diff'), diff_path(@project, "#{@branch.name}...#{branch.name}") \ No newline at end of file diff --git a/app/views/projects/git/trees/_header.html.haml b/app/views/projects/git/trees/_header.html.haml new file mode 100644 index 000000000..fb8b8bbc7 --- /dev/null +++ b/app/views/projects/git/trees/_header.html.haml @@ -0,0 +1,10 @@ +- subjects_name = action_name.to_s + +%h3= t("layout.projects.#{subjects_name}") +- if subject.empty? + %p= t("layout.projects.no_#{subjects_name}") +- elsif subject.count == 1 + %p= t("layout.projects.showing_#{subjects_name.gsub /[e]*s$/, ''}") +- else + %p= t("layout.projects.showing_#{subjects_name}", :count => subject.count) +.both \ No newline at end of file diff --git a/app/views/projects/git/trees/branches.html.haml b/app/views/projects/git/trees/branches.html.haml index c1b56835e..1ce31f8b4 100644 --- a/app/views/projects/git/trees/branches.html.haml +++ b/app/views/projects/git/trees/branches.html.haml @@ -1,4 +1,10 @@ -set_meta_tags :title => "#{title_object @project}" = render 'submenu' -= render 'repo_block', :project => @project \ No newline at end of file += render 'repo_block', :project => @project += render 'header', :subject => @branches + +- if @branches.present? + %table#project-branches + %tbody + = render :partial => 'branch', :collection => @branches.select{ |b| b.name != @branch.name }.unshift(@branch) \ No newline at end of file diff --git a/app/views/projects/git/trees/tags.html.haml b/app/views/projects/git/trees/tags.html.haml index c1b56835e..9fd70b6ca 100644 --- a/app/views/projects/git/trees/tags.html.haml +++ b/app/views/projects/git/trees/tags.html.haml @@ -1,4 +1,5 @@ -set_meta_tags :title => "#{title_object @project}" = render 'submenu' -= render 'repo_block', :project => @project \ No newline at end of file += render 'repo_block', :project => @project += render 'header', :subject => @tags \ No newline at end of file diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index 92b46cd12..f75cb25f7 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -1,6 +1,15 @@ en: layout: projects: + branches: Branches + showing_branches: Showing %{count} branches + showing_branch: Showing 1 branch + no_branches: No branches + base_branch: Base branch + tags: Tags + showing_tags: Showing %{count} tags + showing_tag: Showing 1 tag + no_tags: No tags add: Add public_projects_list: Public projects list edit: Settings diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index 60b13d39f..0b047d44d 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -1,6 +1,15 @@ ru: layout: projects: + branches: Ветки + showing_branches: Показано %{count} веток + showing_branch: Показана 1 ветка + no_branch: Нет веток + base_branch: Текущая ветка + tags: Теги + showing_tags: Показано %{count} тегов + showing_tag: Показан 1 тег + no_tags: Нет тегов add: Добавить public_projects_list: Список публичных проектов edit: Настройки