Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
e237b2ac
Commit
e237b2ac
authored
Aug 20, 2012
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creating a proper WikiSlug javascript generator from the django urlify
parent
95d8651b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
wiki/plugins/attachments/views.py
+0
-6
wiki/templates/wiki/create.html
+5
-1
No files found.
wiki/plugins/attachments/views.py
View file @
e237b2ac
...
...
@@ -99,7 +99,6 @@ class AttachmentReplaceView(ArticleMixin, FormView):
return
redirect
(
wiki_settings
.
LOGIN_URL
)
return
super
(
AttachmentReplaceView
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
kwargs
)
@transaction.commit_manually
def
form_valid
(
self
,
form
):
try
:
...
...
@@ -112,19 +111,14 @@ class AttachmentReplaceView(ArticleMixin, FormView):
self
.
attachment
.
save
()
messages
.
success
(
self
.
request
,
_
(
u'
%
s uploaded and replaces old attachment.'
)
%
attachment_revision
.
get_filename
())
except
models
.
IllegalFileExtension
,
e
:
transaction
.
rollback
()
messages
.
error
(
self
.
request
,
_
(
u'Your file could not be saved:
%
s'
)
%
e
)
transaction
.
commit
()
return
redirect
(
"wiki:attachments_replace"
,
attachment_id
=
self
.
attachment
.
id
,
path
=
self
.
urlpath
.
path
,
article_id
=
self
.
article
.
id
)
except
Exception
:
transaction
.
rollback
()
messages
.
error
(
self
.
request
,
_
(
u'Your file could not be saved, probably because of a permission error on the web server.'
))
transaction
.
commit
()
return
redirect
(
"wiki:attachments_replace"
,
attachment_id
=
self
.
attachment
.
id
,
path
=
self
.
urlpath
.
path
,
article_id
=
self
.
article
.
id
)
transaction
.
commit
()
return
redirect
(
"wiki:attachments_index"
,
path
=
self
.
urlpath
.
path
,
article_id
=
self
.
article
.
id
)
def
get_form
(
self
,
form_class
):
...
...
wiki/templates/wiki/create.html
View file @
e237b2ac
...
...
@@ -15,7 +15,11 @@
$
(
"#id_title"
).
keyup
(
function
()
{
var
e
=
$
(
"#id_slug"
)[
0
];
if
(
!
e
.
_changed
)
{
e
.
value
=
URLify
(
this
.
value
,
64
);
slug
=
URLify
(
this
.
value
,
64
);
wikislug
=
slug
.
replace
(
/
\-
/g
,
" "
);
wikislug
=
wikislug
.
replace
(
/
\w\S
*/g
,
function
(
txt
){
return
txt
.
charAt
(
0
).
toUpperCase
()
+
txt
.
substr
(
1
);});
wikislug
=
wikislug
.
replace
(
/
\s
*/g
,
""
);
e
.
value
=
wikislug
;
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment