Commit 477e9f87 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'drop_rjs_2' of /home/git/repositories/gitlab/gitlabhq

parents ff25cb93 da10cad1
...@@ -54,7 +54,16 @@ ...@@ -54,7 +54,16 @@
unless terms is last_terms unless terms is last_terms
last_terms = terms last_terms = terms
if terms.length >= 2 or terms.length is 0 if terms.length >= 2 or terms.length is 0
form.submit() $.ajax
type: "GET"
url: location.href
data: "issue_search=" + terms
complete: ->
$(".loading").hide()
success: (data) ->
$('.issues-holder').html(data.html)
Issues.reload()
dataType: "json"
checkChanged: -> checkChanged: ->
checked_issues = $(".selected_issue:checked") checked_issues = $(".selected_issue:checked")
......
...@@ -6,7 +6,7 @@ var NoteList = { ...@@ -6,7 +6,7 @@ var NoteList = {
target_type: null, target_type: null,
init: function(tid, tt, path) { init: function(tid, tt, path) {
NoteList.notes_path = path + ".js"; NoteList.notes_path = path + ".json";
NoteList.target_id = tid; NoteList.target_id = tid;
NoteList.target_type = tt; NoteList.target_type = tt;
NoteList.target_params = "target_type=" + NoteList.target_type + "&target_id=" + NoteList.target_id; NoteList.target_params = "target_type=" + NoteList.target_type + "&target_id=" + NoteList.target_id;
...@@ -411,7 +411,10 @@ var NoteList = { ...@@ -411,7 +411,10 @@ var NoteList = {
data: NoteList.target_params, data: NoteList.target_params,
complete: function(){ $('.js-notes-busy').removeClass("loading")}, complete: function(){ $('.js-notes-busy').removeClass("loading")},
beforeSend: function() { $('.js-notes-busy').addClass("loading") }, beforeSend: function() { $('.js-notes-busy').addClass("loading") },
dataType: "script" success: function(data) {
NoteList.setContent(data.html);
},
dataType: "json"
}); });
}, },
...@@ -419,7 +422,7 @@ var NoteList = { ...@@ -419,7 +422,7 @@ var NoteList = {
* Called in response to getContent(). * Called in response to getContent().
* Replaces the content of #notes-list with the given html. * Replaces the content of #notes-list with the given html.
*/ */
setContent: function(newNoteIds, html) { setContent: function(html) {
$("#notes-list").html(html); $("#notes-list").html(html);
}, },
......
...@@ -188,4 +188,12 @@ class ApplicationController < ActionController::Base ...@@ -188,4 +188,12 @@ class ApplicationController < ActionController::Base
count: count count: count
} }
end end
def view_to_html_string(partial)
render_to_string(
partial,
layout: false,
formats: [:html]
)
end
end end
...@@ -11,7 +11,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -11,7 +11,7 @@ class Projects::IssuesController < Projects::ApplicationController
# Allow modify issue # Allow modify issue
before_filter :authorize_modify_issue!, only: [:edit, :update] before_filter :authorize_modify_issue!, only: [:edit, :update]
respond_to :js, :html respond_to :html
def index def index
terms = params['issue_search'] terms = params['issue_search']
...@@ -28,9 +28,13 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -28,9 +28,13 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html
format.js
format.atom { render layout: false } format.atom { render layout: false }
format.json do
render json: {
html: view_to_html_string("projects/issues/_issues")
}
end
end end
end end
...@@ -48,10 +52,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -48,10 +52,7 @@ class Projects::IssuesController < Projects::ApplicationController
@target_type = :issue @target_type = :issue
@target_id = @issue.id @target_id = @issue.id
respond_to do |format| respond_with(@issue)
format.html
format.js
end
end end
def create def create
......
...@@ -14,7 +14,14 @@ class Projects::NotesController < Projects::ApplicationController ...@@ -14,7 +14,14 @@ class Projects::NotesController < Projects::ApplicationController
@discussions = discussions_from_notes @discussions = discussions_from_notes
end end
respond_with(@notes) respond_to do |format|
format.html { redirect_to :back }
format.json do
render json: {
html: view_to_html_string("projects/notes/_notes")
}
end
end
end end
def create def create
......
...@@ -21,9 +21,5 @@ ...@@ -21,9 +21,5 @@
= 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 = 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
%i.icon-plus %i.icon-plus
New Issue New Issue
= form_tag project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: 'pull-right issue-search-form' do = form_tag project_issues_path(@project), method: :get, id: "issue_search_form", class: 'pull-right issue-search-form' do
= hidden_field_tag :status, params[:status], id: 'search_status'
= hidden_field_tag :assignee_id, params[:assignee_id], id: 'search_assignee_id'
= hidden_field_tag :milestone_id, params[:milestone_id], id: 'search_milestone_id'
= hidden_field_tag :label_name, params[:label_name], id: 'search_label_name'
= 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' } = 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' }
:plain
$('.issues-holder').html("#{escape_javascript(render('issues'))}");
History.replaceState({path: "#{request.url}"}, document.title, "#{request.url}");
Issues.reload();
- unless @notes.blank?
var notesHtml = "#{escape_javascript(render 'projects/notes/notes')}";
- new_note_ids = @notes.map(&:id)
NoteList.setContent(#{new_note_ids}, notesHtml);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment