administrate 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of administrate might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0ffa94bab53d4877a173651ce606729bcb586f5
4
- data.tar.gz: eb04d83ab59f3963c73f090210793a1dc0e82d31
3
+ metadata.gz: edc61eafe7e1c58cccdf49d53f0b5c279e343deb
4
+ data.tar.gz: 2410bd7f50fe33e8341d1c662db4c6ddc343d408
5
5
  SHA512:
6
- metadata.gz: a0a2ea77c9767eed3f20e55ceb7cd52cc05a0894949cb0bfd6fea7a0b733d3ba939b55d60ec00f98532a1a60af1d903752fa829be096b811418f076c6af43cc1
7
- data.tar.gz: 8bc9dddba60190a8d3a1cf416eb9a87554f0c22007792d88501abdcc8039de2d335f9ad5168d652f699b53430ef67454dfc75c939c372e80f20ace3c85b046ee
6
+ metadata.gz: 9402b5353adf25c3a1a06f6e33ad963bca6e6aeb3d1806e47941581f1b95d08e737d61bfd42af7a8c495cb24962ab63cb7ca11f7eec5b9b3ad2581185bfd47e2
7
+ data.tar.gz: f51fab8de37a22371755543ad6ac29437d0b81c95edfbda7e8f1e93b0a53ac7e8a6f9722c9874176e800f190e29757dcd3ca6605ca81bfb343c7748551716145
@@ -0,0 +1,6 @@
1
+ <svg id="cancel-search" width="48" height="48" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
2
+ <title>cancel</title>
3
+ <g fill="#D8D8D8" fill-rule="evenodd">
4
+ <path d="M24 19.757l-8.485-8.485c-.784-.783-2.047-.782-2.827 0l-1.417 1.416c-.777.777-.78 2.046.002 2.827L19.757 24l-8.485 8.485c-.783.784-.782 2.047 0 2.827l1.416 1.417c.777.777 2.046.78 2.827-.002L24 28.243l8.485 8.485c.784.783 2.047.782 2.827 0l1.417-1.416c.777-.777.78-2.046-.002-2.827L28.243 24l8.485-8.485c.783-.784.782-2.047 0-2.827l-1.416-1.417c-.777-.777-2.046-.78-2.827.002L24 19.757zM24 47c12.703 0 23-10.297 23-23S36.703 1 24 1 1 11.297 1 24s10.297 23 23 23z"/>
5
+ </g>
6
+ </svg>
@@ -1,3 +1,4 @@
1
1
  .form-actions {
2
2
  @include shift(2);
3
+ margin-bottom: $base-spacing * 4;
3
4
  }
@@ -9,9 +9,15 @@
9
9
  width: 100%;
10
10
  }
11
11
 
12
+ .search__clear,
12
13
  .search__icon {
13
14
  svg {
14
15
  @include size(1em);
16
+ }
17
+ }
18
+
19
+ .search__icon {
20
+ path {
15
21
  fill: $hint-grey;
16
22
  transition: fill $base-duration $base-timing;
17
23
  }
@@ -23,6 +29,18 @@
23
29
  }
24
30
  }
25
31
 
