Commit 2aa620c2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

move more inline js to handle via dispatcher

parent 6473aaf8
$ -> @Admin =
$('input#user_force_random_password').on 'change', (elem) -> init: ->
elems = $('#user_password, #user_password_confirmation') $('input#user_force_random_password').on 'change', (elem) ->
elems = $('#user_password, #user_password_confirmation')
if $(@).attr 'checked' if $(@).attr 'checked'
elems.val('').attr 'disabled', true elems.val('').attr 'disabled', true
else else
elems.removeAttr 'disabled' elems.removeAttr 'disabled'
$('.log-tabs a').click (e) -> $('.log-tabs a').click (e) ->
e.preventDefault() e.preventDefault()
$(this).tab('show') $(this).tab('show')
$('.log-bottom').click (e) -> $('.log-bottom').click (e) ->
e.preventDefault() e.preventDefault()
visible_log = $(".file_content:visible") visible_log = $(".file_content:visible")
visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast") visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast")
modal = $('.change-owner-holder')
$('.change-owner-link').bind "click", ->
$(this).hide()
modal.show()
$('.change-owner-cancel-link').bind "click", ->
modal.hide()
$('.change-owner-link').show()
@Commit =
init: ->
$('.files .file').each ->
new CommitFile(this)
...@@ -10,8 +10,10 @@ class Dispatcher ...@@ -10,8 +10,10 @@ class Dispatcher
switch page switch page
when 'issues:index' then Issues.init() when 'issues:index' then Issues.init()
when 'dashboard:show' then dashboardPage() when 'dashboard:show' then dashboardPage()
when 'groups:show' then Pager.init(20, true) when 'commit:show' then Commit.init()
when 'teams:show' then Pager.init(20, true) when 'groups:show', 'teams:show', 'projects:show'
when 'projects:show' then Pager.init(20, true) Pager.init(20, true)
when 'projects:new' then new Projects() when 'projects:new', 'projects:edit'
when 'projects:edit' then new Projects() new Projects()
when 'admin:teams:show', 'admin:groups:show', 'admin:logs:show', 'admin:users:new'
Admin.init()
...@@ -191,6 +191,9 @@ module ApplicationHelper ...@@ -191,6 +191,9 @@ module ApplicationHelper
end end
def body_data_page def body_data_page
controller.controller_name + ":" + controller.action_name path = controller.controller_path.split('/')
namespace = path.first if path.second
[namespace, controller.controller_name, controller.action_name].compact.join(":")
end end
end end
...@@ -118,16 +118,3 @@ ...@@ -118,16 +118,3 @@
.form-actions .form-actions
= submit_tag 'Move projects', class: "btn btn-create" = submit_tag 'Move projects', class: "btn btn-create"
:javascript
$(function(){
var modal = $('.change-owner-holder');
$('.change-owner-link').bind("click", function(){
$(this).hide();
modal.show();
});
$('.change-owner-cancel-link').bind("click", function(){
modal.hide();
$('.change-owner-link').show();
})
})
...@@ -91,17 +91,3 @@ ...@@ -91,17 +91,3 @@
= link_to 'Edit', edit_admin_team_project_path(@team, project), class: "btn btn-small" = link_to 'Edit', edit_admin_team_project_path(@team, project), class: "btn btn-small"
   
= link_to 'Relegate', admin_team_project_path(@team, project), confirm: 'Remove project from team. Are you sure?', method: :delete, class: "btn btn-remove small", id: "relegate_project_#{project.id}" = link_to 'Relegate', admin_team_project_path(@team, project), confirm: 'Remove project from team. Are you sure?', method: :delete, class: "btn btn-remove small", id: "relegate_project_#{project.id}"
:javascript
$(function(){
var modal = $('.change-owner-holder');
$('.change-owner-link').bind("click", function(){
$(this).hide();
modal.show();
});
$('.change-owner-cancel-link').bind("click", function(){
modal.hide();
$('.change-owner-link').show();
})
})
...@@ -9,10 +9,3 @@ ...@@ -9,10 +9,3 @@
= render "commits/diffs", diffs: @commit.diffs = render "commits/diffs", diffs: @commit.diffs
= render "notes/notes_with_form" = render "notes/notes_with_form"
:javascript
$(function(){
$('.files .file').each(function(){
new CommitFile(this);
});
});
...@@ -11,7 +11,5 @@ ...@@ -11,7 +11,5 @@
- if @commits.count == @limit - if @commits.count == @limit
:javascript :javascript
$(function(){ CommitsList.init("#{@ref}", #{@limit});
CommitsList.init("#{@ref}", #{@limit});
});
...@@ -27,9 +27,7 @@ ...@@ -27,9 +27,7 @@
:javascript :javascript
$(function(){ var labels = [#{@graph.labels.to_json}];
var labels = [#{@graph.labels.to_json}]; var commits = [#{@graph.commits.join(', ')}];
var commits = [#{@graph.commits.join(', ')}]; var title = "Commit activity for last #{@graph.weeks} weeks";
var title = "Commit activity for last #{@graph.weeks} weeks"; Chart.init(labels, commits, title);
Chart.init(labels, commits, title);
})
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