Reduce the amount of JavaScript written in views

Seeing `:javascript` all over Views feels like a code smell. This goes a
long way towards reducing the amount of JS in views, but there's still
plenty to be done on that front.
This commit is contained in:
Robert Speicher 2012-09-10 02:09:55 -04:00
parent b565f33472
commit d6c384c20f
18 changed files with 22 additions and 122 deletions

View file

@ -1,7 +1,7 @@
%ul.nav.nav-tabs
%li
= form_tag switch_project_refs_path(@project), method: :get, class: "project-refs-form", remote: true do
= select_tag "ref", grouped_options_refs, onchange: "$(this.form).trigger('submit');", class: "project-refs-select"
= select_tag "ref", grouped_options_refs, onchange: "$(this.form).trigger('submit');", class: "project-refs-select chosen"
= hidden_field_tag :destination, "tree"
= hidden_field_tag :path, params[:path]
%li{class: "#{'active' if (controller.controller_name == "refs") }"}

View file

@ -47,10 +47,7 @@
:javascript
$(function(){
$('.project-refs-select').chosen();
history.pushState({ path: this.path }, '', "#{@history_path}");
});
// Load last commit log for each file in tree

View file

@ -38,8 +38,3 @@
= preserve do
%pre
= Gitlab::Encode.utf8 lines.join("\n")
:javascript
$(function(){
$('.project-refs-select').chosen();
});