Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename remaining article to thread #1138

Open
wants to merge 12 commits into
base: dev/new_features
Choose a base branch
from
40 changes: 40 additions & 0 deletions assets/controllers/subject_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,46 @@ export default class extends Controller {
}
}

/**
* Calls the address attached to the nearest link node. Replaces the outer html of the nearest `cssclass` parameter
* with the response from the link
*/
async linkCallback(event) {
const { cssclass: cssClass, refreshlink: refreshLink, refreshselector: refreshSelector } = event.params
event.preventDefault();

const a = event.target.closest('a');

try {
this.loadingValue = true;

let response = await fetch(a.href, {
method: 'GET',
});

response = await ok(response);
response = await response.json();

event.target.closest(`.${cssClass}`).outerHTML = response.html;

const refreshElement = this.element.querySelector(refreshSelector)
console.log("linkCallback refresh stuff", refreshLink, refreshSelector, refreshElement)

if (!!refreshLink && refreshLink !== "" && !!refreshElement) {
let response = await fetch(refreshLink, {
method: 'GET',
});

response = await ok(response);
response = await response.json();
refreshElement.outerHTML = response.html;
}
} catch (e) {
} finally {
this.loadingValue = false;
}
}

loadingValueChanged(val) {
const submitButton = this.containerTarget.querySelector('form button[type="submit"]');

Expand Down
4 changes: 4 additions & 0 deletions assets/styles/app.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '@fortawesome/fontawesome-free/scss/fontawesome';
@import '@fortawesome/fontawesome-free/scss/solid';
@import '@fortawesome/fontawesome-free/scss/regular';
@import '@fortawesome/fontawesome-free/scss/brands';
@import 'simple-icons-font/font/simple-icons';
@import 'glightbox/dist/css/glightbox.min.css';
Expand All @@ -21,6 +22,7 @@
@import 'layout/alerts';
@import 'layout/forms';
@import 'layout/images';
@import 'layout/icons';
@import 'components/announcement';
@import 'components/topbar';
@import 'components/header';
Expand All @@ -35,6 +37,7 @@
@import 'components/figure_image';
@import 'components/figure_lightbox';
@import 'components/post';
@import 'components/search';
@import 'components/subject';
@import 'components/login';
@import 'components/modlog';
Expand All @@ -51,6 +54,7 @@
@import 'components/settings_row';
@import 'pages/post_single';
@import 'pages/post_front';
@import 'pages/page_bookmarks';
@import 'themes/kbin';
@import 'themes/default';
@import 'themes/solarized';
Expand Down
24 changes: 24 additions & 0 deletions assets/styles/components/_search.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.search-container {
background: var(--kbin-input-bg);
border: var(--kbin-input-border);
border-radius: var(--kbin-rounded-edges-radius) !important;

input.form-control {
border-radius: 0 !important;
border: none;
background: transparent;
margin: 0 .5em;
padding: .5rem .25rem;
}

button {
border-radius: 0 var(--kbin-rounded-edges-radius) var(--kbin-rounded-edges-radius) 0 !important;
border: 0;
padding: 1rem 0.5rem;

&:not(:hover) {
background: var(--kbin-input-bg);
color: var(--kbin-input-text-color) !important;
}
}
}
6 changes: 6 additions & 0 deletions assets/styles/layout/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,9 @@ div.input-box {
border-radius: var(--kbin-rounded-edges-radius) !important;
}
}

.form-control {
display: block;
width: 100%;

}
3 changes: 3 additions & 0 deletions assets/styles/layout/_icons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
i.active {
color: var(--kbin-color-icon-active, orange);
}
10 changes: 9 additions & 1 deletion assets/styles/layout/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ figure {
code,
.ts-control > [data-value].item,
.image-preview-container {
border-radius: var(--kbin-rounded-edges-radius) !important;
&:not(.ignore-edges) {
border-radius: var(--kbin-rounded-edges-radius) !important;
}
}

.ts-wrapper {
Expand Down Expand Up @@ -361,6 +363,12 @@ figure {
gap: .25rem;
}

@include media-breakpoint-down(lg) {
.flex.mobile {
display: block;
}
}

.flex-wrap {
flex-wrap: wrap;
}
Expand Down
8 changes: 0 additions & 8 deletions assets/styles/layout/_section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,3 @@
color: var(--kbin-alert-danger-text-color);
}
}

.page-search {
.section--top {
button {
padding: 1rem 1.5rem;
}
}
}
6 changes: 6 additions & 0 deletions assets/styles/pages/page_bookmarks.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.page-bookmarks {
.entry, .entry-comment, .post, .post-comment, .comment {
margin-top: 0!important;
margin-bottom: .5em!important;
}
}
71 changes: 71 additions & 0 deletions config/kbin_routes/bookmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
bookmark_front:
controller: App\Controller\BookmarkListController::front
defaults: { sortBy: hot, time: '∞', federation: all }
path: /bookmark-lists/show/{list}/{sortBy}/{time}/{federation}
methods: [GET]
requirements: &front_requirement
sortBy: "%default_sort_options%"
time: "%default_time_options%"
federation: "%default_federation_options%"

bookmark_lists:
controller: App\Controller\BookmarkListController::list
path: /bookmark-lists
methods: [GET, POST]

bookmark_lists_menu_refresh_status:
controller: App\Controller\BookmarkListController::subjectBookmarkMenuListRefresh
path: /blr/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

bookmark_lists_make_default:
controller: App\Controller\BookmarkListController::makeDefault
path: /bookmark-lists/makeDefault
methods: [GET]

bookmark_lists_edit_list:
controller: App\Controller\BookmarkListController::editList
path: /bookmark-lists/editList/{list}
methods: [GET, POST]

bookmark_lists_delete_list:
controller: App\Controller\BookmarkListController::deleteList
path: /bookmark-lists/deleteList/{list}
methods: [GET]

subject_bookmark_standard:
controller: App\Controller\BookmarkController::subjectBookmarkStandard
path: /bos/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_bookmark_refresh_status:
controller: App\Controller\BookmarkController::subjectBookmarkRefresh
path: /bor/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_bookmark_to_list:
controller: App\Controller\BookmarkController::subjectBookmarkToList
path: /bol/{subject_id}/{subject_type}/{list}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_remove_bookmarks:
controller: App\Controller\BookmarkController::subjectRemoveBookmarks
path: /rbo/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_remove_bookmark_from_list:
controller: App\Controller\BookmarkController::subjectRemoveBookmarkFromList
path: /rbol/{subject_id}/{subject_type}/{list}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]
61 changes: 61 additions & 0 deletions config/kbin_routes/bookmark_api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
api_bookmark_front:
controller: App\Controller\Api\Bookmark\BookmarkListApiController::front
path: /api/bookmark-lists/show
methods: [GET]
format: json

api_bookmark_lists:
controller: App\Controller\Api\Bookmark\BookmarkListApiController::list
path: /api/bookmark-lists
methods: [GET]
format: json

api_bookmark_lists_make_default:
controller: App\Controller\Api\Bookmark\BookmarkListApiController::makeDefault
path: /api/bookmark-lists/{list_name}/makeDefault
methods: [GET]
format: json

api_bookmark_lists_edit_list:
controller: App\Controller\Api\Bookmark\BookmarkListApiController::editList
path: /api/bookmark-lists/{list_name}
methods: [POST]
format: json

api_bookmark_lists_delete_list:
controller: App\Controller\Api\Bookmark\BookmarkListApiController::deleteList
path: /api/bookmark-lists/{list_name}
methods: [DELETE]
format: json

api_subject_bookmark_standard:
controller: App\Controller\Api\Bookmark\BookmarkApiController::subjectBookmarkStandard
path: /api/bos/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]
format: json

api_subject_bookmark_to_list:
controller: App\Controller\Api\Bookmark\BookmarkApiController::subjectBookmarkToList
path: /api/bol/{subject_id}/{subject_type}/{list_name}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]
format: json

api_subject_remove_bookmarks:
controller: App\Controller\Api\Bookmark\BookmarkApiController::subjectRemoveBookmarks
path: /api/rbo/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]
format: json

