Skip to content

Commit 8f66df1

Browse files
authored
Merge pull request #683 from coopdevs/develop
Release v4.1.0
2 parents 2157c4d + 264a82d commit 8f66df1

File tree

25 files changed

+125
-61
lines changed

25 files changed

+125
-61
lines changed

.env.example

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@
88
# Your local .env file is added to .gitignore and
99
# wont be uploaded to the repo.
1010

11-
12-
# database setup
11+
# Database setup
1312
DATABASE_USER=postgres
1413
DATABASE_NAME=timeoverflow_development
1514

16-
# host part of the url for mail links:
15+
# Host part of the url for mail links:
1716
MAIL_LINK_HOST=localhost:3000
1817
MAIL_LINK_PROTO=http
1918

20-
# a list of emails for superadmin users
19+
# Email provider
20+
SMTP_PASSWORD=XXXXXXXX
21+
SMTP_DOMAIN=www.timeoverflow.org
22+
SMTP_USER_NAME=my_username@timeoverflow.org
23+
SMTP_ADDRESS=smtp.mailgun.org
24+
SMTP_PORT=587
25+
26+
# List of emails for superadmin users
2127
ADMINS="admin@timeoverflow.org"
2228

2329
# AWS settings

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TimeOverflow
2-
[![View performance data on Skylight](https://badges.skylight.io/problem/grDTNuzZRnyu.svg)](https://oss.skylight.io/app/applications/grDTNuzZRnyu)
2+
[![View performance data on Skylight](https://badges.skylight.io/typical/grDTNuzZRnyu.svg)](https://oss.skylight.io/app/applications/grDTNuzZRnyu)
33
[![Build Status](https://github.com/coopdevs/timeoverflow/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/coopdevs/timeoverflow/actions)
44
[![Maintainability](https://api.codeclimate.com/v1/badges/f82c6d98a2441c84f2ef/maintainability)](https://codeclimate.com/github/coopdevs/timeoverflow/maintainability)
55
[![Test Coverage](https://api.codeclimate.com/v1/badges/f82c6d98a2441c84f2ef/test_coverage)](https://codeclimate.com/github/coopdevs/timeoverflow/test_coverage)

app/admin/category.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
index do
33
id_column
44
column :name do |category|
5-
"#{tag.span(nil, class: "glyphicon glyphicon-#{category.icon_name}")} #{category.name}".html_safe
5+
"#{category_icon(category)} #{category.name}".html_safe
66
end
77
actions
88
end
@@ -17,9 +17,12 @@
1717

1818
show do |cat|
1919
attributes_table do
20+
row :name do
21+
"#{category_icon(cat)} #{cat.name}".html_safe
22+
end
23+
row :icon_name
2024
row :created_at
2125
row :updated_at
22-
row :icon_name
2326
row :name_translations do
2427
render_translations(cat.name_translations)
2528
end

app/admin/dashboard.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
33

44
content title: proc { I18n.t("active_admin.dashboard") } do
5+
columns do
6+
panel "Global Stats", class: "global_stats_panel" do
7+
div { "#{glyph(:home)} Time Banks <b>#{Organization.count}</b>".html_safe }
8+
div { "#{glyph(:user)} Users <b>#{User.count}</b>".html_safe }
9+
div { "#{glyph(:hand_up)} Offers <b>#{Offer.count}</b>".html_safe }
10+
div { "#{glyph(:bell)} Inquiries <b>#{Inquiry.count}</b>".html_safe }
11+
div { "#{glyph(:transfer)} Transfers <b>#{Transfer.count}</b>".html_safe }
12+
end
13+
end
14+
515
columns do
616
column do
717
panel "Recent Organizations" do
@@ -32,6 +42,16 @@
3242
end
3343
end
3444
end
45+
46+
column do
47+
panel "Recent Petitions" do
48+
ul do
49+
Petition.last(5).map do |petition|
50+
li "#{petition.user} #{glyph(:arrow_right)} #{petition.organization}".html_safe
51+
end
52+
end
53+
end
54+
end
3555
end
3656
end
3757
end

app/admin/document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
render_translations(t.title_translations)
2121
end
2222
row :content_translations do
23-
render_translations(t.content_translations, "<br>")
23+
render_translations(t.content_translations, "<hr>")
2424
end
2525
end
2626
end

app/admin/organization.rb

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
11
ActiveAdmin.register Organization do
22
index do
33
id_column
4-
column :name
4+
column :name do |organization|
5+
output = tag.p organization.name
6+
7+
if organization.logo.attached?
8+
output << image_tag(organization.logo.variant(resize: "40^x"))
9+
end
10+
11+
output.html_safe
12+
end
513
column :created_at do |organization|
614
l organization.created_at.to_date, format: :long
715
end
816
column :city
917
column :neighborhood
1018
column :email
1119
column :phone
20+
column :members do |organization|
21+
organization.members.count
22+
end
23+
column :posts do |organization|
24+
organization.posts.count
25+
end
1226
actions
1327
end
1428

29+
show do
30+
div do
31+
if organization.logo.attached?
32+
image_tag(organization.logo.variant(resize: "100^x"))
33+
end
34+
end
35+
default_main_content
36+
end
37+
1538
form do |f|
1639
f.inputs do
1740
f.input :name
@@ -23,6 +46,7 @@
2346
f.input :address
2447
f.input :description
2548
f.input :public_opening_times
49+
f.input :logo, as: :file
2650
end
2751
f.actions
2852
end
@@ -47,5 +71,5 @@ def destroy
4771
filter :neighborhood
4872

4973
permit_params :name, :email, :web, :phone, :city, :neighborhood,
50-
:address, :description, :public_opening_times
74+
:address, :description, :public_opening_times, :logo
5175
end

app/admin/petition.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
column :user
77
column :organization
88
column :created_at
9-
column :status
9+
column :status do |petition|
10+
petition.status.upcase
11+
end
1012
end
1113

1214
filter :status, as: :select, collection: -> { Petition.statuses }

app/admin/user.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
column :organizations do |u|
2424
u.organizations.map(&:to_s).join(", ")
2525
end
26+
column :posts do |u|
27+
u.posts.count
28+
end
2629
actions
2730
end
2831

@@ -31,6 +34,7 @@
3134
filter :username
3235
filter :phone
3336
filter :postcode
37+
filter :locale
3438

3539
form do |f|
3640
f.semantic_errors *f.object.errors.keys
@@ -40,9 +44,10 @@
4044
f.input :phone
4145
f.input :postcode
4246
f.input :gender, as: :select, collection: User::GENDERS
47+
f.input :locale, as: :select, collection: I18n.available_locales
4348
end
4449
f.inputs "Memberships" do
45-
f.has_many :members do |m|
50+
f.has_many :members, allow_destroy: true do |m|
4651
m.input :organization, collection: Organization.order(id: :asc).pluck(:name, :id)
4752
m.input :active
4853
m.input :manager
@@ -78,6 +83,6 @@
7883
end
7984
end
8085

81-
permit_params :username, :email, :phone, :postcode, :gender,
82-
members_attributes: [:organization_id, :active, :manager]
86+
permit_params :username, :email, :phone, :postcode, :gender, :locale,
87+
members_attributes: [:id, :organization_id, :active, :manager, :_destroy]
8388
end

app/assets/javascripts/application.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,12 @@ $(document).on('click', 'a[data-popup]', function(event) {
99
$(document).on('click', 'span.show-password', function(event) {
1010
event.preventDefault();
1111

12-
var inputType = 'text';
13-
var icon = 'visibility_off';
12+
var input = $(this).prev('input');
13+
var icon = $(this).find('.glyphicon');
1414

15-
if ($(this).hasClass('checked')) {
16-
$(this).removeClass('checked');
17-
inputType = 'password';
18-
icon = 'visibility';
19-
} else {
20-
$(this).addClass('checked');
21-
}
22-
23-
$(this).prev('input').attr('type', inputType);
24-
$(this).find('.material-icons').html(icon);
15+
$(input).attr('type', input[0].type === 'password' ? 'text' : 'password');
16+
$(icon).toggleClass('glyphicon-eye-close');
17+
$(icon).toggleClass('glyphicon-eye-open');
2518
});
2619

2720
$(function() {

app/assets/stylesheets/active_admin.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@ $table-stripe-color: #f5f5f5;
88
@import "bootstrap-sprockets";
99
@import "bootstrap/variables";
1010
@import "bootstrap/glyphicons";
11+
12+
.global_stats_panel div {
13+
display: flex;
14+
justify-content: space-between;
15+
align-items: baseline;
16+
gap: 5px;
17+
font-size: 18px;
18+
19+
b {
20+
font-size: 20px;
21+
}
22+
}

0 commit comments

Comments
 (0)