Skip to content
Snippets Groups Projects
Commit ca225d92 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Replace inline document.ready with dispatcher

parent 4f5aae1d
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 28 deletions
$ ->
new Dispatcher()
class Dispatcher
constructor: () ->
page = $('body').attr('data-page')
console.log(page)
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()
Loading
Loading
@@ -189,4 +189,8 @@ module ApplicationHelper
css_class << " multiselect" if opts[:multiple]
hidden_field_tag(id, '', class: css_class)
end
def body_data_page
controller.controller_name + ":" + controller.action_name
end
end
Loading
Loading
@@ -7,6 +7,3 @@
 
- else
= render "zero_authorized_projects"
:javascript
dashboardPage();
Loading
Loading
@@ -24,6 +24,3 @@
 
%hr
= render 'shared/promo'
:javascript
$(function(){ Pager.init(20, true); });
Loading
Loading
@@ -23,8 +23,3 @@
= render 'filter', entity: 'issue'
.span9.issues-holder
= render "issues"
:javascript
$(function(){
Issues.init();
})
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Admin area"
%body{class: "#{app_theme} admin"}
%body{class: "#{app_theme} admin", :'data-page' => body_data_page}
= render "layouts/head_panel", title: "Admin area"
= render "layouts/flash"
%nav.main-nav
Loading
Loading
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Dashboard"
%body{class: "#{app_theme} application"}
%body{class: "#{app_theme} application", :'data-page' => body_data_page }
= render "layouts/head_panel", title: "Dashboard"
= render "layouts/flash"
%nav.main-nav
Loading
Loading
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "#{@group.name}"
%body{class: "#{app_theme} application"}
%body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/head_panel", title: "group: #{@group.name}"
= render "layouts/flash"
%nav.main-nav
Loading
Loading
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Profile"
%body{class: "#{app_theme} profile"}
%body{class: "#{app_theme} profile", :'data-page' => body_data_page}
= render "layouts/head_panel", title: "Profile"
= render "layouts/flash"
%nav.main-nav
Loading
Loading
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @project.name_with_namespace
%body{class: "#{app_theme} project"}
%body{class: "#{app_theme} project", :'data-page' => body_data_page}
= render "layouts/head_panel", title: project_title(@project)
= render "layouts/flash"
- if can?(current_user, :download_code, @project)
Loading
Loading
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "#{@team.name}"
%body{class: "#{app_theme} application"}
%body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/head_panel", title: "team: #{@team.name}"
= render "layouts/flash"
%nav.main-nav
Loading
Loading
Loading
Loading
@@ -8,6 +8,3 @@
%center
= image_tag "ajax_loader.gif"
%h3 Saving project. Please wait a moment, this page will automatically refresh when ready.
:javascript
$(function(){ new Projects(); });
Loading
Loading
@@ -7,6 +7,3 @@
%center
= image_tag "ajax_loader.gif"
%h3 Creating project &amp; repository. Please wait a moment, this page will automatically refresh when ready.
:javascript
$(function(){ new Projects(); });
Loading
Loading
@@ -17,5 +17,3 @@
%p Repo Size: #{@project.repository.size} MB
%p Created at: #{@project.created_at.stamp('Aug 22, 2013')}
%p Owner: #{link_to @project.owner_name, @project.owner}
:javascript
$(function(){ Pager.init(20); });
Loading
Loading
@@ -23,6 +23,3 @@
 
%hr
= render 'shared/promo'
:javascript
$(function(){ Pager.init(20, true); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment