simple_resource 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +5 -0
- data/app/helpers/simple_resource/base_helper.rb +7 -0
- data/app/views/simple_resource/base/_collection.html.erb +7 -1
- data/app/views/simple_resource/base/show.html.erb +1 -1
- data/lib/simple_resource/configuration.rb +9 -0
- data/lib/simple_resource/version.rb +1 -1
- data/spec/helpers/base_helper_spec.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -101,6 +101,13 @@ module SimpleResource
|
|
101
101
|
button_classes.join(" ").strip
|
102
102
|
end
|
103
103
|
|
104
|
+
def table_classes_for(table_type)
|
105
|
+
table_classes = Array.new
|
106
|
+
table_classes << SimpleResource::Configuration.table_classes
|
107
|
+
table_classes << SimpleResource::Configuration.send("table_classes_for_#{table_type.to_s}")
|
108
|
+
table_classes.join(" ").strip
|
109
|
+
end
|
110
|
+
|
104
111
|
def controller_namespaces
|
105
112
|
namespaces = controller_path.split("/")
|
106
113
|
namespaces.pop
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% @title ||= collection_title %>
|
2
2
|
|
3
|
-
<table>
|
3
|
+
<table class="<%= table_classes_for(:collection) %>">
|
4
4
|
<thead>
|
5
5
|
<tr>
|
6
6
|
<% attributes.each do |attribute_name| %>
|
@@ -20,3 +20,9 @@
|
|
20
20
|
<% end %>
|
21
21
|
</tbody>
|
22
22
|
</table>
|
23
|
+
|
24
|
+
<%=
|
25
|
+
if defined?(Kaminari)
|
26
|
+
paginate(collection)
|
27
|
+
end
|
28
|
+
%>
|
@@ -1,5 +1,14 @@
|
|
1
1
|
module SimpleResource
|
2
2
|
module Configuration
|
3
|
+
mattr_accessor :table_classes
|
4
|
+
self.table_classes = "table"
|
5
|
+
|
6
|
+
mattr_accessor :table_classes_for_collection
|
7
|
+
self.table_classes_for_collection = "collection"
|
8
|
+
|
9
|
+
mattr_accessor :table_classes_for_resource
|
10
|
+
self.table_classes_for_resource = "resource"
|
11
|
+
|
3
12
|
mattr_accessor :button_classes
|
4
13
|
self.button_classes = "btn"
|
5
14
|
|
@@ -332,7 +332,7 @@ describe SimpleResource::BaseHelper do
|
|
332
332
|
let(:collection) { FactoryGirl.create_list(:language, 10) }
|
333
333
|
|
334
334
|
it "returns collection table in HTML" do
|
335
|
-
expected = %Q(<table>)
|
335
|
+
expected = %Q(<table class="table collection">)
|
336
336
|
expected += %Q(<thead><tr><th>Name</th><th> </th></tr></thead><tbody>)
|
337
337
|
|
338
338
|
collection.each do |resource|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -317,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
317
317
|
version: '0'
|
318
318
|
segments:
|
319
319
|
- 0
|
320
|
-
hash:
|
320
|
+
hash: 11179807578126379
|
321
321
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
322
322
|
none: false
|
323
323
|
requirements:
|
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
326
|
version: '0'
|
327
327
|
segments:
|
328
328
|
- 0
|
329
|
-
hash:
|
329
|
+
hash: 11179807578126379
|
330
330
|
requirements: []
|
331
331
|
rubyforge_project:
|
332
332
|
rubygems_version: 1.8.24
|