Browse Source

rename htmlpage to html-documents

Guénaël Muller 6 years ago
parent
commit
8ab1bc2582

+ 4 - 4
tracim/models/applications.py View File

@@ -79,19 +79,19 @@ markdownpluspage = Application(
79 79
     main_route='/#/workspaces/{workspace_id}/contents?type=markdownpluspage',
80 80
 )
81 81
 
82
-htmlpage = Application(
82
+html_documents = Application(
83 83
     label='Text Documents',  # TODO - G.M - 24-05-2018 - Check label
84
-    slug='contents/htmlpage',
84
+    slug='contents/html-documents',
85 85
     fa_icon='file-text-o',
86 86
     hexcolor='#3f52e3',
87 87
     is_active=True,
88 88
     config={},
89
-    main_route='/#/workspaces/{workspace_id}/contents?type=htmlpage',
89
+    main_route='/#/workspaces/{workspace_id}/contents?type=html-documents',
90 90
 )
91 91
 # TODO - G.M - 08-06-2018 - This is hardcoded lists of app, make this dynamic.
92 92
 # List of applications
93 93
 applications = [
94
-    htmlpage,
94
+    html_documents,
95 95
     markdownpluspage,
96 96
     _file,
97 97
     thread,

+ 6 - 6
tracim/models/contents.py View File

@@ -3,7 +3,7 @@ import typing
3 3
 from enum import Enum
4 4
 
5 5
 from tracim.exceptions import ContentStatusNotExist, ContentTypeNotExist
6
-from tracim.models.applications import htmlpage, _file, thread, markdownpluspage
6
+from tracim.models.applications import html_documents, _file, thread, markdownpluspage
7 7
 
8 8
 
9 9
 ####
@@ -159,10 +159,10 @@ markdownpluspage_type = NewContentType(
159 159
     available_statuses=CONTENT_DEFAULT_STATUS,
160 160
 )
161 161
 
162
-htmlpage_type = NewContentType(
162
+html_documents_type = NewContentType(
163 163
     slug='html-documents',
164
-    fa_icon=htmlpage.fa_icon,
165
-    hexcolor=htmlpage.hexcolor,
164
+    fa_icon=html_documents.fa_icon,
165
+    hexcolor=html_documents.hexcolor,
166 166
     label='Text Document',
167 167
     creation_label='Write a document',
168 168
     available_statuses=CONTENT_DEFAULT_STATUS,
@@ -182,7 +182,7 @@ CONTENT_DEFAULT_TYPE = [
182 182
     thread_type,
183 183
     file_type,
184 184
     markdownpluspage_type,
185
-    htmlpage_type,
185
+    html_documents_type,
186 186
     folder_type,
187 187
 ]
188 188
 
@@ -227,7 +227,7 @@ class ContentTypeLegacy(NewContentType):
227 227
 
228 228
     File = file_type.slug
229 229
     Thread = thread_type.slug
230
-    Page = htmlpage_type.slug
230
+    Page = html_documents_type.slug
231 231
     MarkdownPage = markdownpluspage_type.slug
232 232
 
233 233
     def __init__(self, slug: str):

+ 1 - 1
tracim/tests/functional/test_system.py View File

@@ -25,7 +25,7 @@ class TestApplicationEndpoint(FunctionalTest):
25 25
         res = res.json_body
26 26
         application = res[0]
27 27
         assert application['label'] == "Text Documents"
28
-        assert application['slug'] == 'contents/htmlpage'
28
+        assert application['slug'] == 'contents/html-documents'
29 29
         assert application['fa_icon'] == 'file-text-o'
30 30
         assert application['hexcolor'] == '#3f52e3'
31 31
         assert application['is_active'] is True

+ 2 - 2
tracim/tests/functional/test_user.py View File

@@ -48,9 +48,9 @@ class TestUserWorkspaceEndpoint(FunctionalTest):
48 48
         assert sidebar_entry['fa_icon'] == ""
49 49
 
50 50
         sidebar_entry = workspace['sidebar_entries'][2]
51
-        assert sidebar_entry['slug'] == 'contents/htmlpage'
51
+        assert sidebar_entry['slug'] == 'contents/html-documents'
52 52
         assert sidebar_entry['label'] == 'Text Documents'
53
-        assert sidebar_entry['route'] == '/#/workspaces/1/contents?type=htmlpage'  # nopep8
53
+        assert sidebar_entry['route'] == '/#/workspaces/1/contents?type=html-documents'  # nopep8
54 54
         assert sidebar_entry['hexcolor'] == "#3f52e3"
55 55
         assert sidebar_entry['fa_icon'] == "file-text-o"
56 56
 

+ 2 - 2
tracim/tests/functional/test_workspaces.py View File

@@ -48,9 +48,9 @@ class TestWorkspaceEndpoint(FunctionalTest):
48 48
         assert sidebar_entry['fa_icon'] == ""
49 49
 
50 50
         sidebar_entry = workspace['sidebar_entries'][2]
51
-        assert sidebar_entry['slug'] == 'contents/htmlpage'
51
+        assert sidebar_entry['slug'] == 'contents/html-documents'
52 52
         assert sidebar_entry['label'] == 'Text Documents'
53
-        assert sidebar_entry['route'] == '/#/workspaces/1/contents?type=htmlpage'  # nopep8
53
+        assert sidebar_entry['route'] == '/#/workspaces/1/contents?type=html-documents'  # nopep8
54 54
         assert sidebar_entry['hexcolor'] == "#3f52e3"
55 55
         assert sidebar_entry['fa_icon'] == "file-text-o"
56 56
 

+ 5 - 5
tracim/views/contents_api/html_document_controller.py View File

@@ -26,7 +26,7 @@ from tracim.exceptions import InsufficientUserWorkspaceRole
26 26
 from tracim.exceptions import NotAuthenticated
27 27
 from tracim.exceptions import AuthenticationFailed
28 28
 from tracim.models.contents import ContentTypeLegacy as ContentType
29
-from tracim.models.contents import htmlpage_type
29
+from tracim.models.contents import html_documents_type
30 30
 from tracim.models.revision_protection import new_revision
31 31
 
32 32
 HTML_DOCUMENT_ENDPOINTS_TAG = 'HTML documents'
@@ -41,7 +41,7 @@ class HTMLDocumentController(Controller):
41 41
     @hapic.handle_exception(AuthenticationFailed, HTTPStatus.BAD_REQUEST)
42 42
     @hapic.handle_exception(ContentTypeNotAllowed, HTTPStatus.BAD_REQUEST)
43 43
     @require_workspace_role(UserRoleInWorkspace.READER)
44
-    @require_content_types([htmlpage_type])
44
+    @require_content_types([html_documents_type])
45 45
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
46 46
     @hapic.output_body(HtmlDocumentContentSchema())
47 47
     def get_html_document(self, context, request: TracimRequest, hapic_data=None):  # nopep8
@@ -66,7 +66,7 @@ class HTMLDocumentController(Controller):
66 66
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
67 67
     @hapic.handle_exception(AuthenticationFailed, HTTPStatus.BAD_REQUEST)
68 68
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
69
-    @require_content_types([htmlpage_type])
69
+    @require_content_types([html_documents_type])
70 70
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
71 71
     @hapic.input_body(HtmlDocumentModifySchema())
72 72
     @hapic.output_body(HtmlDocumentContentSchema())
@@ -104,7 +104,7 @@ class HTMLDocumentController(Controller):
104 104
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
105 105
     @hapic.handle_exception(AuthenticationFailed, HTTPStatus.BAD_REQUEST)
106 106
     @require_workspace_role(UserRoleInWorkspace.READER)
107
-    @require_content_types([htmlpage_type])
107
+    @require_content_types([html_documents_type])
108 108
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
109 109
     @hapic.output_body(HtmlDocumentRevisionSchema(many=True))
110 110
     def get_html_document_revisions(self, context, request: TracimRequest, hapic_data=None):  # nopep8
@@ -133,7 +133,7 @@ class HTMLDocumentController(Controller):
133 133
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
134 134
     @hapic.handle_exception(AuthenticationFailed, HTTPStatus.BAD_REQUEST)
135 135
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
136
-    @require_content_types([htmlpage_type])
136
+    @require_content_types([html_documents_type])
137 137
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
138 138
     @hapic.input_body(SetContentStatusSchema())
139 139
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8

+ 1 - 1
tracim/views/core_api/schemas.py View File

@@ -336,7 +336,7 @@ class ContentCreationSchema(marshmallow.Schema):
336 336
         description='Title of the content to create'
337 337
     )
338 338
     content_type = marshmallow.fields.String(
339
-        example='htmlpage',
339
+        example='html-documents',
340 340
         validate=OneOf([content.slug for content in CONTENT_DEFAULT_TYPE]),
341 341
     )
342 342