Commit ca225d92c38d955f3c39fd80e031396fee7723a3
1 parent
4f5aae1d
Exists in
master
and in
4 other branches
Replace inline document.ready with dispatcher
Showing
15 changed files
with
27 additions
and
28 deletions
Show diff stats
... | ... | @@ -0,0 +1,17 @@ |
1 | +$ -> | |
2 | + new Dispatcher() | |
3 | + | |
4 | +class Dispatcher | |
5 | + constructor: () -> | |
6 | + page = $('body').attr('data-page') | |
7 | + | |
8 | + console.log(page) | |
9 | + | |
10 | + switch page | |
11 | + when 'issues:index' then Issues.init() | |
12 | + when 'dashboard:show' then dashboardPage() | |
13 | + when 'groups:show' then Pager.init(20, true) | |
14 | + when 'teams:show' then Pager.init(20, true) | |
15 | + when 'projects:show' then Pager.init(20, true) | |
16 | + when 'projects:new' then new Projects() | |
17 | + when 'projects:edit' then new Projects() | ... | ... |
app/helpers/application_helper.rb
app/views/dashboard/show.html.haml
app/views/groups/show.html.haml
app/views/issues/index.html.haml
app/views/layouts/admin.html.haml
1 | 1 | !!! 5 |
2 | 2 | %html{ lang: "en"} |
3 | 3 | = render "layouts/head", title: "Admin area" |
4 | - %body{class: "#{app_theme} admin"} | |
4 | + %body{class: "#{app_theme} admin", :'data-page' => body_data_page} | |
5 | 5 | = render "layouts/head_panel", title: "Admin area" |
6 | 6 | = render "layouts/flash" |
7 | 7 | %nav.main-nav | ... | ... |
app/views/layouts/application.html.haml
1 | 1 | !!! 5 |
2 | 2 | %html{ lang: "en"} |
3 | 3 | = render "layouts/head", title: "Dashboard" |
4 | - %body{class: "#{app_theme} application"} | |
4 | + %body{class: "#{app_theme} application", :'data-page' => body_data_page } | |
5 | 5 | = render "layouts/head_panel", title: "Dashboard" |
6 | 6 | = render "layouts/flash" |
7 | 7 | %nav.main-nav | ... | ... |
app/views/layouts/group.html.haml
1 | 1 | !!! 5 |
2 | 2 | %html{ lang: "en"} |
3 | 3 | = render "layouts/head", title: "#{@group.name}" |
4 | - %body{class: "#{app_theme} application"} | |
4 | + %body{class: "#{app_theme} application", :'data-page' => body_data_page} | |
5 | 5 | = render "layouts/head_panel", title: "group: #{@group.name}" |
6 | 6 | = render "layouts/flash" |
7 | 7 | %nav.main-nav | ... | ... |
app/views/layouts/profile.html.haml
app/views/layouts/project_resource.html.haml
1 | 1 | !!! 5 |
2 | 2 | %html{ lang: "en"} |
3 | 3 | = render "layouts/head", title: @project.name_with_namespace |
4 | - %body{class: "#{app_theme} project"} | |
4 | + %body{class: "#{app_theme} project", :'data-page' => body_data_page} | |
5 | 5 | = render "layouts/head_panel", title: project_title(@project) |
6 | 6 | = render "layouts/flash" |
7 | 7 | - if can?(current_user, :download_code, @project) | ... | ... |
app/views/layouts/user_team.html.haml
1 | 1 | !!! 5 |
2 | 2 | %html{ lang: "en"} |
3 | 3 | = render "layouts/head", title: "#{@team.name}" |
4 | - %body{class: "#{app_theme} application"} | |
4 | + %body{class: "#{app_theme} application", :'data-page' => body_data_page} | |
5 | 5 | = render "layouts/head_panel", title: "team: #{@team.name}" |
6 | 6 | = render "layouts/flash" |
7 | 7 | %nav.main-nav | ... | ... |
app/views/projects/edit.html.haml
app/views/projects/new.html.haml
app/views/projects/show.html.haml