diff --git a/app/admin/user.rb b/app/admin/user.rb index 77435bdad..f4b5c26c0 100644 --- a/app/admin/user.rb +++ b/app/admin/user.rb @@ -41,6 +41,7 @@ f.inputs "Members" do f.has_many :members do |m| m.input :organization, collection: Organization.order(id: :asc).pluck(:name, :id) + m.input :active m.input :manager end end @@ -59,6 +60,9 @@ panel "Memberships" do table_for user.members do column :organization + column :active do |member| + "✔" if member.active + end column :manager do |member| "✔" if member.manager end diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 52243c47c..1e03e2958 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -232,12 +232,7 @@ html { overflow-x: inherit; } -table.users { - padding: 10px; -} - @media screen { - html { min-height: 100%; position: relative; @@ -280,7 +275,6 @@ table.users { } @media print { - body { padding-top: 0px; } @@ -288,10 +282,8 @@ table.users { .table { border-collapse: collapse; } - } - .error { color: red; } diff --git a/app/assets/stylesheets/application/footer.scss b/app/assets/stylesheets/application/footer.scss index dfc4a67af..ef565181e 100644 --- a/app/assets/stylesheets/application/footer.scss +++ b/app/assets/stylesheets/application/footer.scss @@ -41,12 +41,10 @@ } } -.landing-page, .login-page, .pages, .unlocks-page, .confirmations-page, .passwords-page { - .footer { - position: absolute; - bottom: 0; - left: 0; - } +.footer { + position: absolute; + bottom: 0; + left: 0; } .language-selector { @@ -65,23 +63,12 @@ border: 1px solid white; padding: 4px 8px; } - - &:hover { - background-color: transparent; - } } &.open > a.btn-default.dropdown-toggle { & { background-color: transparent; - color: white; - border-color: #ddd; - } - - &:hover { - background-color: transparent; - color: white; - border-color: #ddd; + border: 1px solid white; } } } diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index ea52cbe98..0c747804a 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -1,12 +1,6 @@ class OrganizationsController < ApplicationController before_action :load_resource, only: [:show, :edit, :update, :set_current] - def new - @organization = Organization.new - - authorize @organization - end - def index @organizations = Organization.all.page(params[:page]).per(25) end @@ -20,18 +14,6 @@ def show per(10) end - def create - @organization = Organization.new(organization_params) - - authorize @organization - - if @organization.save - redirect_to @organization - else - render action: :new, status: :unprocessable_entity - end - end - def update if @organization.update(organization_params) redirect_to @organization @@ -40,8 +22,6 @@ def update end end - # POST /organizations/:organization_id/set_current - # def set_current if current_user session[:current_organization_id] = @organization.id diff --git a/app/policies/organization_policy.rb b/app/policies/organization_policy.rb index 532fdda78..1081ee5ca 100644 --- a/app/policies/organization_policy.rb +++ b/app/policies/organization_policy.rb @@ -5,10 +5,6 @@ def index? true end - def create? - user&.superadmin? - end - def update? user&.superadmin? || user&.admins?(organization) end diff --git a/app/views/organizations/index.html.erb b/app/views/organizations/index.html.erb index bc255c7ac..20090cac9 100644 --- a/app/views/organizations/index.html.erb +++ b/app/views/organizations/index.html.erb @@ -2,41 +2,32 @@ <%= Organization.model_name.human(count: :many) %> - - - - - - - - - - - - <% @organizations.each do |org| %> - - - - - - <% end %> - -
<%= Organization.model_name.human(count: :one) %><%= t '.member_count' %>
<%= link_to org.name, org %><%= org.users.count %> - <% if current_user&.admins?(org) %> - <%= link_to edit_organization_path(org), class: 'action' do %> - <%= glyph :pencil %> - <%= t 'global.edit' %> - <% end %> - <% end %> -
- -<%= paginate @organizations %> +
+
+ + + + + + + + + + + + <% @organizations.each do |org| %> + + + + + + + + <% end %> + +
<%= t '.city' %><%= t '.neighborhood' %><%= t '.web' %><%= t '.member_count' %>
<%= link_to(org.name, org) %><%= org.city %><%= org.neighborhood %><%= link_to(org.web, org.web) if org.web.present? %><%= org.members.count %>
+
+ <%= paginate @organizations %> +
+
+
diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb deleted file mode 100644 index bb6907b0f..000000000 --- a/app/views/organizations/new.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -

- <%= t '.new' %> -

-<%= render 'form' %> diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index d5e16dce3..d14dca13d 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -84,14 +84,6 @@
-
-
-

- <%= link_to current_organization.name, - organization_path(current_organization) %> -

-
-
-
<%= render partial: 'member_card', collection: @member_view_models, as: :member %>
diff --git a/app/views/users/manage.html.erb b/app/views/users/manage.html.erb index 186bc2759..ef715a5a9 100644 --- a/app/views/users/manage.html.erb +++ b/app/views/users/manage.html.erb @@ -1,7 +1,10 @@
-

<%= t(".members") %>

+

+ <%= link_to current_organization.name, current_organization %> + <%= t("users.index.members") %> +

@@ -30,17 +33,13 @@
+
-

- <%= link_to current_organization.name, - organization_path(current_organization) %> -

-
- +
diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index f7b99c3bc..3193df533 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -1,6 +1,7 @@ ActiveAdmin.setup do |config| config.site_title = "TimeOverflow" config.site_title_link = "/" + config.footer = "TimeOverflow Admin | www.timeoverflow.org" config.authentication_method = :authenticate_superuser! config.current_user_method = :current_user config.logout_link_path = :destroy_user_session_path diff --git a/config/routes.rb b/config/routes.rb index 91d3d73ff..cc8fd4c7e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,7 +28,7 @@ get :give_time, on: :member end - resources :organizations, concerns: :accountable, except: :destroy do + resources :organizations, except: [:new, :create, :destroy], concerns: :accountable do member do post :set_current end @@ -41,7 +41,7 @@ end end - resources :transfers, only: [:create, :new] do + resources :transfers, only: [:new, :create] do member do put :delete_reason end diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb index d40fb8f79..e0ae5a717 100644 --- a/spec/controllers/organizations_controller_spec.rb +++ b/spec/controllers/organizations_controller_spec.rb @@ -31,16 +31,6 @@ end end - describe 'POST #create' do - it 'only superdamins are authorized create to new organizations' do - login(member.user) - - expect { - post :create, params: { organization: { name: 'New cool organization' } } - }.not_to change { Organization.count } - end - end - describe 'POST #update' do context 'with a logged user (admins organization)' do let(:member) { Fabricate(:member, organization: organization, manager: true) }