Commit da10cad1da7039a346f1f0d32325d8be4c3a1c56
1 parent
596e64e5
Exists in
master
and in
4 other branches
Drop rjs from Issues#index
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
6 changed files
with
29 additions
and
25 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/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
| ... | ... | @@ -17,14 +17,8 @@ class Projects::NotesController < Projects::ApplicationController |
| 17 | 17 | respond_to do |format| |
| 18 | 18 | format.html { redirect_to :back } |
| 19 | 19 | format.json do |
| 20 | - html = render_to_string( | |
| 21 | - "projects/notes/_notes", | |
| 22 | - layout: false, | |
| 23 | - formats: [:html] | |
| 24 | - ) | |
| 25 | - | |
| 26 | 20 | render json: { |
| 27 | - html: html, | |
| 21 | + html: view_to_html_string("projects/notes/_notes") | |
| 28 | 22 | } |
| 29 | 23 | end |
| 30 | 24 | end | ... | ... |
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