action_admin 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8c1c4bce91ccdc0e91b160a64bb2d33c4813b5a
4
- data.tar.gz: b4a4abebea3d0b3db713543c4a80600849ffb163
3
+ metadata.gz: cfa12b281f6b7400703f1de253f6748bb55dd2d5
4
+ data.tar.gz: c334bd62b1f4c7ff4b2176542d17f77b606a6f4c
5
5
  SHA512:
6
- metadata.gz: a3d44fb6749ae4bc557f5d04d906427c5295073466633c6d8317bc67818d67d383943a57d66e4e4f7bd3e11a9340f3210a26bd4944538dad971cd7bbea73a55c
7
- data.tar.gz: 1ab6296221e9377178c6fbf56f18cece1af8a5c9dc908140b75e83cf06bdd50537ec1a838e36b9fb8d640b3db3b951125ef4e9fb2ebd79ec7ad5da7d2256b1d4
6
+ metadata.gz: 1cf489226899b73d86acde8e54469a7b5a980555a7b138f44162a665bec5b4a988958ad8885157b7fe91054f6f1c44fad3915718fd78607f4134638e26179700
7
+ data.tar.gz: 2febc76021ba622ac7b9818694f30825999257fd9a3c649a224bad0c1105a42d2bbfafe7266d9ced7acbd13e37e6f239be0f306a7f696686261574bee2855b4c
@@ -9,12 +9,20 @@ module ActionAdmin
9
9
  # Use forgery protection
10
10
  protect_from_forgery with: :exception
11
11
 
12
+ # Set locale
13
+ before_action :set_admin_locale
14
+
12
15
  # Render default view
13
16
  rescue_from ActionController::UnknownFormat, with: :render_default_view
14
17
  end
15
18
 
16
19
  private
17
20
 
21
+ # Set admin default locale
22
+ def set_admin_locale
23
+ I18n.locale = ActionAdmin.config.admin_locale || I18n.default_locale
24
+ end
25
+
18
26
  # Render default view template
19
27
  def render_default_view
20
28
  respond_to do |format|
@@ -46,5 +46,20 @@ module ActionAdmin
46
46
 
47
47
  render partial, options
48
48
  end
49
+
50
+ def admin_search?
51
+ params[:search].present?
52
+ end
53
+
54
+ def merge_params(original, keys, candidates)
55
+ original = Hash(original)
56
+ selected = candidates.select { |k, _v| Array(keys).include? :"#{k}" }
57
+
58
+ original.merge(selected)
59
+ end
60
+
61
+ def admin_search_url
62
+ url_for merge_params({}, [:per_page, :filter, :sort], params.permit(:per_page, filter: {}, sort: {}).to_h)
63
+ end
49
64
  end
50
65
  end
@@ -9,39 +9,39 @@ ruby:
9
9
  thumbnail_width: "300"
10
10
  }
11
11
 
12
- #media-modal.reveal.full.reveal-panel data-media-reveal="" data-media-url=admin_media_url(per_page: 10000, format: :json)
12
+ #media-modal.reveal.full.reveal-panel.media-reveal data-media-reveal="" data-media-url=admin_media_url(per_page: 10000, format: :json)
13
13
  .panel
14
14
  .panel-header.border
15
15
  = 'Add Media'
16
16
  button.close-button aria-label='Close modal' data-close="" type="button"
17
17
  span aria-hidden="true" ×
18
18
 
19
- .panel-header.border.padding-0
20
- ul#media-modal-tabs.tabs.padding-0.border-none data-tabs=""
21
- li.tabs-title.is-active
22
- a aria-selected="true" href="#media-modal-library"
23
- i.mdi.mdi-play-circle-outline
24
- | Library
25
- li.tabs-title
26
- a href="#media-modal-uploads"
27
- i.mdi.mdi-upload
28
- | Upload
29
-
30
19
  .panel-content.border.padding-0
31
- .tabs-content.border-none.padding-0 data-tabs-content="media-modal-tabs"
32
- #media-modal-library.tabs-panel.is-active
33
- .attachments-grid data-list-select=""
34
- #media-modal-uploads.tabs-panel
35
- = admin_form_for([:admin, current_record], html: { id: 'media-modal-upload', class: 'dropzone', data: options }) do |f|
36
- = f.input :file, as: :hidden
37
-
38
- .dz-message.bordered.margin-bottom-1
39
- .no-content
40
- i.mdi.mdi-upload
41
- span = 'Drop files here to upload'
42
- a#media-modal-upload-button.button.success.hollow.margin-top-1 = 'Select Files'
43
-
44
- #media-modal-upload-previews.attachments-grid
20
+ .media-columns
21
+ .media-menu
22
+ ul#media-modal-tabs.tabs.menu.vertical.icons.icon-left data-tabs=""
23
+ li.tabs-title.is-active
24
+ a aria-selected="true" href="#media-modal-library"
25
+ = admin_icon 'play-circle-outline', text: 'Library'
26
+ li.tabs-title
27
+ a href="#media-modal-uploads"
28
+ = admin_icon 'upload', text: 'Upload'
29
+
30
+ .media-content
31
+ .tabs-content.border-none.padding-0 data-tabs-content="media-modal-tabs"
32
+ #media-modal-library.tabs-panel.is-active
33
+ .attachments-grid data-list-select=""
34
+ #media-modal-uploads.tabs-panel
35
+ = admin_form_for([:admin, current_record], html: { id: 'media-modal-upload', class: 'dropzone', data: options }) do |f|
36
+ = f.input :file, as: :hidden
37
+
38
+ .dz-message.bordered.margin-bottom-1
39
+ .no-content
40
+ i.mdi.mdi-upload
41
+ span = 'Drop files here to upload'
42
+ a#media-modal-upload-button.button.success.hollow.margin-top-1 = 'Select Files'
43
+
44
+ #media-modal-upload-previews.attachments-grid
45
45
 
