From 85a23c468e451321d6bd1465dbb178b36cfc9e30 Mon Sep 17 00:00:00 2001 From: zhangyang Date: Wed, 7 Aug 2013 15:29:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E2=80=9C=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E2=80=9D=EF=BC=9B=E8=B0=83=E6=95=B4=E2=80=9C?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9B=AE=E2=80=9D=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/documents_controller.rb | 2 +- app/controllers/projects_controller.rb | 26 +++---------------- app/views/projects/index.html.erb | 4 +++ app/views/projects/new.html.erb | 15 +++++++---- config/routes.rb | 34 ++++++++++++------------- 5 files changed, 35 insertions(+), 46 deletions(-) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 0c9f0382b..a311fc765 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -22,7 +22,7 @@ class DocumentsController < ApplicationController before_filter :find_project_by_project_id, :only => [:index, :new, :create] before_filter :find_model_object, :except => [:index, :new, :create] before_filter :find_project_from_association, :except => [:index, :new, :create] - before_filter :authorize, :except => [:index]#Added by young + before_filter :authorize #, :except => [:index]#Added by young helper :attachments diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a75fac2eb..04793ef7e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -22,11 +22,11 @@ class ProjectsController < ApplicationController # menu_item :settings, :only => :settings before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] - before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :investor, :issue, :mission, :on, :file] + before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file] before_filter :authorize_global, :only => [:new, :create] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] #by young - before_filter :member, :focus, :mission, :issue, :on, :file, :investor + before_filter :member, :file # accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy @@ -119,6 +119,7 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] + render :layout => 'base' end def create @@ -271,31 +272,10 @@ class ProjectsController < ApplicationController #by young def member - session[:project_member_num] = 12 end - def focus - session[:project_focus_num] = 2508 - end - - def investor - session[:project_investor_num] = 8 - end - - def issue - session[:project_issue_num] = 1 - end - - def mission - session[:project_mission_num] = 225 - end - - def on - session[:project_on_num] = 1208 - end def file - session[:project_file_num] = 125 end #end diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index b93e2eaca..1add4f2b5 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -2,6 +2,10 @@ <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <% end %> +
+ <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> +
+ <%= form_tag(projects_path, :method => :get) do %>
<%=l(:label_project_plural)%> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 95b233f48..c66523896 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -1,8 +1,13 @@

<%=l(:label_project_new)%>

<%= labelled_form_for @project do |f| %> -<%= render :partial => 'form', :locals => { :f => f } %> -<%= submit_tag l(:button_create) %> -<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> -<%= javascript_tag "$('#project_name').focus();" %> -<% end %> + +
+

<%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %>

+ <%= render :partial => 'form', :locals => { :f => f } %> + <%= submit_tag l(:button_create) %> + <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> + <%= javascript_tag "$('#project_name').focus();" %> + <% end %> +
+ diff --git a/config/routes.rb b/config/routes.rb index 3de86aded..7407b0dfe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -113,16 +113,16 @@ RedmineApp::Application.routes.draw do resources :projects do member do get 'settings(/:tab)', :action => 'settings', :as => 'settings' - get 'show', :action => 'show', :as => 'project_show' - get 'activity', :controller => 'activities', :action => 'index', :as => 'activity' - get 'repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository' + # get 'show', :action => 'show', :as => 'project_show' + # get 'activity', :controller => 'activities', :action => 'index', :as => 'activity' + # get 'repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository' #by young get 'member', :controller => 'projects', :action => 'member', :as => 'member' - get 'focus', :action => 'focus', :as => 'focus' - get 'investor', :action => 'investor', :as => 'investor' +# get 'focus', :action => 'focus', :as => 'focus' +# get 'investor', :action => 'investor', :as => 'investor' # get 'issue', :action =>'issue', :as => 'issue' - get 'mission', :action => 'mission', :as => 'mission' - get 'on', :action => 'on', :as => 'on' +# get 'mission', :action => 'mission', :as => 'mission' +# get 'on', :action => 'on', :as => 'on' get 'file', :action => 'file', :as => 'file' #end @@ -136,18 +136,18 @@ RedmineApp::Application.routes.draw do #by young match '/member', :controller => 'projects', :action => 'member', :as => 'member', :via => :get - match '/focus', :controller => 'projects', :action => 'focus', :as => 'focus', :via => :get - match '/mission', :controller => 'projects', :action => 'mission', :as => 'mission', :via => :get - match '/on', :controller => 'projects', :action => 'on', :as => 'on', :via => :get - match '/settings(/:tab)', :controller => 'projects', :action => 'settings', :as => 'settings', :via => :get +# match '/focus', :controller => 'projects', :action => 'focus', :as => 'focus', :via => :get +# match '/mission', :controller => 'projects', :action => 'mission', :as => 'mission', :via => :get +# match '/on', :controller => 'projects', :action => 'on', :as => 'on', :via => :get +# match '/settings(/:tab)', :controller => 'projects', :action => 'settings', :as => 'settings', :via => :get match '/file', :controller => 'projects', :action => 'file', :as => 'file', :via => :get - match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get +# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get - match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get - match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get - match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get - get 'projects/:project_id/show', :to => 'projects#show', :as => 'project_show' - get 'projects/:project_id/repository', :to => 'repositories#show', :as => 'project_repository' +# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get +# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get +# match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get +# get 'projects/:project_id/show', :to => 'projects#show', :as => 'project_show' +# get 'projects/:project_id/repository', :to => 'repositories#show', :as => 'project_repository' # match '/show', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get