diff --git a/Gemfile.lock b/Gemfile.lock index 66d3dfb4e..355ca422d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,10 +91,6 @@ GEM descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.2.5) - dnsruby (1.57.0) - email_verifier (0.0.7) - dnsruby (>= 1.5) - rails (>= 3.0.0) equalizer (0.0.9) erubis (2.7.0) execjs (2.2.1) @@ -170,7 +166,6 @@ GEM mysql2 (0.3.11-x86-mingw32) nenv (0.2.0) net-ldap (0.3.1) - newrelic_rpm (3.9.9.275) nokogiri (1.6.3) mini_portile (= 0.6.0) nokogiri (1.6.3-x86-mingw32) @@ -320,7 +315,6 @@ DEPENDENCIES capybara (~> 2.4.1) coderay (~> 1.0.6) coffee-rails (~> 3.2.1) - email_verifier factory_girl (~> 4.4.0) faker fastercsv (~> 1.5.0) @@ -336,7 +330,6 @@ DEPENDENCIES mocha (~> 1.1.0) mysql2 (= 0.3.11) net-ldap (~> 0.3.1) - newrelic_rpm nokogiri (~> 1.6.3) paperclip (~> 3.5.4) rack-mini-profiler! diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9b1e045e3..aab9d7b69 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -283,4 +283,43 @@ class AdminController < ApplicationController end end + #企业主页定制 + def enterprise_page_made + @enterprise_page = FirstPage.find_by_page_type('enterprise') + if @enterprise_page.nil? + @enterprise_page = FirstPage.new + @enterprise_page.page_type = 'enterprise' + end + if request.get? + @first_page = FirstPage.find_by_page_type('project') + elsif request.post? + @first_page = FirstPage.find_by_page_type('project') + @first_page.web_title = params[:web_title] + @enterprise_page.web_title = params[:web_title] + @enterprise_page.title = params[:course_title] + @enterprise_page.image_width = params[:image_width] + @enterprise_page.image_height = params[:image_height] + @enterprise_page.description = params[:course_description] + if @first_page.save && @enterprise_page.save + respond_to do |format| + format.html { + flash[:notice] = l(:notice_successful_update) + redirect_to enterprise_page_made_url + } + format.api { render_api_ok } + end + else + respond_to do |format| + flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@enterprise_page.errors.full_messages[0]}" + #flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}" + format.html { + render :action => 'enterprise_page_made' + } + format.api { render_validation_errors(@first_page) } + format.api { render_validation_errors(@enterprise_page) } + end + end + end + end + end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 6704346a5..144199b86 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -30,6 +30,11 @@ class WelcomeController < ApplicationController @organization = @cur_projects.enterprise_name @organization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @organization]) @e_count = @organization_projects.count + @enterprise_page = FirstPage.find_by_page_type('enterprise') + if @enterprise_page.nil? + @enterprise_page = FirstPage.new + @enterprise_page.page_type = 'enterprise' + end if @e_count < 9 part_count = 9 - @e_count # @part_projects = find_all_hot_project part_count, order diff --git a/app/views/admin/_tab_partial.html.erb b/app/views/admin/_tab_partial.html.erb index 6b8788a90..917d7dd3f 100644 --- a/app/views/admin/_tab_partial.html.erb +++ b/app/views/admin/_tab_partial.html.erb @@ -4,5 +4,6 @@
+ + <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +
+ <%= render 'tab_partial' %> ++ +
++ + <%= text_field_tag 'image_width', params[:label_image_width],:value => @enterprise_page.image_width,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +
++ + <%= text_field_tag 'image_height', params[:label_imgae_height], :value => @enterprise_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +
++ + <%= text_field_tag 'course_title', params[:label_site_title], :value => @enterprise_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +
++ + <%= text_area_tag 'course_description',@enterprise_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +
+ + <%= submit_tag l(:button_save), :class => "small", :name => nil %> +<% end %> +