Explorar el Código

rename htmlpage to html-documents

Guénaël Muller hace 6 años
padre
commit
8ab1bc2582

+ 4 - 4
tracim/models/applications.py Ver fichero

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

+ 6 - 6
tracim/models/contents.py Ver fichero

3
 from enum import Enum
3
 from enum import Enum
4
 
4
 
5
 from tracim.exceptions import ContentStatusNotExist, ContentTypeNotExist
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
     available_statuses=CONTENT_DEFAULT_STATUS,
159
     available_statuses=CONTENT_DEFAULT_STATUS,
160
 )
160
 )
161
 
161
 
162
-htmlpage_type = NewContentType(
162
+html_documents_type = NewContentType(
163
     slug='html-documents',
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
     label='Text Document',
166
     label='Text Document',
167
     creation_label='Write a document',
167
     creation_label='Write a document',
168
     available_statuses=CONTENT_DEFAULT_STATUS,
168
     available_statuses=CONTENT_DEFAULT_STATUS,
182
     thread_type,
182
     thread_type,
183
     file_type,
183
     file_type,
184
     markdownpluspage_type,
184
     markdownpluspage_type,
185
-    htmlpage_type,
185
+    html_documents_type,
186
     folder_type,
186
     folder_type,
187
 ]
187
 ]
188
 
188
 
227
 
227
 
228
     File = file_type.slug
228
     File = file_type.slug
229
     Thread = thread_type.slug
229
     Thread = thread_type.slug
230
-    Page = htmlpage_type.slug
230
+    Page = html_documents_type.slug
231
     MarkdownPage = markdownpluspage_type.slug
231
     MarkdownPage = markdownpluspage_type.slug
232
 
232
 
233
     def __init__(self, slug: str):
233
     def __init__(self, slug: str):

+ 1 - 1
tracim/tests/functional/test_system.py Ver fichero

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

+ 2 - 2
tracim/tests/functional/test_user.py Ver fichero

48
         assert sidebar_entry['fa_icon'] == ""
48
         assert sidebar_entry['fa_icon'] == ""
49
 
49
 
50
         sidebar_entry = workspace['sidebar_entries'][2]
50
         sidebar_entry = workspace['sidebar_entries'][2]
51
-        assert sidebar_entry['slug'] == 'contents/htmlpage'
51
+        assert sidebar_entry['slug'] == 'contents/html-documents'
52
         assert sidebar_entry['label'] == 'Text Documents'
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
         assert sidebar_entry['hexcolor'] == "#3f52e3"
54
         assert sidebar_entry['hexcolor'] == "#3f52e3"
55
         assert sidebar_entry['fa_icon'] == "file-text-o"
55
         assert sidebar_entry['fa_icon'] == "file-text-o"
56
 
56
 

+ 2 - 2
tracim/tests/functional/test_workspaces.py Ver fichero

48
         assert sidebar_entry['fa_icon'] == ""
48
         assert sidebar_entry['fa_icon'] == ""
49
 
49
 
50
         sidebar_entry = workspace['sidebar_entries'][2]
50
         sidebar_entry = workspace['sidebar_entries'][2]
51
-        assert sidebar_entry['slug'] == 'contents/htmlpage'
51
+        assert sidebar_entry['slug'] == 'contents/html-documents'
52
         assert sidebar_entry['label'] == 'Text Documents'
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
         assert sidebar_entry['hexcolor'] == "#3f52e3"
54
         assert sidebar_entry['hexcolor'] == "#3f52e3"
55
         assert sidebar_entry['fa_icon'] == "file-text-o"
55
         assert sidebar_entry['fa_icon'] == "file-text-o"
56
 
56
 

+ 5 - 5
tracim/views/contents_api/html_document_controller.py Ver fichero

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

+ 1 - 1
tracim/views/core_api/schemas.py Ver fichero

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