diff --git a/Gemfile b/Gemfile index 81925700d..05e6eb8dc 100644 --- a/Gemfile +++ b/Gemfile @@ -102,6 +102,10 @@ end gem 'rack-utf8_sanitizer' gem 'web-console', '~> 2.0' +#github api +gem 'github_api' +gem 'faraday-http-cache' + group :production do gem 'airbrake' #gem 'bluepill', '~> 0.0.60', require: false diff --git a/Gemfile.lock b/Gemfile.lock index ad673e984..ae491e402 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -164,6 +164,8 @@ GEM creole (0.5.0) daemons (1.2.2) debug_inspector (0.0.2) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) devise (3.5.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -188,6 +190,8 @@ GEM railties (>= 3.0.0) faraday (0.9.1) multipart-post (>= 1.2, < 3) + faraday-http-cache (1.2.2) + faraday (~> 0.8) ffi (1.9.8) font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) @@ -205,6 +209,14 @@ GEM rugged (~> 0.21.0) github-markup (1.1.2) posix-spawn (~> 0.3.8) + github_api (0.13.0) + addressable (~> 2.3) + descendants_tracker (~> 0.0.4) + faraday (~> 0.8, < 0.10) + hashie (>= 3.4) + multi_json (>= 1.7.5, < 2.0) + nokogiri (~> 1.6.6) + oauth2 gitlab-grit (2.6.12) charlock_holmes (~> 0.6) diff-lcs (~> 1.1) @@ -637,6 +649,11 @@ GEM rack (>= 1.0.0) warden (1.2.3) rack (>= 1.0) + web-console (2.2.1) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) webmock (1.21.0) addressable (>= 2.3.6) crack (>= 0.3.2) @@ -681,11 +698,13 @@ DEPENDENCIES devise diff-display factory_girl_rails + faraday-http-cache ffi font-awesome-rails friendly_id gemoji github-linguist (= 3.1.5) + github_api gollum-lib (~> 3.0) grack! grit! @@ -756,8 +775,12 @@ DEPENDENCIES timecop uglifier underscore-rails + web-console (~> 2.0) webmock whenever wikicloth will_paginate zeroclipboard-rails + +BUNDLED WITH + 1.10.6 diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c1ed6c3ff..9a51c3e76 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -36,53 +36,6 @@ class HomeController < ApplicationController activity(true) end - def issues - @created_issues = current_user.issues - @assigned_issues = Issue.where(assignee_id: current_user.id) - @all_issues = ProjectPolicy::Scope.new(current_user, Issue).membered.uniq.joins(:project) - - @created_issues, @assigned_issues, @all_issues = - if action_name == 'issues' - [@created_issues.without_pull_requests, - @assigned_issues.without_pull_requests, - @all_issues.without_pull_requests] - else - [@created_issues.joins(:pull_request), - @assigned_issues.joins(:pull_request), - @all_issues.joins(:pull_request)] - end - - case params[:filter] - when 'created' - @issues = @created_issues - when 'assigned' - @issues = @assigned_issues - else - params[:filter] = 'all' # default - @issues = @all_issues - end - @filter = params[:filter] - @opened_issues, @closed_issues = @issues.not_closed_or_merged, @issues.closed_or_merged - - @status = params[:status] == 'closed' ? :closed : :open - @issues = @issues.send( (@status == :closed) ? :closed_or_merged : :not_closed_or_merged ) - - @sort = params[:sort] == 'updated' ? :updated : :created - @direction = params[:direction] == 'asc' ? :asc : :desc - @issues = @issues.order("issues.#{@sort}_at #{@direction}") - .includes(:assignee, :user, :pull_request).uniq - .paginate page: current_page - - respond_to do |format| - format.html { render 'activity' } - format.json { render 'issues' } - end - end - - def pull_requests - issues - end - def get_owners_list if params[:term].present? users = User.opened.search(params[:term]).first(5) diff --git a/app/controllers/projects/base_controller.rb b/app/controllers/projects/base_controller.rb index eef9e3574..a0bbb460b 100644 --- a/app/controllers/projects/base_controller.rb +++ b/app/controllers/projects/base_controller.rb @@ -19,8 +19,8 @@ class Projects::BaseController < ApplicationController def init_statistics if @project - @opened_issues_count = @project.issues.without_pull_requests.not_closed_or_merged.count - @opened_pull_requests_count = @project.issues.joins(:pull_request).not_closed_or_merged.count + #@opened_issues_count = @project.issues.without_pull_requests.not_closed_or_merged.count + #@opened_pull_requests_count = @project.issues.joins(:pull_request).not_closed_or_merged.count end end end diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index f89f004f0..33893c779 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -14,6 +14,7 @@ class Projects::BuildListsController < Projects::BaseController def index authorize :build_list params[:filter].each{|k,v| params[:filter].delete(k) if v.blank? } if params[:filter] + @project.fetch_github_repo_data unless not @project respond_to do |format| format.html @@ -42,6 +43,7 @@ class Projects::BuildListsController < Projects::BaseController def new authorize @build_list = @project.build_lists.build + @project.fetch_github_repo_data unless not @project if params[:show] == 'inline' && params[:build_list_id].present? render json: new_build_list_data(@build_list, @project, params), layout: false else @@ -66,7 +68,6 @@ class Projects::BuildListsController < Projects::BaseController @build_list.user = current_user @build_list.include_repos = @build_list.include_repos.select {|ir| @build_list.build_for_platform.repository_ids.include? ir.to_i} @build_list.priority = current_user.build_priority # User builds more priority than mass rebuild with zero priority - flash_options = { project_version: @build_list.project_version, arch: arch.name, build_for_platform: build_for_platform.name } authorize @build_list if @build_list.save diff --git a/app/controllers/projects/project/project_controller.rb b/app/controllers/projects/project/project_controller.rb index ff23e4517..15e0b4762 100644 --- a/app/controllers/projects/project/project_controller.rb +++ b/app/controllers/projects/project/project_controller.rb @@ -1,5 +1,6 @@ class Projects::Project::ProjectController < Projects::Project::BaseController - def index - console - end + def index + authorize @project + (render :error_github) if not @project.github_data + end end \ No newline at end of file diff --git a/app/controllers/projects/projects_controller.rb b/app/controllers/projects/projects_controller.rb index e80d2f32a..007d04d76 100644 --- a/app/controllers/projects/projects_controller.rb +++ b/app/controllers/projects/projects_controller.rb @@ -7,6 +7,7 @@ class Projects::ProjectsController < Projects::BaseController def index authorize :project + Project.fetch_github_data_on_find = false @projects = ProjectPolicy::Scope.new(current_user, Project).membered.search(params[:search]) respond_to do |format| format.html { diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 1a111918c..562474285 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -87,6 +87,12 @@ class BuildList < ActiveRecord::Base before_validation :prepare_extra_build_lists, on: :create before_validation :prepare_extra_params, on: :create before_validation :prepare_auto_publish_status, on: :create + after_validation -> { + errors.each do |x, y| + puts x + puts y + end + } LIVE_TIME = 4.week # for unpublished MAX_LIVE_TIME = 3.month # for published diff --git a/app/models/project.rb b/app/models/project.rb index 9355376fc..9749904fb 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -19,22 +19,13 @@ class Project < ActiveRecord::Base belongs_to :owner, polymorphic: true, counter_cache: :own_projects_count belongs_to :maintainer, class_name: 'User' - belongs_to :alias_from, class_name: 'Project' - has_many :aliases, class_name: 'Project', foreign_key: 'alias_from_id' - - has_many :issues, dependent: :destroy - has_many :pull_requests, dependent: :destroy, foreign_key: 'to_project_id' - has_many :labels, dependent: :destroy has_many :build_scripts, dependent: :destroy - has_many :project_imports, dependent: :destroy has_many :project_to_repositories, dependent: :destroy has_many :repositories, through: :project_to_repositories - has_many :project_tags, dependent: :destroy has_many :project_statistics, dependent: :destroy has_many :build_lists, dependent: :destroy - has_many :hooks, dependent: :destroy has_many :relations, as: :target, dependent: :destroy has_many :collaborators, through: :relations, source: :actor, source_type: 'User' @@ -69,13 +60,23 @@ class Project < ActiveRecord::Base before_create :set_maintainer after_save :attach_to_personal_repository after_update -> { update_path_to_project(name_was) }, if: :name_changed? + after_find :fetch_github_repo_data - attr_accessor :url, :srpms_list, :mass_import, :add_to_repository_id + attr_accessor :url, :srpms_list, :mass_import, :add_to_repository_id, :github_data def init_mass_import Project.perform_later :low, :run_mass_import, url, srpms_list, visibility, owner, add_to_repository_id end + def fetch_github_repo_data + org = github_organization || APP_CONFIG["github_organization"] + begin + @github_data = Github.repos.get user: org, repo: name + rescue + @github_data = nil + end + end + def name_with_owner "#{owner_uname || owner.uname}/#{name}" end @@ -104,6 +105,12 @@ class Project < ActiveRecord::Base @platforms ||= repositories.map(&:platform).uniq end + def in_main_platform? + platforms.map do |platform| + platform.platform_type + end.include?('main') + end + def admins admins = self.collaborators.where("relations.role = 'admin'") grs = self.groups.where("relations.role = 'admin'") @@ -166,20 +173,6 @@ class Project < ActiveRecord::Base build_list.save end - def fork(new_owner, new_name: nil, is_alias: false) - new_name = new_name.presence || name - dup.tap do |c| - c.name = new_name - c.parent_id = id - c.alias_from_id = is_alias ? (alias_from_id || id) : nil - c.owner = new_owner - c.updated_at = nil; c.created_at = nil # :id = nil - # Hack to call protected method :) - c.send :set_maintainer - c.save - end - end - def get_project_tag_sha1(tag, format) format_id = ProjectTag::FORMATS["#{tag_file_format(format)}"] project_tag = project_tags.where(tag_name: tag.name, format_id: format_id).first diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 1d2ae53c4..80d63bff3 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -77,6 +77,7 @@ class ProjectPolicy < ApplicationPolicy def permitted_attributes %i( add_to_repository_id + github_organization architecture_dependent autostart_status default_branch diff --git a/app/views/projects/base/_settings_menu.html.slim b/app/views/projects/base/_settings_menu.html.slim index 22dcb9203..930bc6977 100644 --- a/app/views/projects/base/_settings_menu.html.slim +++ b/app/views/projects/base/_settings_menu.html.slim @@ -5,10 +5,6 @@ ul.nav.nav-tabs.nav-justified.boffset10[ role = 'tablist' ] - if policy(@project).edit? li[ class = "#{(act == :edit && contr == :projects) ? 'active' : ''}" ] = link_to t("layout.projects.edit"), edit_project_path(@project) - li[ class = "#{(act == :sections && contr == :projects) ? 'active' : ''}" ] - = link_to t("layout.projects.sections"), sections_project_path(@project) - li[ class = "#{(contr == :hooks) ? 'active' : ''}" ] - = link_to t("layout.projects.hooks"), project_hooks_path(@project) - if policy(@project).manage_collaborators? li[ class = "#{(act == :index && contr == :collaborators) ? 'active' : ''}" ] = link_to t("layout.projects.edit_collaborators"), project_collaborators_path(@project) diff --git a/app/views/projects/base/_submenu.html.slim b/app/views/projects/base/_submenu.html.slim index 42587cb65..f4c214baf 100644 --- a/app/views/projects/base/_submenu.html.slim +++ b/app/views/projects/base/_submenu.html.slim @@ -1,5 +1,7 @@ - content_for :submenu do - act = action_name.to_sym; contr = controller_name.to_sym; treeish = @project.default_head(params[:treeish]) + - github_success = @project.github_data != nil + - github_base_url = @project.github_data.html_url unless not github_success nav.navbar.navbar-default role='navigation' .container-fluid ng-cloak = true / Brand and toggle get grouped for better mobile display @@ -17,38 +19,31 @@ / Collect the nav links, forms, and other content for toggling #submenu-navbar-collapse.collapse.navbar-collapse ul.nav.navbar-nav.left-border - - if @project.parent - - is_alias = @project.alias_from_id.present? - - tooltip_title = t(".tooltips.#{is_alias ? 'alias' : 'fork' }", name: @project.parent.name_with_owner) - li data-toggle='tooltip' data-placement='bottom' title=tooltip_title - = link_to project_path(@project.parent), class: 'small' do - - if is_alias - = fa_icon 'share-alt' - - else - = fa_icon 'code-fork' - =< @project.parent.name_with_owner - li class=('active' if act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits) - a href=tree_path(@project, treeish) + li class=('active' if act == :index && contr == :project) + a href=("/"+@project.name_with_owner) i.fa.fa-files-o> - = t('project_menu.code') + = t("project_menu.project") - if @project.is_package li class=('active' if contr == :build_lists) a href=project_build_lists_path(@project) i.fa.fa-cogs> = t('project_menu.builds') - - if @project.has_issues - li class=('active' if contr == :issues && act == :index) - a href=project_issues_path(@project) + - if github_success and @project.github_data.has_issues + li + a href=(github_base_url + "/issues") target="_blank" i.fa.fa-exclamation-circle> - = t('project_menu.tracker', count: @opened_issues_count) - li class=('active' if contr == :issues && act == :pull_requests) - a href=project_pull_requests_path(@project) - i.fa.fa-tasks> - = t('project_menu.pull_requests', count: @opened_pull_requests_count) - - if @project.has_wiki - li class=('active' if contr == :wiki) - = link_to t('project_menu.wiki'), project_wiki_index_path(@project) + = t('project_menu.tracker', count: @project.github_data.open_issues_count) + - if github_success + li + a href=(github_base_url + "/pulls") target="_blank" + i.fa.fa-tasks> + = t('project_menu.pull_requests') + - if github_success and @project.github_data.has_wiki + li + a href=(github_base_url + "/wiki") target="_blank" + i.fa.fa-book> + = t('project_menu.wiki') / li / = link_to t('project_menu.readme'), '#' #pending - if policy(@project).update? diff --git a/app/views/projects/build_lists/show.html.slim b/app/views/projects/build_lists/show.html.slim index 89ff17a56..27251eeba 100644 --- a/app/views/projects/build_lists/show.html.slim +++ b/app/views/projects/build_lists/show.html.slim @@ -118,7 +118,7 @@ row[ ng-controller='BuildListController' tr td= t('activerecord.attributes.build_list.project_version') - td= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version) + -# td= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version) tr td= t('diff') diff --git a/app/views/projects/git/base/_whereami.html.haml b/app/views/projects/git/base/_whereami.html.haml deleted file mode 100644 index cbc5dfbff..000000000 --- a/app/views/projects/git/base/_whereami.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%ol.breadcrumb - %li= link_to @project.name, tree_path(@project, treeish: @treeish), 'ng-click' => "getTree($event, '')" - %li{ 'ng-repeat' => 'el in breadcrumb.paths' } - %a{ href: '#', 'ng-click' => 'getTree($event, el.path)' } {{el.name}} - %li.active {{breadcrumb.last}} diff --git a/app/views/projects/git/trees/show.html.slim b/app/views/projects/git/trees/show.html.slim index 24c6b3b60..fe9601fe6 100644 --- a/app/views/projects/git/trees/show.html.slim +++ b/app/views/projects/git/trees/show.html.slim @@ -4,5 +4,3 @@ description: truncate(@project.description, length: 255) } - set_meta_tags twitter: { title: title, description: truncate(@project.description, length: 200) } - -== render partial: "show", layout: 'layout' diff --git a/app/views/projects/project/base/index.html.slim b/app/views/projects/project/base/index.html.slim deleted file mode 100644 index 95d09f2b1..000000000 --- a/app/views/projects/project/base/index.html.slim +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/app/views/projects/project/project/error_github.html.slim b/app/views/projects/project/project/error_github.html.slim new file mode 100644 index 000000000..be8ea7c90 --- /dev/null +++ b/app/views/projects/project/project/error_github.html.slim @@ -0,0 +1,4 @@ +=render 'submenu' +.col-xs-12.col-md-10.col-md-offset-1 + .row + .alert.alert-danger.text-center=t('layout.projects.no_github_repo_error', organization:@project.github_data || APP_CONFIG['github_organization']) \ No newline at end of file diff --git a/app/views/projects/project/project/error_personal.html.slim b/app/views/projects/project/project/error_personal.html.slim new file mode 100644 index 000000000..46323ed5c --- /dev/null +++ b/app/views/projects/project/project/error_personal.html.slim @@ -0,0 +1,3 @@ +.container + .row + .alert.alert-danger.text-center=t('layout.projects.only_personal_error') \ No newline at end of file diff --git a/app/views/projects/project/project/index.html.haml b/app/views/projects/project/project/index.html.haml new file mode 100644 index 000000000..4c4415041 --- /dev/null +++ b/app/views/projects/project/project/index.html.haml @@ -0,0 +1,14 @@ +-title = title_object(@project) +-set_meta_tags title: "#{title}" +-set_meta_tags og: { title: title, + description: truncate(@project.github_data.description, length: 255) } +-set_meta_tags twitter: { title: title, + description: truncate(@project.github_data.description, length: 200) } + +=render 'submenu' +.col-xs-12.col-md-10.col-md-offset-1 + .row + %h3=@project.name + %a{:href => @project.github_data.html_url, :target => "_blank"}=t("layout.projects.github_link") + %hr + =@project.github_data.description \ No newline at end of file diff --git a/app/views/projects/projects/_form.html.slim b/app/views/projects/projects/_form.html.slim index a84abde8f..c1b47c981 100644 --- a/app/views/projects/projects/_form.html.slim +++ b/app/views/projects/projects/_form.html.slim @@ -2,6 +2,7 @@ div ng-controller = 'ProjectFromController' ng-cloak = 'true' = f.input :name = f.input :description, as: :text + = f.input :github_organization - if [:new, :create].include? act = render 'owner', f: f @@ -10,11 +11,6 @@ div ng-controller = 'ProjectFromController' ng-cloak = 'true' collection: project_visibility_options, include_blank: false - - if [:edit, :update].include? act - = f.input :default_branch, - collection: @project.repo.branches.map(&:name), - selected: @project.default_branch - = f.input :is_package, as: :boolean, input_html: { 'ng-model' => 'project.is_package', 'ng-change' => 'project.publish_i686_into_x86_64 = false' } diff --git a/app/views/projects/projects/edit.html.slim b/app/views/projects/projects/edit.html.slim index ca3048d6e..304eb2988 100644 --- a/app/views/projects/projects/edit.html.slim +++ b/app/views/projects/projects/edit.html.slim @@ -11,9 +11,6 @@ == render "form", f: f == render 'build_schedule' - - if @project_aliases.present? - hr.col-sm-12 - == render 'aliases' hr.col-sm-12 .col-sm-9.col-sm-offset-3 diff --git a/config/application.rb b/config/application.rb index 1631a0b61..1ba712598 100644 --- a/config/application.rb +++ b/config/application.rb @@ -67,6 +67,6 @@ module Rosa config.log_redis = false config.angular_templates.ignore_prefix = 'angularjs/templates/' - config.web_console.whitelisted_ips = '192.168.0.0/16' + config.web_console.whitelisted_ips = '127.0.0.0/24' end end diff --git a/config/environments/production.rb b/config/environments/production.rb index f1265039e..71cac9403 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -2,7 +2,7 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + config.cache_classes = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers diff --git a/config/locales/menu.en.yml b/config/locales/menu.en.yml index fd636af5f..ae020a453 100644 --- a/config/locales/menu.en.yml +++ b/config/locales/menu.en.yml @@ -25,7 +25,7 @@ en: abf_blog_url: http://abf-blog.rosalinux.ru abf_ideas: ABF Ideas project_menu: - code: Code + project: Project files: Files commits: Commits branches: Branches (%{count}) @@ -35,7 +35,7 @@ en: wiki: Wiki readme: Readme settings: Settings - pull_requests: Pull Requests (%{count}) + pull_requests: Pull Requests activity_menu: activity_feed: Activity Feed tracker: Tracker diff --git a/config/locales/menu.ru.yml b/config/locales/menu.ru.yml index f2162054c..aef0e621e 100644 --- a/config/locales/menu.ru.yml +++ b/config/locales/menu.ru.yml @@ -25,7 +25,7 @@ ru: abf_blog_url: http://abf-blog.rosalinux.ru abf_ideas: Идеи для ABF project_menu: - code: Код + project: Проект files: Файлы commits: Коммиты branches: Ветки (%{count}) @@ -35,7 +35,7 @@ ru: wiki: Wiki readme: Readme settings: Настройки - pull_requests: Пул реквесты (%{count}) + pull_requests: Пул реквесты activity_menu: activity_feed: Лента активности tracker: Трекер diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index 8dbdcc6c6..46a94f932 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -70,6 +70,9 @@ en: create_repository: Create Repository move_files_to_folder: Move files you need to the project or create them. existing_git_repo: Git repo already exist? + only_personal_error: This project doesn't belong to any main architecture + no_github_repo_error: This project doesn't exist in %{organization} on github + github_link: Link on Github git_help: cloning: Cloning the repository diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index dab880340..1d4efc3b8 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -71,6 +71,9 @@ ru: create_repository: Создание репозитория move_files_to_folder: Переместите нужные файлы в проект или создайте их. existing_git_repo: Git репозиторий уже существует? + only_personal_error: Этот проект не принадлежит никакой основной архитектуре + no_github_repo_error: Этот проект не существует в %{organization} на + github_link: Ссылка на Гитхабе diff_show_header: "%{files} с %{additions} и %{deletions}." about_subheader: "О проекте" diff --git a/config/routes.rb b/config/routes.rb index a7c3b1b0d..da5c57851 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -302,55 +302,12 @@ Rails.application.routes.draw do end scope '*name_with_owner', name_with_owner: Project::OWNER_AND_NAME_REGEXP do # project scope as: 'project' do - resources :wiki do - collection do - match '_history' => 'wiki#wiki_history', as: :history, via: :get - match '_access' => 'wiki#git', as: :git, via: :get - match '_revert/:sha1/:sha2' => 'wiki#revert_wiki', as: :revert, via: [:get, :post] - match '_compare' => 'wiki#compare_wiki', as: :compare, via: :post - #match '_compare/:versions' => 'wiki#compare_wiki', versions: /.*/, as: :compare_versions, via: :get - match '_compare/:versions' => 'wiki#compare_wiki', versions: /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, as: :compare_versions, via: :get - post :preview - get :search - get :pages - end - member do - get :history - get :edit - match 'revert/:sha1/:sha2' => 'wiki#revert', as: :revert_page, via: [:get, :post] - match ':ref' => 'wiki#show', as: :versioned, via: :get - - post :compare - #match 'compare/*versions' => 'wiki#compare', as: :compare_versions, via: :get - match 'compare/:versions' => 'wiki#compare', versions: /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, as: :compare_versions, via: :get - end - end - resources :issues, except: [:destroy, :edit] do - resources :comments, only: [:edit, :create, :update, :destroy] - post '/subscribe' => "subscribes#create", as: :subscribe - delete '/unsubscribe' => "subscribes#destroy", as: :unsubscribe - collection do - post :create_label - get :search_collaborators - end - end - - get 'pull_requests' => 'issues#pull_requests', as: :pull_requests - get 'labels' => 'issues#labels', as: :labels - post 'labels/:label_id' => 'issues#destroy_label', as: :issues_delete_label - post 'labels/:label_id/update' => 'issues#update_label', as: :issues_update_label - resources :build_lists, only: [:index, :new, :create] do get :list, on: :collection end resources :collaborators do get :find, on: :collection end - resources :hooks, except: :show - resources :pull_requests, except: [:index, :destroy] do - get :autocomplete_to_project, on: :collection - put :merge, on: :member - end post '/preview' => 'projects#preview', as: 'md_preview' post 'refs_list' => 'projects#refs_list', as: 'refs_list' put 'schedule' => 'projects#schedule' @@ -362,14 +319,16 @@ Rails.application.routes.draw do patch '/' => 'projects#update' delete '/' => 'projects#destroy' # Member - post '/fork' => 'projects#fork', as: :fork_project - post '/alias' => 'projects#alias', as: :alias_project - get '/possible_forks' => 'projects#possible_forks', as: :possible_forks_project - get '/sections' => 'projects#sections', as: :sections_project - patch '/sections' => 'projects#sections' delete '/remove_user' => 'projects#remove_user', as: :remove_user_project - get '/' => 'project/project#index' + get '/' => 'project/project#index', as: :project + get '/tree' => 'project/project#index', as: :tree + get '/tree2' => 'project/project#index', as: :project_issues + get '/tree3' => 'project/project#index', as: :project_pull_requests + get '/tree4' => 'project/project#index', as: :archive + get '/tree5' => 'project/project#index', as: :commits + get '/tree6' => 'project/project#index', as: :branch + get '/tree7' => 'project/project#index', as: :tags end end diff --git a/db/migrate/20151211150310_add_github_organization_to_projects.rb b/db/migrate/20151211150310_add_github_organization_to_projects.rb new file mode 100644 index 000000000..ee0c1b5bc --- /dev/null +++ b/db/migrate/20151211150310_add_github_organization_to_projects.rb @@ -0,0 +1,5 @@ +class AddGithubOrganizationToProjects < ActiveRecord::Migration + def change + add_column :projects, :github_organization, :string + end +end