Drop Organization Feature
This commit is contained in:
parent
dc1a6a4363
commit
275be8c80a
28 changed files with 22 additions and 402 deletions
|
|
@ -1,10 +1,6 @@
|
|||
%h4
|
||||
Basic Information
|
||||
%hr
|
||||
- if f.object.new_record?
|
||||
.form-group
|
||||
= f.label :organization, "Organization"
|
||||
= f.select :organization_id, Organization.accessible_by(current_ability, :update).pluck(:name, :id)
|
||||
.form-group
|
||||
= f.label :title, "Title"
|
||||
%abbr{title: 'This field is required'} *
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
= form_for(@organization, url: (@organization.new_record? ? admin_organizations_path : admin_organization_path(@organization))) do |f|
|
||||
.form-group
|
||||
= f.label :name, "Name"
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.text_field :name, required: true, class: 'form-control', placeholder: 'Name'
|
||||
.form-group
|
||||
= f.text_area :description, rows: 10, data: { provide: 'markdown' }, class: 'form-control', placeholder: 'Decribe about your organization...'
|
||||
%span.help-block
|
||||
= markdown_hint
|
||||
.form-group
|
||||
= f.text_area :code_of_conduct, rows: 10, data: { provide: 'markdown' }, class: 'form-control', placeholder: 'Rules governing behavior and dispute resolution...'
|
||||
%span.help-block
|
||||
= markdown_hint
|
||||
.form-group
|
||||
= image_tag f.object.picture.thumb.url if f.object.picture?
|
||||
= f.file_field :picture
|
||||
%p.text-right
|
||||
%button{type: 'submit', class: 'btn btn-success'}
|
||||
- if @organization.new_record?
|
||||
Create Organization
|
||||
- else
|
||||
Update Organization
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
.page-header
|
||||
%h3 Users (#{users.length})
|
||||
- if users.present?
|
||||
%table.datatable#users
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Email
|
||||
- if ( can? :unassign_org_admins, organization )
|
||||
%th
|
||||
Actions
|
||||
%tbody
|
||||
- users.each do |user|
|
||||
%tr
|
||||
%td= user.name
|
||||
%td= user.email
|
||||
- if ( can? :unassign_org_admins, organization )
|
||||
%td
|
||||
= link_to 'Remove from organization admin',
|
||||
unassign_org_admins_admin_organization_path(organization.id,
|
||||
role.name,
|
||||
user: {email: user.email}),
|
||||
method: :delete,
|
||||
class: 'btn btn-danger'
|
||||
- else
|
||||
%h5 No users found!
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
Edit Organization
|
||||
= @organization.name
|
||||
.row
|
||||
.col-md-8
|
||||
= render partial: 'form'
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1 Organizations
|
||||
- if can? :manage, :all
|
||||
.btn-group.pull-right
|
||||
= link_to 'Create Organization', new_admin_organization_path, class: 'btn btn-success pull-right'
|
||||
%p.text-muted
|
||||
Manage organizations in OSEM
|
||||
.row
|
||||
.col-md-12
|
||||
%table.datatable
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Upcoming Conferences
|
||||
%th Past Conferences
|
||||
%th Code of Conduct?
|
||||
%th Actions
|
||||
%tbody
|
||||
- @organizations.each do |organization|
|
||||
%tr{ id: "organization-#{organization.id}" }
|
||||
%td
|
||||
= organization.name
|
||||
%td
|
||||
= organization.conferences.upcoming.count
|
||||
%td
|
||||
= organization.conferences.past.count
|
||||
%td.text-center
|
||||
- unless organization.code_of_conduct.blank?
|
||||
= icon 'fa-solid', 'check', title: 'yes'
|
||||
%td
|
||||
.btn-group
|
||||
= link_to 'Admins', admins_admin_organization_path(organization),
|
||||
method: :get, class: 'btn btn-success'
|
||||
= link_to 'Edit', edit_admin_organization_path(organization),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
= link_to 'Delete', admin_organization_path(organization),
|
||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Warning: This will delete #{organization.name} and all its data which includes data for all conferences within #{organization.name}. Do you really want to continue?" }
|
||||
= link_to 'Add Conference', new_admin_conference_path, method: :get, class: 'btn btn-info'
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
Create Organization
|
||||
.row
|
||||
.col-md-8
|
||||
= render partial: 'form'
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h2
|
||||
Organization admins for #{@organization.name}
|
||||
.text-muted
|
||||
= @role.description
|
||||
|
||||
.row.col-md-3
|
||||
- if ( can? :assign_org_admins, @organization )
|
||||
= form_for :user, url: assign_org_admins_admin_organization_path(@organization, @role.name), method: :post do |f|
|
||||
.form-group
|
||||
= f.label :email, 'Add user by email: '
|
||||
= f.text_field :email, placeholder: "User's email", class: 'form-control', required: true
|
||||
= f.submit 'Add', id: 'user-add', class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= render partial: 'users_with_org_admin_role',
|
||||
locals: { users: @users, organization: @organization, role: @role }
|
||||
|
|
@ -7,26 +7,13 @@
|
|||
end
|
||||
|
||||
- case version.item_type
|
||||
- when 'Organization'
|
||||
organization
|
||||
= link_to_organization(version.item_id)
|
||||
|
||||
- when 'UsersRole'
|
||||
- role = current_or_last_object_state('Role', object.role_id)
|
||||
- role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: object.role_id).last.changeset[:name].second
|
||||
role
|
||||
- if role_name == 'organization_admin'
|
||||
- if Organization.find_by(id: version.conference_id)
|
||||
-# organization_admin belongs to organization and not conferences
|
||||
- organization = Organization.find_by(id: version.conference_id)
|
||||
= link_if_alive version, role_name,
|
||||
admins_admin_organization_path(organization), organization
|
||||
- else
|
||||
(Deleted Organization)
|
||||
- else
|
||||
- conference = Conference.find_by(id: version.conference_id)
|
||||
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
|
||||
= link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference
|
||||
- conference = Conference.find_by(id: version.conference_id)
|
||||
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
|
||||
= link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference
|
||||
|
||||
= version.event == 'create' ? 'to' : 'from'
|
||||
user
|
||||
|
|
@ -133,19 +120,10 @@
|
|||
- when 'Role'
|
||||
role
|
||||
- role_name = object.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second
|
||||
- if role_name == 'organization_admin'
|
||||
- if Organization.find_by(id: version.conference_id)
|
||||
-# organization_admin belongs to organization and not conferences
|
||||
- organization = Organization.find_by(id: version.conference_id)
|
||||
= link_if_alive version, role_name,
|
||||
admins_admin_organization_path(organization), organization
|
||||
- else
|
||||
(Role Deleted)
|
||||
- else
|
||||
- conference = Conference.find_by(id: version.conference_id)
|
||||
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
|
||||
= link_if_alive version, role_name,
|
||||
admin_conference_role_path(conference_short_title, role_name), conference
|
||||
- conference = Conference.find_by(id: version.conference_id)
|
||||
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
|
||||
= link_if_alive version, role_name,
|
||||
admin_conference_role_path(conference_short_title, role_name), conference
|
||||
|
||||
- when 'Venue'
|
||||
venue
|
||||
|
|
@ -202,16 +180,8 @@
|
|||
user
|
||||
= link_to_user(version.item_id)
|
||||
|
||||
- unless %w(Conference Subscription Registration User Organization).include?(version.item_type)
|
||||
- if (version.item_type == 'Role' && role_name == 'organization_admin') || (version.item_type == 'UsersRole' && role_name == 'organization_admin')
|
||||
in organization
|
||||
- if Organization.find_by(id: version.conference_id)
|
||||
-# organization_admin belongs to organization and not conferences
|
||||
- organization = Organization.find_by(id: version.conference_id)
|
||||
= link_to_organization(version.conference_id)
|
||||
- else
|
||||
(Organization Deleted)
|
||||
- elsif version.item_type == 'Commercial'
|
||||
- unless %w(Conference Subscription Registration User).include?(version.item_type)
|
||||
- if version.item_type == 'Commercial'
|
||||
- commercial = current_or_last_object_state(version.item_type, version.item_id)
|
||||
- commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id)
|
||||
- unless commercial.commercialable_type == 'Conference'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue