[issue #195] Many changes.
* Base presenter moved to lib * Added diff display * Changes in some views TODO Add translations. TODO Change commit page layout. TODO Change representation of commit on commit page. TODO Fix bug with tree/branch select.
This commit is contained in:
parent
b586c5ddf0
commit
fe46e53ad8
|
@ -120,3 +120,94 @@ article h3 {
|
|||
article div.date-block div.date {
|
||||
height: 52px;
|
||||
}
|
||||
|
||||
article div#repo-wrapper div.hr {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
article table.commit_stats {
|
||||
line-height: 1.4em;
|
||||
margin-top: 12px;
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-top: 1px solid #DDDDDD;
|
||||
margin: 10px 0;
|
||||
padding: 0;
|
||||
font-size: 90%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
article table.commit_stats td {
|
||||
border-bottom: 1px solid #DDDDDD;
|
||||
padding: 0.4em 5px;
|
||||
}
|
||||
|
||||
article table.commit_stats .diffstat {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
padding-right: 0;
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
article div.file div.diff_data {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
article div.file table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff td.line_numbers {
|
||||
-moz-user-select: none;
|
||||
font-size: 12px;
|
||||
padding: 0 0.5em;
|
||||
background-color: #ECECEC;
|
||||
border-right: 1px solid #DDDDDD;
|
||||
color: #999999;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff td.line_numbers,
|
||||
#repo-wrapper table.diff td.header,
|
||||
#repo-wrapper table.diff td.code {
|
||||
font-family: 'Bitstream Vera Sans Mono','Courier',monospace;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff td.header {
|
||||
background-color: #ECECEC;
|
||||
color: #999999;
|
||||
width: 100%;
|
||||
line-height: 1.4em;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff td.code, #repo-wrapper table.diff td.header {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff pre {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff .diff-content {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff tr td.code.del {
|
||||
background-color: #FFDDDD;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff tr td.code.del .idiff {
|
||||
background-color: #F2ACAD;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff tr td.code.ins {
|
||||
background-color: #DDFFDD;
|
||||
}
|
||||
|
||||
#repo-wrapper table.diff tr td.code.ins .idiff {
|
||||
background-color: #BAFBAD;
|
||||
}
|
||||
|
|
|
@ -2122,7 +2122,7 @@ div.pagination a {
|
|||
/*404*/
|
||||
|
||||
article div.all.error404 {
|
||||
background: url("../pics/404.png") no-repeat 59% 0;
|
||||
background: image-url("404.png") no-repeat 59% 0;
|
||||
height: 500px;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,14 @@ module CommitHelper
|
|||
stats.files.each do |filename, adds, deletes, total|
|
||||
res << "<tr>"
|
||||
res << "<td><a href='##{h(filename)}'>#{h(filename)}</a></td>"
|
||||
res << "<td>#{total}</td>"
|
||||
res << "<td><small class='deletions'>#{(0...deletes).map{|i| "-" }.join}</small>"
|
||||
res << "<small class='insertions'>#{(0...adds).map{|i| "+" }.join}</small></td>"
|
||||
res << "</tr>"
|
||||
res << "<td class='diffstat'>"
|
||||
res << I18n.t("layout.projects.inline_changes_count", :count => total).strip +
|
||||
" (" +
|
||||
I18n.t("layout.projects.inline_additions_count", :count => adds).strip +
|
||||
", " +
|
||||
I18n.t("layout.projects.inline_deletions_count", :count => deletes).strip +
|
||||
")"
|
||||
res << "</td>"
|
||||
end
|
||||
res << "</table>"
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ module DiffHelper
|
|||
def render_diff(diff)
|
||||
diff_display ||= Diff::Display::Unified.new(diff.diff)
|
||||
|
||||
res = "<a name='#{h(diff.a_path)}'></a>"
|
||||
#res = "<a name='#{h(diff.a_path)}'></a>"
|
||||
|
||||
res += "<table class='diff inline' cellspacing='0' cellpadding='0'>"
|
||||
res = "<table class='diff inline' cellspacing='0' cellpadding='0'>"
|
||||
res += "<tbody>"
|
||||
res += diff_display.render(Git::Diff::InlineCallback.new).encode_to_default
|
||||
res += "</tbody>"
|
||||
|
|
|
@ -71,4 +71,22 @@ module GitHelper
|
|||
a
|
||||
end
|
||||
end
|
||||
|
||||
# TODO This is very dirty hack. Maybe need to be changed.
|
||||
def branch_selector_options(project)
|
||||
tmp = params
|
||||
unless tmp['treeish'].present?
|
||||
tmp.merge!('project_id' => project.id, 'treeish' => project.default_branch).delete('id')
|
||||
end
|
||||
res = {}
|
||||
current = url_for(tmp).split('?', 2).first
|
||||
|
||||
res = project.branches.inject(res) do |h, branch|
|
||||
h[branch.name] = url_for(tmp.merge('treeish' => branch.name)).split('?', 2).first
|
||||
h
|
||||
end
|
||||
res.merge!(tmp['treeish'] => current)
|
||||
|
||||
options_for_select(res.sort, current).html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class GitHook
|
||||
attr_reader :repo, :newrev, :oldrev, :newrev_type, :oldrev_type, :refname,
|
||||
:change_type, :rev, :rev_type, :refname_type, :owner, :project
|
||||
|
@ -53,4 +54,4 @@ class GitHook
|
|||
@refname_type= "*** Unknown type of update to $refname (#{rev_type})"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class RegisterRequest < ActiveRecord::Base
|
||||
default_scope order('created_at ASC')
|
||||
|
||||
|
|
|
@ -1,25 +1,56 @@
|
|||
class ApplicationPresenter
|
||||
include Rails.application.routes.url_helpers
|
||||
include ActionView::Helpers::UrlHelper
|
||||
|
||||
def initialize(item, opts)
|
||||
end
|
||||
|
||||
# TODO it needs to be refactored!
|
||||
class << self
|
||||
def present(item, opts, &block)
|
||||
block.call(self.new(item, opts))
|
||||
end
|
||||
|
||||
def present_collection(collection, &block)
|
||||
res = collection.map {|e| self.new(*e)}
|
||||
if block.present?
|
||||
res = res.inject('') do |akk, presenter|
|
||||
akk << block.call(presenter)
|
||||
akk
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
end
|
||||
# -*- encoding : utf-8 -*-
|
||||
class ApplicationPresenter < RosaPresenter::Base
|
||||
end
|
||||
|
||||
#class ApplicationPresenter
|
||||
# include ActionDispatch::Routing::UrlFor
|
||||
# include ActionView::Helpers::UrlHelper
|
||||
# include Rails.application.routes.url_helpers
|
||||
#
|
||||
# attr_accessor :controller
|
||||
#
|
||||
# def initialize(item, opts)
|
||||
# end
|
||||
#
|
||||
# # TODO it needs to be refactored!
|
||||
# class << self
|
||||
# def present(item, opts, &block)
|
||||
# block.call(self.new(item, opts))
|
||||
# end
|
||||
#
|
||||
# def present_collection(collection, &block)
|
||||
# res = collection.map {|e| self.new(*e)}
|
||||
# if block.present?
|
||||
# res = res.inject('') do |akk, presenter|
|
||||
# akk << block.call(presenter)
|
||||
# akk
|
||||
# end
|
||||
# end
|
||||
# return res
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# protected
|
||||
#
|
||||
# def t(*args)
|
||||
# I18n.translate(*args)
|
||||
# end
|
||||
#
|
||||
# def l(*args)
|
||||
# I18n.localize(*args)
|
||||
# end
|
||||
#end
|
||||
#
|
||||
#module Presenters
|
||||
# module Activation
|
||||
# def self.included(klass) # :nodoc:
|
||||
# klass.prepend_before_filter :activate_presenter
|
||||
# end
|
||||
#
|
||||
# private
|
||||
# def activate_presenter
|
||||
# ApplicationPresenter.controller = self
|
||||
# end
|
||||
# end
|
||||
#end
|
||||
#ActionController::Base.send(:include, Presenters::Activation)
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
|
||||
include CommitHelper
|
||||
|
||||
attr_accessor :commit, :options
|
||||
attr_reader :header, :image, :date, :caption, :content, :expandable
|
||||
|
||||
|
@ -11,10 +14,10 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
|
|||
def header
|
||||
@header ||= if options[:branch].present?
|
||||
I18n.t("layout.messages.commits.header_with_branch",
|
||||
:committer => committer_link, :commit => '', :branch => options[:branch].name)
|
||||
:committer => committer_link, :commit => commit_link, :branch => options[:branch].name)
|
||||
elsif options[:project].present?
|
||||
I18n.t("layout.messages.commits.header_with_project",
|
||||
:committer => committer_link, :commit => '', :project => options[:project].name)
|
||||
:committer => committer_link, :commit => commit_link, :project => options[:project].name)
|
||||
end.html_safe
|
||||
end
|
||||
|
||||
|
@ -42,17 +45,19 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
|
|||
|
||||
def committer_link
|
||||
@committer_link ||= if committer.is_a? User
|
||||
link_to committer.uname, '#'#user_path(committer)
|
||||
link_to committer.uname, user_path(committer)
|
||||
else
|
||||
self.mail_to committer.email.encode_to_default, committer.name.encode_to_default
|
||||
mail_to committer.email.encode_to_default, committer.name.encode_to_default
|
||||
end
|
||||
end
|
||||
|
||||
def commit_link
|
||||
link_to shortest_hash_id(@commit.id), commit_path(options[:project], @commit.id)
|
||||
end
|
||||
|
||||
def prepare_message
|
||||
(@caption, @content) = @commit.message.encode_to_default.split("\n\n", 2)
|
||||
@caption = 'empty message' unless @caption.present?
|
||||
puts @caption.inspect
|
||||
puts @content.inspect
|
||||
if @caption.length > 72
|
||||
tmp = '...' + @caption[69..-1]
|
||||
@content = (@content.present?) ? tmp + @content : tmp
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
%h3= t("layout.projects.files_in_project")
|
||||
.files
|
||||
.l
|
||||
= render :partial => 'git/shared/whereami'
|
||||
.both
|
||||
|
||||
= form_tag blob_file_path, :name => 'blob-editor', :method => :put do
|
||||
.file
|
||||
= text_area_tag :content, @blob.data.encode_to_default, :id => 'code'
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
%h3= t("layout.projects.files_in_project")
|
||||
.files
|
||||
.l
|
||||
= render :partial => 'git/shared/whereami'
|
||||
.both
|
||||
|
||||
- render_way = choose_render_way(@blob)
|
||||
.file
|
||||
.top
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
.block
|
||||
.content
|
||||
.inner
|
||||
.file
|
||||
%a{ :name => h(commit_diff.a_path.encode_to_default) }
|
||||
.top
|
||||
.l= h(commit_diff.a_path.encode_to_default)
|
||||
- if commit_diff.b_path.present?
|
||||
.r
|
||||
= link_to("view file @ #{short_hash_id(@commit.id)}", blob_commit_path(@project, @commit.id, commit_diff.b_path.encode_to_default))
|
||||
.clear
|
||||
|
||||
%a{ :name => h(commit_diff.a_path.encode_to_default) }
|
||||
|
||||
.blob_header
|
||||
.size= h(commit_diff.a_path.encode_to_default)
|
||||
- if commit_diff.b_path.present?
|
||||
.buttons
|
||||
= link_to("view file @ #{short_hash_id(@commit.id)}", blob_commit_path(@project, @commit.id, commit_diff.b_path.encode_to_default))
|
||||
.clear
|
||||
|
||||
.diff_data
|
||||
= render_diff(commit_diff)
|
||||
.diff_data
|
||||
= render_diff(commit_diff)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
= raw l(commits.first.authored_date, :format => :date_block_format)
|
||||
.messages
|
||||
- commits.each_with_index do |commit|
|
||||
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch) do |presenter|
|
||||
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
|
||||
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => counter}
|
||||
- counter += 1
|
||||
.both
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
- stats = @commit.stats
|
||||
.leftside
|
||||
%h5= t("layout.projects.diff_show_header",
|
||||
:files => t("layout.projects.commit_files_count", :count => stats.files.size),
|
||||
:additions => t("layout.projects.commit_additions_count", :count => stats.additions),
|
||||
:deletions => t("layout.projects.commit_deletions_count", :count => stats.deletions))
|
||||
.both
|
||||
.rightside
|
||||
= link_to "raw diff", commit_path(@project, @commit.id, :diff)
|
||||
\|
|
||||
= link_to "patch", commit_path(@project, @commit.id, :patch)
|
||||
.both
|
||||
|
||||
-begin
|
||||
= render_commit_stats(stats)
|
||||
|
||||
= render :partial => 'git/commits/commit_diff', :collection => @commit.diffs
|
||||
- rescue Grit::Git::GitTimeout
|
||||
%p= t 'layout.git.repositories.commit_diff_too_big'
|
|
@ -1,15 +1,31 @@
|
|||
.block
|
||||
= render :partial => 'projects/submenu'
|
||||
|
||||
.description
|
||||
%h3= t("layout.projects.about_subheader")
|
||||
%p
|
||||
= @project.description
|
||||
= link_to t('layout.read_more'), '#'
|
||||
|
||||
%h3= t("layout.projects.last_commit")
|
||||
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|
|
||||
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1}
|
||||
|
||||
.both
|
||||
|
||||
#repo-wrapper
|
||||
= render :partial => 'show'
|
||||
-#.block
|
||||
= render :partial => "git/shared/navigation"
|
||||
|
||||
= render :partial => "git/shared/info"
|
||||
|
||||
|
||||
.block
|
||||
-#.block
|
||||
.content
|
||||
.inner
|
||||
= render :partial => "git/commits/commits", :object => [@commit]
|
||||
|
||||
- begin
|
||||
-#- begin
|
||||
.block
|
||||
.content
|
||||
.inner
|
||||
|
@ -21,16 +37,16 @@
|
|||
= render_commit_stats(@commit.stats)
|
||||
|
||||
= render :partial => "git/commits/commit_diff", :collection => @commit.diffs
|
||||
- rescue Grit::Git::GitTimeout
|
||||
-#- rescue Grit::Git::GitTimeout
|
||||
.block
|
||||
.content
|
||||
.inner
|
||||
%p= t 'layout.git.repositories.commit_diff_too_big'
|
||||
|
||||
- content_for :sidebar, render(:partial => 'git/shared/sidebar')
|
||||
-#- content_for :sidebar, render(:partial => 'git/shared/sidebar')
|
||||
|
||||
= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
|
||||
%p
|
||||
-#= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
|
||||
-#%p
|
||||
%b
|
||||
= t('layout.issues.subscribe')
|
||||
\:
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
%h3= t("layout.projects.files_in_project")
|
||||
.files
|
||||
.l
|
||||
= render :partial => 'git/shared/whereami'
|
||||
.both
|
||||
|
||||
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}
|
||||
%thead
|
||||
%tr
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
.lineForm.fork
|
||||
= form_tag project_path(project), :id => 'branch_changer' do
|
||||
= select_tag :branch,
|
||||
options_from_collection_for_select(project.branches, :name, :name, @branch.name),
|
||||
= form_tag '', :id => 'branch_changer', :'data-action' => controller_name do
|
||||
= select_tag :branch, branch_selector_options(project),
|
||||
:class => 'sel80', :id => 'branch_selector'
|
||||
.fork
|
||||
%p= t('layout.projects.current_branch')+':'
|
||||
.both
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('select#branch_selector').live('change', function(e) {
|
||||
$form = $('form#branch_changer');
|
||||
$form.attr('action', $(this).val());
|
||||
$form.submit();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,12 +7,3 @@
|
|||
чтение и запись
|
||||
= render :partial => 'projects/branch_select', :locals => {:project => project}
|
||||
.both
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('select#branch_selector').live('change', function(e) {
|
||||
$form = $('form#branch_changer');
|
||||
$form.attr('action', $form.attr('action') + '/git/tree/' + $(this).val());
|
||||
$form.submit();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,16 +8,9 @@
|
|||
= link_to t('layout.read_more'), '#'
|
||||
|
||||
%h3= t("layout.projects.last_commit")
|
||||
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch) do |presenter|
|
||||
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|
|
||||
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1}
|
||||
|
||||
%h3= t("layout.projects.files_in_project")
|
||||
.files
|
||||
.l
|
||||
= render :partial => 'git/shared/whereami'
|
||||
|
||||
#fork-and-edit.r
|
||||
%a.button{:href => "#"} Fork and edit
|
||||
.both
|
||||
|
||||
#repo-wrapper
|
||||
|
|
|
@ -21,8 +21,8 @@ Rosa::Application.configure do
|
|||
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
||||
|
||||
# Print deprecation notices to the Rails logger
|
||||
#config.active_support.deprecation = :log
|
||||
config.active_support.deprecation = false
|
||||
config.active_support.deprecation = :log
|
||||
#config.active_support.deprecation = false
|
||||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require './lib/ext/core/string'
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require './lib/gollum1'
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require './lib/rosa_presenter/rosa_presenter'
|
|
@ -0,0 +1,4 @@
|
|||
ru:
|
||||
layout:
|
||||
projects:
|
||||
diff_show_header: "%{files} с %{additions} и %{deletions}."
|
|
@ -0,0 +1,22 @@
|
|||
en:
|
||||
layout:
|
||||
projects:
|
||||
commit_files_count:
|
||||
one: "Showing %{count} file"
|
||||
other: "Showing %{count} files"
|
||||
commit_additions_count:
|
||||
one: "%{count} addition"
|
||||
other: "%{count} additions"
|
||||
commit_deletions_count:
|
||||
one: "%{count} deletion"
|
||||
other: "%{count} deletions"
|
||||
|
||||
inline_additions_count:
|
||||
one: "%{count} addition"
|
||||
other: "%{count} additions"
|
||||
inline_deletions_count:
|
||||
one: "%{count} deletion"
|
||||
other: "%{count} deletions"
|
||||
inline_changes_count:
|
||||
one: "%{count} change"
|
||||
other: "%{count} changes"
|
|
@ -0,0 +1,28 @@
|
|||
ru:
|
||||
layout:
|
||||
projects:
|
||||
commit_files_count:
|
||||
one: "Показан %{count} файл"
|
||||
few: "Показано %{count} файла"
|
||||
many: "Показано %{count} файлов"
|
||||
commit_additions_count:
|
||||
one: "%{count} добавлением"
|
||||
few: "%{count} добавлениями"
|
||||
many: "%{count} добавлениями"
|
||||
commit_deletions_count:
|
||||
one: "%{count} удалением"
|
||||
few: "%{count} удалениями"
|
||||
many: "%{count} удалениями"
|
||||
|
||||
inline_additions_count:
|
||||
one: "%{count} добавление"
|
||||
few: "%{count} добавления"
|
||||
many: "%{count} добавлений"
|
||||
inline_deletions_count:
|
||||
one: "%{count} удаление"
|
||||
few: "%{count} удаления"
|
||||
many: "%{count} удалений"
|
||||
inline_changes_count:
|
||||
one: "%{count} изменение"
|
||||
few: "%{count} изменения"
|
||||
many: "%{count} изменений"
|
|
@ -205,7 +205,7 @@ Rosa::Application.routes.draw do
|
|||
|
||||
# Blobs
|
||||
match '/projects/:project_id/git/blob/:treeish/*path', :controller => "git/blobs", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blob, :via => :get, :format => false
|
||||
match '/projects/:project_id/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :project_id => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit, :via => :get
|
||||
match '/projects/:project_id/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :project_id => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit, :via => :get, :format => false
|
||||
|
||||
# Blame
|
||||
match '/projects/:project_id/git/blame/:treeish/*path', :controller => "git/blobs", :action => :blame, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blame
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddSettingsToSettingsNotifiers < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :settings_notifiers, :new_comment_commit_owner, :boolean, :default => true
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddStatusToSubscribe < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :subscribes, :status, :boolean, :default => true
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddProjectToSubscribe < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :subscribes, :project_id, :integer
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class ChangeSubscribeableToString < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_column :subscribes, :subscribeable_id, :string
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddPlatformReferenceToProjectImports < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :project_imports, :platform_id, :integer
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddQueueToDelayedJobs < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :delayed_jobs, :queue, :string
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class ChangeCommentableIdToDecimal < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :comments, :commentable_id_tmp, :decimal, :precision => 50, :scale => 0
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class CreateRegisterRequests < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :register_requests do |t|
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddMoreFieldsToRegisterRequests < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :register_requests, :interest, :string
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class ChangeSubscribeableIdToDecimal < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :subscribes, :subscribeable_id_tmp, :decimal, :precision => 50, :scale => 0
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddDefaultBranchToProjects < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :default_branch, :string, :default => 'master'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AddIsRpmToProjects < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :is_rpm, :boolean, :default => true
|
||||
|
|
131
db/schema.rb
131
db/schema.rb
|
@ -13,18 +13,10 @@
|
|||
|
||||
ActiveRecord::Schema.define(:version => 20120224122738) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
|
||||
|
@ -33,8 +25,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "user_id"
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
||||
|
@ -45,8 +37,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "arch_id"
|
||||
t.integer "pl_id"
|
||||
t.integer "bpl_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "build_list_items", :force => true do |t|
|
||||
|
@ -54,8 +46,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "level"
|
||||
t.integer "status"
|
||||
t.integer "build_list_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "version"
|
||||
end
|
||||
|
||||
|
@ -69,8 +61,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "project_id"
|
||||
t.integer "arch_id"
|
||||
t.datetime "notified_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "is_circle", :default => false
|
||||
t.text "additional_repos"
|
||||
t.string "name"
|
||||
|
@ -93,16 +85,16 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "name"
|
||||
t.string "ancestry"
|
||||
t.integer "projects_count", :default => 0, :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
t.string "commentable_type"
|
||||
t.integer "user_id"
|
||||
t.text "body"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.decimal "commentable_id", :precision => 50, :scale => 0
|
||||
end
|
||||
|
||||
|
@ -110,8 +102,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "name", :null => false
|
||||
t.integer "project_id", :null => false
|
||||
t.integer "owner_id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "delayed_jobs", :force => true do |t|
|
||||
|
@ -123,8 +115,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.datetime "locked_at"
|
||||
t.datetime "failed_at"
|
||||
t.string "locked_by"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "queue"
|
||||
end
|
||||
|
||||
|
@ -136,8 +128,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "distro"
|
||||
t.string "platform"
|
||||
t.integer "counter", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "event_logs", :force => true do |t|
|
||||
|
@ -152,15 +144,15 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "controller"
|
||||
t.string "action"
|
||||
t.text "message"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "groups", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "owner_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "uname"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
end
|
||||
|
@ -172,8 +164,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "title"
|
||||
t.text "body"
|
||||
t.string "status", :default => "open"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "issues", ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
||||
|
@ -182,8 +174,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "description"
|
||||
t.string "name"
|
||||
t.integer "parent_platform_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "released", :default => false
|
||||
t.integer "owner_id"
|
||||
t.string "owner_type"
|
||||
|
@ -196,8 +188,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "platform_id"
|
||||
t.string "login"
|
||||
t.string "password"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
|
@ -205,8 +197,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "product_id"
|
||||
t.integer "status", :default => 2, :null => false
|
||||
t.datetime "notified_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
|
@ -216,8 +208,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.integer "platform_id", :null => false
|
||||
t.integer "build_status", :default => 2, :null => false
|
||||
t.string "build_path"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "build_script"
|
||||
t.text "counter"
|
||||
t.text "ks"
|
||||
|
@ -237,8 +229,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "name"
|
||||
t.string "version"
|
||||
t.datetime "file_mtime"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "platform_id"
|
||||
end
|
||||
|
||||
|
@ -247,14 +239,14 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
create_table "project_to_repositories", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "repository_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "owner_id"
|
||||
t.string "owner_type"
|
||||
t.string "visibility", :default => "open"
|
||||
|
@ -271,36 +263,38 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.boolean "is_rpm", :default => true
|
||||
end
|
||||
|
||||
add_index "projects", ["category_id"], :name => "index_projects_on_category_id"
|
||||
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
||||
|
||||
create_table "register_requests", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email"
|
||||
t.string "token"
|
||||
t.boolean "approved", :default => false
|
||||
t.boolean "rejected", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "interest"
|
||||
t.text "more"
|
||||
end
|
||||
|
||||
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
|
||||
add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
|
||||
|
||||
create_table "relations", :force => true do |t|
|
||||
t.integer "object_id"
|
||||
t.string "object_type"
|
||||
t.integer "target_id"
|
||||
t.string "target_type"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "role"
|
||||
end
|
||||
|
||||
create_table "repositories", :force => true do |t|
|
||||
t.string "description", :null => false
|
||||
t.integer "platform_id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "name", :null => false
|
||||
end
|
||||
|
||||
|
@ -308,8 +302,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.string "name", :null => false
|
||||
t.integer "arch_id", :null => false
|
||||
t.integer "project_id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
|
||||
|
@ -322,8 +316,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
t.boolean "new_comment_reply", :default => true
|
||||
t.boolean "new_issue", :default => true
|
||||
t.boolean "issue_assign", :default => true
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "new_comment_commit_owner", :default => true
|
||||
t.boolean "new_comment_commit_repo_owner", :default => true
|
||||
t.boolean "new_comment_commit_commentor", :default => true
|
||||
|
@ -332,8 +326,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
create_table "subscribes", :force => true do |t|
|
||||
t.string "subscribeable_type"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "status", :default => true
|
||||
t.integer "project_id"
|
||||
t.decimal "subscribeable_id", :precision => 50, :scale => 0
|
||||
|
@ -341,25 +335,20 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
|
|||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "ssh_key"
|
||||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
end
|
||||
|
||||
add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
|
||||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
||||
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
||||
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class String
|
||||
def encode_to_default
|
||||
force_encoding(Encoding.default_internal || Encoding::UTF_8)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
|
||||
# This code based on https://github.com/ihoka/viewtastic
|
||||
module RosaPresenter
|
||||
module Activation
|
||||
def self.included(klass) # :nodoc:
|
||||
klass.prepend_before_filter :activate_rosa_presenter
|
||||
end
|
||||
|
||||
private
|
||||
def activate_rosa_presenter
|
||||
RosaPresenter::Base.controller = self
|
||||
end
|
||||
end
|
||||
end
|
||||
ActionController::Base.send(:include, RosaPresenter::Activation)
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
|
||||
# This code based on https://github.com/ihoka/viewtastic
|
||||
module RosaPresenter
|
||||
class Base
|
||||
include ActionDispatch::Routing::UrlFor
|
||||
include ActionView::Helpers::UrlHelper
|
||||
include ActionView::Helpers::TextHelper
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
def initialize(item, opts)
|
||||
end
|
||||
|
||||
def controller
|
||||
Thread.current[:rosa_presenter_controller]
|
||||
end
|
||||
|
||||
# TODO it needs to be refactored!
|
||||
class << self
|
||||
def present(item, opts, &block)
|
||||
block.call(self.new(item, opts))
|
||||
end
|
||||
|
||||
def present_collection(collection, &block)
|
||||
res = collection.map {|e| self.new(*e)}
|
||||
if block.present?
|
||||
res = res.inject('') do |akk, presenter|
|
||||
akk << block.call(presenter)
|
||||
akk
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
def controller=(value) #:nodoc:
|
||||
Thread.current[:rosa_presenter_controller] = value
|
||||
end
|
||||
|
||||
def controller #:nodoc:
|
||||
Thread.current[:rosa_presenter_controller]
|
||||
end
|
||||
|
||||
def activated? #:nodoc:
|
||||
!controller.nil?
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def t(*args)
|
||||
I18n.translate(*args)
|
||||
end
|
||||
|
||||
def l(*args)
|
||||
I18n.localize(*args)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require File.dirname(__FILE__) + "/lib/activation"
|
||||
require File.dirname(__FILE__) + "/lib/base"
|
||||
|
||||
module RosaPresenter
|
||||
VERSION = "0.0.1"
|
||||
end
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
# Read about factories at http://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require 'spec_helper'
|
||||
|
||||
describe RegisterRequest do
|
||||
|
|
Loading…
Reference in New Issue