BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4a6596af
Commit
4a6596af
authored
Aug 30, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bunch of js bugs with comments. Also added development tips
parent
92137b7b
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
131 additions
and
62 deletions
+131
-62
README.md
README.md
+1
-0
application.js
app/assets/javascripts/application.js
+20
-0
note.js
app/assets/javascripts/note.js
+41
-41
notes.scss
app/assets/stylesheets/sections/notes.scss
+1
-1
show.html.haml
app/views/commits/show.html.haml
+2
-8
_create_common.js.haml
app/views/notes/_create_common.js.haml
+6
-5
_create_line.js.haml
app/views/notes/_create_line.js.haml
+1
-1
_form.html.haml
app/views/notes/_form.html.haml
+3
-2
_per_line_form.html.haml
app/views/notes/_per_line_form.html.haml
+3
-2
development.md
doc/development.md
+45
-0
gitlab
gitlab
+6
-1
resque_dev.sh
resque_dev.sh
+2
-1
No files found.
README.md
View file @
4a6596af
...
...
@@ -39,5 +39,6 @@ Email
## Contribute
[
Development Tips
](
https://github.com/gitlabhq/gitlabhq/blob/master/doc/development.md
)
Want to help - send a pull request.
We'll accept good pull requests.
app/assets/javascripts/application.js
View file @
4a6596af
...
...
@@ -128,3 +128,23 @@ function showDiff(link) {
function
ajaxGet
(
url
)
{
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
dataType
:
"script"
});
}
/**
* Disable button if text field is empty
*/
function
disableButtonIfEmtpyField
(
field_selector
,
button_selector
)
{
field
=
$
(
field_selector
);
if
(
field
.
val
()
==
""
)
{
field
.
closest
(
"form"
).
find
(
button_selector
).
attr
(
"disabled"
,
"disabled"
).
addClass
(
"disabled"
);
}
field
.
on
(
'keyup'
,
function
(){
var
field
=
$
(
this
);
var
closest_submit
=
field
.
closest
(
"form"
).
find
(
button_selector
);
if
(
field
.
val
()
==
""
)
{
closest_submit
.
attr
(
"disabled"
,
"disabled"
).
addClass
(
"disabled"
);
}
else
{
closest_submit
.
removeAttr
(
"disabled"
).
removeClass
(
"disabled"
);
}
})
}
app/assets/javascripts/note.js
View file @
4a6596af
var
NoteList
=
{
notes_path
:
null
,
target_params
:
null
,
target_id
:
0
,
target_type
:
null
,
first_id
:
0
,
last_id
:
0
,
disable
:
false
,
init
:
notes_path
:
null
,
target_params
:
null
,
target_id
:
0
,
target_type
:
null
,
first_id
:
0
,
last_id
:
0
,
disable
:
false
,
init
:
function
(
tid
,
tt
,
path
)
{
this
.
notes_path
=
path
+
".js"
;
this
.
target_id
=
tid
;
...
...
@@ -24,30 +24,19 @@ init:
$
(
'.delete-note'
).
live
(
'ajax:success'
,
function
()
{
$
(
this
).
closest
(
'li'
).
fadeOut
();
});
$
(
'#note_note'
).
on
(
'keyup'
,
function
(){
var
field
=
$
(
this
);
var
closest_submit
=
field
.
closest
(
"form"
).
find
(
".submit_note"
);
if
(
field
.
val
()
==
""
)
{
closest_submit
.
attr
(
"disabled"
,
"disabled"
).
addClass
(
"disabled"
);
}
else
{
closest_submit
.
removeAttr
(
"disabled"
).
removeClass
(
"disabled"
);
}
})
$
(
"#new_note"
).
live
(
"ajax:before"
,
function
(){
$
(
".note-form-holder"
).
live
(
"ajax:before"
,
function
(){
$
(
".submit_note"
).
attr
(
"disabled"
,
"disabled"
);
})
$
(
"#new_note
"
).
live
(
"ajax:complete"
,
function
(){
$
(
".note-form-holder
"
).
live
(
"ajax:complete"
,
function
(){
$
(
".submit_note"
).
removeAttr
(
"disabled"
);
})
$
(
"#note_note"
).
live
(
"focus"
,
function
(){
disableButtonIfEmtpyField
(
".note-text"
,
".submit_note"
);
$
(
".note-text"
).
live
(
"focus"
,
function
(){
$
(
this
).
css
(
"height"
,
"80px"
);
$
(
'.note_advanced_opts'
).
show
();
if
(
$
(
this
).
val
()
==
""
)
{
$
(
this
).
closest
(
"form"
).
find
(
".submit_note"
).
attr
(
"disabled"
,
"disabled"
).
addClass
(
"disabled"
);
}
});
$
(
"#note_attachment"
).
change
(
function
(
e
){
...
...
@@ -59,31 +48,31 @@ init:
},
/**
/**
* Load new notes to fresh list called 'new_notes_list':
* - Replace 'new_notes_list' with new list every n seconds
* - Append new notes to this list after submit
*/
initRefresh
:
initRefresh
:
function
()
{
// init timer
var
intNew
=
setInterval
(
"NoteList.getNew()"
,
10000
);
},
replace
:
replace
:
function
(
html
)
{
$
(
"#new_notes_list"
).
html
(
html
);
},
prepend
:
prepend
:
function
(
id
,
html
)
{
if
(
id
!=
this
.
last_id
)
{
$
(
"#new_notes_list"
).
prepend
(
html
);
}
},
getNew
:
getNew
:
function
()
{
// refersh notes list
$
.
ajax
({
...
...
@@ -93,7 +82,7 @@ getNew:
dataType
:
"script"
});
},
refresh
:
refresh
:
function
()
{
// refersh notes list
$
.
ajax
({
...
...
@@ -104,14 +93,14 @@ refresh:
},
/**
/**
* Init load of notes:
* 1. Get content with ajax call
* 2. Set content of notes list with loaded one
*/
getContent
:
getContent
:
function
()
{
$
.
ajax
({
type
:
"GET"
,
...
...
@@ -122,7 +111,7 @@ getContent:
dataType
:
"script"
});
},
setContent
:
setContent
:
function
(
fid
,
lid
,
html
)
{
this
.
last_id
=
lid
;
this
.
first_id
=
fid
;
...
...
@@ -133,16 +122,14 @@ setContent:
},
/**
/**
* Paging for old notes when scroll to bottom:
* 1. Init scroll events with 'initLoadMore'
* 2. Load onlder notes with 'getOld' method
* 3. append old notes to bottom of list with 'append'
*
*/
getOld
:
getOld
:
function
()
{
$
(
'.loading'
).
show
();
$
.
ajax
({
...
...
@@ -154,7 +141,7 @@ getOld:
dataType
:
"script"
});
},
append
:
append
:
function
(
id
,
html
)
{
if
(
this
.
first_id
==
id
)
{
this
.
disable
=
true
;
...
...
@@ -164,8 +151,7 @@ append:
}
},
initLoadMore
:
initLoadMore
:
function
()
{
$
(
document
).
endlessScroll
({
bottomPixels
:
400
,
...
...
@@ -179,4 +165,18 @@ initLoadMore:
}
});
}
};
var
PerLineNotes
=
{
init
:
function
()
{
$
(
".line_note_link, .line_note_reply_link"
).
live
(
"click"
,
function
(
e
)
{
var
form
=
$
(
".per_line_form"
);
$
(
this
).
closest
(
"tr"
).
after
(
form
);
form
.
find
(
"#note_line_code"
).
val
(
$
(
this
).
attr
(
"line_code"
));
form
.
show
();
return
false
;
});
disableButtonIfEmtpyField
(
".line-note-text"
,
".submit_inline_note"
);
}
}
app/assets/stylesheets/sections/notes.scss
View file @
4a6596af
...
...
@@ -30,7 +30,7 @@
}
#new_note
{
#note_note
{
.note-text
{
height
:
25px
;
}
.attach_holder
{
...
...
app/views/commits/show.html.haml
View file @
4a6596af
...
...
@@ -5,12 +5,6 @@
:javascript
$
(
document
).
ready
(
function
(){
$
(
".line_note_link, .line_note_reply_link"
).
live
(
"click"
,
function
(
e
)
{
var
form
=
$
(
".per_line_form"
);
$
(
this
).
parent
().
parent
().
after
(
form
);
form
.
find
(
"#note_line_code"
).
val
(
$
(
this
).
attr
(
"line_code"
));
form
.
show
();
return
false
;
});
$
(
function
(){
PerLineNotes
.
init
();
});
app/views/notes/_create_common.js.haml
View file @
4a6596af
-
if
note
.
valid?
:plain
$("#new_note .error").remove();
$('#new_note textarea').val("");
$('#preview-link').text('Preview');
$('#preview-note').hide(); $('#note_note').show();
$(".note-form-holder .error").remove();
$('.note-form-holder textarea').val("");
$('.note-form-holder #preview-link').text('Preview');
$('.note-form-holder #preview-note').hide();
$('.note-form-holder').show();
NoteList.prepend(
#{
note
.
id
}
, "
#{
escape_javascript
(
render
partial:
"notes/show"
,
locals:
{
note:
note
})
}
");
-
else
:plain
$("
#new_note
").replaceWith("
#{
escape_javascript
(
render
(
'form'
))
}
");
$("
.note-form-holder
").replaceWith("
#{
escape_javascript
(
render
(
'form'
))
}
");
app/views/notes/_create_line.js.haml
View file @
4a6596af
-
if
note
.
valid?
:plain
$(".per_line_form").hide();
$('
#new_note
textarea').val("");
$('
.line-note-form-holder
textarea').val("");
$("a.line_note_reply_link[line_code='
#{
note
.
line_code
}
']").closest("tr").remove();
var trEl = $(".
#{
note
.
line_code
}
").parent();
trEl.after("
#{
escape_javascript
(
render
partial:
"notes/per_line_show"
,
locals:
{
note:
note
})
}
");
...
...
app/views/notes/_form.html.haml
View file @
4a6596af
=
form_for
[
@project
,
@note
],
remote:
"true"
,
multipart:
true
do
|
f
|
.note-form-holder
=
form_for
[
@project
,
@note
],
remote:
"true"
,
multipart:
true
do
|
f
|
%h3
.page_title
Leave a comment
-
if
@note
.
errors
.
any?
.alert-message.block-message.error
...
...
@@ -7,7 +8,7 @@
=
f
.
hidden_field
:noteable_id
=
f
.
hidden_field
:noteable_type
=
f
.
text_area
:note
,
size:
255
=
f
.
text_area
:note
,
size:
255
,
class:
'note-text'
#preview-note
.preview_note.hide
.hint
.right
Comments are parsed with
#{
link_to
"Gitlab Flavored Markdown"
,
help_markdown_path
,
target:
'_blank'
}
.
...
...
app/views/notes/_per_line_form.html.haml
View file @
4a6596af
%table
{
style:
"display:none;"
}
%tr
.per_line_form
%td
{
colspan:
3
}
.line-note-form-holder
=
form_for
[
@project
,
@note
],
remote:
"true"
,
multipart:
true
do
|
f
|
%h3
.page_title
Leave a note
%div
.span10
...
...
@@ -12,10 +13,10 @@
=
f
.
hidden_field
:noteable_id
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:line_code
=
f
.
text_area
:note
,
size:
255
=
f
.
text_area
:note
,
size:
255
,
class:
'line-note-text'
.note_actions
.buttons
=
f
.
submit
'Add note'
,
class:
"btn primary submit
_note"
,
id:
"submit_note"
=
f
.
submit
'Add note'
,
class:
"btn primary submit_note submit_inline
_note"
,
id:
"submit_note"
=
link_to
"Cancel"
,
"#"
,
class:
"btn hide-button"
.options
%h6
.left
Notify via email:
...
...
doc/development.md
0 → 100644
View file @
4a6596af
## Development tips:
### Start application in development mode
#### 1. Via foreman
bundle exec foreman -p 3000
#### 2. Via gitlab cli
./gitlab start
#### 3. Manually
bundle exec rails s
bundle exec rake environment resque:work QUEUE=
*
VVERBOSE=1
### Run tests:
#### 1. Packages
# ubuntu
sudo apt-get install libqt4-dev libqtwebkit-dev
sudo apt-get install xvfb
# Mac
brew install qt
brew install xvfb
#### 2. DB & seeds
bundle exec rake db:setup RAILS_ENV=test
bundle exec rake db:seed_fu RAILS_ENV=test
### 3. Run Tests
# All in one
bundle exec gitlab:test
# Rspec
bundle exec rake spec
# Cucumber
bundle exec rake cucumber
gitlab
View file @
4a6596af
...
...
@@ -22,10 +22,11 @@ class GitlabCli
case
@mode
when
'production'
;
system
(
unicorn_start_cmd
)
system
(
resque_start_cmd
)
else
system
(
rails_start_cmd
)
system
(
resque_dev_start_cmd
)
end
system
(
resque_start_cmd
)
end
def
stop
...
...
@@ -57,6 +58,10 @@ class GitlabCli
"kill -QUIT `cat
#{
pid
}
`"
end
def
resque_dev_start_cmd
"./resque_dev.sh > /dev/null 2>&1"
end
def
resque_start_cmd
"./resque.sh > /dev/null 2>&1"
end
...
...
resque_dev.sh
View file @
4a6596af
bundle
exec
rake environment resque:work
QUEUE
=
post_receive,mailer,system_hook
VVERBOSE
=
1
mkdir
-p
tmp/pids
bundle
exec
rake environment resque:work
QUEUE
=
post_receive,mailer,system_hook
VVERBOSE
=
1
PIDFILE
=
tmp/pids/resque_worker.pid
RAILS_ENV
=
development
BACKGROUND
=
yes
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