move more inline js to handle via dispatcher
This commit is contained in:
parent
6473aaf877
commit
2aa620c25a
9 changed files with 46 additions and 63 deletions
|
@ -1,17 +1,28 @@
|
|||
$ ->
|
||||
$('input#user_force_random_password').on 'change', (elem) ->
|
||||
elems = $('#user_password, #user_password_confirmation')
|
||||
@Admin =
|
||||
init: ->
|
||||
$('input#user_force_random_password').on 'change', (elem) ->
|
||||
elems = $('#user_password, #user_password_confirmation')
|
||||
|
||||
if $(@).attr 'checked'
|
||||
elems.val('').attr 'disabled', true
|
||||
else
|
||||
elems.removeAttr 'disabled'
|
||||
if $(@).attr 'checked'
|
||||
elems.val('').attr 'disabled', true
|
||||
else
|
||||
elems.removeAttr 'disabled'
|
||||
|
||||
$('.log-tabs a').click (e) ->
|
||||
e.preventDefault()
|
||||
$(this).tab('show')
|
||||
$('.log-tabs a').click (e) ->
|
||||
e.preventDefault()
|
||||
$(this).tab('show')
|
||||
|
||||
$('.log-bottom').click (e) ->
|
||||
e.preventDefault()
|
||||
visible_log = $(".file_content:visible")
|
||||
visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast")
|
||||
$('.log-bottom').click (e) ->
|
||||
e.preventDefault()
|
||||
visible_log = $(".file_content:visible")
|
||||
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()
|
||||
|
|
5
app/assets/javascripts/commit.js.coffee
Normal file
5
app/assets/javascripts/commit.js.coffee
Normal file
|
@ -0,0 +1,5 @@
|
|||
@Commit =
|
||||
init: ->
|
||||
$('.files .file').each ->
|
||||
new CommitFile(this)
|
||||
|
|
@ -10,8 +10,10 @@ class Dispatcher
|
|||
switch page
|
||||
when 'issues:index' then Issues.init()
|
||||
when 'dashboard:show' then dashboardPage()
|
||||
when 'groups:show' then Pager.init(20, true)
|
||||
when 'teams:show' then Pager.init(20, true)
|
||||
when 'projects:show' then Pager.init(20, true)
|
||||
when 'projects:new' then new Projects()
|
||||
when 'projects:edit' then new Projects()
|
||||
when 'commit:show' then Commit.init()
|
||||
when 'groups:show', 'teams:show', 'projects:show'
|
||||
Pager.init(20, true)
|
||||
when 'projects:new', 'projects:edit'
|
||||
new Projects()
|
||||
when 'admin:teams:show', 'admin:groups:show', 'admin:logs:show', 'admin:users:new'
|
||||
Admin.init()
|
||||
|
|
|
@ -191,6 +191,9 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -118,16 +118,3 @@
|
|||
.form-actions
|
||||
= 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 @@
|
|||
= 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}"
|
||||
|
||||
: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 @@
|
|||
|
||||
= render "commits/diffs", diffs: @commit.diffs
|
||||
= render "notes/notes_with_form"
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
$('.files .file').each(function(){
|
||||
new CommitFile(this);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,5 @@
|
|||
|
||||
- if @commits.count == @limit
|
||||
:javascript
|
||||
$(function(){
|
||||
CommitsList.init("#{@ref}", #{@limit});
|
||||
});
|
||||
CommitsList.init("#{@ref}", #{@limit});
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
var labels = [#{@graph.labels.to_json}];
|
||||
var commits = [#{@graph.commits.join(', ')}];
|
||||
var title = "Commit activity for last #{@graph.weeks} weeks";
|
||||
Chart.init(labels, commits, title);
|
||||
})
|
||||
var labels = [#{@graph.labels.to_json}];
|
||||
var commits = [#{@graph.commits.join(', ')}];
|
||||
var title = "Commit activity for last #{@graph.weeks} weeks";
|
||||
Chart.init(labels, commits, title);
|
||||
|
|
Loading…
Reference in a new issue