Commit 6323cdda authored by Aleksei Kvitinskii's avatar Aleksei Kvitinskii

Merge branch 'dev' into issue-184

parents b946da44 0b0e0225
app/assets/images/ajax-loader.gif

6.66 KB | W: | H:

app/assets/images/ajax-loader.gif

4.08 KB | W: | H:

app/assets/images/ajax-loader.gif
app/assets/images/ajax-loader.gif
app/assets/images/ajax-loader.gif
app/assets/images/ajax-loader.gif
  • 2-up
  • Swipe
  • Onion skin
...@@ -21,6 +21,6 @@ $(function(){ ...@@ -21,6 +21,6 @@ $(function(){
$('select#tag').selectmenu({style:'popup', width:200}); $('select#tag').selectmenu({style:'popup', width:200});
}); });
function updatePage(){ function updatePage(data){
$.ajax({type: "GET", url: location.href, dataType: "script"}); $.ajax({type: "GET", url: location.href, data: data, dataType: "script"});
} }
var NoteList = {
first_id: 0,
last_id: 0,
resource_name: null,
init:
function(resource_name, first_id, last_id) {
this.resource_name = resource_name;
this.first_id = first_id;
this.last_id = last_id;
this.initRefresh();
this.initLoadMore();
},
getOld:
function() {
$('.loading').show();
$.ajax({
type: "GET",
url: location.href,
data: "first_id=" + this.first_id,
complete: function(){ $('.loading').hide()},
dataType: "script"});
},
append:
function(id, html) {
this.first_id = id;
$("#notes-list").append(html);
this.initLoadMore();
},
prepend:
function(id, html) {
this.last_id = id;
$("#notes-list").prepend(html);
},
getNew:
function() {
// refersh notes list
$.ajax({
type: "GET",
url: location.href,
data: "last_id=" + this.last_id,
dataType: "script"});
},
initRefresh:
function() {
// init timer
var int = setInterval("NoteList.getNew()", 20000);
},
initLoadMore:
function() {
$(window).bind('scroll', function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$(window).unbind('scroll');
NoteList.getOld();
}
});
}
}
...@@ -421,31 +421,6 @@ input.ssh_project_url { ...@@ -421,31 +421,6 @@ input.ssh_project_url {
list-style:none; list-style:none;
margin:0px; margin:0px;
padding:0px; padding:0px;
li {
display:list-item;
padding:8px;
margin:0px;
background: #F7FBFC;
border-top: 1px solid #E2EAEE;
&:first-child {
border-top: none;
}
&:nth-child(2n+1) {
background: white;
}
p {
margin-bottom: 4px;
font-size: 13px;
color:#111;
}
}
cite {
&.ago {
color:#666;
}
}
} }
.notes_count { .notes_count {
...@@ -460,14 +435,6 @@ input.ssh_project_url { ...@@ -460,14 +435,6 @@ input.ssh_project_url {
right: 6px; right: 6px;
top: 6px; top: 6px;
} }
.note_author {
float:left;
width:60px;
}
.note_content {
float:left;
width:650px;
}
.issue_notes { .issue_notes {
.note_content { .note_content {
...@@ -556,8 +523,7 @@ input.ssh_project_url { ...@@ -556,8 +523,7 @@ input.ssh_project_url {
} }
.commit, .commit,
.message, .message{
#notes-list{
.author { .author {
background: #eaeaea; background: #eaeaea;
color: #333; color: #333;
...@@ -574,7 +540,7 @@ input.ssh_project_url { ...@@ -574,7 +540,7 @@ input.ssh_project_url {
font-size:14px; font-size:14px;
} }
.wall_page { #new_note {
#note_note { #note_note {
height:25px; height:25px;
} }
...@@ -719,3 +685,11 @@ table.highlighttable pre{ ...@@ -719,3 +685,11 @@ table.highlighttable pre{
.project-refs-select { .project-refs-select {
width:200px; width:200px;
} }
body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
body.project-page #notes-list .note img{float: left; margin-right: 10px;}
body.project-page #notes-list .note span.note-title{display: block;}
body.project-page #notes-list .note span.note-title{margin-bottom: 10px}
body.project-page #notes-list .note span.note-author{color: #999; font-weight: normal; font-style: italic;}
body.project-page #notes-list .note span.note-author strong{font-weight: bold; font-style: normal;}
...@@ -292,7 +292,7 @@ body.login-page{background-color: #f1f1f1; padding-top: 10%} ...@@ -292,7 +292,7 @@ body.login-page{background-color: #f1f1f1; padding-top: 10%}
/* General */ /* General */
#container{background-color: white; overflow: hidden;} #container{background-color: white; overflow: hidden;}
/*#container{margin: auto; width: 980px; border: 1px solid rgba(0,0,0,.22); border-top: 0; box-shadow: 0 0 0px 4px rgba(0,0,0,.04)}*/ body.collapsed #container{margin: auto; width: 980px; border: 1px solid rgba(0,0,0,.22); border-top: 0; box-shadow: 0 0 0px 4px rgba(0,0,0,.04)}
......
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :view_style
protect_from_forgery protect_from_forgery
helper_method :abilities, :can? helper_method :abilities, :can?
...@@ -73,4 +75,12 @@ class ApplicationController < ActionController::Base ...@@ -73,4 +75,12 @@ class ApplicationController < ActionController::Base
def require_non_empty_project def require_non_empty_project
redirect_to @project unless @project.repo_exists? redirect_to @project unless @project.repo_exists?
end end
def view_style
if params[:view_style] == "collapsed"
cookies[:view_style] = "collapsed"
elsif params[:view_style] == "fluid"
cookies[:view_style] = ""
end
end
end end
...@@ -28,12 +28,15 @@ class CommitsController < ApplicationController ...@@ -28,12 +28,15 @@ class CommitsController < ApplicationController
def show def show
@commit = project.repo.commits(params[:id]).first @commit = project.repo.commits(params[:id]).first
@notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit") @notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit").order("created_at DESC").limit(20)
@note = @project.notes.new(:noteable_id => @commit.id, :noteable_type => "Commit") @note = @project.notes.new(:noteable_id => @commit.id, :noteable_type => "Commit")
respond_to do |format| respond_to do |format|
format.html # show.html.erb format.html
format.js format.js do
@notes = @notes.where("id > ?", params[:last_id]) if params[:last_id]
@notes = @notes.where("id < ?", params[:first_id]) if params[:first_id]
end
end end
end end
end end
...@@ -35,8 +35,16 @@ class IssuesController < ApplicationController ...@@ -35,8 +35,16 @@ class IssuesController < ApplicationController
end end
def show def show
@notes = @issue.notes.order("created_at ASC") @notes = @issue.notes.order("created_at DESC").limit(20)
@note = @project.notes.new(:noteable => @issue) @note = @project.notes.new(:noteable => @issue)
respond_to do |format|
format.html
format.js do
@notes = @notes.where("id > ?", params[:last_id]) if params[:last_id]
@notes = @notes.where("id < ?", params[:first_id]) if params[:first_id]
end
end
end end
def create def create
......
...@@ -86,12 +86,14 @@ class ProjectsController < ApplicationController ...@@ -86,12 +86,14 @@ class ProjectsController < ApplicationController
def wall def wall
@note = Note.new @note = Note.new
@notes = @project.common_notes.order("created_at DESC") @notes = @project.common_notes.order("created_at DESC")
@notes = @notes.fresh.limit(20)
@notes = case params[:view] respond_to do |format|
when "week" then @notes.since((Date.today - 7.days).at_beginning_of_day) format.html
when "all" then @notes.all format.js do
when "day" then @notes.since(Date.today.at_beginning_of_day) @notes = @notes.where("id > ?", params[:last_id]) if params[:last_id]
else @notes.fresh.limit(10) @notes = @notes.where("id < ?", params[:first_id]) if params[:first_id]
end
end end
end end
......
...@@ -4,6 +4,14 @@ module ApplicationHelper ...@@ -4,6 +4,14 @@ module ApplicationHelper
"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon" "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon"
end end
def body_class(default_class = nil)
main = content_for(:body_class).blank? ?
default_class :
content_for(:body_class)
[main, cookies[:view_style]].join(" ")
end
def commit_name(project, commit) def commit_name(project, commit)
if project.commit.id == commit.id if project.commit.id == commit.id
"master" "master"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
\/ \/
%a{:href => "#"}= params[:path].split("/").join(" / ") %a{:href => "#"}= params[:path].split("/").join(" / ")
.right= render "projects/refs" .right= render :partial => "projects/refs", :locals => { :destination => project_commits_path(@project) }
%div{:id => dom_id(@project)} %div{:id => dom_id(@project)}
= render "commits" = render "commits"
-#:plain = render "notes/load"
$("#side-commit-preview").remove();
var side = $("<div id='side-commit-preview'></div>");
side.html("#{escape_javascript(render "commits/show")}");
$("##{dom_id(@project)}").parent().append(side);
$("##{dom_id(@project)}").addClass("span-14");
:plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
%h2 %h2
= "Issue ##{@issue.id} - #{html_escape(@issue.title)}" = "Issue ##{@issue.id} - #{html_escape(@issue.title)}"
.left.width-65p .left.width-65p
-#= simple_format html_escape(@issue.content)
.issue_notes= render "notes/notes" .issue_notes= render "notes/notes"
.loading{ :style => "display:none;"}
%center= image_tag "ajax-loader.gif"
.right.width-30p .right.width-30p
.span-8 .span-8
- if @issue.closed
%center.success Closed
- else
%center.error Open
%table.round-borders %table.round-borders
%tr %tr
%td Title: %td Title:
...@@ -54,4 +52,3 @@ ...@@ -54,4 +52,3 @@
= link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "lbutton positive", :remote => true = link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "lbutton positive", :remote => true
.right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}" .right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}"
.clear .clear
:plain = render "notes/load"
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
<!-- Page Header --> <!-- Page Header -->
<header> <header>
<h1 class="logo"> <h1 class="logo">
<a href="/">GITLAB</a></h1> <a href="/">GITLAB</a>
<div class="login-top"> </h1>
<div class="account-box">
<%= link_to profile_path, :class => "pic" do %> <%= link_to profile_path, :class => "pic" do %>
<%= image_tag gravatar_icon(current_user.email) %> <%= image_tag gravatar_icon(current_user.email) %>
<% end %> <% end %>
<a href="#" class="arrow-up"></a>
<div class="account-links">
<%= link_to profile_path, :class => "username" do %> <%= link_to profile_path, :class => "username" do %>
<%= current_user.name %> <%#= current_user.name %>
Your profile
<% end %> <% end %>
<%= link_to "Fluid layout", url_for( :view_style => 'fluid' ) if cookies[:view_style] == "collapsed"%>
<%= link_to "Fixed layout", url_for( :view_style => 'collapsed' ) unless cookies[:view_style] == "collapsed"%>
<%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %> <%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %>
</div> </div>
</div><!-- .account-box -->
<div class="search"> <div class="search">
<%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %> <%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %>
</div> </div>
...@@ -26,23 +36,10 @@ ...@@ -26,23 +36,10 @@
<span></span>Admin <span></span>Admin
<% end %> <% end %>
</nav> </nav>
</header> </header>
<!-- eo Page Header --> <!-- eo Page Header -->
<div id="header-panel" style="display:none">
<div class="container">
<div class="span-24">
<div class="span-10">
<span class="search-holder">
</span>
</div>
<div class="right">
<%= link_to truncate(@project.name, :length => 20), project_path(@project), :class => "current button" if @project && !@project.new_record? %>
</div>
</div>
</div>
</div>
<% if current_user %> <% if current_user %>
<%= javascript_tag do %> <%= javascript_tag do %>
$(function() { $(function() {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= javascript_tag do = javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} %body{ :class => body_class('project-page'), :id => yield(:boyd_id)}
#container #container
= render :partial => "layouts/flash" = render :partial => "layouts/flash"
= render :partial => "layouts/head_panel" = render :partial => "layouts/head_panel"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
= javascript_tag do = javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => yield(:body_class), :id => yield(:boyd_id)} %body{ :class => body_class, :id => yield(:boyd_id)}
#container #container
= render :partial => "layouts/flash" = render :partial => "layouts/flash"
= render :partial => "layouts/head_panel" = render :partial => "layouts/head_panel"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= javascript_tag do = javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} %body{ :class => body_class('project-page'), :id => yield(:boyd_id)}
#container #container
= render :partial => "layouts/flash" = render :partial => "layouts/flash"
= render :partial => "layouts/head_panel" = render :partial => "layouts/head_panel"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= javascript_tag do = javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} %body{ :class => body_class('project-page'), :id => yield(:boyd_id)}
#container #container
= render :partial => "layouts/flash" = render :partial => "layouts/flash"
= render :partial => "layouts/head_panel" = render :partial => "layouts/head_panel"
......
- unless @notes.blank?
- if params[:last_id]
:plain
NoteList.prepend(#{@notes.first.id}, "#{escape_javascript(render(:partial => 'notes/notes_list'))}");
- if params[:first_id]
:plain
NoteList.append(#{@notes.last.id}, "#{escape_javascript(render(:partial => 'notes/notes_list'))}");
- if controller.action_name == "wall" - if can? current_user, :write_note, @project
%ul#notes-list= render "notes/notes_list"
- else
%ul#notes-list= render "notes/notes_list"
%br
%br
- if can? current_user, :write_note, @project
= render "notes/form" = render "notes/form"
.clear
%hr
%ul#notes-list= render "notes/notes_list"
:javascript :javascript
$('.delete-note').live('ajax:success', function() { $('.delete-note').live('ajax:success', function() {
...@@ -20,8 +16,11 @@ ...@@ -20,8 +16,11 @@
$("#submit_note").removeAttr("disabled"); $("#submit_note").removeAttr("disabled");
}) })
- if ["issues", "projects"].include?(controller.controller_name)
:javascript
$(function(){ $(function(){
var int =self.setInterval("updatePage()", 20000); $("#note_note").live("click", function(){
$(this).css("height", "100px");
$('.attach_holder').show();
});
NoteList.init("wall", #{@notes.last.try(:id) || 0}, #{@notes.first.try(:id) || 0});
}); });
%li{:id => dom_id(note)} %li{:id => dom_id(note), :class => "note"}
%div.note_author
= image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
%div.note_content.left %div.note-author
%strong= note.author_name
%cite
= time_ago_in_words(note.updated_at)
ago
- if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
= link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative"
%div.note-title
= markdown(note.note) = markdown(note.note)
- if note.attachment.url - if note.attachment.url
Attachment: Attachment:
= link_to note.attachment_identifier, note.attachment.url, :target => "_blank" = link_to note.attachment_identifier, note.attachment.url, :target => "_blank"
%br %br
%span.author= note.author.name
%cite.ago
= time_ago_in_words(note.updated_at)
ago
%br
- if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
= link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative"
.clear .clear
- if @note.valid? - if @note.valid?
:plain :plain
$("#new_note .errors").remove(); $("#new_note .errors").remove();
updatePage();
$('#note_note').val(""); $('#note_note').val("");
NoteList.prepend(#{@note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => @note})}");
- else - else
:plain :plain
$("#new_note").replaceWith("#{escape_javascript(render('form'))}"); $("#new_note").replaceWith("#{escape_javascript(render('form'))}");
......
= form_tag project_commits_path(@project), :method => :get, :class => "project-refs-form" do = form_tag destination, :method => :get, :class => "project-refs-form" do
= select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select" = select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
\/ \/
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true = link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true
&nbsp; &nbsp;
.right= render "projects/refs" .right= render :partial => "projects/refs", :locals => { :destination => tree_project_path(@project) }
.clear .clear
#tree-content-holder #tree-content-holder
......
%div.wall_page %div.wall_page
- if can? current_user, :write_note, @project = render "notes/notes"
= render "notes/form"
.right .loading{ :style => "display:none;"}
= form_tag wall_project_path(@project), :method => :get do %center= image_tag "ajax-loader.gif"
.span-2
= radio_button_tag :view, "recent", (params[:view] || "recent") == "recent", :onclick => "this.form.submit()", :id => "recent_view"
= label_tag "recent_view","Recent"
.span-2
= radio_button_tag :view, "day", params[:view] == "day", :onclick => "this.form.submit()", :id => "day_view"
= label_tag "day_view","Today"
.span-2
= radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view"
= label_tag "week_view","Week"
.span-2
= radio_button_tag :view, "all", params[:view] == "all", :onclick => "this.form.submit()", :id => "all_view"
= label_tag "all_view","All"
.clear
%br
%hr
= render "notes/notes"
:javascript
$(function(){
$("#note_note").live("click", function(){
$(this).css("height", "100px");
$('.attach_holder').show();
});
});
:plain = render "notes/load"
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
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