thredded 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +69 -23
- data/app/assets/javascripts/thredded/components/post_form.es6 +4 -4
- data/app/assets/javascripts/thredded/components/quote_post.es6 +45 -0
- data/app/assets/javascripts/thredded/components/topic_form.es6 +4 -4
- data/app/assets/javascripts/thredded/core/on_page_load.es6 +8 -0
- data/app/assets/javascripts/thredded/dependencies.js +1 -1
- data/app/assets/stylesheets/thredded/_base.scss +1 -0
- data/app/assets/stylesheets/thredded/_email.scss +2 -3
- data/app/assets/stylesheets/thredded/base/_dropdown-menu.scss +83 -0
- data/app/assets/stylesheets/thredded/components/_post.scss +5 -60
- data/app/assets/stylesheets/thredded/components/_preferences.scss +17 -4
- data/app/assets/stylesheets/thredded/layout/_main-navigation.scss +4 -1
- data/app/assets/stylesheets/thredded/layout/_search-navigation.scss +31 -6
- data/app/assets/stylesheets/thredded/layout/_user-navigation.scss +1 -0
- data/app/controllers/concerns/thredded/new_post_params.rb +20 -0
- data/app/controllers/concerns/thredded/new_private_post_params.rb +20 -0
- data/app/controllers/thredded/application_controller.rb +6 -0
- data/app/controllers/thredded/posts_controller.rb +28 -13
- data/app/controllers/thredded/preferences_controller.rb +1 -0
- data/app/controllers/thredded/private_posts_controller.rb +30 -12
- data/app/controllers/thredded/private_topics_controller.rb +11 -1
- data/app/controllers/thredded/theme_previews_controller.rb +4 -2
- data/app/controllers/thredded/topics_controller.rb +36 -3
- data/app/forms/thredded/post_form.rb +52 -0
- data/app/forms/thredded/private_post_form.rb +48 -0
- data/app/forms/thredded/private_topic_form.rb +8 -0
- data/app/forms/thredded/topic_form.rb +8 -0
- data/app/forms/thredded/user_preferences_form.rb +7 -1
- data/app/helpers/thredded/urls_helper.rb +18 -0
- data/app/models/thredded/topic.rb +3 -3
- data/app/policies/thredded/post_policy.rb +1 -1
- data/app/policies/thredded/private_topic_policy.rb +1 -1
- data/app/view_hooks/thredded/all_view_hooks.rb +3 -0
- data/app/view_models/thredded/messageboard_group_view.rb +1 -1
- data/app/view_models/thredded/post_view.rb +19 -3
- data/app/view_models/thredded/private_topic_view.rb +0 -4
- data/app/view_models/thredded/topic_view.rb +0 -4
- data/app/views/thredded/moderation/_users_search_form.html.erb +1 -1
- data/app/views/thredded/moderation/user.html.erb +13 -11
- data/app/views/thredded/moderation/users.html.erb +1 -0
- data/app/views/thredded/posts/_form.html.erb +0 -2
- data/app/views/thredded/posts/edit.html.erb +2 -5
- data/app/views/thredded/posts/new.html.erb +15 -0
- data/app/views/thredded/posts_common/_actions.html.erb +3 -0
- data/app/views/thredded/posts_common/_form.html.erb +5 -3
- data/app/views/thredded/posts_common/_header.html.erb +3 -1
- data/app/views/thredded/posts_common/actions/_quote.html.erb +4 -0
- data/app/views/thredded/preferences/_form.html.erb +3 -5
- data/app/views/thredded/preferences/_messageboards_nav.html.erb +8 -0
- data/app/views/thredded/preferences/_messageboards_nav_item.html.erb +2 -0
- data/app/views/thredded/preferences/edit.html.erb +13 -3
- data/app/views/thredded/private_posts/_form.html.erb +0 -2
- data/app/views/thredded/private_posts/edit.html.erb +2 -4
- data/app/views/thredded/private_posts/new.html.erb +11 -0
- data/app/views/thredded/private_topics/_form.html.erb +2 -2
- data/app/views/thredded/private_topics/index.html.erb +1 -2
- data/app/views/thredded/private_topics/new.html.erb +0 -1
- data/app/views/thredded/private_topics/show.html.erb +5 -3
- data/app/views/thredded/shared/_nav.html.erb +1 -7
- data/app/views/thredded/shared/nav/_notification_preferences.html.erb +1 -1
- data/app/views/thredded/shared/nav/_standalone.html.erb +4 -4
- data/app/views/thredded/shared/nav/_standalone_profile.html.erb +3 -0
- data/app/views/thredded/theme_previews/show.html.erb +3 -17
- data/app/views/thredded/topics/_form.html.erb +3 -2
- data/app/views/thredded/topics/index.html.erb +0 -2
- data/app/views/thredded/topics/new.html.erb +0 -2
- data/app/views/thredded/topics/search.html.erb +20 -2
- data/app/views/thredded/topics/show.html.erb +1 -3
- data/config/locales/en.yml +9 -5
- data/config/locales/es.yml +10 -6
- data/config/locales/pl.yml +9 -5
- data/config/locales/pt-BR.yml +9 -5
- data/config/locales/ru.yml +18 -10
- data/config/routes.rb +2 -0
- data/db/migrate/20160329231848_create_thredded.rb +1 -1
- data/db/upgrade_migrations/20170420163138_upgrade_thredded_v0_11_to_v0_12.rb +25 -0
- data/lib/generators/thredded/install/templates/initializer.rb +4 -4
- data/lib/thredded/content_formatter.rb +17 -3
- data/lib/thredded/html_pipeline/kramdown_filter.rb +1 -1
- data/lib/thredded/version.rb +1 -1
- data/lib/thredded.rb +13 -10
- data/vendor/assets/javascripts/autosize.js +290 -0
- metadata +31 -18
- data/app/views/thredded/preferences/_header.html.erb +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9da3f257731b6397128563a35788225046e8a589
|
|
4
|
+
data.tar.gz: fc0b9d0117acd6de8c6d21fa1d3ff629e3e463e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d811130638a892c28e07b2065f05b0c8e6edd8d2aabea59691dd0f5653424818978fd4bb2d0676875aa85110e9b58bacda911efc60c26ce4dd5bb53fefa306c6
|
|
7
|
+
data.tar.gz: b78b12a3e681153c4b82363b6334a5c09648e86910f17f8d997e4f53dac0cd84555a3141c83d7da20f885b4b532a385913703ad6ff8a36982cc7c4ecc91636d1
|
data/README.md
CHANGED
|
@@ -33,6 +33,49 @@ application and not an engine like Thredded.
|
|
|
33
33
|
|
|
34
34
|
[Discourse]: http://www.discourse.org/
|
|
35
35
|
|
|
36
|
+
Table of Contents
|
|
37
|
+
=================
|
|
38
|
+
|
|
39
|
+
* [Installation](#installation)
|
|
40
|
+
* [Creating a new Rails app with Thredded](#creating-a-new-rails-app-with-thredded)
|
|
41
|
+
* [Adding Thredded to an existing Rails app](#adding-thredded-to-an-existing-rails-app)
|
|
42
|
+
* [Upgrading an existing install](#upgrading-an-existing-install)
|
|
43
|
+
* [Migrating from Forem](#migrating-from-forem)
|
|
44
|
+
* [Views and other assets](#views-and-other-assets)
|
|
45
|
+
* [Standalone layout](#standalone-layout)
|
|
46
|
+
* [Application layout](#application-layout)
|
|
47
|
+
* [Reference your paths so that Thredded can find them](#reference-your-paths-so-that-thredded-can-find-them)
|
|
48
|
+
* [Add Thredded styles](#add-thredded-styles)
|
|
49
|
+
* [Add Thredded JavaScripts](#add-thredded-javascripts)
|
|
50
|
+
* [jQuery version](#jquery-version)
|
|
51
|
+
* [User profile page](#user-profile-page)
|
|
52
|
+
* [Customizing views](#customizing-views)
|
|
53
|
+
* [View hooks](#view-hooks)
|
|
54
|
+
* [Theming](#theming)
|
|
55
|
+
* [Styles](#styles)
|
|
56
|
+
* [Email and other notifications](#email-and-other-notifications)
|
|
57
|
+
* [Enabling auto-follow](#enabling-auto-follow)
|
|
58
|
+
* [I18n](#i18n)
|
|
59
|
+
* [Permissions](#permissions)
|
|
60
|
+
* [Permission methods](#permission-methods)
|
|
61
|
+
* [Reading messageboards](#reading-messageboards)
|
|
62
|
+
* [Posting to messageboards](#posting-to-messageboards)
|
|
63
|
+
* [Messaging other users (posting to private topics)](#messaging-other-users-posting-to-private-topics)
|
|
64
|
+
* [Moderating messageboards](#moderating-messageboards)
|
|
65
|
+
* [Admin permissions](#admin-permissions)
|
|
66
|
+
* [Default permissions](#default-permissions)
|
|
67
|
+
* [Handling "Permission denied" and "Not found" errors](#handling-permission-denied-and-not-found-errors)
|
|
68
|
+
* [Moderation](#moderation)
|
|
69
|
+
* [Disabling moderation](#disabling-moderation)
|
|
70
|
+
* [Plugins](#plugins)
|
|
71
|
+
* [Development](#development)
|
|
72
|
+
* [Testing](#testing)
|
|
73
|
+
* [Ruby](#ruby)
|
|
74
|
+
* [JavaScript](#javascript)
|
|
75
|
+
* [Testing with all the databases and Rails versions locally.](#testing-with-all-the-databases-and-rails-versions-locally)
|
|
76
|
+
* [Developing and Testing with Docker Compose](#developing-and-testing-with-docker-compose)
|
|
77
|
+
|
|
78
|
+
|
|
36
79
|
## Installation
|
|
37
80
|
|
|
38
81
|
### Creating a new Rails app with Thredded
|
|
@@ -56,7 +99,7 @@ Then, see the rest of this Readme for more information about using and customizi
|
|
|
56
99
|
Add the gem to your Gemfile:
|
|
57
100
|
|
|
58
101
|
```ruby
|
|
59
|
-
gem 'thredded', '~> 0.
|
|
102
|
+
gem 'thredded', '~> 0.12.0'
|
|
60
103
|
```
|
|
61
104
|
|
|
62
105
|
Add the Thredded [initializer] to your parent app by running the install generator.
|
|
@@ -105,11 +148,11 @@ rails g thredded:install
|
|
|
105
148
|
|
|
106
149
|
But then compare this with the previous version to decide what to keep.
|
|
107
150
|
|
|
108
|
-
2) To upgrade the database (in this example from v0.
|
|
151
|
+
2) To upgrade the database (in this example from v0.10 to v0.11):
|
|
109
152
|
|
|
110
153
|
```console
|
|
111
|
-
# Note that for guaranteed best results you will want to run this with the gem checked out with v0.
|
|
112
|
-
cp `bundle show thredded`/db/upgrade_migrations/
|
|
154
|
+
# Note that for guaranteed best results you will want to run this with the gem checked out with v0.11
|
|
155
|
+
cp `bundle show thredded`/db/upgrade_migrations/20170312131417_upgrade_thredded_v0_10_to_v0_11.rb db/migrate
|
|
113
156
|
rake db:migrate
|
|
114
157
|
```
|
|
115
158
|
|
|
@@ -150,9 +193,6 @@ In your layout you will probably have links to other paths in your app (e.g. nav
|
|
|
150
193
|
For any url helpers (like `users_path` or `projects_path` or whatever) will need to have `main_app.`
|
|
151
194
|
prefixed to them so that they can be found from thredded (`main_app.users_path` will work from both thredded and your app).
|
|
152
195
|
|
|
153
|
-
However if you don't want to update your layouts and partials, you can define methods automatically to delegate to the main_app's routes:
|
|
154
|
-
See https://gist.github.com/timdiggins/bf6d09b28828a392198562c93554ad07.
|
|
155
|
-
|
|
156
196
|
#### Add Thredded styles
|
|
157
197
|
|
|
158
198
|
In this case, you will also need to include Thredded styles and JavaScript into the application styles and JavaScript.
|
|
@@ -261,13 +301,13 @@ To see the complete list of view hooks and their arguments, run:
|
|
|
261
301
|
grep view_hooks -R --include '*.html.erb' "$(bundle show thredded)"
|
|
262
302
|
```
|
|
263
303
|
|
|
264
|
-
|
|
304
|
+
### Theming
|
|
265
305
|
|
|
266
306
|
The engine comes by default with a light and effective implementation of the
|
|
267
307
|
views, styles, and javascript. Once you mount the engine you will be presented
|
|
268
308
|
with a "themed" version of thredded.
|
|
269
309
|
|
|
270
|
-
|
|
310
|
+
#### Styles
|
|
271
311
|
|
|
272
312
|
Thredded comes with a light Sass theme controlled by a handful of variables that can be found here:
|
|
273
313
|
https://github.com/thredded/thredded/blob/master/app/assets/stylesheets/thredded/base/_variables.scss.
|
|
@@ -307,8 +347,18 @@ If you use [Rails Email Preview], you can include Thredded emails into the list
|
|
|
307
347
|
|
|
308
348
|
[Rails Email Preview]: https://github.com/glebm/rails_email_preview
|
|
309
349
|
|
|
310
|
-
You can also turn off the email notifier totally, or add other notifiers (e.g. Pushover, possibly Slack) by adjusting
|
|
311
|
-
`Thredded.notifiers` configuration in your initializer. See the default initializer for examples.
|
|
350
|
+
You can also turn off the email notifier totally, or add other notifiers (e.g. Pushover, possibly Slack) by adjusting
|
|
351
|
+
the `Thredded.notifiers` configuration in your initializer. See the default initializer for examples.
|
|
352
|
+
|
|
353
|
+
### Enabling auto-follow
|
|
354
|
+
|
|
355
|
+
In some cases, you'll want all users to auto-follow new messageboard topics by default. This might be useful
|
|
356
|
+
for a team messageboard or a company announcements board, for example. To enable user auto-follow of new topics,
|
|
357
|
+
run the following migration(s):
|
|
358
|
+
|
|
359
|
+
```ruby
|
|
360
|
+
change_column_default :thredded_user_preferences, :auto_follow_topics, 1
|
|
361
|
+
```
|
|
312
362
|
|
|
313
363
|
## I18n
|
|
314
364
|
|
|
@@ -318,7 +368,7 @@ We welcome PRs adding support for new languages.
|
|
|
318
368
|
|
|
319
369
|
Here are the steps to ensure the best support for your language if it isn't English:
|
|
320
370
|
|
|
321
|
-
1. Add `rails-i18n` to your Gemfile.
|
|
371
|
+
1. Add `rails-i18n` and `kaminari-i18n` to your Gemfile.
|
|
322
372
|
|
|
323
373
|
2. Require the translations for rails-timeago in your JavaScript before `thredded` but after `jquery.timeago`
|
|
324
374
|
(included in `thredded/dependencies`). E.g. for Brazilian Portuguese:
|
|
@@ -504,16 +554,6 @@ To disable moderation, e.g. if you run internal forums that do not need moderati
|
|
|
504
554
|
change_column_default :thredded_user_details, :moderation_state, 1 # approved
|
|
505
555
|
```
|
|
506
556
|
|
|
507
|
-
### Enabling auto-follow
|
|
508
|
-
|
|
509
|
-
In some cases, you'll want all users to auto-follow new messageboard topics by default. This might be useful
|
|
510
|
-
for a team messageboard or a company announcements board, for example. To enable user auto-follow of new topics,
|
|
511
|
-
run the following migration(s):
|
|
512
|
-
|
|
513
|
-
```ruby
|
|
514
|
-
change_column_default :thredded_user_preferences, :auto_follow_topics, 1
|
|
515
|
-
```
|
|
516
|
-
|
|
517
557
|
## Plugins
|
|
518
558
|
|
|
519
559
|
The following official plugins are available for Thredded:
|
|
@@ -544,12 +584,18 @@ Then, start the dummy app server:
|
|
|
544
584
|
rake dev:server
|
|
545
585
|
```
|
|
546
586
|
|
|
587
|
+
### Testing
|
|
588
|
+
|
|
547
589
|
To run the tests, just run `rspec`. The test suite will re-create the test database on every run, so there is no need to
|
|
548
590
|
run tasks that maintain the test database.
|
|
549
591
|
|
|
550
592
|
By default, SQLite is used in development and test. On Travis, the tests will run using SQLite, PostgreSQL, MySQL,
|
|
551
593
|
and all the supported Rails versions.
|
|
552
594
|
|
|
595
|
+
The test suite requires [PhantomJS](http://phantomjs.org) to be present in the path.
|
|
596
|
+
To install it, run `sudo apt-get install phantomjs` on Ubuntu or Debian, or `brew install phantomjs` on Mac.
|
|
597
|
+
For other operating systems, refer to the [PhantomJS documentation](http://phantomjs.org/download.html).
|
|
598
|
+
|
|
553
599
|
### Ruby
|
|
554
600
|
|
|
555
601
|
Thredded Ruby code formatting is ensured by [Rubocop](https://github.com/bbatsov/rubocop). Run `rubocop -a` to ensure a
|
|
@@ -635,7 +681,7 @@ To test all combinations of supported databases and Rails versions, run:
|
|
|
635
681
|
rake test_all
|
|
636
682
|
```
|
|
637
683
|
|
|
638
|
-
|
|
684
|
+
### Developing and Testing with [Docker Compose](http://docs.docker.com/compose/)
|
|
639
685
|
|
|
640
686
|
To quickly try out _Thredded_ with the included dummy app, clone the source and
|
|
641
687
|
start the included docker-compose.yml file with:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//= require ./preview_area
|
|
2
2
|
|
|
3
|
-
((
|
|
3
|
+
(($, autosize) => {
|
|
4
4
|
const COMPONENT_SELECTOR = '[data-thredded-post-form]';
|
|
5
5
|
|
|
6
6
|
class ThreddedPostForm {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
autosize($textarea) {
|
|
21
|
-
$textarea
|
|
21
|
+
autosize($textarea)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
destroy($nodes) {
|
|
25
|
-
$nodes.find(this.textareaSelector)
|
|
25
|
+
autosize.destroy($nodes.find(this.textareaSelector));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
new ThreddedPostForm().destroy($nodes);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
})(jQuery);
|
|
42
|
+
})(jQuery, window.autosize);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
window.Thredded.onPageLoad(() => {
|
|
3
|
+
Array.prototype.forEach.call(document.querySelectorAll('[data-thredded-quote-post]'), (el) => {
|
|
4
|
+
el.addEventListener('click', onClick);
|
|
5
|
+
});
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function onClick(evt) {
|
|
9
|
+
// Handle only left clicks with no modifier keys
|
|
10
|
+
if (evt.button !== 0 || evt.ctrlKey || evt.altKey || evt.metaKey || evt.shiftKey) return;
|
|
11
|
+
evt.preventDefault();
|
|
12
|
+
const target = document.getElementById('post_content');
|
|
13
|
+
target.scrollIntoView();
|
|
14
|
+
target.value = '...';
|
|
15
|
+
fetchReply(evt.target.getAttribute('data-thredded-quote-post'), (replyText) => {
|
|
16
|
+
if (!target.ownerDocument.body.contains(target)) return;
|
|
17
|
+
target.focus();
|
|
18
|
+
target.value = replyText;
|
|
19
|
+
|
|
20
|
+
const autosizeUpdateEvent = document.createEvent('Event');
|
|
21
|
+
autosizeUpdateEvent.initEvent('autosize:update', true, false);
|
|
22
|
+
target.dispatchEvent(autosizeUpdateEvent);
|
|
23
|
+
// Scroll into view again as the size might have changed.
|
|
24
|
+
target.scrollIntoView();
|
|
25
|
+
}, (errorMessage) => {
|
|
26
|
+
target.value = errorMessage;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function fetchReply(url, onSuccess, onError) {
|
|
31
|
+
const request = new XMLHttpRequest();
|
|
32
|
+
request.open('GET', url, /* async */ true);
|
|
33
|
+
request.onload = () => {
|
|
34
|
+
if (request.status >= 200 && request.status < 400) {
|
|
35
|
+
onSuccess(request.responseText);
|
|
36
|
+
} else {
|
|
37
|
+
onError(`Error (${request.status}): ${request.statusText} ${request.responseText}`);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
request.onerror = () => {
|
|
41
|
+
onError('Network Error');
|
|
42
|
+
};
|
|
43
|
+
request.send();
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
((
|
|
1
|
+
(($, autosize) => {
|
|
2
2
|
const COMPONENT_SELECTOR = '[data-thredded-topic-form]';
|
|
3
3
|
class ThreddedTopicForm {
|
|
4
4
|
constructor() {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
init($nodes) {
|
|
18
|
-
$nodes.find(this.textareaSelector)
|
|
18
|
+
autosize($nodes.find(this.textareaSelector));
|
|
19
19
|
$nodes.each(function() {
|
|
20
20
|
new ThreddedPreviewArea($(this));
|
|
21
21
|
});
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
destroy($nodes) {
|
|
50
|
-
$nodes.find(this.textareaSelector)
|
|
50
|
+
autosize.destroy($nodes.find(this.textareaSelector));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -64,6 +64,6 @@
|
|
|
64
64
|
new ThreddedTopicForm().destroy($nodes);
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
})(jQuery);
|
|
67
|
+
})(jQuery, window.autosize);
|
|
68
68
|
|
|
69
69
|
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
if (isTurbolinks5) {
|
|
29
|
+
// In Turbolinks 5.0.1, turbolinks:load may have already fired (before DOMContentLoaded).
|
|
30
|
+
// If so, add our own DOMContentLoaded listener:
|
|
31
|
+
// See: https://github.com/turbolinks/turbolinks/commit/69d353ea73d10ee6b25c2866fc5706879ba403e3
|
|
32
|
+
if (window.Turbolinks.controller.lastRenderedLocation) {
|
|
33
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
34
|
+
triggerOnPageLoad();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
29
37
|
document.addEventListener('turbolinks:load', () => {
|
|
30
38
|
triggerOnPageLoad();
|
|
31
39
|
});
|
|
@@ -21,14 +21,13 @@
|
|
|
21
21
|
margin: 0;
|
|
22
22
|
|
|
23
23
|
&--author {
|
|
24
|
-
margin-bottom:
|
|
24
|
+
margin-bottom: 2px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.thredded--post--content {
|
|
28
28
|
font-size: inherit;
|
|
29
|
-
border-left: solid 5px $thredded-blockquote-border-color;
|
|
30
29
|
margin: 0 0 0.75rem;
|
|
31
|
-
padding:
|
|
30
|
+
padding-left: 0;
|
|
32
31
|
|
|
33
32
|
.onebox-wrapper-table {
|
|
34
33
|
width: 100%;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
%thredded--dropdown-menu--container {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
|
|
6
|
+
&:hover {
|
|
7
|
+
%thredded--dropdown-menu--toggle {
|
|
8
|
+
color: $thredded-action-hover-color;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
%thredded--dropdown-menu--actions {
|
|
12
|
+
transform: scale(1);
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
%thredded--dropdown-menu--toggle {
|
|
19
|
+
color: $thredded-action-color;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
%thredded--dropdown-menu--actions {
|
|
23
|
+
position: absolute;
|
|
24
|
+
background-color: $thredded-overlay-background-color;
|
|
25
|
+
border-radius: 2px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
min-width: 8.5rem;
|
|
28
|
+
z-index: 3;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
box-shadow: $thredded-overlay-box-shadow;
|
|
31
|
+
transform: scale(0);
|
|
32
|
+
opacity: 0;
|
|
33
|
+
transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .2s cubic-bezier(.4, 0, .2, 1);
|
|
34
|
+
will-change: transform;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
%thredded--dropdown-menu--actions-bottom-left {
|
|
38
|
+
@extend %thredded--dropdown-menu--actions;
|
|
39
|
+
right: 0;
|
|
40
|
+
transform-origin: 100% 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
%thredded--dropdown-menu--actions-bottom-right {
|
|
44
|
+
@extend %thredded--dropdown-menu--actions;
|
|
45
|
+
left: 0;
|
|
46
|
+
transform-origin: 0 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
%thredded--dropdown-menu--actions--item,
|
|
50
|
+
// This specific selector protects from global button rules
|
|
51
|
+
form.button_to > %thredded--dropdown-menu--actions--item {
|
|
52
|
+
// Override potential global rules
|
|
53
|
+
background: none;
|
|
54
|
+
border-radius: 0;
|
|
55
|
+
border: 0;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
font: inherit;
|
|
58
|
+
margin: 0;
|
|
59
|
+
text-align: left;
|
|
60
|
+
transition: none;
|
|
61
|
+
width: 100%;
|
|
62
|
+
|
|
63
|
+
font-size: $thredded-font-size-small;
|
|
64
|
+
color: $thredded-text-color;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
padding: 1rem 0.75rem;
|
|
67
|
+
display: block;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
|
|
70
|
+
&:active,
|
|
71
|
+
&:focus,
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: $thredded-button-background;
|
|
74
|
+
color: $thredded-button-color;
|
|
75
|
+
text-decoration: none;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:active,
|
|
80
|
+
&:focus {
|
|
81
|
+
outline: none;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.thredded--post--dropdown--toggle {
|
|
10
|
+
@extend %thredded--dropdown-menu--toggle;
|
|
10
11
|
fill: currentColor;
|
|
11
12
|
box-sizing: content-box;
|
|
12
13
|
color: $thredded-action-color;
|
|
@@ -22,76 +23,20 @@
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.thredded--post--dropdown {
|
|
25
|
-
|
|
26
|
-
display: inline-block;
|
|
26
|
+
@extend %thredded--dropdown-menu--container;
|
|
27
27
|
float: right;
|
|
28
|
-
cursor: pointer;
|
|
29
28
|
@media print {
|
|
30
29
|
display: none;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
.thredded--post--dropdown--actions {
|
|
35
|
-
|
|
34
|
+
@extend %thredded--dropdown-menu--actions-bottom-left;
|
|
36
35
|
margin-top: -0.875rem;
|
|
37
|
-
right: 0;
|
|
38
|
-
background-color: $thredded-overlay-background-color;
|
|
39
|
-
border-radius: 2px;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
min-width: 10rem;
|
|
42
|
-
z-index: 1;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
box-shadow: $thredded-overlay-box-shadow;
|
|
45
|
-
transform: scale(0);
|
|
46
|
-
opacity: 0;
|
|
47
|
-
transform-origin: 100% 0;
|
|
48
|
-
transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .2s cubic-bezier(.4, 0, .2, 1);
|
|
49
|
-
will-change: transform;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.thredded--post--dropdown--actions--item,
|
|
53
|
-
// This specific selector protects from global button rules
|
|
54
|
-
form.button_to > .thredded--post--dropdown--actions--item {
|
|
55
|
-
// Override potential global rules
|
|
56
|
-
background: none;
|
|
57
|
-
border-radius: 0;
|
|
58
|
-
border: 0;
|
|
59
|
-
box-sizing: border-box;
|
|
60
|
-
font: inherit;
|
|
61
|
-
margin: 0;
|
|
62
|
-
text-align: left;
|
|
63
|
-
transition: none;
|
|
64
|
-
width: 100%;
|
|
65
|
-
|
|
66
|
-
font-size: $thredded-font-size-small;
|
|
67
|
-
color: $thredded-text-color;
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
padding: 1rem 0.75rem;
|
|
70
|
-
display: block;
|
|
71
|
-
white-space: nowrap;
|
|
72
|
-
|
|
73
|
-
&:active,
|
|
74
|
-
&:focus,
|
|
75
|
-
&:hover {
|
|
76
|
-
background-color: $thredded-button-background;
|
|
77
|
-
color: $thredded-button-color;
|
|
78
|
-
text-decoration: none;
|
|
79
|
-
cursor: pointer;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&:active,
|
|
83
|
-
&:focus {
|
|
84
|
-
outline: none;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.thredded--post--dropdown:hover .thredded--post--dropdown--actions {
|
|
89
|
-
transform: scale(1);
|
|
90
|
-
opacity: 1;
|
|
91
36
|
}
|
|
92
37
|
|
|
93
|
-
.thredded--post--dropdown
|
|
94
|
-
|
|
38
|
+
.thredded--post--dropdown--actions--item {
|
|
39
|
+
@extend %thredded--dropdown-menu--actions--item;
|
|
95
40
|
}
|
|
96
41
|
|
|
97
42
|
.thredded--post--avatar {
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
.thredded--preferences
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.thredded--preferences--title {
|
|
2
|
+
@extend %thredded--heading;
|
|
3
|
+
font-size: 1.5rem; // 24px
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.thredded--preferences--form {
|
|
7
|
+
padding-bottom: $thredded-base-spacing;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.thredded--preferences--messageboards-nav {
|
|
11
|
+
border-top: $thredded-base-border;
|
|
12
|
+
padding-top: $thredded-base-spacing;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.thredded--preferences--messageboards-nav--item {
|
|
16
|
+
&.thredded--messageboard {
|
|
17
|
+
padding: $thredded-small-spacing;
|
|
5
18
|
}
|
|
6
19
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
.thredded--navigation--search {
|
|
2
|
-
|
|
2
|
+
$input-padding-x: 0.75rem;
|
|
3
|
+
|
|
4
|
+
margin: 0;
|
|
3
5
|
padding: 0;
|
|
4
6
|
position: absolute;
|
|
5
7
|
top: 0;
|
|
6
|
-
right: 0;
|
|
7
8
|
|
|
8
9
|
@include thredded-media-tablet-and-down {
|
|
9
10
|
position: initial;
|
|
@@ -20,16 +21,15 @@
|
|
|
20
21
|
|
|
21
22
|
@include thredded-media-desktop-and-up {
|
|
22
23
|
$line-height: 1rem;
|
|
23
|
-
$padding-x: 0.75rem;
|
|
24
24
|
background: transparent;
|
|
25
25
|
border-color: transparent;
|
|
26
26
|
font-size: $thredded-font-size-small;
|
|
27
27
|
line-height: $line-height;
|
|
28
28
|
min-width: 13rem;
|
|
29
|
-
text-align: right;
|
|
30
29
|
width: auto;
|
|
31
|
-
padding: 0.9375rem
|
|
32
|
-
margin: -1px
|
|
30
|
+
padding: 0.9375rem $input-padding-x 0.875rem $input-padding-x;
|
|
31
|
+
margin-top: -1px;
|
|
32
|
+
margin-bottom: 0;
|
|
33
33
|
|
|
34
34
|
&, &:focus {
|
|
35
35
|
transition: background, border-color, box-shadow, min-width 0.15s ease-out 0s;
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
background: $thredded-background-color;
|
|
40
40
|
box-shadow: none;
|
|
41
41
|
margin-right: 0;
|
|
42
|
+
margin-left: 0;
|
|
42
43
|
min-width: 16rem;
|
|
43
44
|
text-align: left;
|
|
44
45
|
}
|
|
@@ -98,4 +99,28 @@
|
|
|
98
99
|
@media print {
|
|
99
100
|
display: none;
|
|
100
101
|
}
|
|
102
|
+
|
|
103
|
+
// On the left:
|
|
104
|
+
right: auto;
|
|
105
|
+
left: 0;
|
|
106
|
+
@include thredded-media-desktop-and-up {
|
|
107
|
+
input[type="search"] {
|
|
108
|
+
text-align: left;
|
|
109
|
+
margin-right: 0;
|
|
110
|
+
margin-left: -$input-padding-x;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// On the right:
|
|
115
|
+
&--right {
|
|
116
|
+
right: 0;
|
|
117
|
+
left: auto;
|
|
118
|
+
@include thredded-media-desktop-and-up {
|
|
119
|
+
input[type="search"] {
|
|
120
|
+
text-align: right;
|
|
121
|
+
margin-right: -$input-padding-x;
|
|
122
|
+
margin-left: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
101
126
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Thredded
|
|
3
|
+
# @api private
|
|
4
|
+
module NewPostParams
|
|
5
|
+
protected
|
|
6
|
+
|
|
7
|
+
def new_post_params
|
|
8
|
+
params.fetch(:post, {})
|
|
9
|
+
.permit(:content, :quote_post_id)
|
|
10
|
+
.merge(ip: request.remote_ip).tap do |p|
|
|
11
|
+
quote_id = p.delete(:quote_post_id)
|
|
12
|
+
if quote_id
|
|
13
|
+
post = Post.find(quote_id)
|
|
14
|
+
authorize_reading post
|
|
15
|
+
p[:quote_post] = post
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Thredded
|
|
3
|
+
# @api private
|
|
4
|
+
module NewPrivatePostParams
|
|
5
|
+
protected
|
|
6
|
+
|
|
7
|
+
def new_private_post_params
|
|
8
|
+
params.fetch(:post, {})
|
|
9
|
+
.permit(:content, :quote_private_post_id)
|
|
10
|
+
.merge(ip: request.remote_ip).tap do |p|
|
|
11
|
+
quote_id = p.delete(:quote_private_post_id)
|
|
12
|
+
if quote_id
|
|
13
|
+
post = PrivatePost.find(quote_id)
|
|
14
|
+
authorize_reading post
|
|
15
|
+
p[:quote_post] = post
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|