Skip to content

Commit e0de73a

Browse files
authored
Merge branch 'master' into followup-template
2 parents f92e60f + b48d936 commit e0de73a

119 files changed

Lines changed: 1258 additions & 533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Docker.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ To simplify set up of a developement environment, LinuxFr.org can be
55
run on Docker with `docker-compose up`.
66

77
To init the SQL database schema, you need to wait upto the `database`
8-
and `database-test` containers are ready to listen MySQL connections.
8+
container to be ready to listen MySQL connections.
99

1010
For example, you should see in the logs:
1111

12-
> database-test_1 | 2020-09-21 16:03:12 140126029907968 [Note] mysqld: ready for connections.
13-
>
14-
> database-test_1 | Version: '10.1.46-MariaDB-1\~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
15-
>
1612
> database_1 | 2020-09-21 16:03:12 139820938893312 [Note] mysqld: ready for connections.
1713
>
1814
> database_1 | Version: '10.1.46-MariaDB-1\~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
@@ -26,9 +22,12 @@ docker-compose run linuxfr.org bin/rails db:setup
2622
Finally, the environment is ready and you can open [http://dlfp.lo](http://dlfp.lo)
2723
in your favorite browser.
2824

29-
Note: to be able to access this URL, you'll need to add the line
30-
`127.0.0.1 dlfp.lo image.dlfp.lo` to the `/etc/hosts` file of your
31-
machine.
25+
Note: to be able to access this URL, you'll need to add the following line
26+
into the `/etc/hosts` file of your machine:
27+
28+
```
29+
127.0.0.1 dlfp.lo image.dlfp.lo
30+
```
3231

3332
Personalize configuration
3433
=========================
@@ -62,19 +61,39 @@ will directly detect changes and apply them on next page reload.
6261
Furthermore, if you need to access the Rails console, you need a second
6362
terminal and run:
6463

65-
`docker-compose run linuxfr.org bin/rails console`
64+
```
65+
docker-compose run linuxfr.org bin/rails console
66+
```
6667

6768
Note: currently, we didn't configure rails to show directly the
6869
`webconsole` in your browser. That's just because of time needed to
6970
find the good configuration, any help will be appreciated !
7071

72+
Run application tests
73+
=====================
74+
75+
To help maintainers, we are in the process of adding tests to check the
76+
application has still the expected behaviour.
77+
78+
To get help about writing tests, see the
79+
[Ruby on Rails documentation](https://guides.rubyonrails.org/testing.html#the-rails-test-runner)
80+
.
81+
82+
To run tests with Docker environment, you need to use this command:
83+
84+
```
85+
docker-compose run linuxfr.org bin/rails test -v
86+
```
87+
7188
Inspect database schema
7289
=======================
7390

7491
In case you need to inspect the database, you need a second terminal
7592
and run:
7693

77-
`docker-compose run database mysql -hdatabase -ulinuxfr_rails -p linuxfr_rails`
94+
```
95+
docker-compose run database mysql -hdatabase -ulinuxfr_rails -p linuxfr_rails
96+
```
7897

7998
By default, the requested password is the same as the username.
8099

@@ -84,12 +103,16 @@ Apply database migrations
84103
In case you need to apply new database migrations, you need a second
85104
terminal and run:
86105

87-
`docker-compose run linuxfr.org bin/rails db:migrate`
106+
```
107+
docker-compose run linuxfr.org bin/rails db:migrate
108+
```
88109

89110
If you had issue and want to reset all data in your database system,
90111
use:
91112

92-
`docker-compose run linuxfr.org bin/rails db:reset`
113+
```
114+
docker-compose run linuxfr.org bin/rails db:reset
115+
```
93116

94117
Services provided by the docker-compose
95118
=======================================

Gemfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ gem "sass-rails", "~>5.0", require: assets
4545
gem "rails-sass-images", require: assets
4646
gem "uglifier", require: assets
4747

48+
group :development, :test do
49+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
50+
gem "byebug", platforms: :mri
51+
end
52+
4853
group :development do
4954
gem "annotate"
5055
gem "better_errors"
5156
gem "binding_of_caller"
52-
gem "byebug", platform: :mri
5357
gem "capistrano", "~>2.15", github: 'capistrano', branch: 'legacy-v2'
5458
gem "capistrano-maintenance"
5559
gem "letter_opener"
@@ -62,6 +66,12 @@ group :development do
6266
gem "web-console"
6367
end
6468

69+
group :test do
70+
# Adds support for Capybara system testing and selenium driver
71+
gem "capybara", ">= 2.15"
72+
gem "selenium-webdriver"
73+
end
74+
6575
group :production, :alpha do
6676
gem "unicorn", "~>5.1"
6777
gem "gctools", "~>0.2"

INSTALL.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,24 @@ server {
176176
177177
listen 0.0.0.0:80;
178178
179-
location ~ ^/(avatars|medias)/ {
179+
location ~ ^/medias/ {
180180
root /home/linuxfr/linuxfr.org/uploads;
181181
}
182182
183-
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
183+
# Avatars files uploaded on linuxfr server are stored in partitions
184+
# with folder name containing 3 digits
185+
location ~ ^/avatars/\d\d\d/ {
186+
root /home/linuxfr/linuxfr.org/uploads;
187+
}
188+
189+
# Avatars URLs has to be served by the image service
190+
location ~ ^/avatars/ {
191+
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
192+
proxy_pass http://localhost:8000;
193+
}
194+
184195
location /img/ {
196+
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
185197
proxy_pass http://localhost:8000;
186198
}
187199

app/assets/javascripts/application.coffee

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ $("textarea, #form_answers input").keypress (event) ->
3434
# Add/Remove dynamically links in the news form
3535
langs =
3636
fr: "Français"
37-
en: "Anglais"
3837
de: "Allemand"
38+
en: "Anglais"
3939
eu: "Basque"
4040
ct: "Catalan"
4141
cn: "Chinois"
4242
ko: "Coréen"
4343
da: "Danois"
4444
es: "Espagnol"
45+
ee: "Estonien"
4546
fi: "Finnois"
4647
el: "Grec"
4748
it: "Italien"
@@ -53,6 +54,7 @@ langs =
5354
ru: "Russe"
5455
sv: "Suédois"
5556
xx: "!? hmmm ?!"
57+
wq: "Code/binaire"
5658

5759
$("#form_links").nested_fields "news", "link", "lien", "fieldset", title: "text", url: "url", lang: langs
5860
$("#form_answers").nested_fields "poll", "answer", "choix", "p", answer: "text"
@@ -63,7 +65,7 @@ $("article.news .edited_by").each ->
6365
nb = field.find("a").length
6466
if nb > 3
6567
was = field.html()
66-
field.html "<a>#{nb} contributeurs</a>"
68+
field.html "<a>#{nb} personnes</a>"
6769
field.one "click", -> field.html was
6870

6971
# Toolbar preferences

app/assets/javascripts/edition_in_place.coffee

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ class EditionInPlace
4242
false
4343

4444
error: =>
45+
try
46+
error = @el.find("ul.error")
47+
response = $.parseJSON(@xhr.responseText)
48+
messages = []
49+
for attribute, errors of response.errors
50+
for message in errors
51+
messages.push(message)
52+
if messages.length == 1
53+
error.text("Erreur : " + messages[0])
54+
else
55+
error.text("Erreurs :")
56+
for message in messages
57+
error.append($("<li>").append(message))
58+
error.show()
4559
@el.trigger "in_place:error", @xhr
4660
@xhr = null
4761

app/assets/stylesheets/common/generics.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@
4040
#edition img[alt=""] {
4141
border: 3px dotted red;
4242
}
43+
44+
textarea {
45+
hyphens: none;
46+
}

app/assets/stylesheets/parts/content.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ body#news-revision #contents,
1414
body#boards-show #contents,
1515
body#stylesheets-edit #contents,
1616
body#wiki_pages-changes #contents,
17-
body#admin-index #container > ul {
17+
body#admin-index #container > ul,
18+
#redaction #new_link,
19+
#redaction .edit_link {
1820
display: block;
1921
background: white;
2022
padding: 10px $PX_PAD_NODE 10px $PX_PAD_NODE;

app/assets/stylesheets/parts/redaction.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,10 @@ body#redaction-index {
503503
}
504504
}
505505
}
506+
#new_link,
507+
.edit_link {
508+
padding: 5px;
509+
}
506510
input#link_title {
507511
width: 100%; // this rule force the input to not enlarge the #edition flex box
508512
}

app/controllers/admin/accounts_controller.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def update
4848
else
4949
@account.inactivate!
5050
user = @account.user
51-
user.homesite = ""
51+
user.homesite = nil
52+
user.jabber_id = nil
53+
user.mastodon_url = nil
5254
user.save
5355
Board.amr_notification("Le compte #{@account.login} #{user_url @account.login} a été désactivé par #{current_user.name} #{user_url(current_user)}")
5456
redirect_back notice: "Compte désactivé", fallback_location: admin_accounts_url
@@ -58,7 +60,9 @@ def update
5860
def destroy
5961
@account.inactivate!
6062
user = @account.user
61-
user.homesite = ""
63+
user.homesite = nil
64+
user.jabber_id = nil
65+
user.mastodon_url = nil
6266
user.save
6367
Board.amr_notification("Le compte #{@account.login} #{user_url @account.login} a été désactivé par #{current_user.name} #{user_url(current_user)}")
6468
redirect_to admin_accounts_url, notice: "Compte désactivé"

app/controllers/application_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def seo_filter
3737
@keywords = %w(Linux Logiciel Libre GNU Free Software Actualité Forum Communauté)
3838
@description = "L’actualité du logiciel libre et des sujets voisins (DIY, Open Hardware, Open Data, les Communs, etc.), sur un site francophone contributif géré par une équipe bénévole par et pour des libristes enthousiastes"
3939
@feeds = {}
40+
@links = {}
4041
@last_comments = Comment.footer
4142
@popular_tags = Tag.footer
4243
@friend_sites = FriendSite.select([:url, :title])
@@ -56,7 +57,7 @@ def configure_permitted_parameters
5657
:sort_by_date_on_home, :hide_signature, :show_negative_nodes,
5758
:totoz_style, :totoz_source,
5859
:board_in_sidebar,
59-
user_attributes: [:id, :name, :homesite, :jabber_id, :signature, :avatar, :custom_avatar_url]
60+
user_attributes: [:id, :name, :homesite, :jabber_id, :mastodon_url, :signature, :avatar, :custom_avatar_url]
6061
])
6162
end
6263

0 commit comments

Comments
 (0)