32
+ .search__clear {
33
+ z-index: 2;
34
+
35
+ path {
36
+ fill: $hint-grey;
37
+ }
38
+
39
+ &:hover path {
40
+ fill: $action-color;
41
+ }
42
+ }
43
+
26
44
  .search__input {
27
45
  appearance: none;
28
46
  border: 0;
@@ -41,6 +59,7 @@
41
59
  color: $hint-grey;
42
60
  opacity: 0;
43
61
  transition: opacity $base-duration $base-timing;
62
+ z-index: 1;
44
63
 
45
64
  svg {
46
65
  @include size(100%);
@@ -32,5 +32,13 @@ module Administrate
32
32
  content_tag :use, nil, svg_attributes
33
33
  end
34
34
  end
35
+
36
+ def sanitized_order_params
37
+ params.permit(:search, :id, :order, :page, :per_page, :direction)
38
+ end
39
+
40
+ def clear_search_params
41
+ params.except(:search, :page).permit(:order, :direction, :per_page)
42
+ end
35
43
  end
36
44
  end
@@ -26,7 +26,7 @@ to display a collection of resources in an HTML table.
26
26
  cell-label--<%= attr_type.html_class %>
27
27
  cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
28
28
  " scope="col">
29
- <%= link_to(params.merge(
29
+ <%= link_to(sanitized_order_params.merge(
30
30
  collection_presenter.order_params_for(attr_name)
31
31
  )) do %>
32
32
  <%= t(
@@ -0,0 +1,21 @@
1
+ <form class="search">
2
+ <span class="search__icon">
3
+ <%= svg_tag "administrate/search.svg", "search", width: 16, height: 16 %>
4
+ </span>
5
+ <input
6
+ type="text"
7
+ name="search"
8
+ class="search__input"
9
+ placeholder="Search"
10
+ value="<%= search_term %>"
11
+ aria-label="Search"
12
+ />
13
+ <span class="search__hint">
14
+ Press enter to search
15
+ </span>
16
+ <span class="search__clear">
17
+ <%= link_to clear_search_params do %>
18
+ <%= svg_tag "administrate/cancel.svg", "cancel-search", width: 16, height: 16 %>
19
+ <% end %>
20
+ </span>
21
+ </form>
@@ -26,22 +26,7 @@ It renders the `_table` partial to display details about the resources.
26
26
  <% end %>
27
27
 
28
28
  <% content_for(:search) do %>
29
- <form class="search">
30
- <span class="search__icon">
31
- <%= svg_tag "administrate/search.svg", "search", width: 16, height: 16 %>
32
- </span>
33
- <input
34
- type="text"
35
- name="search"
36
- class="search__input"
37
- placeholder="Search"
38
- value="<%= search_term %>"
39
- aria-label="Search"
40
- />
41
- <span class="search__hint">
42
- Press enter to search
43
- </span>
44
- </form>
29
+ <%= render "search", search_term: search_term %>
45
30
  <% end %>
46
31
 
47
32
  <header class="header">
@@ -0,0 +1,23 @@
1
+ ---
2
+ ar:
3
+ administrate:
4
+ actions:
5
+ confirm: "هل أنت متأكد ؟"
6
+ destroy: "حذف"
7
+ edit: "تعديل"
8
+ show: "إظهار"
9
+ controller:
10
+ create:
11
+ success: ".بنجاح %{resource} لقد تم إنشاء"
12
+ destroy:
13
+ success: ".بنجاح %{resource} لقد تم حذف"
14
+ update:
15
+ success: ".بنجاح %{resource} لقد تم تحديث"
16
+ fields:
17
+ has_many:
18
+ more: إظهار %{count} من %{total_count}
19
+ none: "لا يوجد"
20
+ polymorphic:
21
+ not_supported: "غير مدعمه \"Polymorphic\" هذه العلاقه"
22
+ has_one:
23
+ not_supported: "غير مدعمه \"HasOne\" هذه العلاقه"
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
@@ -81,7 +81,7 @@ module Administrate
81
81
  if enum_column?(attr)
82
82
  :enum
83
83
  else
84
- klass.column_types[attr].type
84
+ column_types(attr)
85
85
  end
86
86
  end
87
87
 
@@ -90,6 +90,10 @@ module Administrate
90
90
  klass.defined_enums.keys.include?(attr)
91
91
  end
92
92
 
93
+ def column_types(attr)
94
+ klass.columns.find { |column| column.name == attr }.try(:type)
95
+ end
96
+
93
97
  def association_type(attribute)
94
98
  relationship = klass.reflections[attribute.to_s]
95
99
  if relationship.has_one?
@@ -1,12 +1,12 @@
1
1
  # All Administrate controllers inherit from this `Admin::ApplicationController`,
2
2
  # making it the ideal place to put authentication logic or other
3
- # before_filters.
3
+ # before_actions.
4
4
  #
5
5
  # If you want to add pagination or other controller-level concerns,
6
6
  # you're free to overwrite the RESTful controller actions.
7
7
  module Admin
8
8
  class ApplicationController < Administrate::ApplicationController
9
- before_filter :authenticate_admin
9
+ before_action :authenticate_admin
10
10
 
11
11
  def authenticate_admin
12
12
  # TODO Add authentication logic here.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grayson Wright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-21 00:00:00.000000000 Z
11
+ date: 2016-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoprefixer-rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bourbon
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: datetime_picker_rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -112,16 +126,22 @@ dependencies:
112
126
  name: rails
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - "~>"
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
131
  version: '4.2'
132
+ - - "<"
133
+ - !ruby/object:Gem::Version
134
+ version: '5.1'
118
135
  type: :runtime
119
136
  prerelease: false
120
137
  version_requirements: !ruby/object:Gem::Requirement
121
138
  requirements:
122
- - - "~>"
139
+ - - ">="
123
140
  - !ruby/object:Gem::Version
124
141
  version: '4.2'
142
+ - - "<"
143
+ - !ruby/object:Gem::Version
144
+ version: '5.1'
125
145
  - !ruby/object:Gem::Dependency
126
146
  name: sass-rails
127
147
  requirement: !ruby/object:Gem::Requirement
@@ -170,6 +190,7 @@ extensions: []
170
190
  extra_rdoc_files: []
171
191
  files:
172
192
  - Rakefile
193
+ - app/assets/images/administrate/cancel.svg
173
194
  - app/assets/images/administrate/dropdown.svg
174
195
  - app/assets/images/administrate/search.svg
175
196
  - app/assets/images/administrate/sort_arrow.svg
@@ -207,6 +228,7 @@ files:
207
228
  - app/views/administrate/application/_flashes.html.erb
208
229
  - app/views/administrate/application/_form.html.erb
209
230
  - app/views/administrate/application/_javascript.html.erb
231
+ - app/views/administrate/application/_search.html.erb
210
232
  - app/views/administrate/application/_sidebar.html.erb
211
233
  - app/views/administrate/application/_stylesheet.html.erb
212
234
  - app/views/administrate/application/edit.html.erb
@@ -249,6 +271,7 @@ files:
249
271
  - app/views/layouts/administrate/application.html.erb
250
272
  - app/views/layouts/docs.html.erb
251
273
  - config/i18n-tasks.yml
274
+ - config/locales/administrate.ar.yml
252
275
  - config/locales/administrate.da.yml
253
276
  - config/locales/administrate.de.yml
254
277
  - config/locales/administrate.en.yml
@@ -342,9 +365,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
365
  version: '0'
343
366
  requirements: []
344
367
  rubyforge_project:
345
- rubygems_version: 2.4.5.1
368
+ rubygems_version: 2.6.7
346
369
  signing_key:
347
370
  specification_version: 4
348
371
  summary: A Rails engine for creating super-flexible admin dashboards
349
372
  test_files: []
350
- has_rdoc: