Commit 7d56a51bdcffa2413a68779e4899e8139c1ba4f9
1 parent
f1c534c6
Exists in
master
and in
4 other branches
Js refactoring and ajax animation replaced
Showing
14 changed files
with
41 additions
and
54 deletions
Show diff stats
app/assets/images/ajax-loader-facebook.gif
723 Bytes
app/assets/images/ajax-loader.gif
4.08 KB
7.37 KB
app/assets/javascripts/application.js
@@ -70,3 +70,7 @@ function showMenu() { | @@ -70,3 +70,7 @@ function showMenu() { | ||
70 | function resetMenu() { | 70 | function resetMenu() { |
71 | $(this).removeClass("hover"); | 71 | $(this).removeClass("hover"); |
72 | } | 72 | } |
73 | + | ||
74 | +function slugify(text) { | ||
75 | + return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase(); | ||
76 | +} |
app/assets/javascripts/merge_requests.js
@@ -31,10 +31,12 @@ var MergeRequest = { | @@ -31,10 +31,12 @@ var MergeRequest = { | ||
31 | $.ajax({ | 31 | $.ajax({ |
32 | type: "GET", | 32 | type: "GET", |
33 | url: $(".merge-diffs-tab").attr("data-url"), | 33 | url: $(".merge-diffs-tab").attr("data-url"), |
34 | + beforeSend: function(){ $('.status').addClass("loading")}, | ||
34 | complete: function(){ | 35 | complete: function(){ |
35 | MergeRequest.diffs_loaded = true; | 36 | MergeRequest.diffs_loaded = true; |
36 | $(".merge_request_notes").hide(); | 37 | $(".merge_request_notes").hide(); |
37 | - $(".dashboard-loader").hide()}, | 38 | + $('.status').removeClass("loading"); |
39 | + }, | ||
38 | dataType: "script"}); | 40 | dataType: "script"}); |
39 | } | 41 | } |
40 | } | 42 | } |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +function Projects() { | ||
2 | + $("#project_name").live("change", function(){ | ||
3 | + var slug = slugify($(this).val()); | ||
4 | + $("#project_code").val(slug); | ||
5 | + $("#project_path").val(slug); | ||
6 | + }); | ||
7 | + | ||
8 | + $('.new_project, .edit_project').live('ajax:before', function() { | ||
9 | + $('.project_new_holder, .project_edit_holder').hide(); | ||
10 | + $('.ajax_loader').show(); | ||
11 | + }); | ||
12 | + | ||
13 | + $('form #project_default_branch').chosen(); | ||
14 | +} |
app/assets/stylesheets/common.scss
@@ -589,7 +589,7 @@ table a code { | @@ -589,7 +589,7 @@ table a code { | ||
589 | 589 | ||
590 | .loading { | 590 | .loading { |
591 | margin:20px auto; | 591 | margin:20px auto; |
592 | - background: url(ajax-loader-facebook.gif) no-repeat center center; | 592 | + background: url(ajax_loader.gif) no-repeat center center; |
593 | width:40px; | 593 | width:40px; |
594 | height:40px; | 594 | height:40px; |
595 | } | 595 | } |
app/views/issues/index.html.haml
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | Issues | 3 | Issues |
4 | %span.rss-icon | 4 | %span.rss-icon |
5 | = link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do | 5 | = link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do |
6 | - = image_tag "Rss-UI.PNG", :width => 22, :title => "feed" | 6 | + = image_tag "Rss-UI.PNG", :width => 16, :title => "feed" |
7 | 7 | ||
8 | - if can? current_user, :write_issue, @project | 8 | - if can? current_user, :write_issue, @project |
9 | = link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do | 9 | = link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do |
app/views/merge_requests/show.html.haml
@@ -73,12 +73,11 @@ | @@ -73,12 +73,11 @@ | ||
73 | = link_to "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab tab" do | 73 | = link_to "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab tab" do |
74 | Diff | 74 | Diff |
75 | 75 | ||
76 | - %img{:src => "/assets/ajax-loader-facebook.gif", :class => "dashboard-loader"} | ||
77 | 76 | ||
78 | .merge_request_notes#notes= render "notes/notes", :tid => @merge_request.id, :tt => "merge_request" | 77 | .merge_request_notes#notes= render "notes/notes", :tid => @merge_request.id, :tt => "merge_request" |
79 | 78 | ||
80 | .merge-request-diffs | 79 | .merge-request-diffs |
81 | - | 80 | +.status |
82 | 81 | ||
83 | :javascript | 82 | :javascript |
84 | $(function(){ | 83 | $(function(){ |
app/views/projects/_form.html.haml
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | .clearfix | 49 | .clearfix |
50 | = f.label :description | 50 | = f.label :description |
51 | .input | 51 | .input |
52 | - = f.text_area :description, :placeholder => "project description", :class => "xlarge", :rows => 4 | 52 | + = f.text_area :description, :placeholder => "project description", :class => "xxlarge", :rows => 5 |
53 | %p.hint Markdown is enabled. | 53 | %p.hint Markdown is enabled. |
54 | 54 | ||
55 | %br | 55 | %br |
app/views/projects/create.js.haml
@@ -3,5 +3,6 @@ | @@ -3,5 +3,6 @@ | ||
3 | location.href = "#{project_path(@project, :notice => 'Project was successfully created.')}"; | 3 | location.href = "#{project_path(@project, :notice => 'Project was successfully created.')}"; |
4 | - else | 4 | - else |
5 | :plain | 5 | :plain |
6 | + $('.project_new_holder').show(); | ||
6 | $("#new_project").replaceWith("#{escape_javascript(render('form'))}"); | 7 | $("#new_project").replaceWith("#{escape_javascript(render('form'))}"); |
7 | $('.ajax_loader').hide(); | 8 | $('.ajax_loader').hide(); |
app/views/projects/edit.html.haml
1 | = render "project_head" | 1 | = render "project_head" |
2 | -%h3 Edit Project | ||
3 | -%hr | ||
4 | -= render "projects/form" | ||
5 | -%div{ :class => "ajax_loader", :style => "display:none;height:200px;"} | 2 | +.project_edit_holder |
3 | + %h3 Edit Project | ||
4 | + %hr | ||
5 | + = render "projects/form" | ||
6 | +%div.ajax_loader.hide | ||
6 | %center | 7 | %center |
7 | - = image_tag "ajax-loader.gif", :class => "append-bottom" | 8 | + %div.padded= image_tag "ajax_loader.gif" |
8 | %h3.prepend-top Saving project & repository. Please wait... | 9 | %h3.prepend-top Saving project & repository. Please wait... |
9 | 10 | ||
10 | :javascript | 11 | :javascript |
11 | - $(function(){ | ||
12 | - $("#project_name").live("change", function(){ | ||
13 | - var slug = slugify($(this).val()); | ||
14 | - $("#project_code").val(slug); | ||
15 | - $("#project_path").val(slug); | ||
16 | - }); | ||
17 | - }); | ||
18 | - | ||
19 | - function slugify(text) { | ||
20 | - return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase(); | ||
21 | - } | ||
22 | - | ||
23 | - $(function(){ | ||
24 | - $('.edit_project').live('ajax:before', function() { | ||
25 | - $(this).hide(); | ||
26 | - $('.ajax_loader').show(); | ||
27 | - }); | ||
28 | - $('form #project_default_branch').chosen(); | ||
29 | - }) | 12 | + $(function(){ new Projects(); }); |
app/views/projects/new.html.haml
1 | -%h3 New Project | ||
2 | -%hr | ||
3 | -= render 'form' | ||
4 | -%div{ :class => "ajax_loader", :style => "display:none;height:200px;"} | 1 | +.project_new_holder |
2 | + %h3 New Project | ||
3 | + %hr | ||
4 | + = render 'form' | ||
5 | +%div.ajax_loader.hide | ||
5 | %center | 6 | %center |
6 | - = image_tag "ajax-loader.gif", :class => "append-bottom" | 7 | + %div.padded= image_tag "ajax_loader.gif" |
7 | %h3.prepend-top Creating project & repository. Please wait for few minutes | 8 | %h3.prepend-top Creating project & repository. Please wait for few minutes |
8 | 9 | ||
9 | :javascript | 10 | :javascript |
10 | - $(function(){ | ||
11 | - $("#project_name").live("change", function(){ | ||
12 | - var slug = slugify($(this).val()); | ||
13 | - $("#project_code").val(slug); | ||
14 | - $("#project_path").val(slug); | ||
15 | - }); | ||
16 | - }); | ||
17 | - | ||
18 | - function slugify(text) { | ||
19 | - return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase(); | ||
20 | - } | ||
21 | - | ||
22 | - $(function(){ | ||
23 | - $('.new_project').live('ajax:before', function() { | ||
24 | - $(this).hide(); | ||
25 | - $('.ajax_loader').show(); | ||
26 | - }); | ||
27 | - $('form #project_default_branch').chosen(); | ||
28 | - }) | 11 | + $(function(){ new Projects(); }); |
app/views/projects/update.js.haml
@@ -3,5 +3,6 @@ | @@ -3,5 +3,6 @@ | ||
3 | location.href = "#{edit_project_path(@project, :notice => 'Project was successfully updated.')}"; | 3 | location.href = "#{edit_project_path(@project, :notice => 'Project was successfully updated.')}"; |
4 | - else | 4 | - else |
5 | :plain | 5 | :plain |
6 | + $('.project_edit_holder').show(); | ||
6 | $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); | 7 | $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); |
7 | $('.ajax_loader').hide(); | 8 | $('.ajax_loader').hide(); |