Skip to content

Commit c99aab5

Browse files
WebVPFBen Thomson
and
Ben Thomson
authored
Added the ability to disable the default CSS. (#146)
Co-authored-by: Ben Thomson <[email protected]>
1 parent 93fb8bf commit c99aab5

File tree

8 files changed

+81
-11
lines changed

8 files changed

+81
-11
lines changed

components/Channel.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ public function defineProperties()
8181
'type' => 'dropdown',
8282
'group' => 'Links',
8383
],
84+
'includeStyles' => [
85+
'title' => 'rainlab.forum::lang.components.general.properties.includeStyles',
86+
'description' => 'rainlab.forum::lang.components.general.properties.includeStyles_desc',
87+
'type' => 'checkbox',
88+
'default' => true
89+
],
8490
];
8591
}
8692

@@ -91,7 +97,9 @@ public function getPropertyOptions($property)
9197

9298
public function onRun()
9399
{
94-
$this->addCss('assets/css/forum.css');
100+
if ($this->property('includeStyles', true)) {
101+
$this->addCss('assets/css/forum.css');
102+
}
95103

96104
$this->prepareVars();
97105
$this->page['channel'] = $this->getChannel();

components/Channels.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public function defineProperties()
5959
'description' => 'rainlab.forum::lang.topic.page_help',
6060
'type' => 'dropdown',
6161
],
62+
'includeStyles' => [
63+
'title' => 'rainlab.forum::lang.components.general.properties.includeStyles',
64+
'description' => 'rainlab.forum::lang.components.general.properties.includeStyles_desc',
65+
'type' => 'checkbox',
66+
'default' => true
67+
],
6268
];
6369
}
6470

@@ -69,7 +75,9 @@ public function getPropertyOptions($property)
6975

7076
public function onRun()
7177
{
72-
$this->addCss('assets/css/forum.css');
78+
if ($this->property('includeStyles', true)) {
79+
$this->addCss('assets/css/forum.css');
80+
}
7381

7482
$this->prepareVars();
7583
$this->page['channels'] = $this->listChannels();

components/Member.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public function defineProperties()
7575
'type' => 'dropdown',
7676
'group' => 'Links',
7777
],
78+
'includeStyles' => [
79+
'title' => 'rainlab.forum::components.general.properties.includeStyles',
80+
'description' => 'rainlab.forum::components.general.properties.includeStyles_desc',
81+
'type' => 'checkbox',
82+
'default' => true
83+
],
7884
];
7985
}
8086

@@ -90,7 +96,9 @@ public function getPropertyOptions($property)
9096

9197
public function onRun()
9298
{
93-
$this->addCss('assets/css/forum.css');
99+
if ($this->property('includeStyles', true)) {
100+
$this->addCss('assets/css/forum.css');
101+
}
94102

95103
$this->prepareVars();
96104
}

components/Posts.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ public function defineProperties()
6767
'validationPattern' => '^[0-9]+$',
6868
'validationMessage' => 'rainlab.forum::lang.posts.per_page_validation',
6969
'default' => '20',
70-
]
70+
],
71+
'includeStyles' => [
72+
'title' => 'rainlab.forum::lang.components.general.properties.includeStyles',
73+
'description' => 'rainlab.forum::lang.components.general.properties.includeStyles_desc',
74+
'type' => 'checkbox',
75+
'default' => true
76+
],
7177
];
7278
}
7379

@@ -78,7 +84,9 @@ public function getPropertyOptions($property)
7884

7985
public function onRun()
8086
{
81-
$this->addCss('assets/css/forum.css');
87+
if ($this->property('includeStyles', true)) {
88+
$this->addCss('assets/css/forum.css');
89+
}
8290

8391
$this->prepareVars();
8492

components/Topic.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ public function defineProperties()
9696
'type' => 'dropdown',
9797
'group' => 'Links',
9898
],
99+
'includeStyles' => [
100+
'title' => 'rainlab.forum::lang.components.general.properties.includeStyles',
101+
'description' => 'rainlab.forum::lang.components.general.properties.includeStyles_desc',
102+
'type' => 'checkbox',
103+
'default' => true
104+
],
99105
];
100106
}
101107

@@ -106,7 +112,9 @@ public function getPropertyOptions($property)
106112

107113
public function onRun()
108114
{
109-
$this->addCss('assets/css/forum.css');
115+
if ($this->property('includeStyles', true)) {
116+
$this->addCss('assets/css/forum.css');
117+
}
110118
$this->addJs('assets/js/forum.js');
111119

112120
$this->prepareVars();

components/Topics.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ public function defineProperties()
6363
'validationPattern' => '^[0-9]+$',
6464
'validationMessage' => 'rainlab.forum::lang.topics.per_page_validation',
6565
'default' => '20',
66-
]
66+
],
67+
'includeStyles' => [
68+
'title' => 'rainlab.forum::lang.components.general.properties.includeStyles',
69+
'description' => 'rainlab.forum::lang.components.general.properties.includeStyles_desc',
70+
'type' => 'checkbox',
71+
'default' => true
72+
],
6773
];
6874
}
6975

@@ -74,7 +80,9 @@ public function getPropertyOptions($property)
7480

7581
public function onRun()
7682
{
77-
$this->addCss('assets/css/forum.css');
83+
if ($this->property('includeStyles', true)) {
84+
$this->addCss('assets/css/forum.css');
85+
}
7886

7987
$this->prepareVars();
8088

lang/en/lang.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,13 @@
131131
'slug_desc' => 'The URL route parameter used for looking up the topic by its slug. A hard coded slug can also be used.',
132132
'channel_title' => 'Channel Page',
133133
'channel_desc' => 'Page name to use for clicking on a channel.'
134-
]
134+
],
135+
'components' => [
136+
'general' => [
137+
'properties' => [
138+
'includeStyles' => 'Enable CSS',
139+
'includeStyles_desc' => 'Include the CSS files with default styles for the forum',
140+
],
141+
],
142+
],
135143
];

lang/ru/lang.php

+16-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@
8686
'banned_comment' => 'Поставьте галочку, чтобы заблокировать отправку сообщений пользователю.',
8787
'forum_username' => 'Имя на форуме',
8888
'channels' => 'Категории форума',
89-
'channels_desc' => 'Управление имеющимся на форуме категориями.'
89+
'channels_desc' => 'Управление имеющимся на форуме категориями.',
90+
'channels_filter' => 'Channel filter',
91+
'channels_filter_description' => 'Введите название категории или параметр URL-адреса для фильтрации тем. Оставьте поле пустым, чтобы отобразить все темы.',
92+
'rssfeed_title' => 'RSS-канал',
93+
'rssfeed_description' => 'Создаёт RSS-канал, содержащий темы форума.',
94+
'rssfeed_forum' => 'Страница форума',
95+
'rssfeed_forum_description' => 'Имя файла главной страницы форума для генерации ссылок. Это свойство используется дефолтным partial-ом компонента.',
9096
],
9197
'embedch' => [
9298
'channel_name' => 'Встроенная Категория',
@@ -125,5 +131,13 @@
125131
'slug_desc' => 'Параметр URL, используемый для поиска темы по её URL.',
126132
'channel_title' => 'Страница Категории',
127133
'channel_desc' => 'Имя страницы, используемое при клике на категорию.'
128-
]
134+
],
135+
'components' => [
136+
'general' => [
137+
'properties' => [
138+
'includeStyles' => 'Включить CSS',
139+
'includeStyles_desc' => 'Подключить css-файл с дефолтными стилями для форума',
140+
],
141+
],
142+
],
129143
];

0 commit comments

Comments
 (0)