contour 2.4.0.beta1 → 2.4.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/app/assets/javascripts/contour/global.js.coffee +1 -13
- data/app/helpers/contour_helper.rb +2 -2
- data/app/views/contour/layouts/_per_page.html.erb +24 -3
- data/app/views/kaminari/contour-large/_paginator.html.erb +4 -4
- data/app/views/kaminari/contour-small/_paginator.html.erb +4 -4
- data/app/views/kaminari/contour/_paginator.html.erb +4 -4
- data/lib/contour/version.rb +1 -1
- data/lib/generators/contour/scaffold/scaffold_generator.rb +1 -1
- data/lib/generators/contour/scaffold/templates/_paginate.html.erb +2 -2
- data/lib/generators/contour/scaffold/templates/index.html.erb +6 -5
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/helpers/contour_helper_test.rb +4 -0
- metadata +2 -3
- data/lib/generators/contour/scaffold/templates/index.js.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 310fce2685f889fe7272d0164e812429bb03ce5e
|
4
|
+
data.tar.gz: b82b531a51e1b45ae6b3b7d2e914d9314da8d7d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1f0ea2d95e77751a1fa0da7107751f41b96d9e6fd542240dbd4cfe61fa0d81b1b91d33e7768db58c59247957b9b6a794fd2238604a9b367e1a027aa86f2c59
|
7
|
+
data.tar.gz: c18c9dff02ed41227eee41d73c842bd44992a9cd15201ca2023a3259d0f1060b93f612075db46b30980be0e190a4bf8b9f9f4574ab79941eb22f675f3f1f1740
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,16 @@
|
|
4
4
|
- Updated Bootstrap to 3.1.0
|
5
5
|
- **Gem Changes**
|
6
6
|
- Updated to devise 3.2.2
|
7
|
+
- Added the suppress-click data-object
|
8
|
+
- <a href="#" data-object="suppress-click">Ignore Click</a>
|
9
|
+
- Updated layout for contour per page header
|
10
|
+
|
11
|
+
### Breaking Changes
|
12
|
+
- Removed pagination AJAX methods to reduce overall contour JavaScript footprint
|
13
|
+
- `sort_field_helper` updated to work with turbolinks and no longer uses AJAX
|
14
|
+
|
15
|
+
### Bug Fix
|
16
|
+
- Fixed the per page links to no longer include starting and ending links when the max page is reached
|
7
17
|
|
8
18
|
## 2.3.0 (February 3, 2014)
|
9
19
|
|
@@ -30,18 +30,6 @@ $(document)
|
|
30
30
|
catch error
|
31
31
|
# Nothing
|
32
32
|
)
|
33
|
-
.on('click', "
|
34
|
-
return false if $(this).parent().is('.active, .disabled, .per_page')
|
35
|
-
$.get(this.href, null, null, "script")
|
36
|
-
false
|
37
|
-
)
|
38
|
-
.on("click", ".per_page a", () ->
|
39
|
-
object_class = $(this).data('object')
|
40
|
-
$.get($("#"+object_class+"_search").attr("action"), $("#"+object_class+"_search").serialize() + "&"+object_class+"_per_page="+ $(this).data('count'), null, "script")
|
41
|
-
false
|
42
|
-
)
|
43
|
-
.on('click', '[data-object~="order"]', () ->
|
44
|
-
$('#order').val($(this).data('order'))
|
45
|
-
$($(this).data('form')).submit()
|
33
|
+
.on('click', '[data-object~="suppress-click"]', () ->
|
46
34
|
false
|
47
35
|
)
|
@@ -4,12 +4,12 @@ module ContourHelper
|
|
4
4
|
link_to 'Cancel', URI.parse(request.referer.to_s).path.blank? ? root_path : (URI.parse(request.referer.to_s).path), class: 'btn btn-default'
|
5
5
|
end
|
6
6
|
|
7
|
-
def sort_field_helper(order, sort_field, display_name
|
7
|
+
def sort_field_helper(order, sort_field, display_name)
|
8
8
|
sort_field_order = (order == sort_field) ? "#{sort_field} DESC" : sort_field
|
9
9
|
symbol = (order == sort_field) ? '»' : (order == sort_field + ' DESC' ? '«' : '«»')
|
10
10
|
selected_class = (order == sort_field) ? 'selected' : (order == sort_field + ' DESC' ? 'selected' : '')
|
11
11
|
content_tag(:span, class: selected_class) do
|
12
|
-
display_name.to_s.html_safe + ' ' + link_to(raw(symbol),
|
12
|
+
display_name.to_s.html_safe + ' ' + link_to(raw(symbol), url_for( params.merge( order: sort_field_order ) ), style: 'text-decoration:none')
|
13
13
|
end.html_safe
|
14
14
|
end
|
15
15
|
|
@@ -1,8 +1,29 @@
|
|
1
1
|
<% pagination_size_hash = { 'large' => 'lg', 'small' => 'sm' } %>
|
2
|
+
<% per_page = 20 unless defined?(per_page) and per_page %>
|
3
|
+
<% object_count = 0 unless defined?(object_count) and object_count %>
|
4
|
+
<% page = params[:page].blank? ? 1 : params[:page].to_i %>
|
5
|
+
<% current_page_min = (page - 1)*per_page + 1 %>
|
6
|
+
<% current_page_max = page*per_page %>
|
7
|
+
|
2
8
|
<ul class="pagination pull-right <%= "pagination-#{pagination_size_hash[pagination_size]}" if defined?(pagination_size) and ['large', 'small'].include?(pagination_size) %>">
|
3
|
-
|
4
|
-
|
5
|
-
<%
|
9
|
+
<% if current_page_min > 1 %>
|
10
|
+
<li><%= link_to '«'.html_safe, url_for( params.merge( page: page - 1 ) ) %></li>
|
11
|
+
<% else %>
|
12
|
+
<li class="disabled"><span>«</span></li>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<li>
|
16
|
+
<span style="color:#333">
|
17
|
+
<b><%= number_with_delimiter current_page_min %> to <%= number_with_delimiter [current_page_max, object_count].min %></b>
|
18
|
+
of <%= number_with_delimiter object_count %>
|
19
|
+
</span>
|
20
|
+
</li>
|
21
|
+
|
22
|
+
<% if current_page_max < object_count %>
|
23
|
+
<li><%= link_to '»'.html_safe, url_for( params.merge( page: page + 1 ) ) %></li>
|
24
|
+
<% else %>
|
25
|
+
<li class="disabled"><span>»</span></li>
|
26
|
+
<% end %>
|
6
27
|
</ul>
|
7
28
|
|
8
29
|
<div class="clear"> </div>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
-%>
|
9
9
|
<%= paginator.render do -%>
|
10
10
|
<ul class="pagination pagination-lg">
|
11
|
-
<%= first_page_tag
|
12
|
-
<%= prev_page_tag
|
11
|
+
<%= first_page_tag unless current_page.first? %>
|
12
|
+
<%= prev_page_tag unless current_page.first? %>
|
13
13
|
<% each_page do |page| -%>
|
14
14
|
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
15
15
|
<%= page_tag page %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<%= gap_tag %>
|
18
18
|
<% end -%>
|
19
19
|
<% end -%>
|
20
|
-
<%= next_page_tag
|
21
|
-
<%= last_page_tag
|
20
|
+
<%= next_page_tag unless current_page.last? %>
|
21
|
+
<%= last_page_tag unless current_page.last? %>
|
22
22
|
</ul>
|
23
23
|
<% end -%>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
-%>
|
9
9
|
<%= paginator.render do -%>
|
10
10
|
<ul class="pagination pagination-sm">
|
11
|
-
<%= first_page_tag
|
12
|
-
<%= prev_page_tag
|
11
|
+
<%= first_page_tag unless current_page.first? %>
|
12
|
+
<%= prev_page_tag unless current_page.first? %>
|
13
13
|
<% each_page do |page| -%>
|
14
14
|
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
15
15
|
<%= page_tag page %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<%= gap_tag %>
|
18
18
|
<% end -%>
|
19
19
|
<% end -%>
|
20
|
-
<%= next_page_tag
|
21
|
-
<%= last_page_tag
|
20
|
+
<%= next_page_tag unless current_page.last? %>
|
21
|
+
<%= last_page_tag unless current_page.last? %>
|
22
22
|
</ul>
|
23
23
|
<% end -%>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
-%>
|
9
9
|
<%= paginator.render do -%>
|
10
10
|
<ul class="pagination">
|
11
|
-
<%= first_page_tag
|
12
|
-
<%= prev_page_tag
|
11
|
+
<%= first_page_tag unless current_page.first? %>
|
12
|
+
<%= prev_page_tag unless current_page.first? %>
|
13
13
|
<% each_page do |page| -%>
|
14
14
|
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
15
15
|
<%= page_tag page %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<%= gap_tag %>
|
18
18
|
<% end -%>
|
19
19
|
<% end -%>
|
20
|
-
<%= next_page_tag
|
21
|
-
<%= last_page_tag
|
20
|
+
<%= next_page_tag unless current_page.last? %>
|
21
|
+
<%= last_page_tag unless current_page.last? %>
|
22
22
|
</ul>
|
23
23
|
<% end -%>
|
data/lib/contour/version.rb
CHANGED
@@ -49,7 +49,7 @@ class Contour::ScaffoldGenerator < Rails::Generators::NamedBase
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def generate_views
|
52
|
-
['_form.html.erb', 'new.html.erb', 'edit.html.erb', 'show.html.erb', 'index.html.erb'
|
52
|
+
['_form.html.erb', 'new.html.erb', 'edit.html.erb', 'show.html.erb', 'index.html.erb'].each do |view|
|
53
53
|
template view, "app/views/#{resource_name_plural}/#{view}"
|
54
54
|
end
|
55
55
|
template '_paginate.html.erb', "app/views/#{resource_name_plural}/_#{resource_name_plural}.html.erb"
|
@@ -1,10 +1,10 @@
|
|
1
|
-
<%%= render partial: 'contour/layouts/per_page', locals: {
|
1
|
+
<%%= render partial: 'contour/layouts/per_page', locals: { per_page: 20, object_count: @<%= resource_name_plural %>.total_count } %>
|
2
2
|
|
3
3
|
<table class="table table-striped">
|
4
4
|
<thead>
|
5
5
|
<tr>
|
6
6
|
<%- columns.each do |column| -%>
|
7
|
-
<th style="white-space:nowrap"><%%== sort_field_helper(@order, '<%= resource_name_plural %>.<%= column.name %>', '<%= column.name.titleize %>'
|
7
|
+
<th style="white-space:nowrap"><%%== sort_field_helper(@order, '<%= resource_name_plural %>.<%= column.name %>', '<%= column.name.titleize %>') %></th>
|
8
8
|
<%- end -%>
|
9
9
|
<th>Actions</th>
|
10
10
|
</tr>
|
@@ -2,14 +2,15 @@
|
|
2
2
|
<div class="page-header">
|
3
3
|
<h1>
|
4
4
|
<%%= @title %>
|
5
|
-
<%%= link_to
|
5
|
+
<%%= link_to 'Create <%= resource_title %>', new_<%= resource_name %>_path, class: 'btn btn-xs btn-primary' %>
|
6
6
|
</h1>
|
7
7
|
</div>
|
8
8
|
|
9
|
-
<%%= form_tag <%= resource_name_plural %>_path, method: :get,
|
10
|
-
<%%= hidden_field_tag :order %>
|
9
|
+
<%%= form_tag <%= resource_name_plural %>_path, method: :get, class: 'form-inline' do %>
|
10
|
+
<%%= hidden_field_tag :order, params[:order] %>
|
11
11
|
<%%= text_field_tag 'search', params[:search], class: 'form-control' %>
|
12
|
-
<%%= submit_tag 'Search', class: 'btn btn-primary' %>
|
12
|
+
<%%= submit_tag 'Search', class: 'btn btn-primary', name: nil %>
|
13
|
+
<%%= link_to 'Reset', <%= resource_name_plural %>_path, class: 'btn btn-default' %>
|
13
14
|
<%% end %>
|
14
15
|
|
15
|
-
|
16
|
+
<%%= render partial: '<%= resource_name_plural %>/<%= resource_name_plural %>' %>
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -3,10 +3,14 @@ require 'test_helper'
|
|
3
3
|
class ContourHelperTest < ActionView::TestCase
|
4
4
|
|
5
5
|
test "should show sort field helper" do
|
6
|
+
params[:controller] = 'welcome'
|
7
|
+
params[:action] = 'index'
|
6
8
|
assert sort_field_helper("first_name DESC", "last_name", "First Name").kind_of?(String)
|
7
9
|
end
|
8
10
|
|
9
11
|
test "should show sort field helper with same order" do
|
12
|
+
params[:controller] = 'welcome'
|
13
|
+
params[:action] = 'index'
|
10
14
|
assert sort_field_helper("first_name", "first_name", "First Name").kind_of?(String)
|
11
15
|
end
|
12
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.0.
|
4
|
+
version: 2.4.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Remo Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -310,7 +310,6 @@ files:
|
|
310
310
|
- lib/generators/contour/scaffold/templates/controller.rb
|
311
311
|
- lib/generators/contour/scaffold/templates/edit.html.erb
|
312
312
|
- lib/generators/contour/scaffold/templates/index.html.erb
|
313
|
-
- lib/generators/contour/scaffold/templates/index.js.erb
|
314
313
|
- lib/generators/contour/scaffold/templates/new.html.erb
|
315
314
|
- lib/generators/contour/scaffold/templates/show.html.erb
|
316
315
|
- test/contour_test.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
$("#<%= resource_name_plural %>").html("<%%= escape_javascript(render("<%= resource_name_plural %>")) %>");
|