administrate 0.1.4 → 0.1.5

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: cd6b7e88304b6a4b6255696bd3e09757f8dc9fa1
4
- data.tar.gz: 46632cb11d7f960f33f89177d41e6be93407c200
3
+ metadata.gz: cc3433138207bed6d4a596ef48f6bfac9429e4ee
4
+ data.tar.gz: 1b6e823bb2465556926e562e0e4e21a5bbfc1e61
5
5
  SHA512:
6
- metadata.gz: 0fd234605bdad1d95b25a2bd494df96ec9450d15c31500349edc4045daaea79da1acf394627a0930e3b487ffd5d9b9a43e30c27da6df07b674973e026adce839
7
- data.tar.gz: aca5e1ea7517a2eca432c8edd9394cbf9be95e630c8de24f86eb2c9d63405bca2a8c7f28a4f29033a99dfaad0b385d70c7c16ad2a0416432f63a1b4d6afdb2c0
6
+ metadata.gz: 416d6157029a929e125139cd53897d93187cf798106fe8e43a5232c7a4ab193d1975f496af6e23e4f03036bfae478f9153597229dbfa308a595802b8b6d01b8e
7
+ data.tar.gz: 27967f0496a392f5dfee4914a35728d8e6f743a27d2d9e15c16f289995fdb40e7d9b18feabf273025e0646ff93ee7be1733216d7dabe6d930c34c971ccf9ab20
@@ -1,5 +1,7 @@
1
1
  module Administrate
2
2
  class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+
3
5
  def index
4
6
  search_term = params[:search].to_s.strip
5
7
  resources = Administrate::Search.new(resource_resolver, search_term).run
@@ -0,0 +1,31 @@
1
+ <%#
2
+ # Select Index Partial
3
+
4
+ This partial renders a selectable text attribute,
5
+ to be displayed on a resource's edit form page.
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of [Administrate::Field::Select][1].
13
+ A wrapper around the attribute pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Select
16
+ %>
17
+
18
+ <div class="field-unit__label">
19
+ <%= f.label field.attribute %>
20
+ </div>
21
+ <div class="field-unit__field">
22
+ <%= f.select(
23
+ field.attribute,
24
+ options_from_collection_for_select(
25
+ field.selectable_options,
26
+ :to_s,
27
+ :to_s,
28
+ field.data.presence,
29
+ )
30
+ ) %>
31
+ </div>
@@ -0,0 +1,16 @@
1
+ <%#
2
+ # Select Index Partial
3
+
4
+ This partial renders a selectable text attribute,
5
+ to be displayed on a resource's index page.
6
+
7
+ ## Local variables:
8
+
9
+ - `field`:
10
+ An instance of [Administrate::Field::Select][1].
11
+ A wrapper around the attribute pulled from the database.
12
+
13
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Select
14
+ %>
15
+
16
+ <%= field.data %>
@@ -0,0 +1,16 @@
1
+ <%#
2
+ # Select Show Partial
3
+
4
+ This partial renders a selectable text attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ ## Local variables:
8
+
9
+ - `field`:
10
+ An instance of [Administrate::Field::Select][1].
11
+ A wrapper around the attribute pulled from the database.
12
+
13
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Select
14
+ %>
15
+
16
+ <%= field.data %>
@@ -7,6 +7,7 @@ require "administrate/field/has_one"
7
7
  require "administrate/field/image"
8
8
  require "administrate/field/number"
9
9
  require "administrate/field/polymorphic"
10
+ require "administrate/field/select"
10
11
  require "administrate/field/string"
11
12
  require "administrate/field/text"
12
13
 
@@ -0,0 +1,21 @@
1
+ require_relative "base"
2
+
3
+ module Administrate
4
+ module Field
5
+ class Select < Field::Base
6
+ def self.searchable?
7
+ true
8
+ end
9
+
10
+ def selectable_options
11
+ collection
12
+ end
13
+
14
+ private
15
+
16
+ def collection
17
+ @collection ||= options.fetch(:collection, [])
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.1.4".freeze
2
+ VERSION = "0.1.5".freeze
3
3
  end
@@ -1,2 +1,6 @@
1
- <%= f.label field.attribute %>
2
- <%= f.text_field field.attribute %>
1
+ <div class="field-unit__label">
2
+ <%= f.label field.attribute %>
3
+ </div>
4
+ <div class="field-unit__field">
5
+ <%= f.text_field field.attribute %>
6
+ </div>
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.1.4
4
+ version: 0.1.5
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-02-21 00:00:00.000000000 Z
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoprefixer-rails
@@ -239,6 +239,9 @@ files:
239
239
  - app/views/fields/polymorphic/_form.html.erb
240
240
  - app/views/fields/polymorphic/_index.html.erb
241
241
  - app/views/fields/polymorphic/_show.html.erb
242
+ - app/views/fields/select/_form.html.erb
243
+ - app/views/fields/select/_index.html.erb
244
+ - app/views/fields/select/_show.html.erb
242
245
  - app/views/fields/string/_form.html.erb
243
246
  - app/views/fields/string/_index.html.erb
244
247
  - app/views/fields/string/_show.html.erb
@@ -280,6 +283,7 @@ files:
280
283
  - lib/administrate/field/image.rb
281
284
  - lib/administrate/field/number.rb
282
285
  - lib/administrate/field/polymorphic.rb
286
+ - lib/administrate/field/select.rb
283
287
  - lib/administrate/field/string.rb
284
288
  - lib/administrate/field/text.rb
285
289
  - lib/administrate/generator_helpers.rb
@@ -341,8 +345,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
345
  version: '0'
342
346
  requirements: []
343
347
  rubyforge_project:
344
- rubygems_version: 2.4.5.1
348
+ rubygems_version: 2.6.2
345
349
  signing_key:
346
350
  specification_version: 4
347
351
  summary: A Rails engine for creating super-flexible admin dashboards
348
352
  test_files: []
353
+ has_rdoc: