From 39dd53ff9b9ecb6e04b6aeaa0fe52eac050fc16b Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Thu, 5 Apr 2012 11:26:03 +0400 Subject: [PATCH] [refs #358] Add git clone repo help hint --- app/assets/javascripts/application.js | 11 +++++++++++ app/assets/stylesheets/design/custom.scss | 15 +++++++++++++++ app/views/projects/_repo_block.html.haml | 20 ++++++++++++++++++++ config/locales/models/project.en.yml | 4 ++++ config/locales/models/project.ru.yml | 6 +++++- 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d8dd4c4fe..eaeeb93af 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -49,4 +49,15 @@ $(document).ready(function() { return false; }); + $('.description-top .git_help').click(function() { + $('#git_help_data').toggle(); + var desc = $('.description-top'); + + if ($('#git_help_data').css('display') == 'none') { + desc.css('height', '38px'); + } else { + desc.css('height', '200px'); + } + }); + }); diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 90d49db25..cb06a9d10 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -764,3 +764,18 @@ div.tos_sidebar ul li a { padding-top: 5px; text-decoration: none; } + +div.description-top div.git_help { + float: left; + margin-top: 11px; + margin-left: 10px; + font-size: 11px; + color: green; + cursor: pointer; +} + +div#git_help_data { + display: none; + padding-left: 10px; + padding-top: 15px; +} diff --git a/app/views/projects/_repo_block.html.haml b/app/views/projects/_repo_block.html.haml index a9d3a95fa..7d1850157 100644 --- a/app/views/projects/_repo_block.html.haml +++ b/app/views/projects/_repo_block.html.haml @@ -1,7 +1,27 @@ .description-top = text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true + .git_help ? .role= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access") = render :partial => 'projects/branch_select', :locals => {:project => project} + #git_help_data + = t("layout.projects.git_help.cloning") + ":" + %br + %br + %b git clone #{git_repo_url(project.git_repo_name)} #{project.name} + %br + %b cd #{project.name} + %br + %br + = t("layout.projects.git_help.remote") + ":" + %br + %br + %b git remote add #{project.name} #{git_repo_url(project.git_repo_name)} + %br + %b git fetch #{project.name} + %br + %b git checkout -b my-local-tracking-branch #{project.name}/master_or_other_branch + %br + %br .both :javascript $(document).ready(function() { diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index e1f408056..f2380d9f8 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -30,6 +30,10 @@ en: has_issue_description: Tracker adds a lightweight issue management system tightly integrated with your repository. has_wiki_description: Wikis are the simplest way to allow other users to contribute content. Any user can create and edit pages for documentation, examples, support or anything you wish. + git_help: + cloning: Cloning the repository + remote: Add this repository as a remote to an existing local repository + diff_show_header: "%{files} with %{additions} and %{deletions}." about_subheader: "About project" last_commit: "Last commit" diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index 23a15dc72..762cb9f82 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -44,7 +44,11 @@ ru: current_branch: Текущая ветка/тег current_commit: Текущий коммит files_in_project: Файлы в - + + git_help: + cloning: Клонирование этого репозитория + remote: Добавление этого репозитория как удаленного к существующему локальному репозиторию + flash: project: saved: Проект успешно сохранен