administrate 0.2.0 → 0.2.1

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: 7e185c08ce88b4be68e64691e196c5149cc8a0ba
4
- data.tar.gz: 531f557b4fdb2adb9122b09c31438c287e437650
3
+ metadata.gz: 6dcf61ca72126a4432eda744d07b390e1ec3b2da
4
+ data.tar.gz: 781a34ee9c1fad4f418908f34c2340f142f54b0e
5
5
  SHA512:
6
- metadata.gz: 416352158e2a8269cf65f0b32faca4987af32343e99c0d1a4c94dc1f37a7b261fbafed307205db8434741dc67e1b58adb2325c939de184afc3be3b79e84b7d40
7
- data.tar.gz: ba0a699adfec38e79306fe8288e8655b1abbb0513f08f2c35008ece9c188d35fde6db73b53102127f28a2409c2fb551a7517cad6a114ca4a47e4c35993b75ff5
6
+ metadata.gz: 02e412ab411212d0c9a39cb54cac74f1c594c29c2076ed253d59b438af9f64f5d44a642e31db6108db3b3a685fd0ec726dbf28190687154861958726a037e200
7
+ data.tar.gz: 82e28834016669c8f48eca8e9028384abf6d4098e8f14f331654f1bbc7d425fd32e19f08afe7b677908b2021a9a0cce6bcce63cd6735903f35accd7fbc25e1b4
@@ -109,6 +109,7 @@ module Administrate
109
109
 
110
110
  delegate :resource_class, :resource_name, :namespace, to: :resource_resolver
111
111
  helper_method :namespace
112
+ helper_method :resource_name
112
113
 
113
114
  def resource_resolver
114
115
  @_resource_resolver ||=
@@ -22,13 +22,17 @@ to display a collection of resources in an HTML table.
22
22
  <thead>
23
23
  <tr>
24
24
  <% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
25
- <th class="cell-label cell-label--<%= attr_type.html_class %>
26
- cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
25
+ <th class="cell-label
26
+ cell-label--<%= attr_type.html_class %>
27
+ cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
27
28
  " scope="col">
28
29
  <%= link_to(params.merge(
29
30
  collection_presenter.order_params_for(attr_name)
30
31
  )) do %>
31
- <%= attr_name.to_s.titleize %>
32
+ <%= t(
33
+ "helpers.label.#{resource_name}.#{attr_name}",
34
+ default: attr_name.to_s,
35
+ ).titleize %>
32
36
 
33
37
  <% if collection_presenter.ordered_by?(attr_name) %>
34
38
  <span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
@@ -7,7 +7,9 @@ but each page can define additional JS sources
7
7
  by providing a `content_for(:javascript)` block.
8
8
  %>
9
9
 
10
- <%= javascript_include_tag "administrate/application" %>
10
+ <% Administrate::Engine.javascripts.each do |js_path| %>
11
+ <%= javascript_include_tag js_path %>
12
+ <% end %>
11
13
 
12
14
  <%= yield :javascript %>
13
15
 
@@ -0,0 +1,14 @@
1
+ <%#
2
+ # Stylesheet Partial
3
+
4
+ This partial imports the necessary stylesheets on each page.
5
+ By default, it includes the application CSS,
6
+ but each page can define additional CSS sources
7
+ by providing a `content_for(:stylesheet)` block.
8
+ %>
9
+
10
+ <% Administrate::Engine.stylesheets.each do |css_path| %>
11
+ <%= stylesheet_link_tag css_path %>
12
+ <% end %>
13
+
14
+ <%= yield :stylesheet %>
@@ -31,7 +31,12 @@ as well as a link to its edit page.
31
31
 
32
32
  <dl>
33
33
  <% page.attributes.each do |attribute| %>
34
- <dt class="attribute-label"><%= attribute.name.titleize %></dt>
34
+ <dt class="attribute-label">
35
+ <%= t(
36
+ "helpers.label.#{resource_name}.#{attribute.name}",
37
+ default: attribute.name.titleize,
38
+ ) %>
39
+ </dt>
35
40
 
36
41
  <dd class="attribute-data attribute-data--<%=attribute.html_class%>"
37
42
  ><%= render_field attribute %></dd>
@@ -17,5 +17,5 @@ as a localized date & time string.
17
17
  %>
18
18
 
19
19
  <% if field.data %>
20
- <%= l field.data %>
20
+ <%= l(field.data, default: field.data) %>
21
21
  <% end %>
@@ -36,5 +36,5 @@ from the associated resource class's dashboard.
36
36
  <% end %>
37
37
 
38
38
  <% else %>
39
- <%= t("administrate.fields.has_many.none") %>
39
+ <%= t("administrate.fields.has_many.none", default: "–") %>
40
40
  <% end %>
@@ -19,7 +19,7 @@ By default, it renders:
19
19
  <meta name="ROBOTS" content="NOODP" />
20
20
  <meta name="viewport" content="initial-scale=1" />
21
21
  <title><%= content_for(:title) %> | <%= Rails.application.class.parent_name.titlecase %></title>
22
- <%= stylesheet_link_tag "administrate/application", media: "all" %>
22
+ <%= render "stylesheet" %>
23
23
  <%= csrf_meta_tags %>
24
24
  </head>
25
25
 
@@ -20,6 +20,28 @@ module Administrate
20
20
  class Engine < ::Rails::Engine
21
21
  isolate_namespace Administrate
22
22
 
23
+ @@javascripts = []
24
+ @@stylesheets = []
25
+
23
26
  Engine.config.assets.precompile << /\.(?:svg)\z/
27
+
28
+ def self.add_javascript(script)
29
+ @@javascripts << script
30
+ end
31
+
32
+ def self.add_stylesheet(stylesheet)
33
+ @@stylesheets << stylesheet
34
+ end
35
+
36
+ def self.stylesheets
37
+ @@stylesheets
38
+ end
39
+
40
+ def self.javascripts
41
+ @@javascripts
42
+ end
43
+
44
+ add_javascript "administrate/application"
45
+ add_stylesheet "administrate/application"
24
46
  end
25
47
  end
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
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.0
4
+ version: 0.2.1
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-04-21 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoprefixer-rails
@@ -208,6 +208,7 @@ files:
208
208
  - app/views/administrate/application/_form.html.erb
209
209
  - app/views/administrate/application/_javascript.html.erb
210
210
  - app/views/administrate/application/_sidebar.html.erb
211
+ - app/views/administrate/application/_stylesheet.html.erb
211
212
  - app/views/administrate/application/edit.html.erb
212
213
  - app/views/administrate/application/index.html.erb
213
214
  - app/views/administrate/application/new.html.erb
@@ -346,3 +347,4 @@ signing_key:
346
347
  specification_version: 4
347
348
  summary: A Rails engine for creating super-flexible admin dashboards
348
349
  test_files: []
350
+ has_rdoc: