@@ -1,118 +1,117 | |||||
1 | source 'https://rubygems.org' |
|
1 | source 'https://rubygems.org' | |
2 |
|
2 | |||
3 | if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0') |
|
3 | if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0') | |
4 | abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'." |
|
4 | abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'." | |
5 | end |
|
5 | end | |
6 |
|
6 | |||
7 | gem "rails", "4.2.6" |
|
7 | gem "rails", "4.2.6" | |
8 | gem "jquery-rails", "~> 3.1.4" |
|
8 | gem "jquery-rails", "~> 3.1.4" | |
9 | gem "coderay", "~> 1.1.1" |
|
9 | gem "coderay", "~> 1.1.1" | |
10 | gem "builder", ">= 3.0.4" |
|
10 | gem "builder", ">= 3.0.4" | |
11 | gem "request_store", "1.0.5" |
|
11 | gem "request_store", "1.0.5" | |
12 | gem "mime-types", (RUBY_VERSION >= "2.0" ? "~> 3.0" : "~> 2.99") |
|
12 | gem "mime-types", (RUBY_VERSION >= "2.0" ? "~> 3.0" : "~> 2.99") | |
13 | gem "protected_attributes" |
|
13 | gem "protected_attributes" | |
14 | gem "actionpack-action_caching" |
|
|||
15 | gem "actionpack-xml_parser" |
|
14 | gem "actionpack-xml_parser" | |
16 | gem "roadie-rails" |
|
15 | gem "roadie-rails" | |
17 | gem "mimemagic" |
|
16 | gem "mimemagic" | |
18 |
|
17 | |||
19 | # Request at least nokogiri 1.6.7.2 because of security advisories |
|
18 | # Request at least nokogiri 1.6.7.2 because of security advisories | |
20 | gem "nokogiri", ">= 1.6.7.2" |
|
19 | gem "nokogiri", ">= 1.6.7.2" | |
21 |
|
20 | |||
22 | # Request at least rails-html-sanitizer 1.0.3 because of security advisories |
|
21 | # Request at least rails-html-sanitizer 1.0.3 because of security advisories | |
23 | gem "rails-html-sanitizer", ">= 1.0.3" |
|
22 | gem "rails-html-sanitizer", ">= 1.0.3" | |
24 |
|
23 | |||
25 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem |
|
24 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem | |
26 | gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby] |
|
25 | gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby] | |
27 | gem "rbpdf", "~> 1.19.0" |
|
26 | gem "rbpdf", "~> 1.19.0" | |
28 |
|
27 | |||
29 | # Optional gem for LDAP authentication |
|
28 | # Optional gem for LDAP authentication | |
30 | group :ldap do |
|
29 | group :ldap do | |
31 | gem "net-ldap", "~> 0.12.0" |
|
30 | gem "net-ldap", "~> 0.12.0" | |
32 | end |
|
31 | end | |
33 |
|
32 | |||
34 | # Optional gem for OpenID authentication |
|
33 | # Optional gem for OpenID authentication | |
35 | group :openid do |
|
34 | group :openid do | |
36 | gem "ruby-openid", "~> 2.3.0", :require => "openid" |
|
35 | gem "ruby-openid", "~> 2.3.0", :require => "openid" | |
37 | gem "rack-openid" |
|
36 | gem "rack-openid" | |
38 | end |
|
37 | end | |
39 |
|
38 | |||
40 | platforms :mri, :mingw, :x64_mingw do |
|
39 | platforms :mri, :mingw, :x64_mingw do | |
41 | # Optional gem for exporting the gantt to a PNG file, not supported with jruby |
|
40 | # Optional gem for exporting the gantt to a PNG file, not supported with jruby | |
42 | group :rmagick do |
|
41 | group :rmagick do | |
43 | gem "rmagick", ">= 2.14.0" |
|
42 | gem "rmagick", ">= 2.14.0" | |
44 | end |
|
43 | end | |
45 |
|
44 | |||
46 | # Optional Markdown support, not for JRuby |
|
45 | # Optional Markdown support, not for JRuby | |
47 | group :markdown do |
|
46 | group :markdown do | |
48 | gem "redcarpet", "~> 3.3.2" |
|
47 | gem "redcarpet", "~> 3.3.2" | |
49 | end |
|
48 | end | |
50 | end |
|
49 | end | |
51 |
|
50 | |||
52 | platforms :jruby do |
|
51 | platforms :jruby do | |
53 | # jruby-openssl is bundled with JRuby 1.7.0 |
|
52 | # jruby-openssl is bundled with JRuby 1.7.0 | |
54 | gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0' |
|
53 | gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0' | |
55 | gem "activerecord-jdbc-adapter", "~> 1.3.2" |
|
54 | gem "activerecord-jdbc-adapter", "~> 1.3.2" | |
56 | end |
|
55 | end | |
57 |
|
56 | |||
58 | # Include database gems for the adapters found in the database |
|
57 | # Include database gems for the adapters found in the database | |
59 | # configuration file |
|
58 | # configuration file | |
60 | require 'erb' |
|
59 | require 'erb' | |
61 | require 'yaml' |
|
60 | require 'yaml' | |
62 | database_file = File.join(File.dirname(__FILE__), "config/database.yml") |
|
61 | database_file = File.join(File.dirname(__FILE__), "config/database.yml") | |
63 | if File.exist?(database_file) |
|
62 | if File.exist?(database_file) | |
64 | database_config = YAML::load(ERB.new(IO.read(database_file)).result) |
|
63 | database_config = YAML::load(ERB.new(IO.read(database_file)).result) | |
65 | adapters = database_config.values.map {|c| c['adapter']}.compact.uniq |
|
64 | adapters = database_config.values.map {|c| c['adapter']}.compact.uniq | |
66 | if adapters.any? |
|
65 | if adapters.any? | |
67 | adapters.each do |adapter| |
|
66 | adapters.each do |adapter| | |
68 | case adapter |
|
67 | case adapter | |
69 | when 'mysql2' |
|
68 | when 'mysql2' | |
70 | gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw, :x64_mingw] |
|
69 | gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw, :x64_mingw] | |
71 | gem "activerecord-jdbcmysql-adapter", :platforms => :jruby |
|
70 | gem "activerecord-jdbcmysql-adapter", :platforms => :jruby | |
72 | when 'mysql' |
|
71 | when 'mysql' | |
73 | gem "activerecord-jdbcmysql-adapter", :platforms => :jruby |
|
72 | gem "activerecord-jdbcmysql-adapter", :platforms => :jruby | |
74 | when /postgresql/ |
|
73 | when /postgresql/ | |
75 | gem "pg", "~> 0.18.1", :platforms => [:mri, :mingw, :x64_mingw] |
|
74 | gem "pg", "~> 0.18.1", :platforms => [:mri, :mingw, :x64_mingw] | |
76 | gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby |
|
75 | gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby | |
77 | when /sqlite3/ |
|
76 | when /sqlite3/ | |
78 | gem "sqlite3", :platforms => [:mri, :mingw, :x64_mingw] |
|
77 | gem "sqlite3", :platforms => [:mri, :mingw, :x64_mingw] | |
79 | gem "jdbc-sqlite3", ">= 3.8.10.1", :platforms => :jruby |
|
78 | gem "jdbc-sqlite3", ">= 3.8.10.1", :platforms => :jruby | |
80 | gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby |
|
79 | gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby | |
81 | when /sqlserver/ |
|
80 | when /sqlserver/ | |
82 | gem "tiny_tds", "~> 0.6.2", :platforms => [:mri, :mingw, :x64_mingw] |
|
81 | gem "tiny_tds", "~> 0.6.2", :platforms => [:mri, :mingw, :x64_mingw] | |
83 | gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw] |
|
82 | gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw] | |
84 | else |
|
83 | else | |
85 | warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems") |
|
84 | warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems") | |
86 | end |
|
85 | end | |
87 | end |
|
86 | end | |
88 | else |
|
87 | else | |
89 | warn("No adapter found in config/database.yml, please configure it first") |
|
88 | warn("No adapter found in config/database.yml, please configure it first") | |
90 | end |
|
89 | end | |
91 | else |
|
90 | else | |
92 | warn("Please configure your config/database.yml first") |
|
91 | warn("Please configure your config/database.yml first") | |
93 | end |
|
92 | end | |
94 |
|
93 | |||
95 | group :development do |
|
94 | group :development do | |
96 | gem "rdoc", ">= 2.4.2" |
|
95 | gem "rdoc", ">= 2.4.2" | |
97 | gem "yard" |
|
96 | gem "yard" | |
98 | end |
|
97 | end | |
99 |
|
98 | |||
100 | group :test do |
|
99 | group :test do | |
101 | gem "minitest" |
|
100 | gem "minitest" | |
102 | gem "rails-dom-testing" |
|
101 | gem "rails-dom-testing" | |
103 | gem "mocha" |
|
102 | gem "mocha" | |
104 | gem "simplecov", "~> 0.9.1", :require => false |
|
103 | gem "simplecov", "~> 0.9.1", :require => false | |
105 | # For running UI tests |
|
104 | # For running UI tests | |
106 | gem "capybara" |
|
105 | gem "capybara" | |
107 | gem "selenium-webdriver" |
|
106 | gem "selenium-webdriver" | |
108 | end |
|
107 | end | |
109 |
|
108 | |||
110 | local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") |
|
109 | local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") | |
111 | if File.exists?(local_gemfile) |
|
110 | if File.exists?(local_gemfile) | |
112 | eval_gemfile local_gemfile |
|
111 | eval_gemfile local_gemfile | |
113 | end |
|
112 | end | |
114 |
|
113 | |||
115 | # Load plugins' Gemfiles |
|
114 | # Load plugins' Gemfiles | |
116 | Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file| |
|
115 | Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file| | |
117 | eval_gemfile file |
|
116 | eval_gemfile file | |
118 | end |
|
117 | end |
@@ -1,234 +1,228 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class ProjectsController < ApplicationController |
|
18 | class ProjectsController < ApplicationController | |
19 | menu_item :overview |
|
19 | menu_item :overview | |
20 | menu_item :settings, :only => :settings |
|
20 | menu_item :settings, :only => :settings | |
21 |
|
21 | |||
22 | before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] |
|
22 | before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] | |
23 | before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] |
|
23 | before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] | |
24 | before_filter :authorize_global, :only => [:new, :create] |
|
24 | before_filter :authorize_global, :only => [:new, :create] | |
25 | before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] |
|
25 | before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] | |
26 | accept_rss_auth :index |
|
26 | accept_rss_auth :index | |
27 | accept_api_auth :index, :show, :create, :update, :destroy |
|
27 | accept_api_auth :index, :show, :create, :update, :destroy | |
28 | require_sudo_mode :destroy |
|
28 | require_sudo_mode :destroy | |
29 |
|
29 | |||
30 | after_filter :only => [:create, :edit, :update, :archive, :unarchive, :destroy] do |controller| |
|
|||
31 | if controller.request.post? |
|
|||
32 | controller.send :expire_action, :controller => 'welcome', :action => 'robots' |
|
|||
33 | end |
|
|||
34 | end |
|
|||
35 |
|
||||
36 | helper :custom_fields |
|
30 | helper :custom_fields | |
37 | helper :issues |
|
31 | helper :issues | |
38 | helper :queries |
|
32 | helper :queries | |
39 | helper :repositories |
|
33 | helper :repositories | |
40 | helper :members |
|
34 | helper :members | |
41 |
|
35 | |||
42 | # Lists visible projects |
|
36 | # Lists visible projects | |
43 | def index |
|
37 | def index | |
44 | scope = Project.visible.sorted |
|
38 | scope = Project.visible.sorted | |
45 |
|
39 | |||
46 | respond_to do |format| |
|
40 | respond_to do |format| | |
47 | format.html { |
|
41 | format.html { | |
48 | unless params[:closed] |
|
42 | unless params[:closed] | |
49 | scope = scope.active |
|
43 | scope = scope.active | |
50 | end |
|
44 | end | |
51 | @projects = scope.to_a |
|
45 | @projects = scope.to_a | |
52 | } |
|
46 | } | |
53 | format.api { |
|
47 | format.api { | |
54 | @offset, @limit = api_offset_and_limit |
|
48 | @offset, @limit = api_offset_and_limit | |
55 | @project_count = scope.count |
|
49 | @project_count = scope.count | |
56 | @projects = scope.offset(@offset).limit(@limit).to_a |
|
50 | @projects = scope.offset(@offset).limit(@limit).to_a | |
57 | } |
|
51 | } | |
58 | format.atom { |
|
52 | format.atom { | |
59 | projects = scope.reorder(:created_on => :desc).limit(Setting.feeds_limit.to_i).to_a |
|
53 | projects = scope.reorder(:created_on => :desc).limit(Setting.feeds_limit.to_i).to_a | |
60 | render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") |
|
54 | render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") | |
61 | } |
|
55 | } | |
62 | end |
|
56 | end | |
63 | end |
|
57 | end | |
64 |
|
58 | |||
65 | def new |
|
59 | def new | |
66 | @issue_custom_fields = IssueCustomField.sorted.to_a |
|
60 | @issue_custom_fields = IssueCustomField.sorted.to_a | |
67 | @trackers = Tracker.sorted.to_a |
|
61 | @trackers = Tracker.sorted.to_a | |
68 | @project = Project.new |
|
62 | @project = Project.new | |
69 | @project.safe_attributes = params[:project] |
|
63 | @project.safe_attributes = params[:project] | |
70 | end |
|
64 | end | |
71 |
|
65 | |||
72 | def create |
|
66 | def create | |
73 | @issue_custom_fields = IssueCustomField.sorted.to_a |
|
67 | @issue_custom_fields = IssueCustomField.sorted.to_a | |
74 | @trackers = Tracker.sorted.to_a |
|
68 | @trackers = Tracker.sorted.to_a | |
75 | @project = Project.new |
|
69 | @project = Project.new | |
76 | @project.safe_attributes = params[:project] |
|
70 | @project.safe_attributes = params[:project] | |
77 |
|
71 | |||
78 | if @project.save |
|
72 | if @project.save | |
79 | unless User.current.admin? |
|
73 | unless User.current.admin? | |
80 | @project.add_default_member(User.current) |
|
74 | @project.add_default_member(User.current) | |
81 | end |
|
75 | end | |
82 | respond_to do |format| |
|
76 | respond_to do |format| | |
83 | format.html { |
|
77 | format.html { | |
84 | flash[:notice] = l(:notice_successful_create) |
|
78 | flash[:notice] = l(:notice_successful_create) | |
85 | if params[:continue] |
|
79 | if params[:continue] | |
86 | attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?} |
|
80 | attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?} | |
87 | redirect_to new_project_path(attrs) |
|
81 | redirect_to new_project_path(attrs) | |
88 | else |
|
82 | else | |
89 | redirect_to settings_project_path(@project) |
|
83 | redirect_to settings_project_path(@project) | |
90 | end |
|
84 | end | |
91 | } |
|
85 | } | |
92 | format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) } |
|
86 | format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) } | |
93 | end |
|
87 | end | |
94 | else |
|
88 | else | |
95 | respond_to do |format| |
|
89 | respond_to do |format| | |
96 | format.html { render :action => 'new' } |
|
90 | format.html { render :action => 'new' } | |
97 | format.api { render_validation_errors(@project) } |
|
91 | format.api { render_validation_errors(@project) } | |
98 | end |
|
92 | end | |
99 | end |
|
93 | end | |
100 | end |
|
94 | end | |
101 |
|
95 | |||
102 | def copy |
|
96 | def copy | |
103 | @issue_custom_fields = IssueCustomField.sorted.to_a |
|
97 | @issue_custom_fields = IssueCustomField.sorted.to_a | |
104 | @trackers = Tracker.sorted.to_a |
|
98 | @trackers = Tracker.sorted.to_a | |
105 | @source_project = Project.find(params[:id]) |
|
99 | @source_project = Project.find(params[:id]) | |
106 | if request.get? |
|
100 | if request.get? | |
107 | @project = Project.copy_from(@source_project) |
|
101 | @project = Project.copy_from(@source_project) | |
108 | @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers? |
|
102 | @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers? | |
109 | else |
|
103 | else | |
110 | Mailer.with_deliveries(params[:notifications] == '1') do |
|
104 | Mailer.with_deliveries(params[:notifications] == '1') do | |
111 | @project = Project.new |
|
105 | @project = Project.new | |
112 | @project.safe_attributes = params[:project] |
|
106 | @project.safe_attributes = params[:project] | |
113 | if @project.copy(@source_project, :only => params[:only]) |
|
107 | if @project.copy(@source_project, :only => params[:only]) | |
114 | flash[:notice] = l(:notice_successful_create) |
|
108 | flash[:notice] = l(:notice_successful_create) | |
115 | redirect_to settings_project_path(@project) |
|
109 | redirect_to settings_project_path(@project) | |
116 | elsif !@project.new_record? |
|
110 | elsif !@project.new_record? | |
117 | # Project was created |
|
111 | # Project was created | |
118 | # But some objects were not copied due to validation failures |
|
112 | # But some objects were not copied due to validation failures | |
119 | # (eg. issues from disabled trackers) |
|
113 | # (eg. issues from disabled trackers) | |
120 | # TODO: inform about that |
|
114 | # TODO: inform about that | |
121 | redirect_to settings_project_path(@project) |
|
115 | redirect_to settings_project_path(@project) | |
122 | end |
|
116 | end | |
123 | end |
|
117 | end | |
124 | end |
|
118 | end | |
125 | rescue ActiveRecord::RecordNotFound |
|
119 | rescue ActiveRecord::RecordNotFound | |
126 | # source_project not found |
|
120 | # source_project not found | |
127 | render_404 |
|
121 | render_404 | |
128 | end |
|
122 | end | |
129 |
|
123 | |||
130 | # Show @project |
|
124 | # Show @project | |
131 | def show |
|
125 | def show | |
132 | # try to redirect to the requested menu item |
|
126 | # try to redirect to the requested menu item | |
133 | if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) |
|
127 | if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) | |
134 | return |
|
128 | return | |
135 | end |
|
129 | end | |
136 |
|
130 | |||
137 | @users_by_role = @project.users_by_role |
|
131 | @users_by_role = @project.users_by_role | |
138 | @subprojects = @project.children.visible.to_a |
|
132 | @subprojects = @project.children.visible.to_a | |
139 | @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").to_a |
|
133 | @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").to_a | |
140 | @trackers = @project.rolled_up_trackers.visible |
|
134 | @trackers = @project.rolled_up_trackers.visible | |
141 |
|
135 | |||
142 | cond = @project.project_condition(Setting.display_subprojects_issues?) |
|
136 | cond = @project.project_condition(Setting.display_subprojects_issues?) | |
143 |
|
137 | |||
144 | @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count |
|
138 | @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count | |
145 | @total_issues_by_tracker = Issue.visible.where(cond).group(:tracker).count |
|
139 | @total_issues_by_tracker = Issue.visible.where(cond).group(:tracker).count | |
146 |
|
140 | |||
147 | if User.current.allowed_to_view_all_time_entries?(@project) |
|
141 | if User.current.allowed_to_view_all_time_entries?(@project) | |
148 | @total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f |
|
142 | @total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f | |
149 | end |
|
143 | end | |
150 |
|
144 | |||
151 | @key = User.current.rss_key |
|
145 | @key = User.current.rss_key | |
152 |
|
146 | |||
153 | respond_to do |format| |
|
147 | respond_to do |format| | |
154 | format.html |
|
148 | format.html | |
155 | format.api |
|
149 | format.api | |
156 | end |
|
150 | end | |
157 | end |
|
151 | end | |
158 |
|
152 | |||
159 | def settings |
|
153 | def settings | |
160 | @issue_custom_fields = IssueCustomField.sorted.to_a |
|
154 | @issue_custom_fields = IssueCustomField.sorted.to_a | |
161 | @issue_category ||= IssueCategory.new |
|
155 | @issue_category ||= IssueCategory.new | |
162 | @member ||= @project.members.new |
|
156 | @member ||= @project.members.new | |
163 | @trackers = Tracker.sorted.to_a |
|
157 | @trackers = Tracker.sorted.to_a | |
164 | @wiki ||= @project.wiki || Wiki.new(:project => @project) |
|
158 | @wiki ||= @project.wiki || Wiki.new(:project => @project) | |
165 | end |
|
159 | end | |
166 |
|
160 | |||
167 | def edit |
|
161 | def edit | |
168 | end |
|
162 | end | |
169 |
|
163 | |||
170 | def update |
|
164 | def update | |
171 | @project.safe_attributes = params[:project] |
|
165 | @project.safe_attributes = params[:project] | |
172 | if @project.save |
|
166 | if @project.save | |
173 | respond_to do |format| |
|
167 | respond_to do |format| | |
174 | format.html { |
|
168 | format.html { | |
175 | flash[:notice] = l(:notice_successful_update) |
|
169 | flash[:notice] = l(:notice_successful_update) | |
176 | redirect_to settings_project_path(@project) |
|
170 | redirect_to settings_project_path(@project) | |
177 | } |
|
171 | } | |
178 | format.api { render_api_ok } |
|
172 | format.api { render_api_ok } | |
179 | end |
|
173 | end | |
180 | else |
|
174 | else | |
181 | respond_to do |format| |
|
175 | respond_to do |format| | |
182 | format.html { |
|
176 | format.html { | |
183 | settings |
|
177 | settings | |
184 | render :action => 'settings' |
|
178 | render :action => 'settings' | |
185 | } |
|
179 | } | |
186 | format.api { render_validation_errors(@project) } |
|
180 | format.api { render_validation_errors(@project) } | |
187 | end |
|
181 | end | |
188 | end |
|
182 | end | |
189 | end |
|
183 | end | |
190 |
|
184 | |||
191 | def modules |
|
185 | def modules | |
192 | @project.enabled_module_names = params[:enabled_module_names] |
|
186 | @project.enabled_module_names = params[:enabled_module_names] | |
193 | flash[:notice] = l(:notice_successful_update) |
|
187 | flash[:notice] = l(:notice_successful_update) | |
194 | redirect_to settings_project_path(@project, :tab => 'modules') |
|
188 | redirect_to settings_project_path(@project, :tab => 'modules') | |
195 | end |
|
189 | end | |
196 |
|
190 | |||
197 | def archive |
|
191 | def archive | |
198 | unless @project.archive |
|
192 | unless @project.archive | |
199 | flash[:error] = l(:error_can_not_archive_project) |
|
193 | flash[:error] = l(:error_can_not_archive_project) | |
200 | end |
|
194 | end | |
201 | redirect_to admin_projects_path(:status => params[:status]) |
|
195 | redirect_to admin_projects_path(:status => params[:status]) | |
202 | end |
|
196 | end | |
203 |
|
197 | |||
204 | def unarchive |
|
198 | def unarchive | |
205 | unless @project.active? |
|
199 | unless @project.active? | |
206 | @project.unarchive |
|
200 | @project.unarchive | |
207 | end |
|
201 | end | |
208 | redirect_to admin_projects_path(:status => params[:status]) |
|
202 | redirect_to admin_projects_path(:status => params[:status]) | |
209 | end |
|
203 | end | |
210 |
|
204 | |||
211 | def close |
|
205 | def close | |
212 | @project.close |
|
206 | @project.close | |
213 | redirect_to project_path(@project) |
|
207 | redirect_to project_path(@project) | |
214 | end |
|
208 | end | |
215 |
|
209 | |||
216 | def reopen |
|
210 | def reopen | |
217 | @project.reopen |
|
211 | @project.reopen | |
218 | redirect_to project_path(@project) |
|
212 | redirect_to project_path(@project) | |
219 | end |
|
213 | end | |
220 |
|
214 | |||
221 | # Delete @project |
|
215 | # Delete @project | |
222 | def destroy |
|
216 | def destroy | |
223 | @project_to_destroy = @project |
|
217 | @project_to_destroy = @project | |
224 | if api_request? || params[:confirm] |
|
218 | if api_request? || params[:confirm] | |
225 | @project_to_destroy.destroy |
|
219 | @project_to_destroy.destroy | |
226 | respond_to do |format| |
|
220 | respond_to do |format| | |
227 | format.html { redirect_to admin_projects_path } |
|
221 | format.html { redirect_to admin_projects_path } | |
228 | format.api { render_api_ok } |
|
222 | format.api { render_api_ok } | |
229 | end |
|
223 | end | |
230 | end |
|
224 | end | |
231 | # hide project in layout |
|
225 | # hide project in layout | |
232 | @project = nil |
|
226 | @project = nil | |
233 | end |
|
227 | end | |
234 | end |
|
228 | end |
@@ -1,29 +1,28 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2016 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class WelcomeController < ApplicationController |
|
18 | class WelcomeController < ApplicationController | |
19 | caches_action :robots |
|
|||
20 |
|
19 | |||
21 | def index |
|
20 | def index | |
22 | @news = News.latest User.current |
|
21 | @news = News.latest User.current | |
23 | end |
|
22 | end | |
24 |
|
23 | |||
25 | def robots |
|
24 | def robots | |
26 | @projects = Project.all_public.active |
|
25 | @projects = Project.all_public.active | |
27 | render :layout => false, :content_type => 'text/plain' |
|
26 | render :layout => false, :content_type => 'text/plain' | |
28 | end |
|
27 | end | |
29 | end |
|
28 | end |
General Comments 0
You need to be logged in to leave comments.
Login now