api_subject_remove_bookmark_from_list:
controller: App\Controller\Api\Bookmark\BookmarkApiController::subjectRemoveBookmarkFromList
path: /api/rbol/{subject_id}/{subject_type}/{list_name}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]
format: json
13 changes: 10 additions & 3 deletions config/kbin_routes/magazine_api.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Create an article entry in a magazine
# Create a thread entry in a magazine
api_magazine_entry_create_thread:
controller: App\Controller\Api\Entry\MagazineEntryCreateApi::thread
path: /api/magazine/{magazine_id}/thread
melroy89 marked this conversation as resolved.
Show resolved Hide resolved
methods: [ POST ]
format: json

# Create thread entry, same as above, for for backwards compatibility, also points to thread method
api_magazine_entry_create_article:
controller: App\Controller\Api\Entry\MagazineEntryCreateApi::article
controller: App\Controller\Api\Entry\MagazineEntryCreateApi::thread
path: /api/magazine/{magazine_id}/article
methods: [ POST ]
format: json
Expand Down Expand Up @@ -148,4 +155,4 @@ api_magazine_modlog:
controller: App\Controller\Api\Magazine\MagazineModLogApi::collection
path: /api/magazine/{magazine_id}/log
methods: [ GET ]
format: json
format: json
7 changes: 7 additions & 0 deletions config/packages/league_oauth2_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ league_oauth2_server:
"user:profile",
"user:profile:read",
"user:profile:edit",
"user:bookmark",
"user:bookmark:add",
"user:bookmark:remove",
"user:bookmark:list",
"user:bookmark:list:read",
"user:bookmark:list:edit",
"user:bookmark:list:delete",
"user:message",
"user:message:read",
"user:message:create",
Expand Down
11 changes: 11 additions & 0 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ security:
'ROLE_OAUTH2_USER:OAUTH_CLIENTS:READ',
'ROLE_OAUTH2_USER:OAUTH_CLIENTS:EDIT',
]
'ROLE_OAUTH2_USER:BOOKMARK':
[
'ROLE_OAUTH2_USER:BOOKMARK:ADD',
'ROLE_OAUTH2_USER:BOOKMARK:REMOVE',
]
'ROLE_OAUTH2_USER:BOOKMARK_LIST':
[
'ROLE_OAUTH2_USER:BOOKMARK_LIST:READ',
'ROLE_OAUTH2_USER:BOOKMARK_LIST:EDIT',
'ROLE_OAUTH2_USER:BOOKMARK_LIST:DELETE',
]
'ROLE_OAUTH2_MODERATE':
[
'ROLE_OAUTH2_MODERATE:ENTRY',
Expand Down
3 changes: 2 additions & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ parameters:
front_sort_options: top|hot|active|newest|oldest|commented # TODO remove fallback after tag rework
default_sort_options: top|hot|active|newest|oldest|commented
default_time_options: 3h|6h|12h|1d|1w|1m|1y|all|∞
default_type_options: article|articles|link|links|video|videos|photo|photos|image|images|all
default_type_options: article|articles|thread|threads|link|links|video|videos|photo|photos|image|images|all
default_subscription_options: sub|fav|mod|all|home
default_federation_options: local|all
default_content_options: threads|microblog
default_subject_type_options: entry|entry_comment|post|post_comment

comment_sort_options: top|hot|active|newest|oldest

Expand Down
6 changes: 3 additions & 3 deletions docs/postman/kbin.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@
]
},
{
"name": "Create article in magazine",
"name": "Create thread in magazine",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"accept": true
Expand All @@ -1392,7 +1392,7 @@
}
},
"url": {
"raw": "https://{{host}}/api/magazine/:magazine_id/article",
"raw": "https://{{host}}/api/magazine/:magazine_id/thread",
"protocol": "https",
"host": [
"{{host}}"
Expand All @@ -1401,7 +1401,7 @@
"api",
"magazine",
":magazine_id",
"article"
"thread"
],
"variable": [
{
Expand Down
Loading