Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
9d918b5a
Commit
9d918b5a
authored
13 years ago
by
Tom Needham
Browse files
Options
Downloads
Patches
Plain Diff
Updated control bar styling and save feedback.
parent
58d28441
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_texteditor/css/style.css
+6
-3
6 additions, 3 deletions
apps/files_texteditor/css/style.css
apps/files_texteditor/js/editor.js
+17
-13
17 additions, 13 deletions
apps/files_texteditor/js/editor.js
with
23 additions
and
16 deletions
apps/files_texteditor/css/style.css
+
6
−
3
View file @
9d918b5a
...
...
@@ -14,9 +14,12 @@
left
:
160px
;
display
:
none
;
}
#editor
bar
{
#editor
_close
{
margin-left
:
auto
;
margin-right
:
1
0
px
;
margin-right
:
1
67
px
;
display
:
block
;
width
:
300px
;
}
#editor_save
{
margin-left
:
7px
;
float
:
left
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
apps/files_texteditor/js/editor.js
+
17
−
13
View file @
9d918b5a
...
...
@@ -33,17 +33,17 @@ function setSyntaxMode(ext){
}
}
function
showControl
Bar
(
filename
){
function
showControl
s
(
filename
){
// Loads the control bar at the top.
$
(
'
.actions,#file_action_panel
'
).
fadeOut
(
'
slow
'
).
promise
().
done
(
function
()
{
// Load the new toolbar.
var
html
=
'
<div id="editorbar"><input type="button" id="editor_save" value="
'
+
t
(
'
files_texteditor
'
,
'
Save
'
)
+
'
"><input type="button" id="editor_close" value="
'
+
t
(
'
files_texteditor
'
,
'
Close Editor
'
)
+
'
"></div>
'
;
if
(
$
(
'
#editorbar
'
).
length
==
0
){
$
(
'
#controls
'
).
append
(
html
);
$
(
'
#editorbar
'
).
fadeIn
(
'
slow
'
);
}
var
savebtnhtml
=
'
<input type="button" id="editor_save" value="
'
+
t
(
'
files_texteditor
'
,
'
Save
'
)
+
'
">
'
;
var
html
=
'
<input type="button" id="editor_close" value="
'
+
t
(
'
files_texteditor
'
,
'
Close Editor
'
)
+
'
">
'
;
$
(
'
#controls
'
).
append
(
html
);
$
(
'
#editorbar
'
).
fadeIn
(
'
slow
'
);
var
breadcrumbhtml
=
'
<div class="crumb svg" style="background-image:url("/core/img/breadcrumb.png")"><a href="#">
'
+
filename
+
'
</a></div>
'
;
$
(
'
.actions
'
).
before
(
breadcrumbhtml
);
$
(
'
.actions
'
).
before
(
savebtnhtml
);
});
}
...
...
@@ -56,7 +56,13 @@ function bindControlEvents(){
hideFileEditor
();
});
$
(
document
).
bind
(
'
keydown
'
,
'
Ctrl+s
'
,
doFileSave
);
$
(
window
).
keypress
(
function
(
event
)
{
if
(
!
(
event
.
which
==
115
&&
(
event
.
ctrlKey
||
event
.
metaKey
))
&&
!
(
event
.
which
==
19
))
return
true
;
event
.
preventDefault
();
alert
(
"
Saved file
"
);
doFileSave
();
return
false
;
});
}
function
editorIsShown
(){
...
...
@@ -78,7 +84,7 @@ function updateSessionFileHash(path){
function
doFileSave
(){
if
(
editorIsShown
()){
$
(
'
#editor_save
'
).
val
(
t
(
'
files_texteditor
'
,
'
Saving
'
)
+
'
...
'
)
.
css
(
'
background-color
'
,
'
#84E79F
'
)
;
$
(
'
#editor_save
'
).
val
(
t
(
'
files_texteditor
'
,
'
Saving
'
)
+
'
...
'
);
var
filecontents
=
window
.
aceEditor
.
getSession
().
getValue
();
var
dir
=
$
(
'
#editor
'
).
attr
(
'
data-dir
'
);
var
file
=
$
(
'
#editor
'
).
attr
(
'
data-filename
'
);
...
...
@@ -90,7 +96,6 @@ function doFileSave(){
$
.
post
(
OC
.
filePath
(
'
files_texteditor
'
,
'
ajax
'
,
'
savefile.php
'
),{
filecontents
:
filecontents
,
file
:
file
,
dir
:
dir
,
force
:
'
true
'
},
function
(
jsondata
){
if
(
jsondata
.
status
==
'
success
'
){
$
(
'
#editor_save
'
).
val
(
t
(
'
files_texteditor
'
,
'
Save
'
));
$
(
'
#editor_save
'
).
effect
(
"
highlight
"
,
{
color
:
'
#4BFF8D
'
},
3000
);
}
else
{
// Save error
...
...
@@ -107,7 +112,6 @@ function doFileSave(){
else
if
(
jsondata
.
status
==
'
success
'
){
// Success
$
(
'
#editor_save
'
).
val
(
t
(
'
files_texteditor
'
,
'
Save
'
));
$
(
'
#editor_save
'
).
effect
(
"
highlight
"
,
{
color
:
'
#4BFF8D
'
},
3000
);
}
},
'
json
'
);
giveEditorFocus
();
...
...
@@ -127,7 +131,7 @@ function showFileEditor(dir,filename){
complete
:
function
(
data
){
// Initialise the editor
updateSessionFileHash
(
dir
+
'
/
'
+
filename
);
showControl
Bar
(
filename
);
showControl
s
(
filename
);
$
(
'
table
'
).
fadeOut
(
'
slow
'
,
function
()
{
$
(
'
#editor
'
).
text
(
data
.
responseText
);
// encodeURIComponenet?
...
...
@@ -150,12 +154,12 @@ function showFileEditor(dir,filename){
function
hideFileEditor
(){
// Fade out controls
$
(
'
#editor
bar
'
).
fadeOut
(
'
slow
'
);
$
(
'
#editor
_close
'
).
fadeOut
(
'
slow
'
);
// Fade out breadcrumb
$
(
'
.actions
'
).
prev
().
fadeOut
(
'
slow
'
);
// Fade out editor
$
(
'
#editor
'
).
fadeOut
(
'
slow
'
,
function
(){
$
(
'
#editor
bar
'
).
remove
();
$
(
'
#editor
_close
'
).
remove
();
$
(
'
#editor
'
).
remove
();
$
(
'
.actions
'
).
prev
().
remove
();
var
editorhtml
=
'
<div id="editor"></div>
'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment