Commit 477e9f87e14a8b7a04355453283d49e4e14fcafb
Exists in
master
and in
4 other branches
Merge branch 'drop_rjs_2' of /home/git/repositories/gitlab/gitlabhq
Showing
9 changed files
with
43 additions
and
27 deletions
Show diff stats
app/assets/javascripts/issues.js.coffee
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | backgroundColor: '#DDD' |
23 | 23 | opacity: .4 |
24 | 24 | ) |
25 | - | |
25 | + | |
26 | 26 | reload: -> |
27 | 27 | Issues.initSelects() |
28 | 28 | Issues.initChecks() |
... | ... | @@ -54,7 +54,16 @@ |
54 | 54 | unless terms is last_terms |
55 | 55 | last_terms = terms |
56 | 56 | if terms.length >= 2 or terms.length is 0 |
57 | - form.submit() | |
57 | + $.ajax | |
58 | + type: "GET" | |
59 | + url: location.href | |
60 | + data: "issue_search=" + terms | |
61 | + complete: -> | |
62 | + $(".loading").hide() | |
63 | + success: (data) -> | |
64 | + $('.issues-holder').html(data.html) | |
65 | + Issues.reload() | |
66 | + dataType: "json" | |
58 | 67 | |
59 | 68 | checkChanged: -> |
60 | 69 | checked_issues = $(".selected_issue:checked") | ... | ... |
app/assets/javascripts/notes.js
... | ... | @@ -6,7 +6,7 @@ var NoteList = { |
6 | 6 | target_type: null, |
7 | 7 | |
8 | 8 | init: function(tid, tt, path) { |
9 | - NoteList.notes_path = path + ".js"; | |
9 | + NoteList.notes_path = path + ".json"; | |
10 | 10 | NoteList.target_id = tid; |
11 | 11 | NoteList.target_type = tt; |
12 | 12 | NoteList.target_params = "target_type=" + NoteList.target_type + "&target_id=" + NoteList.target_id; |
... | ... | @@ -411,7 +411,10 @@ var NoteList = { |
411 | 411 | data: NoteList.target_params, |
412 | 412 | complete: function(){ $('.js-notes-busy').removeClass("loading")}, |
413 | 413 | beforeSend: function() { $('.js-notes-busy').addClass("loading") }, |
414 | - dataType: "script" | |
414 | + success: function(data) { | |
415 | + NoteList.setContent(data.html); | |
416 | + }, | |
417 | + dataType: "json" | |
415 | 418 | }); |
416 | 419 | }, |
417 | 420 | |
... | ... | @@ -419,7 +422,7 @@ var NoteList = { |
419 | 422 | * Called in response to getContent(). |
420 | 423 | * Replaces the content of #notes-list with the given html. |
421 | 424 | */ |
422 | - setContent: function(newNoteIds, html) { | |
425 | + setContent: function(html) { | |
423 | 426 | $("#notes-list").html(html); |
424 | 427 | }, |
425 | 428 | ... | ... |
app/controllers/application_controller.rb
app/controllers/projects/issues_controller.rb
... | ... | @@ -11,7 +11,7 @@ class Projects::IssuesController < Projects::ApplicationController |
11 | 11 | # Allow modify issue |
12 | 12 | before_filter :authorize_modify_issue!, only: [:edit, :update] |
13 | 13 | |
14 | - respond_to :js, :html | |
14 | + respond_to :html | |
15 | 15 | |
16 | 16 | def index |
17 | 17 | terms = params['issue_search'] |
... | ... | @@ -28,9 +28,13 @@ class Projects::IssuesController < Projects::ApplicationController |
28 | 28 | |
29 | 29 | |
30 | 30 | respond_to do |format| |
31 | - format.html # index.html.erb | |
32 | - format.js | |
31 | + format.html | |
33 | 32 | format.atom { render layout: false } |
33 | + format.json do | |
34 | + render json: { | |
35 | + html: view_to_html_string("projects/issues/_issues") | |
36 | + } | |
37 | + end | |
34 | 38 | end |
35 | 39 | end |
36 | 40 | |
... | ... | @@ -48,10 +52,7 @@ class Projects::IssuesController < Projects::ApplicationController |
48 | 52 | @target_type = :issue |
49 | 53 | @target_id = @issue.id |
50 | 54 | |
51 | - respond_to do |format| | |
52 | - format.html | |
53 | - format.js | |
54 | - end | |
55 | + respond_with(@issue) | |
55 | 56 | end |
56 | 57 | |
57 | 58 | def create | ... | ... |
app/controllers/projects/notes_controller.rb
... | ... | @@ -14,7 +14,14 @@ class Projects::NotesController < Projects::ApplicationController |
14 | 14 | @discussions = discussions_from_notes |
15 | 15 | end |
16 | 16 | |
17 | - respond_with(@notes) | |
17 | + respond_to do |format| | |
18 | + format.html { redirect_to :back } | |
19 | + format.json do | |
20 | + render json: { | |
21 | + html: view_to_html_string("projects/notes/_notes") | |
22 | + } | |
23 | + end | |
24 | + end | |
18 | 25 | end |
19 | 26 | |
20 | 27 | def create | ... | ... |
app/views/projects/issues/_head.html.haml
... | ... | @@ -21,9 +21,5 @@ |
21 | 21 | = link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "btn btn-new pull-right", title: "New Issue", id: "new_issue_link" do |
22 | 22 | %i.icon-plus |
23 | 23 | New Issue |
24 | - = form_tag project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: 'pull-right issue-search-form' do | |
25 | - = hidden_field_tag :status, params[:status], id: 'search_status' | |
26 | - = hidden_field_tag :assignee_id, params[:assignee_id], id: 'search_assignee_id' | |
27 | - = hidden_field_tag :milestone_id, params[:milestone_id], id: 'search_milestone_id' | |
28 | - = hidden_field_tag :label_name, params[:label_name], id: 'search_label_name' | |
24 | + = form_tag project_issues_path(@project), method: :get, id: "issue_search_form", class: 'pull-right issue-search-form' do | |
29 | 25 | = search_field_tag :issue_search, nil, { placeholder: 'Filter by title or description', class: 'input-xpadding issue_search input-xlarge append-right-10 search-text-input' } | ... | ... |
app/views/projects/issues/index.js.haml
app/views/projects/notes/index.js.haml
config/initializers/1_settings.rb
... | ... | @@ -30,7 +30,7 @@ class Settings < Settingslogic |
30 | 30 | gitlab.relative_url_root |
31 | 31 | ].join('') |
32 | 32 | end |
33 | - | |
33 | + | |
34 | 34 | # check that values in `current` (string or integer) is a contant in `modul`. |
35 | 35 | def verify_constant_array(modul, current, default) |
36 | 36 | values = default || [] | ... | ... |