46
46
  .panel-footer
47
47
  .grid-x
@@ -1 +1 @@
1
- .callout.warning = 'No results found'
1
+ .callout.warning.margin-0 = 'No results found'
@@ -1,24 +1,13 @@
1
- - if current_records.empty?
2
- = render 'admin/common/noresults'
3
-
4
- - else
5
- .panel
6
- .panel-header
7
- = action_name.titleize
8
-
9
- .panel-content.padding-0.border-none
10
- table.unstriped.margin-0
11
- thead
12
- tr
13
- = admin_present(current_model).render_table_header(:index)
14
- th.shrink.actions.text-right = 'Actions'
15
-
16
- tbody
17
- - admin_present_many(current_records).each do |record|
18
- tr
19
- = record.render_table_columns(:index)
20
- = record.action_links(:td, class: 'shrink actions')
21
-
22
- - if current_records.respond_to? :current_page
23
- .panel-footer
24
- = admin_table_pagination current_records
1
+ .panel
2
+ .panel-header
3
+ = render 'admin/records/table/header'
4
+
5
+ .panel-content.padding-0.border-none
6
+ - if current_records.empty?
7
+ = render 'admin/common/noresults'
8
+ - else
9
+ = render 'admin/records/table/body'
10
+
11
+ - if current_records.respond_to? :current_page
12
+ .panel-footer
13
+ = render 'admin/records/table/footer'
@@ -0,0 +1,11 @@
1
+ table.unstriped.margin-0
2
+ thead
3
+ tr
4
+ = admin_present(current_model).render_table_header(:index)
5
+ th.shrink.actions.text-right = 'Actions'
6
+
7
+ tbody
8
+ - admin_present_many(current_records).each do |record|
9
+ tr
10
+ = record.render_table_columns(:index)
11
+ = record.action_links(:td, class: 'shrink actions')
@@ -0,0 +1 @@
1
+ = admin_table_pagination current_records
@@ -0,0 +1,16 @@
1
+ .grid-x
2
+ .cell.shrink
3
+ form action=request.path method="get"
4
+ .input-group.margin-0
5
+ input.input-group-field.small type="text" name="per_page" size="2" value=@pagination_params[:per_page]
6
+ .input-group-button
7
+ button.button.default.small type="submit" = 'Per Page'
8
+ .cell.auto.text-right
9
+ = form_for :search, method: :get, url: admin_search_url, html: { class: 'search-form display-inline-block' } do |f|
10
+ - if params[:per_page]
11
+ input type="hidden" name="per_page" value=params[:per_page]
12
+
13
+ .input-group.margin-0
14
+ = f.text_field :s, class: 'input-group-field small', placeholder: 'Search...', name: :search, value: params[:search]
15
+ .input-group-button
16
+ button.button.default.small type="submit" = admin_icon 'magnify'
@@ -1,6 +1,6 @@
1
1
  SimpleAttribute.setup do |config|
2
2
  config.avatar = { html: { class: 'rounded bordered' } }
3
- config.image = { html: { class: 'thumbnail' }, default_value: 'upload-preview.svg' }
3
+ config.image = { html: { class: 'thumbnail' }, default_value: 'admin/upload-preview.svg' }
4
4
  config.boolean = { true: 'success', false: 'alert', wrapper: { class: 'label' } }
5
5
  config.wrappers = { badge: { class: 'badge' } }
6
6
 
@@ -1,8 +1,9 @@
1
1
  module ActionAdmin
2
2
  class Config < Hashie::Dash
3
- property :app_name, default: 'Action Admin'
4
- property :app_urls, default: :web_url
5
- property :menus, default: Hashie::Mash.new
3
+ property :app_name, default: 'Action Admin'
4
+ property :app_urls, default: :web_url
5
+ property :admin_locale, default: :en
6
+ property :menus, default: Hashie::Mash.new
6
7
 
7
8
  def menu(name, &block)
8
9
  if self.menus.send(:"#{name}").nil?
@@ -1,3 +1,3 @@
1
1
  module ActionAdmin
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonian Guveli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -237,6 +237,9 @@ files:
237
237
  - app/views/admin/records/index.html.slim
238
238
  - app/views/admin/records/new.html.slim
239
239
  - app/views/admin/records/show.html.slim
240
+ - app/views/admin/records/table/_body.html.slim
241
+ - app/views/admin/records/table/_footer.html.slim
242
+ - app/views/admin/records/table/_header.html.slim
240
243
  - app/views/admin/templates/_settings.html.slim
241
244
  - app/views/admin/templates/_upload.html.slim
242
245
  - app/views/layouts/admin.html.slim