Permalink
Browse files

Merge 'master' branch

  • Loading branch information...
2 parents 85db51f + b565f33 commit 77bfc591bf5836892be26059d92411f9fbf04be9 @AlexDenisov AlexDenisov committed Sep 10, 2012
Showing with 965 additions and 435 deletions.
  1. +2 −1 Gemfile
  2. +4 −2 Gemfile.lock
  3. +23 −2 app/assets/javascripts/issues.js
  4. +0 −130 app/assets/javascripts/main.js
  5. +89 −0 app/assets/javascripts/main.js.coffee
  6. +4 −4 app/assets/javascripts/note.js
  7. +1 −1 app/assets/javascripts/projects.js.coffee
  8. +8 −0 app/assets/stylesheets/common.scss
  9. +2 −6 app/controllers/application_controller.rb
  10. +1 −1 app/controllers/issues_controller.rb
  11. +2 −0 app/controllers/refs_controller.rb
  12. +6 −7 app/controllers/team_members_controller.rb
  13. +3 −1 app/decorators/event_decorator.rb
  14. +1 −1 app/helpers/gitlab_markdown_helper.rb
  15. +6 −0 app/helpers/projects_helper.rb
  16. +10 −0 app/helpers/tree_helper.rb
  17. +19 −1 app/models/event.rb
  18. +1 −1 app/models/merge_request.rb
  19. +17 −0 app/models/users_project.rb
  20. +16 −0 app/observers/users_project_observer.rb
  21. +2 −0 app/roles/push_event.rb
  22. +13 −0 app/roles/team.rb
  23. +3 −5 app/views/errors/encoding.html.haml
  24. +0 −3 app/views/errors/invalid_ssh_key.html.haml
  25. +4 −0 app/views/events/_event.html.haml
  26. +9 −0 app/views/events/_event_membership_changed.html.haml
  27. +33 −8 app/views/help/markdown.html.haml
  28. +1 −1 app/views/issues/index.html.haml
  29. +2 −2 app/views/keys/index.html.haml
  30. +0 −8 app/views/layouts/_head_panel.html.haml
  31. +1 −1 app/views/merge_requests/_form.html.haml
  32. +1 −1 app/views/milestones/_form.html.haml
  33. +10 −8 app/views/projects/_team.html.haml
  34. +1 −5 app/views/refs/_tree.html.haml
  35. +2 −3 app/views/refs/_tree_file.html.haml
  36. +11 −14 app/views/team_members/_form.html.haml
  37. +8 −8 app/views/team_members/_show.html.haml
  38. +3 −2 config/gitlab.yml.example
  39. +4 −0 config/initializers/1_settings.rb
  40. +60 −0 doc/api/projects.md
  41. +9 −6 doc/installation.md
  42. +10 −0 features/dashboard/dashboard.feature
  43. +16 −0 features/projects/issues/issues.feature
  44. +25 −0 features/step_definitions/dashboard_steps.rb
  45. +24 −0 features/step_definitions/project/project_issues_steps.rb
  46. +2 −2 features/step_definitions/project/project_team_steps.rb
  47. +5 −0 lib/api/entities.rb
  48. +16 −0 lib/api/helpers.rb
  49. +2 −0 lib/api/issues.rb
  50. +2 −0 lib/api/milestones.rb
  51. +56 −0 lib/api/projects.rb
  52. +15 −174 lib/gitlab/backend/gitolite.rb
  53. +192 −0 lib/gitlab/backend/gitolite_config.rb
  54. +10 −4 lib/gitlab/markdown.rb
  55. +1 −2 lib/gitlab/merge.rb
  56. +14 −15 lib/tasks/bulk_import.rake
  57. +5 −0 spec/helpers/gitlab_markdown_helper_spec.rb
  58. +15 −0 spec/helpers/tree_helper_spec.rb
  59. +16 −0 spec/lib/gitolite_config_spec.rb
  60. +25 −0 spec/lib/gitolite_spec.rb
  61. +22 −0 spec/models/event_spec.rb
  62. +30 −0 spec/observers/users_project_observer_spec.rb
  63. +43 −0 spec/requests/api/projects_spec.rb
  64. +10 −0 spec/requests/projects_spec.rb
  65. +17 −5 spec/support/gitolite_stub.rb
View
@@ -44,7 +44,8 @@ gem "ffaker"
gem "seed-fu"
# Markdown to HTML
-gem "redcarpet", "~> 2.1.1"
+gem "redcarpet", "~> 2.1.1"
+gem "github-markup", "~> 0.7.4"
# Servers
gem "thin"
View
@@ -108,7 +108,7 @@ GEM
bcrypt-ruby (3.0.1)
blankslate (2.1.2.4)
bootstrap-sass (2.0.4.0)
- builder (3.0.0)
+ builder (3.0.2)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@@ -125,7 +125,7 @@ GEM
charlock_holmes (0.6.8)
childprocess (0.3.2)
ffi (~> 1.0.6)
- chosen-rails (0.9.8)
+ chosen-rails (0.9.8.3)
railties (~> 3.0)
thor (~> 0.14)
coderay (1.0.6)
@@ -178,6 +178,7 @@ GEM
gherkin (2.11.0)
json (>= 1.4.6)
git (1.2.5)
+ github-markup (0.7.4)
gitlab_meta (2.9)
grape (0.2.1)
hashie (~> 1.2)
@@ -397,6 +398,7 @@ DEPENDENCIES
ffaker
foreman
git
+ github-markup (~> 0.7.4)
gitlab_meta (= 2.9)
gitolite!
grack!
@@ -5,7 +5,7 @@ function switchToNewIssue(form){
$('select#issue_milestone_id').chosen();
$("#new_issue_dialog").show("fade", { direction: "right" }, 150);
$('.top-tabs .add_new').hide();
- disableButtonIfEmtpyField("#issue_title", ".save-btn");
+ disableButtonIfEmptyField("#issue_title", ".save-btn");
});
}
@@ -16,7 +16,7 @@ function switchToEditIssue(form){
$('select#issue_milestone_id').chosen();
$("#edit_issue_dialog").show("fade", { direction: "right" }, 150);
$('.add_new').hide();
- disableButtonIfEmtpyField("#issue_title", ".save-btn");
+ disableButtonIfEmptyField("#issue_title", ".save-btn");
});
}
@@ -80,6 +80,10 @@ function issuesPage(){
$(this).closest("form").submit();
});
+ $("#new_issue_link").click(function(){
+ updateNewIssueURL();
+ });
+
$('body').on('ajax:success', '.close_issue, .reopen_issue, #new_issue', function(){
var t = $(this),
totalIssues,
@@ -126,3 +130,20 @@ function issuesCheckChanged() {
$('.issues_filters').show();
}
}
+
+function updateNewIssueURL(){
+ var new_issue_link = $("#new_issue_link");
+ var milestone_id = $("#milestone_id").val();
+ var assignee_id = $("#assignee_id").val();
+ var new_href = "";
+ if(milestone_id){
+ new_href = "issue[milestone_id]=" + milestone_id + "&";
+ }
+ if(assignee_id){
+ new_href = new_href + "issue[assignee_id]=" + assignee_id;
+ }
+ if(new_href.length){
+ new_href = new_issue_link.attr("href") + "?" + new_href;
+ new_issue_link.attr("href", new_href);
+ }
+};
@@ -1,130 +0,0 @@
-$(document).ready(function(){
-
- $(".one_click_select").live("click", function(){
- $(this).select();
- });
-
- $('body').on('ajax:complete, ajax:beforeSend, submit', 'form', function(e){
- var buttons = $('[type="submit"]', this);
- switch( e.type ){
- case 'ajax:beforeSend':
- case 'submit':
- buttons.attr('disabled', 'disabled');
- break;
- case ' ajax:complete':
- default:
- buttons.removeAttr('disabled');
- break;
- }
- })
-
- $(".account-box").mouseenter(showMenu);
- $(".account-box").mouseleave(resetMenu);
-
- $("#projects-list .project").live('click', function(e){
- if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") {
- location.href = $(this).attr("url");
- e.stopPropagation();
- return false;
- }
- });
-
- /**
- * Focus search field by pressing 's' key
- */
- $(document).keypress(function(e) {
- if( $(e.target).is(":input") ) return;
- switch(e.which) {
- case 115: focusSearch();
- e.preventDefault();
- }
- });
-
- /**
- * Commit show suppressed diff
- *
- */
- $(".supp_diff_link").bind("click", function() {
- showDiff(this);
- });
-
- /**
- * Note markdown preview
- *
- */
- $(document).on('click', '#preview-link', function(e) {
- $('#preview-note').text('Loading...');
-
- var previewLinkText = ($(this).text() == 'Preview' ? 'Edit' : 'Preview');
- $(this).text(previewLinkText);
-
- var note = $('#note_note').val();
- if (note.trim().length === 0) { note = 'Nothing to preview'; }
- $.post($(this).attr('href'), {note: note}, function(data) {
- $('#preview-note').html(data);
- });
-
- $('#preview-note, #note_note').toggle();
- e.preventDefault();
- });
-});
-
-function focusSearch() {
- $("#search").focus();
-}
-
-function updatePage(data){
- $.ajax({type: "GET", url: location.href, data: data, dataType: "script"});
-}
-
-function showMenu() {
- $(this).toggleClass('hover');
-}
-
-function resetMenu() {
- $(this).removeClass("hover");
-}
-
-function slugify(text) {
- return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase();
-}
-
-function showDiff(link) {
- $(link).next('table').show();
- $(link).remove();
-}
-
-(function($){
- var _chosen = $.fn.chosen;
- $.fn.extend({
- chosen: function(options) {
- var default_options = {'search_contains' : 'true'};
- $.extend(default_options, options);
- return _chosen.apply(this, [default_options]);
- }})
-})(jQuery);
-
-
-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");
- }
- })
-}
@@ -0,0 +1,89 @@
+window.updatePage = (data) ->
+ $.ajax({type: "GET", url: location.href, data: data, dataType: "script"})
+
+window.slugify = (text) ->
+ text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase()
+
+window.ajaxGet = (url) ->
+ $.ajax({type: "GET", url: url, dataType: "script"})
+
+ # Disable button if text field is empty
+window.disableButtonIfEmptyField = (field_selector, button_selector) ->
+ field = $(field_selector)
+ closest_submit = field.closest("form").find(button_selector)
+
+ closest_submit.disable() if field.val() is ""
+
+ field.on "keyup", ->
+ if $(this).val() is ""
+ closest_submit.disable()
+ else
+ closest_submit.enable()
+
+$ ->
+ # Click a .one_click_select field, select the contents
+ $(".one_click_select").live 'click', -> $(this).select()
+
+ # Disable form buttons while a form is submitting
+ $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
+ buttons = $('[type="submit"]', this)
+
+ switch e.type
+ when 'ajax:beforeSend', 'submit'
+ buttons.disable()
+ else
+ buttons.enable()
+
+ # Show/Hide the profile menu when hovering the account box
+ $('.account-box').hover -> $(this).toggleClass('hover')
+
+ # Focus search field by pressing 's' key
+ $(document).keypress (e) ->
+ # Don't do anything if typing in an input
+ return if $(e.target).is(":input")
+
+ switch e.which
+ when 115
+ $("#search").focus()
+ e.preventDefault()
+
+ # Commit show suppressed diff
+ $(".supp_diff_link").bind "click", ->
+ $(this).next('table').show()
+ $(this).remove()
+
+ # Note markdown preview
+ $(document).on 'click', '#preview-link', (e) ->
+ $('#preview-note').text('Loading...')
+
+ previewLinkText = if $(this).text() == 'Preview' then 'Edit' else 'Preview'
+ $(this).text(previewLinkText)
+
+ note = $('#note_note').val()
+
+ if note.trim().length == 0
+ $('#preview-note').text("Nothing to preview.")
+ else
+ $.post $(this).attr('href'), {note: note}, (data) ->
+ $('#preview-note').html(data)
+
+ $('#preview-note, #note_note').toggle()
+ e.preventDefault()
+ false
+
+(($) ->
+ _chosen = $.fn.chosen
+ $.fn.extend chosen: (options) ->
+ default_options = search_contains: "true"
+ $.extend default_options, options
+ _chosen.apply this, [default_options]
+
+ # Disable an element and add the 'disabled' Bootstrap class
+ $.fn.extend disable: ->
+ $(this).attr('disabled', 'disabled').addClass('disabled')
+
+ # Enable an element and remove the 'disabled' Bootstrap class
+ $.fn.extend enable: ->
+ $(this).removeAttr('disabled').removeClass('disabled')
+
+)(jQuery)
@@ -25,14 +25,14 @@ var NoteList = {
$(this).closest('li').fadeOut(); });
$(".note-form-holder").live("ajax:before", function(){
- $(".submit_note").attr("disabled", "disabled");
+ $(".submit_note").disable()
})
$(".note-form-holder").live("ajax:complete", function(){
- $(".submit_note").removeAttr("disabled");
+ $(".submit_note").enable()
})
- disableButtonIfEmtpyField(".note-text", ".submit_note");
+ disableButtonIfEmptyField(".note-text", ".submit_note");
$(".note-text").live("focus", function(){
$(this).css("height", "80px");
@@ -177,6 +177,6 @@ var PerLineNotes = {
form.show();
return false;
});
- disableButtonIfEmtpyField(".line-note-text", ".submit_inline_note");
+ disableButtonIfEmptyField(".line-note-text", ".submit_inline_note");
}
}
@@ -8,7 +8,7 @@ window.Projects = ->
$('.save-project-loader').show()
$('form #project_default_branch').chosen()
- disableButtonIfEmtpyField '#project_name', '.project-submit'
+ disableButtonIfEmptyField '#project_name', '.project-submit'
# Git clone panel switcher
$ ->
@@ -179,6 +179,14 @@ span.update-author {
&.merged {
background-color: #2A2;
}
+
+ &.joined {
+ background-color: #1cb9ff;
+ }
+
+ &.left {
+ background-color: #ff5057;
+ }
}
form {
@@ -11,15 +11,11 @@ class ApplicationController < ActionController::Base
helper_method :abilities, :can?
rescue_from Gitlab::Gitolite::AccessDenied do |exception|
- render "errors/gitolite", layout: "error"
- end
-
- rescue_from Gitlab::Gitolite::InvalidKey do |exception|
- render "errors/invalid_ssh_key", layout: "error"
+ render "errors/gitolite", layout: "error", status: 500
end
rescue_from Encoding::CompatibilityError do |exception|
- render "errors/encoding", layout: "error", status: 404
+ render "errors/encoding", layout: "error", status: 500
end
rescue_from ActiveRecord::RecordNotFound do |exception|
@@ -37,7 +37,7 @@ def index
end
def new
- @issue = @project.issues.new
+ @issue = @project.issues.new(params[:issue])
respond_with(@issue)
end
@@ -1,3 +1,5 @@
+require 'github/markup'
+
class RefsController < ApplicationController
include Gitlab::Encode
before_filter :project
Oops, something went wrong.

0 comments on commit 77bfc59

Please sign in to comment.