diff --git a/app/admin/organisation.rb b/app/admin/organisation.rb index 8b4afbc..2c88380 100644 --- a/app/admin/organisation.rb +++ b/app/admin/organisation.rb @@ -1,15 +1,15 @@ # [+Project:+] DMPonline -# [+Description:+] -# +# [+Description:+] +# # [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre +# [+Copyright:+] Digital Curation Centre ActiveAdmin.register Organisation do permit_params :abbreviation, :banner_file_id, :description, :domain, :logo_file_id, :name, :stylesheet_file_id, :target_url, :organisation_type_id, :wayfless_entity, :parent_id - + menu :priority => 14, :label => proc{I18n.t('admin.org')}, :parent => "Organisations management" - index do + index do column I18n.t('admin.org_title'), :sortable => :name do |ggn| link_to ggn.name, [:admin, ggn] end @@ -23,15 +23,16 @@ column I18n.t('admin.org_type'), :sortable => :organisation_type_id do |org_type| if !org_type.organisation_type_id.nil? then link_to org_type.organisation_type.name, [:admin, org_type] - end + end end - + actions end - - + + #show details of an organisation - show do + show do + resource.check_api_credentials attributes_table do row I18n.t('admin.org_title'), :sortable => :name do |gn| if !gn.name.nil? then @@ -45,12 +46,12 @@ '-' end end - row :sort_name + row :sort_name row I18n.t('admin.org_type'), :organisation_type_id do |org_type| if !org_type.organisation_type_id.nil? then link_to org_type.organisation_type.name, [:admin, org_type] - end - end + end + end row :description do |descr| if !descr.description.nil? then descr.description.html_safe @@ -65,18 +66,21 @@ row :logo_file_name row :domain row :wayfless_entity + row I18n.t('admin.token_permission_type') do + (organisation.token_permission_types.map{|tpt| link_to tpt.token_type, [:admin, tpt]}).join(', ').html_safe + end # row I18n.t('admin.org_parent'), :parent_id do |org_parent| # if !org_parent.parent_id.nil? then # parent_org = Organisation.find(org_parent.parent_id) # link_to parent_org.name, [:admin, parent_org] - # end + # end # end # row :stylesheet_file_id row :created_at row :updated_at end - end - + end + #templates sidebar sidebar I18n.t('admin.templates'), :only => :show, :if => proc { organisation.dmptemplates.count >= 1} do table_for organisation.dmptemplates.order("title asc") do |temp| @@ -87,7 +91,7 @@ end end - #form + #form form do |f| f.inputs "Details" do f.input :name @@ -100,18 +104,22 @@ f.input :logo_file_name f.input :domain f.input :wayfless_entity + f.input :token_permission_types, label: I18n.t('admin.token_permission_type'), + as: :select, multiple: true, include_blank: I18n.t('helpers.none'), + collection: TokenPermissionType.order(:token_type).map{|token| [token.token_type, token.id]}, + hint: I18n.t('admin.choose_api_permissions') # f.input :parent_id, :label => I18n.t('admin.org_parent'), :as => :select, :collection => Organisation.find(:all, :order => 'name ASC').map{|orgp|[orgp.name, orgp.id]} # f.input :stylesheet_file_id end - f.actions - end + f.actions + end controller do def permitted_params params.permit! end - end - - + end + + end