[issue #279] Added views and removed datatables plugin

*  Datatables plugin moved to lib.
  *  Added views to platform and repositories.
This commit is contained in:
George Vinogradov 2012-03-13 19:05:33 +04:00
parent 952c9e46ea
commit 304141b1ba
28 changed files with 196 additions and 117 deletions

View File

@ -3,6 +3,7 @@
//= require jquery-ui
//= require autocomplete-rails
//= require vendor
//= require jquery.dataTables_ext
//= require_tree ./design
//= require_tree ./extra
//= require_self

View File

@ -451,7 +451,7 @@ table.tablesorter.platforms .th2 {
width: 280px;
}
table.tablesorter.platforms tr td.buttons {
table.tablesorter tr td.buttons {
text-align: center;
}
@ -481,3 +481,76 @@ table.tablesorter.unbordered tr td {
border: none;
padding: 3px;
}
table.tablesorter.repo-projects th.th1 {
width: 250px;
}
table.tablesorter.repo-projects th.th3 {
width: 60px;
}
table.tablesorter.repo-projects td.td2,
.table-sort-right {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
div.dataTables_filter {
margin-bottom: 15px;
}
div.dataTables_paginate {
float: left;
}
div.dataTables_info {
float: right;
}
div.dataTables_info,
div.dataTables_paginate.paging_will_paginate_like {
margin-top: 15px;
}
div.dataTables_paginate.paging_will_paginate_like a.paginate_button,
div.dataTables_paginate.paging_will_paginate_like a.paginate_active {
background: none repeat scroll 0 0 #EDEDED;
color: #4C90D0 !important;
border: 1px solid #DDDDDD;
border-radius: 1px 1px 1px 1px;
padding: 3px 7px;
margin-right: 3px;
cursor: pointer;
}
div.dataTables_paginate.paging_will_paginate_like a.paginate_button_disabled,
div.dataTables_paginate.paging_will_paginate_like a.paginate_active {
color: #565657 !important;
cursor: default;
}
div.dataTables_paginate.paging_will_paginate_like a.paginate_button_disabled:hover,
div.dataTables_paginate.paging_will_paginate_like a.paginate_active:hover {
text-decoration: none;
}
div.dataTables_paginate.paging_will_paginate_like a.previous {
margin-left: 0px;
margin-right: 4px;
}
div.dataTables_paginate.paging_will_paginate_like a.next {
margin-left: 1px;
margin-right: 0px;
}
div.dataTables_paginate.paging_will_paginate_like a.paginate_active {
background: none repeat scroll 0 0 #D5E7F9;
border: 1px solid #C1DAED;
}
div.dataTables_processing {
z-index: 999;
}

View File

@ -20,6 +20,8 @@ module ApplicationHelper
nil
when params[:controller] == 'platforms' && params[:action] == 'show'
'right bigpadding'
when params[:controller] == 'platforms' && params[:action] == 'clone'
'right middlepadding'
else
content_for?(:sidebar) ? 'right' : 'all'
end

View File

@ -1,33 +1,28 @@
- unless ['edit', 'update'].include? controller.action_name
.group
= f.label :name, :class => :label
= f.text_field :name, :class => 'text_field'
.leftlist= f.label :name, :class => :label
.rightlist= f.text_field :name, :class => 'text_field'
.group
= f.label :description, :class => :label
= f.text_field :description, :class => 'text_field'
.leftlist= f.label :description, :class => :label
.rightlist= f.text_field :description, :class => 'text_field'
- unless ['edit', 'update'].include? controller.action_name
.group
= f.label :distrib_type, :class => :label
= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types'])
.leftlist= f.label :distrib_type, :class => :label
.rightlist= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types'])
.group
= f.label :parent, :class => :label
= f.collection_select :parent_platform_id, Platform.all, :id, :description, :include_blank => true
.leftlist= f.label :parent, :class => :label
.rightlist= f.collection_select :parent_platform_id, Platform.all, :id, :description, :include_blank => true
.group
= f.label :released, :class => :label
= f.check_box :released, :class => 'check_box'
.leftlist= f.label :released, :class => :label
.rightlist= f.check_box :released, :class => 'check_box'
.group
= label_tag "", t("layout.platforms.admin_id"), :class => :label
= autocomplete_field_tag 'admin_id', @admin_uname, autocomplete_user_uname_platforms_path, :id_element => '#admin_id_field'
= hidden_field_tag 'admin_id', @admin_id, :id => 'admin_id_field'
.group.navform.wat-cf
%button.button{:type => "submit"}
= image_tag("choose.png", :alt => t("layout.save"))
= t("layout.save")
.leftlist= label_tag "", t("layout.platforms.admin_id"), :class => :label
.rightlist= autocomplete_field_tag 'admin_id', @admin_uname, autocomplete_user_uname_platforms_path, :id_element => '#admin_id_field'
= hidden_field_tag 'admin_id', @admin_id, :id => 'admin_id_field'
.button_block
= submit_tag t("layout.clone")
-#%input.button{:type => "submit", :class => "button"}
-#= image_tag("choose.png", :alt => t("layout.save"))
-#= t("layout.clone")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), @platforms_path, :class => "text_button_padding link_button"
= link_to t("layout.cancel"), @platforms_path, :class => "button"

View File

@ -7,9 +7,9 @@
%ul
%li{:class => (act == :show && contr == :platforms) ? 'active' : ''}
= link_to t("layout.platforms.about"), platform_path(@platform)
%li{:class => (act == :index && contr == :repositories) ? 'active' : ''}
%li{:class => (contr == :repositories) ? 'active' : ''}
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
%li{:class => (act == :index && contr == :products) ? 'active' : ''}
%li{:class => (contr == :products) ? 'active' : ''}
= link_to t("layout.products.list_header"), platform_products_path(@platform)
-#- if current_user.owner_of? @platform or current_user.admin?
%li{:class => (act == :index && contr == :private_users) ? 'active' : ''}

View File

@ -1,4 +1,21 @@
.block
= render :partial => 'submenu'
= render :partial => 'sidebar'
= form_for @cloned, :url => make_clone_platform_path(@platform), :html => { :class => :form } do |f|
.leftlist= f.label :name, :class => :label
.rightlist= f.text_field :name, :class => 'text_field'
.leftlist= f.label :description, :class => :label
.rightlist= f.text_field :description, :class => 'text_field'
.button_block
= submit_tag t("layout.clone")
-#%input.button{:type => "submit", :class => "button"}
-#= image_tag("choose.png", :alt => t("layout.save"))
-#= t("layout.clone")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), @platforms_path, :class => "button"
-#.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to "#{t("layout.platforms.list")}", @platforms_path

View File

@ -1,4 +1,9 @@
.block
= render :partial => 'submenu'
= render :partial => 'sidebar'
= form_for @platform, :url => platform_path(@platform), :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}
-#.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.platforms.list"), platforms_path
@ -10,4 +15,4 @@
.inner
= form_for @platform, :url => platform_path(@platform), :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}
- content_for :sidebar, render(:partial => 'sidebar')
-# content_for :sidebar, render(:partial => 'sidebar')

View File

@ -6,3 +6,9 @@
= t("layout.read_write_access")
= render :partial => 'projects/branch_select', :locals => {:project => project}
.both
:javascript
$(document).ready(function() {
$('#url').live('click', function() {
$(this).select();
});
});

View File

@ -1,18 +1,19 @@
- columns = [{:type => 'html', :searchable => false}, {:type => 'html'}, {:type => nil, :sortable => false, :searchable => false}]
= raw datatable(columns, {:sort_by => "[1, 'asc']", :search_label => t("layout.search_by_name"), :processing => t("layout.processing"),
:pagination_labels => {:first => t("datatables.first_label"), :previous => t("datatables.previous_label"),
:next => t("datatables.next_label"), :last => t("datatables.last_label")},
:pagination_labels => {:previous => t("datatables.previous_label"), :next => t("datatables.next_label")},
:empty_label => t("datatables.empty_label"),
:info_label => t("datatables.info_label"),
:info_empty_label => t("datatables.info_empty_label"),
:filtered_label => t("datatables.filtered_label"),
:table_dom_id => 'datatable',
:auto_width => 'false',
:ajax_source => "#{url_for :controller => :repositories, :action => :projects_list, :id => @repository.id}" })
%table.table.datatable
%table#datatable.tablesorter.repo-projects{:cellspacing => 0, :cellpadding => 0}
%thead
%tr
%th.first{:style => 'width: 80px'}= t("activerecord.attributes.user.uname")
%th= t("activerecord.attributes.project.name")
%th.last  
%th.th1= t("activerecord.attributes.user.uname")
%th.th2= t("activerecord.attributes.project.name")
%th.buttons  
%tbody
%br

View File

@ -1,6 +1,15 @@
%table.table
%table#myTable.tablesorter.repo-projects{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1= t("activerecord.attributes.project.name")
%th.th2= t("activerecord.attributes.project.description")
%th.th3= t("layout.remove")
%tbody= render :partial => 'repositories/project', :collection => @projects
-#%table.tablesorter
%tr
%th.first= t("activerecord.attributes.project.name")
%th.
%th.last  
- @projects.each do |project|
%tr{:class => cycle("odd", "even")}

View File

@ -0,0 +1,10 @@
%tr{:id => "Row#{project_counter}", :class => cycle('odd', 'even')}
%td
= link_to project do
.table-sort-left= image_tag visibility_icon(project.visibility)
.table-sort-right #{project.owner.uname} / #{project.name}
%td.td2
%span= project.description
%td.buttons
= link_to remove_project_repository_path(@repository, :project_id => project.id), :method => :delete, :confirm => t("layout.confirm") do
%span.delete  

View File

@ -1,4 +1,6 @@
.block
= render :partial => 'submenu'
= render :partial => 'sidebar'
-#.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.repositories.list"), @repositories_path + "#platforms"

View File

@ -1,45 +1,6 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.repositories.list"), @repositories_path + "#repositories"
%li= link_to t("layout.repositories.new"), @new_repository_path
%li.active= link_to t("layout.repositories.show"), repository_path(@repository)
.content
.inner
%p
%b
= t("activerecord.attributes.repository.name")
\:
= @repository.name
%p
%b
= t("activerecord.attributes.repository.description")
\:
= @repository.description
%p
%b
= t("activerecord.attributes.repository.platform")
\:
= link_to @repository.platform.description, url_for(@repository.platform)
.wat-cf
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), @repository_path, :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete")
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'
%a{ :name => "projects" }
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), repository_path(@repository) + "#projects"
%li.active= link_to t("layout.projects.add"), url_for(:controller => :repositories, :action => :add_project)
.content
%h2.title
= t("layout.projects.list_header")
.inner
-#= render :partial => 'shared/search_form'
= render :partial => 'proj_list', :object => @projects
-#.actions-bar.wat-cf
.actions
= will_paginate @projects, :param_name => :project_page
-# content_for :sidebar, render(:partial => 'sidebar')
%h3= "#{t("layout.repositories.add_project_to")}: #{@repository.name}"
= render :partial => 'proj_list', :object => @projects

View File

@ -1,4 +1,17 @@
.block
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'
%h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}"
%p= @platform.description
%br
%br
%h3.fix= t("layout.projects.list_header")
= link_to t("layout.projects.add"), add_project_repository_path(@repository), :class => 'button'
= render :partial => 'proj_list1', :object => @projects
-#.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.repositories.list"), @repositories_path + "#repositories"
@ -24,8 +37,8 @@
.wat-cf
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), @repository_path, :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete") if can? :destroy, @repository
%a{ :name => "projects" }
.block
-#%a{ :name => "projects" }
-#.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.projects.list"), repository_path(@repository) + "#projects"

View File

@ -24,3 +24,6 @@ types = [
types.each do |type|
MIME::Types.add MIME::Type.from_array(type)
end
# load datatables plugin
require Rails.root.join("lib/rails_datatables")

View File

@ -23,7 +23,7 @@ en:
freeze: Freeze
unfreeze: Unfeeze
confirm_freeze: Are you sure to freeze this platform?
confirm_freeze: Are you sure to clone this platform?
confirm_clone: Are you sure to clone this platform?
confirm_unfreeze: Are you sure to defrost this platform?
released_suffix: (released)
confirm_delete: Are you sure to delete this platform?

View File

@ -23,7 +23,7 @@ ru:
freeze: Заморозить
unfreeze: Разморозить
confirm_freeze: Вы уверены, что хотите заморозить эту платформу?
confirm_freeze: Вы уверены, что хотите клонировать эту платформу?
confirm_clone: Вы уверены, что хотите клонировать эту платформу?
confirm_unfreeze: Вы уверены, что хотите разморозить эту платформу?
released_suffix: (выпущена)
confirm_delete: Вы уверены, что хотите удалить эту платформу?

View File

@ -1,7 +1,9 @@
en:
layout:
repositories:
add_project_to: Add project to repository
list: List
about: About repository
list_header: Repositories
new: New repository
new_header: New repository

View File

@ -1,7 +1,9 @@
ru:
layout:
repositories:
add_project_to: Добавить проект к репозиторию
list: Список
about: О репозитории
list_header: Репозитории
new: Новый репозиторий
new_header: Новый репозиторий

View File

@ -5,8 +5,8 @@ ru:
page_gap: ...
datatables:
previous_label: Пред.
next_label: След.
previous_label: Предыдущая
next_label: Следующая
first_label: « Первая
last_label: Последняя »
empty_label: Нет доступных данных

View File

@ -1,2 +1,3 @@
# -*- encoding : utf-8 -*-
require Rails.root.join('lib/rails_datatables/rails_datatables')
ActionView::Base.send :include, RailsDatatables

View File

@ -60,7 +60,7 @@ module RailsDatatables
"sProcessing": '#{processing}'
},
"sPaginationType": "full_numbers",
"sPaginationType": "will_paginate_like",
"iDisplayLength": #{per_page},
"bProcessing": true,
"bServerSide": #{server_side},
@ -81,6 +81,8 @@ module RailsDatatables
} );
}
})#{append};
$('#datatable_wrapper').append("<div class='both'></div>");
});
</script>
}

View File

@ -2,6 +2,7 @@
//= require gollum/gollum.dialog
//= require gollum/gollum.placeholder
//= require gollum/editor/gollum.editor
//= require jquery.dataTables
//= require codemirror
//= require codemirror/runmode
//= require_tree ./codemirror/modes

View File

@ -1,23 +0,0 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the rails_datatables plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the rails_datatables plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'RailsDatatables'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

View File

@ -1,2 +0,0 @@
# -*- encoding : utf-8 -*-
# Install hook code here

View File

@ -1,2 +0,0 @@
# -*- encoding : utf-8 -*-
# Uninstall hook code here