File tree Expand file tree Collapse file tree
project_manager/static/project_manager/js/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ function getPathSplit ( originalPath ) {
2+ if ( originalPath . startsWith ( "/" ) ) {
3+ originalPath = originalPath . slice ( 1 ) ;
4+ }
5+ if ( originalPath . endsWith ( "/" ) ) {
6+ originalPath = originalPath . slice ( 0 , - 1 ) ;
7+ }
8+ return originalPath . split ( "/" ) ;
9+ }
10+
111function isLongText ( meta ) {
212 return ! ! ( meta . max_length && meta . max_length > 200 ) ;
313}
Original file line number Diff line number Diff line change 11window . onload = function ( ) {
22 console . log ( 'create' )
3- const urlSearchParams = new URLSearchParams ( window . location . search ) ;
4- const params = Object . fromEntries ( urlSearchParams . entries ( ) ) ;
5- let originalPath = window . location . pathname ;
6- if ( originalPath . startsWith ( "/" ) ) {
7- originalPath = originalPath . slice ( 1 ) ;
8- }
9- if ( originalPath . endsWith ( "/" ) ) {
10- originalPath = originalPath . slice ( 0 , - 1 ) ;
11- }
12- const pathStrSplit = originalPath . split ( "/" ) ;
3+ const pathStrSplit = getPathSplit ( window . location . pathname ) ;
134 const projectType = pathStrSplit [ 0 ] ;
145 if ( projectType === 'plugins' || projectType === 'packages' ) {
156 if ( pathStrSplit [ 1 ] ) {
Original file line number Diff line number Diff line change 11window . onload = function ( ) {
22 console . log ( 'delete' )
3- const urlSearchParams = new URLSearchParams ( window . location . search ) ;
4- const params = Object . fromEntries ( urlSearchParams . entries ( ) ) ;
5- let originalPath = window . location . pathname ;
6- if ( originalPath . startsWith ( "/" ) ) {
7- originalPath = originalPath . slice ( 1 ) ;
8- }
9- if ( originalPath . endsWith ( "/" ) ) {
10- originalPath = originalPath . slice ( 0 , - 1 ) ;
11- }
12- const pathStrSplit = originalPath . split ( "/" ) ;
3+ const pathStrSplit = getPathSplit ( window . location . pathname ) ;
134 const projectType = pathStrSplit [ 0 ] ;
145 if ( projectType === 'plugins' || projectType === 'packages' ) {
156 if ( pathStrSplit [ 1 ] ) {
Original file line number Diff line number Diff line change 11window . onload = function ( ) {
22 console . log ( 'edit' )
3- const urlSearchParams = new URLSearchParams ( window . location . search ) ;
4- const params = Object . fromEntries ( urlSearchParams . entries ( ) ) ;
5- let originalPath = window . location . pathname ;
6- if ( originalPath . startsWith ( "/" ) ) {
7- originalPath = originalPath . slice ( 1 ) ;
8- }
9- if ( originalPath . endsWith ( "/" ) ) {
10- originalPath = originalPath . slice ( 0 , - 1 ) ;
11- }
12- const pathStrSplit = originalPath . split ( "/" ) ;
3+ const pathStrSplit = getPathSplit ( window . location . pathname ) ;
134 const projectType = pathStrSplit [ 0 ] ;
145 if ( projectType === 'plugins' || projectType === 'packages' ) {
156 if ( pathStrSplit [ 1 ] ) {
Original file line number Diff line number Diff line change 11window . onload = function ( ) {
2- const urlSearchParams = new URLSearchParams ( window . location . search ) ;
3- const params = Object . fromEntries ( urlSearchParams . entries ( ) ) ;
4- let originalPath = window . location . pathname ;
5- if ( originalPath . startsWith ( "/" ) ) {
6- originalPath = originalPath . slice ( 1 ) ;
7- }
8- if ( originalPath . endsWith ( "/" ) ) {
9- originalPath = originalPath . slice ( 0 , - 1 ) ;
10- }
11- const pathStrSplit = originalPath . split ( "/" ) ;
2+ const urlSearchParams = window . location . search ;
3+ const pathStrSplit = getPathSplit ( window . location . pathname ) ;
124 const projectType = pathStrSplit [ 0 ] ;
135 let urlPath = "/api/" + projectType + "/projects/" ;
146 let projectSlug = pathStrSplit [ 1 ] ;
@@ -20,13 +12,14 @@ window.onload = function(){
2012 urlPath = urlPath + projectSlug + "/" ;
2113 showDetailView ( urlPath ) ;
2214 } else {
23- showListView ( urlPath ) ;
15+ showListView ( urlPath , urlSearchParams ) ;
2416 }
2517} ;
2618
27- function showListView ( urlPath ) {
19+ function showListView ( urlPath , urlSearchParams ) {
2820 document . getElementById ( "list-view" ) . style . display = "block" ;
29- fetch ( urlPath )
21+ const fullApiUrl = `${ urlPath } ${ urlSearchParams } `
22+ fetch ( fullApiUrl )
3023 . then ( res => res . json ( ) )
3124 . then ( data => {
3225 const container = document . getElementById ( "project-list" ) ;
Original file line number Diff line number Diff line change 11window . onload = function ( ) {
22 console . log ( 'update' )
3- let originalPath = window . location . pathname ;
4- if ( originalPath . startsWith ( "/" ) ) {
5- originalPath = originalPath . slice ( 1 ) ;
6- }
7- if ( originalPath . endsWith ( "/" ) ) {
8- originalPath = originalPath . slice ( 0 , - 1 ) ;
9- }
10- const pathStrSplit = originalPath . split ( "/" ) ;
3+ const pathStrSplit = getPathSplit ( window . location . pathname ) ;
114 pathStrSplit . pop ( ) ;
125 let urlPath ;
136 const successUrlPath = "/" + pathStrSplit . join ( "/" ) + "/" ;
Original file line number Diff line number Diff line change @@ -130,10 +130,10 @@ <h1>Popular Tags</h1>
130130 </ footer >
131131
132132 {% block load_scripts %}
133- < script src ="https://code.jquery.com/jquery-3.6.0.min.js "> </ script >
134- < script src ="{% static "project_manager /js/jquery.min.js" %}"> </ script >
135- < script src ="{% static "project_manager /js/bootstrap.js" %}"> </ script >
136- < script src ="{% static "project_manager /js/custom.js" %}"> </ script >
133+ < script src ="https://code.jquery.com/jquery-3.6.0.min.js "> </ script >
134+ < script src ="{% static "project_manager /js/jquery.min.js" %}"> </ script >
135+ < script src ="{% static "project_manager /js/bootstrap.js" %}"> </ script >
136+ < script src ="{% static "project_manager /js/custom.js" %}"> </ script >
137137 {% endblock load_scripts %}
138138 </ body >
139139
Original file line number Diff line number Diff line change 55 {{ title }}
66{% endblock title %}
77{% block load_scripts %}
8+ < script src ="{% static "project_manager /js/controllers/common.js" %}"> </ script >
89 < script src ="{% static "project_manager /js/controllers/delete.js" %}"> </ script >
910{% endblock load_scripts %}
1011
Original file line number Diff line number Diff line change 55 {{ title }}
66{% endblock title %}
77{% block load_scripts %}
8+ < script src ="{% static "project_manager /js/controllers/common.js" %}"> </ script >
89 < script src ="{% static "project_manager /js/controllers/retrieve.js" %}"> </ script >
910{% endblock load_scripts %}
1011
Original file line number Diff line number Diff line change 55 {{ title }}
66{% endblock title %}
77{% block load_scripts %}
8+ < script src ="{% static "project_manager /js/controllers/common.js" %}"> </ script >
89 < script src ="{% static "project_manager /js/controllers/update.js" %}"> </ script >
910{% endblock load_scripts %}
1011
You can’t perform that action at this time.
0 commit comments