modify project model, add project controller for project page
This commit is contained in:
parent
ad21c2146f
commit
bdb6458393
4
Gemfile
4
Gemfile
|
@ -102,6 +102,10 @@ end
|
||||||
gem 'rack-utf8_sanitizer'
|
gem 'rack-utf8_sanitizer'
|
||||||
gem 'web-console', '~> 2.0'
|
gem 'web-console', '~> 2.0'
|
||||||
|
|
||||||
|
#github api
|
||||||
|
gem 'github_api'
|
||||||
|
gem 'faraday-http-cache'
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem 'airbrake'
|
gem 'airbrake'
|
||||||
#gem 'bluepill', '~> 0.0.60', require: false
|
#gem 'bluepill', '~> 0.0.60', require: false
|
||||||
|
|
23
Gemfile.lock
23
Gemfile.lock
|
@ -164,6 +164,8 @@ GEM
|
||||||
creole (0.5.0)
|
creole (0.5.0)
|
||||||
daemons (1.2.2)
|
daemons (1.2.2)
|
||||||
debug_inspector (0.0.2)
|
debug_inspector (0.0.2)
|
||||||
|
descendants_tracker (0.0.4)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
devise (3.5.1)
|
devise (3.5.1)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
@ -188,6 +190,8 @@ GEM
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faraday (0.9.1)
|
faraday (0.9.1)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
|
faraday-http-cache (1.2.2)
|
||||||
|
faraday (~> 0.8)
|
||||||
ffi (1.9.8)
|
ffi (1.9.8)
|
||||||
font-awesome-rails (4.3.0.0)
|
font-awesome-rails (4.3.0.0)
|
||||||
railties (>= 3.2, < 5.0)
|
railties (>= 3.2, < 5.0)
|
||||||
|
@ -205,6 +209,14 @@ GEM
|
||||||
rugged (~> 0.21.0)
|
rugged (~> 0.21.0)
|
||||||
github-markup (1.1.2)
|
github-markup (1.1.2)
|
||||||
posix-spawn (~> 0.3.8)
|
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)
|
gitlab-grit (2.6.12)
|
||||||
charlock_holmes (~> 0.6)
|
charlock_holmes (~> 0.6)
|
||||||
diff-lcs (~> 1.1)
|
diff-lcs (~> 1.1)
|
||||||
|
@ -637,6 +649,11 @@ GEM
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
warden (1.2.3)
|
warden (1.2.3)
|
||||||
rack (>= 1.0)
|
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)
|
webmock (1.21.0)
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
|
@ -681,11 +698,13 @@ DEPENDENCIES
|
||||||
devise
|
devise
|
||||||
diff-display
|
diff-display
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
|
faraday-http-cache
|
||||||
ffi
|
ffi
|
||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
friendly_id
|
friendly_id
|
||||||
gemoji
|
gemoji
|
||||||
github-linguist (= 3.1.5)
|
github-linguist (= 3.1.5)
|
||||||
|
github_api
|
||||||
gollum-lib (~> 3.0)
|
gollum-lib (~> 3.0)
|
||||||
grack!
|
grack!
|
||||||
grit!
|
grit!
|
||||||
|
@ -756,8 +775,12 @@ DEPENDENCIES
|
||||||
timecop
|
timecop
|
||||||
uglifier
|
uglifier
|
||||||
underscore-rails
|
underscore-rails
|
||||||
|
web-console (~> 2.0)
|
||||||
webmock
|
webmock
|
||||||
whenever
|
whenever
|
||||||
wikicloth
|
wikicloth
|
||||||
will_paginate
|
will_paginate
|
||||||
zeroclipboard-rails
|
zeroclipboard-rails
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.10.6
|
||||||
|
|
|
@ -36,53 +36,6 @@ class HomeController < ApplicationController
|
||||||
activity(true)
|
activity(true)
|
||||||
end
|
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
|
def get_owners_list
|
||||||
if params[:term].present?
|
if params[:term].present?
|
||||||
users = User.opened.search(params[:term]).first(5)
|
users = User.opened.search(params[:term]).first(5)
|
||||||
|
|
|
@ -19,8 +19,8 @@ class Projects::BaseController < ApplicationController
|
||||||
|
|
||||||
def init_statistics
|
def init_statistics
|
||||||
if @project
|
if @project
|
||||||
@opened_issues_count = @project.issues.without_pull_requests.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
|
#@opened_pull_requests_count = @project.issues.joins(:pull_request).not_closed_or_merged.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
def index
|
def index
|
||||||
authorize :build_list
|
authorize :build_list
|
||||||
params[:filter].each{|k,v| params[:filter].delete(k) if v.blank? } if params[:filter]
|
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|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
@ -42,6 +43,7 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
authorize @build_list = @project.build_lists.build
|
authorize @build_list = @project.build_lists.build
|
||||||
|
@project.fetch_github_repo_data unless not @project
|
||||||
if params[:show] == 'inline' && params[:build_list_id].present?
|
if params[:show] == 'inline' && params[:build_list_id].present?
|
||||||
render json: new_build_list_data(@build_list, @project, params), layout: false
|
render json: new_build_list_data(@build_list, @project, params), layout: false
|
||||||
else
|
else
|
||||||
|
@ -66,7 +68,6 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
@build_list.user = current_user
|
@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.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
|
@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 }
|
flash_options = { project_version: @build_list.project_version, arch: arch.name, build_for_platform: build_for_platform.name }
|
||||||
authorize @build_list
|
authorize @build_list
|
||||||
if @build_list.save
|
if @build_list.save
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class Projects::Project::ProjectController < Projects::Project::BaseController
|
class Projects::Project::ProjectController < Projects::Project::BaseController
|
||||||
def index
|
def index
|
||||||
console
|
authorize @project
|
||||||
end
|
(render :error_github) if not @project.github_data
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -7,6 +7,7 @@ class Projects::ProjectsController < Projects::BaseController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize :project
|
authorize :project
|
||||||
|
Project.fetch_github_data_on_find = false
|
||||||
@projects = ProjectPolicy::Scope.new(current_user, Project).membered.search(params[:search])
|
@projects = ProjectPolicy::Scope.new(current_user, Project).membered.search(params[:search])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
|
|
|
@ -87,6 +87,12 @@ class BuildList < ActiveRecord::Base
|
||||||
before_validation :prepare_extra_build_lists, on: :create
|
before_validation :prepare_extra_build_lists, on: :create
|
||||||
before_validation :prepare_extra_params, on: :create
|
before_validation :prepare_extra_params, on: :create
|
||||||
before_validation :prepare_auto_publish_status, 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
|
LIVE_TIME = 4.week # for unpublished
|
||||||
MAX_LIVE_TIME = 3.month # for published
|
MAX_LIVE_TIME = 3.month # for published
|
||||||
|
|
|
@ -19,22 +19,13 @@ class Project < ActiveRecord::Base
|
||||||
belongs_to :owner, polymorphic: true, counter_cache: :own_projects_count
|
belongs_to :owner, polymorphic: true, counter_cache: :own_projects_count
|
||||||
belongs_to :maintainer, class_name: 'User'
|
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 :build_scripts, dependent: :destroy
|
||||||
|
|
||||||
has_many :project_imports, dependent: :destroy
|
|
||||||
has_many :project_to_repositories, dependent: :destroy
|
has_many :project_to_repositories, dependent: :destroy
|
||||||
has_many :repositories, through: :project_to_repositories
|
has_many :repositories, through: :project_to_repositories
|
||||||
has_many :project_tags, dependent: :destroy
|
|
||||||
has_many :project_statistics, dependent: :destroy
|
has_many :project_statistics, dependent: :destroy
|
||||||
|
|
||||||
has_many :build_lists, dependent: :destroy
|
has_many :build_lists, dependent: :destroy
|
||||||
has_many :hooks, dependent: :destroy
|
|
||||||
|
|
||||||
has_many :relations, as: :target, dependent: :destroy
|
has_many :relations, as: :target, dependent: :destroy
|
||||||
has_many :collaborators, through: :relations, source: :actor, source_type: 'User'
|
has_many :collaborators, through: :relations, source: :actor, source_type: 'User'
|
||||||
|
@ -69,13 +60,23 @@ class Project < ActiveRecord::Base
|
||||||
before_create :set_maintainer
|
before_create :set_maintainer
|
||||||
after_save :attach_to_personal_repository
|
after_save :attach_to_personal_repository
|
||||||
after_update -> { update_path_to_project(name_was) }, if: :name_changed?
|
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
|
def init_mass_import
|
||||||
Project.perform_later :low, :run_mass_import, url, srpms_list, visibility, owner, add_to_repository_id
|
Project.perform_later :low, :run_mass_import, url, srpms_list, visibility, owner, add_to_repository_id
|
||||||
end
|
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
|
def name_with_owner
|
||||||
"#{owner_uname || owner.uname}/#{name}"
|
"#{owner_uname || owner.uname}/#{name}"
|
||||||
end
|
end
|
||||||
|
@ -104,6 +105,12 @@ class Project < ActiveRecord::Base
|
||||||
@platforms ||= repositories.map(&:platform).uniq
|
@platforms ||= repositories.map(&:platform).uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def in_main_platform?
|
||||||
|
platforms.map do |platform|
|
||||||
|
platform.platform_type
|
||||||
|
end.include?('main')
|
||||||
|
end
|
||||||
|
|
||||||
def admins
|
def admins
|
||||||
admins = self.collaborators.where("relations.role = 'admin'")
|
admins = self.collaborators.where("relations.role = 'admin'")
|
||||||
grs = self.groups.where("relations.role = 'admin'")
|
grs = self.groups.where("relations.role = 'admin'")
|
||||||
|
@ -166,20 +173,6 @@ class Project < ActiveRecord::Base
|
||||||
build_list.save
|
build_list.save
|
||||||
end
|
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)
|
def get_project_tag_sha1(tag, format)
|
||||||
format_id = ProjectTag::FORMATS["#{tag_file_format(format)}"]
|
format_id = ProjectTag::FORMATS["#{tag_file_format(format)}"]
|
||||||
project_tag = project_tags.where(tag_name: tag.name, format_id: format_id).first
|
project_tag = project_tags.where(tag_name: tag.name, format_id: format_id).first
|
||||||
|
|
|
@ -77,6 +77,7 @@ class ProjectPolicy < ApplicationPolicy
|
||||||
def permitted_attributes
|
def permitted_attributes
|
||||||
%i(
|
%i(
|
||||||
add_to_repository_id
|
add_to_repository_id
|
||||||
|
github_organization
|
||||||
architecture_dependent
|
architecture_dependent
|
||||||
autostart_status
|
autostart_status
|
||||||
default_branch
|
default_branch
|
||||||
|
|
|
@ -5,10 +5,6 @@ ul.nav.nav-tabs.nav-justified.boffset10[ role = 'tablist' ]
|
||||||
- if policy(@project).edit?
|
- if policy(@project).edit?
|
||||||
li[ class = "#{(act == :edit && contr == :projects) ? 'active' : ''}" ]
|
li[ class = "#{(act == :edit && contr == :projects) ? 'active' : ''}" ]
|
||||||
= link_to t("layout.projects.edit"), edit_project_path(@project)
|
= 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?
|
- if policy(@project).manage_collaborators?
|
||||||
li[ class = "#{(act == :index && contr == :collaborators) ? 'active' : ''}" ]
|
li[ class = "#{(act == :index && contr == :collaborators) ? 'active' : ''}" ]
|
||||||
= link_to t("layout.projects.edit_collaborators"), project_collaborators_path(@project)
|
= link_to t("layout.projects.edit_collaborators"), project_collaborators_path(@project)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
- content_for :submenu do
|
- content_for :submenu do
|
||||||
- act = action_name.to_sym; contr = controller_name.to_sym; treeish = @project.default_head(params[:treeish])
|
- 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'
|
nav.navbar.navbar-default role='navigation'
|
||||||
.container-fluid ng-cloak = true
|
.container-fluid ng-cloak = true
|
||||||
/ Brand and toggle get grouped for better mobile display
|
/ Brand and toggle get grouped for better mobile display
|
||||||
|
@ -17,38 +19,31 @@
|
||||||
/ Collect the nav links, forms, and other content for toggling
|
/ Collect the nav links, forms, and other content for toggling
|
||||||
#submenu-navbar-collapse.collapse.navbar-collapse
|
#submenu-navbar-collapse.collapse.navbar-collapse
|
||||||
ul.nav.navbar-nav.left-border
|
ul.nav.navbar-nav.left-border
|
||||||
- if @project.parent
|
li class=('active' if act == :index && contr == :project)
|
||||||
- is_alias = @project.alias_from_id.present?
|
a href=("/"+@project.name_with_owner)
|
||||||
- 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)
|
|
||||||
i.fa.fa-files-o>
|
i.fa.fa-files-o>
|
||||||
= t('project_menu.code')
|
= t("project_menu.project")
|
||||||
- if @project.is_package
|
- if @project.is_package
|
||||||
li class=('active' if contr == :build_lists)
|
li class=('active' if contr == :build_lists)
|
||||||
a href=project_build_lists_path(@project)
|
a href=project_build_lists_path(@project)
|
||||||
i.fa.fa-cogs>
|
i.fa.fa-cogs>
|
||||||
= t('project_menu.builds')
|
= t('project_menu.builds')
|
||||||
|
|
||||||
- if @project.has_issues
|
- if github_success and @project.github_data.has_issues
|
||||||
li class=('active' if contr == :issues && act == :index)
|
li
|
||||||
a href=project_issues_path(@project)
|
a href=(github_base_url + "/issues") target="_blank"
|
||||||
i.fa.fa-exclamation-circle>
|
i.fa.fa-exclamation-circle>
|
||||||
= t('project_menu.tracker', count: @opened_issues_count)
|
= t('project_menu.tracker', count: @project.github_data.open_issues_count)
|
||||||
li class=('active' if contr == :issues && act == :pull_requests)
|
- if github_success
|
||||||
a href=project_pull_requests_path(@project)
|
li
|
||||||
i.fa.fa-tasks>
|
a href=(github_base_url + "/pulls") target="_blank"
|
||||||
= t('project_menu.pull_requests', count: @opened_pull_requests_count)
|
i.fa.fa-tasks>
|
||||||
- if @project.has_wiki
|
= t('project_menu.pull_requests')
|
||||||
li class=('active' if contr == :wiki)
|
- if github_success and @project.github_data.has_wiki
|
||||||
= link_to t('project_menu.wiki'), project_wiki_index_path(@project)
|
li
|
||||||
|
a href=(github_base_url + "/wiki") target="_blank"
|
||||||
|
i.fa.fa-book>
|
||||||
|
= t('project_menu.wiki')
|
||||||
/ li
|
/ li
|
||||||
/ = link_to t('project_menu.readme'), '#' #pending
|
/ = link_to t('project_menu.readme'), '#' #pending
|
||||||
- if policy(@project).update?
|
- if policy(@project).update?
|
||||||
|
|
|
@ -118,7 +118,7 @@ row[ ng-controller='BuildListController'
|
||||||
|
|
||||||
tr
|
tr
|
||||||
td= t('activerecord.attributes.build_list.project_version')
|
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
|
tr
|
||||||
td= t('diff')
|
td= t('diff')
|
||||||
|
|
|
@ -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}}
|
|
|
@ -4,5 +4,3 @@
|
||||||
description: truncate(@project.description, length: 255) }
|
description: truncate(@project.description, length: 255) }
|
||||||
- set_meta_tags twitter: { title: title,
|
- set_meta_tags twitter: { title: title,
|
||||||
description: truncate(@project.description, length: 200) }
|
description: truncate(@project.description, length: 200) }
|
||||||
|
|
||||||
== render partial: "show", layout: 'layout'
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
hello world
|
|
|
@ -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'])
|
|
@ -0,0 +1,3 @@
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.alert.alert-danger.text-center=t('layout.projects.only_personal_error')
|
|
@ -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
|
|
@ -2,6 +2,7 @@
|
||||||
div ng-controller = 'ProjectFromController' ng-cloak = 'true'
|
div ng-controller = 'ProjectFromController' ng-cloak = 'true'
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :description, as: :text
|
= f.input :description, as: :text
|
||||||
|
= f.input :github_organization
|
||||||
|
|
||||||
- if [:new, :create].include? act
|
- if [:new, :create].include? act
|
||||||
= render 'owner', f: f
|
= render 'owner', f: f
|
||||||
|
@ -10,11 +11,6 @@ div ng-controller = 'ProjectFromController' ng-cloak = 'true'
|
||||||
collection: project_visibility_options,
|
collection: project_visibility_options,
|
||||||
include_blank: false
|
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,
|
= f.input :is_package, as: :boolean,
|
||||||
input_html: { 'ng-model' => 'project.is_package',
|
input_html: { 'ng-model' => 'project.is_package',
|
||||||
'ng-change' => 'project.publish_i686_into_x86_64 = false' }
|
'ng-change' => 'project.publish_i686_into_x86_64 = false' }
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
== render "form", f: f
|
== render "form", f: f
|
||||||
|
|
||||||
== render 'build_schedule'
|
== render 'build_schedule'
|
||||||
- if @project_aliases.present?
|
|
||||||
hr.col-sm-12
|
|
||||||
== render 'aliases'
|
|
||||||
|
|
||||||
hr.col-sm-12
|
hr.col-sm-12
|
||||||
.col-sm-9.col-sm-offset-3
|
.col-sm-9.col-sm-offset-3
|
||||||
|
|
|
@ -67,6 +67,6 @@ module Rosa
|
||||||
config.log_redis = false
|
config.log_redis = false
|
||||||
|
|
||||||
config.angular_templates.ignore_prefix = 'angularjs/templates/'
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# Code is not reloaded between requests.
|
# 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
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
# your application in memory, allowing both threaded web servers
|
# your application in memory, allowing both threaded web servers
|
||||||
|
|
|
@ -25,7 +25,7 @@ en:
|
||||||
abf_blog_url: http://abf-blog.rosalinux.ru
|
abf_blog_url: http://abf-blog.rosalinux.ru
|
||||||
abf_ideas: ABF Ideas
|
abf_ideas: ABF Ideas
|
||||||
project_menu:
|
project_menu:
|
||||||
code: Code
|
project: Project
|
||||||
files: Files
|
files: Files
|
||||||
commits: Commits
|
commits: Commits
|
||||||
branches: Branches (%{count})
|
branches: Branches (%{count})
|
||||||
|
@ -35,7 +35,7 @@ en:
|
||||||
wiki: Wiki
|
wiki: Wiki
|
||||||
readme: Readme
|
readme: Readme
|
||||||
settings: Settings
|
settings: Settings
|
||||||
pull_requests: Pull Requests (%{count})
|
pull_requests: Pull Requests
|
||||||
activity_menu:
|
activity_menu:
|
||||||
activity_feed: Activity Feed
|
activity_feed: Activity Feed
|
||||||
tracker: Tracker
|
tracker: Tracker
|
||||||
|
|
|
@ -25,7 +25,7 @@ ru:
|
||||||
abf_blog_url: http://abf-blog.rosalinux.ru
|
abf_blog_url: http://abf-blog.rosalinux.ru
|
||||||
abf_ideas: Идеи для ABF
|
abf_ideas: Идеи для ABF
|
||||||
project_menu:
|
project_menu:
|
||||||
code: Код
|
project: Проект
|
||||||
files: Файлы
|
files: Файлы
|
||||||
commits: Коммиты
|
commits: Коммиты
|
||||||
branches: Ветки (%{count})
|
branches: Ветки (%{count})
|
||||||
|
@ -35,7 +35,7 @@ ru:
|
||||||
wiki: Wiki
|
wiki: Wiki
|
||||||
readme: Readme
|
readme: Readme
|
||||||
settings: Настройки
|
settings: Настройки
|
||||||
pull_requests: Пул реквесты (%{count})
|
pull_requests: Пул реквесты
|
||||||
activity_menu:
|
activity_menu:
|
||||||
activity_feed: Лента активности
|
activity_feed: Лента активности
|
||||||
tracker: Трекер
|
tracker: Трекер
|
||||||
|
|
|
@ -70,6 +70,9 @@ en:
|
||||||
create_repository: Create Repository
|
create_repository: Create Repository
|
||||||
move_files_to_folder: Move files you need to the project or create them.
|
move_files_to_folder: Move files you need to the project or create them.
|
||||||
existing_git_repo: Git repo already exist?
|
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:
|
git_help:
|
||||||
cloning: Cloning the repository
|
cloning: Cloning the repository
|
||||||
|
|
|
@ -71,6 +71,9 @@ ru:
|
||||||
create_repository: Создание репозитория
|
create_repository: Создание репозитория
|
||||||
move_files_to_folder: Переместите нужные файлы в проект или создайте их.
|
move_files_to_folder: Переместите нужные файлы в проект или создайте их.
|
||||||
existing_git_repo: Git репозиторий уже существует?
|
existing_git_repo: Git репозиторий уже существует?
|
||||||
|
only_personal_error: Этот проект не принадлежит никакой основной архитектуре
|
||||||
|
no_github_repo_error: Этот проект не существует в %{organization} на
|
||||||
|
github_link: Ссылка на Гитхабе
|
||||||
|
|
||||||
diff_show_header: "%{files} с %{additions} и %{deletions}."
|
diff_show_header: "%{files} с %{additions} и %{deletions}."
|
||||||
about_subheader: "О проекте"
|
about_subheader: "О проекте"
|
||||||
|
|
|
@ -302,55 +302,12 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
scope '*name_with_owner', name_with_owner: Project::OWNER_AND_NAME_REGEXP do # project
|
scope '*name_with_owner', name_with_owner: Project::OWNER_AND_NAME_REGEXP do # project
|
||||||
scope as: 'project' do
|
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
|
resources :build_lists, only: [:index, :new, :create] do
|
||||||
get :list, on: :collection
|
get :list, on: :collection
|
||||||
end
|
end
|
||||||
resources :collaborators do
|
resources :collaborators do
|
||||||
get :find, on: :collection
|
get :find, on: :collection
|
||||||
end
|
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 '/preview' => 'projects#preview', as: 'md_preview'
|
||||||
post 'refs_list' => 'projects#refs_list', as: 'refs_list'
|
post 'refs_list' => 'projects#refs_list', as: 'refs_list'
|
||||||
put 'schedule' => 'projects#schedule'
|
put 'schedule' => 'projects#schedule'
|
||||||
|
@ -362,14 +319,16 @@ Rails.application.routes.draw do
|
||||||
patch '/' => 'projects#update'
|
patch '/' => 'projects#update'
|
||||||
delete '/' => 'projects#destroy'
|
delete '/' => 'projects#destroy'
|
||||||
# Member
|
# 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
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddGithubOrganizationToProjects < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :projects, :github_organization, :string
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue