diff --git a/app/controllers/admin/enterprise_groups_controller.rb b/app/controllers/admin/enterprise_groups_controller.rb index 466bde2cd5..cc2f3ed1db 100644 --- a/app/controllers/admin/enterprise_groups_controller.rb +++ b/app/controllers/admin/enterprise_groups_controller.rb @@ -15,12 +15,10 @@ module Admin redirect_to main_app.admin_enterprise_groups_path end - private def collection EnterpriseGroup.by_position end - end end diff --git a/app/models/enterprise_group.rb b/app/models/enterprise_group.rb index 0638577850..6c163b087a 100644 --- a/app/models/enterprise_group.rb +++ b/app/models/enterprise_group.rb @@ -4,10 +4,12 @@ class EnterpriseGroup < ActiveRecord::Base has_and_belongs_to_many :enterprises validates :name, presence: true - #validates :description, presence: true + validates :description, presence: true + + attr_accessible :name, :description, :long_description, :on_front_page, :enterprise_ids attr_accessible :promo_image - has_attached_file :promo_image, styles: {medium: "1200x1200>"} + has_attached_file :promo_image, styles: {medium: "800>400"} validates_attachment_content_type :promo_image, :content_type => /\Aimage\/.*\Z/ attr_accessible :logo diff --git a/app/views/admin/enterprise_groups/_form.html.haml b/app/views/admin/enterprise_groups/_form.html.haml index b41a68d4a5..ec4934bf19 100644 --- a/app/views/admin/enterprise_groups/_form.html.haml +++ b/app/views/admin/enterprise_groups/_form.html.haml @@ -3,6 +3,16 @@ %br/ = f.text_field :name += f.field_container :description do + = f.label :description + %br/ + = f.text_field :description + += f.field_container :long_description do + = f.label :long_description + %br/ + = f.text_area :long_description + = f.field_container :on_front_page do = f.label :on_front_page, 'On front page?' %br/ @@ -12,3 +22,22 @@ = f.label :enterprise_ids, 'Enterprises' %br/ = f.collection_select :enterprise_ids, Enterprise.all, :id, :name, {}, {class: "select2 fullwidth", multiple: true} + + +.row + .alpha.three.columns + = f.label :logo, class: 'with-tip', 'data-powertip' => 'This is the logo' + .with-tip{'data-powertip' => 'This is the logo'} + %a What's this? + .omega.eight.columns + = image_tag @object.logo.url if @object.logo.present? + = f.file_field :logo + +.row + .alpha.three.columns + = f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed at the top of the Group profile' + .with-tip{'data-powertip' => 'This image is displayed at the top of the Group profile'} + %a What's this? + .omega.eight.columns + = image_tag @object.promo_image.url if @object.promo_image.present? + = f.file_field :promo_image diff --git a/spec/features/admin/enterprise_groups_spec.rb b/spec/features/admin/enterprise_groups_spec.rb index f0ab8564b1..24e89e9be7 100644 --- a/spec/features/admin/enterprise_groups_spec.rb +++ b/spec/features/admin/enterprise_groups_spec.rb @@ -62,9 +62,9 @@ feature %q{ page.should have_select 'enterprise_group_enterprise_ids', selected: [e1.name, e2.name] fill_in 'enterprise_group_name', with: 'xyzzy' - fill_in 'enterprise_group_description', with: 'This is a description' uncheck 'enterprise_group_on_front_page' unselect e1.name, from: 'enterprise_group_enterprise_ids' + select e2.name, from: 'enterprise_group_enterprise_ids' click_button 'Update' @@ -72,7 +72,6 @@ feature %q{ eg = EnterpriseGroup.last eg.name.should == 'xyzzy' - eg.description.should == 'This is a description' eg.on_front_page.should be_false eg.enterprises.should == [e2] end