my_admin 0.1.4 → 0.1.5

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: fcd68a7e9716e15df35d850eaebfc2a12bdb9436
4
- data.tar.gz: 3c919a4febd16e6fefc8775518e88b34767514da
3
+ metadata.gz: 57c58e480841d6bc60fd59c6c1191771a98ac242
4
+ data.tar.gz: 4d0734b87d3409416f30f80b2d66d07fed4d5e39
5
5
  SHA512:
6
- metadata.gz: 466081411ceb304451bb2c3148049a79780b29b913474f6c1cf6833cf21539d9470b61a3947f54bafc65a77564d0256d26105c1c2c3c68ef7b9005add044f47d
7
- data.tar.gz: 05095bc9dd6926e559395ac8efd298e9af10a1ce9021c7630084073f332f0536cd9f28e93141e830360f748426f1053386a4c5d3bfdbee55d47ae40fbab1d9ae
6
+ metadata.gz: 7b4e5ebf6e599d6c535e7e00ddad32805a75b970492f8211861e0e107da109746854d597a65edb629054e2b733fd6758a8efd14a31fe0276316c8536ef764cdb
7
+ data.tar.gz: 3d8c93c93760e11833c8cbf222c28f73ebf144a723a56c0ecde5ffa9c572efeb26c6af7dc4568eec62a14b6b11fff9c5f8210c70596cf1c903d6601cc46876ea
@@ -23,6 +23,7 @@
23
23
  *= require my_admin/plugins/datepicker/datepicker
24
24
  *= require my_admin/plugins/timepicker/bootstrap-timepicker.min
25
25
  *= require my_admin/plugins/xeditable/bootstrap-editable
26
+ *= require my_admin/plugins/icheck/all
26
27
  *= require my_admin/style
27
28
  *= require my_admin/themes
28
29
  *= require my_admin/my_admin
@@ -25,6 +25,14 @@ module MyAdminFieldHelper
25
25
  collection ||= []
26
26
  collection
27
27
  end
28
+
29
+ def field_default_value(application, model, field, object)
30
+ block = field_setting(model, field, :default_value)
31
+ unless block.blank?
32
+ block = instance_exec object, &(block) if block.class == Proc
33
+ end
34
+ block
35
+ end
28
36
 
29
37
  def field_hint(application, model, field, type)
30
38
  content_tag(:code, I18n.t!("activerecord.hint.#{model.i18n}.#{field}.#{type}"), :class => "help-block") rescue ""
@@ -8,4 +8,4 @@
8
8
  collection_selected = params[model.underscore][field_name] if params[model.underscore].present? and params[model.underscore][field_name].present?
9
9
  #collection_selected = object.send(field.to_s.singularize).id unless object.send(field.to_s.singularize).blank?
10
10
  %>
11
- <%= select_tag "#{model.underscore}[#{field_name}]", options_for_select(collection, collection_selected) %>
11
+ <%= select_tag "#{model.underscore}[#{field_name}]", options_for_select(collection, collection_selected), { :class => "select2-me input-large" } %>
@@ -0,0 +1,18 @@
1
+ <%
2
+ field_name = "#{field.to_s.singularize}"
3
+
4
+ collection = field_collection(application, model, field, object)
5
+ default_value = field_default_value(application, model, field, object) || []
6
+
7
+ collection_selected = params[model.underscore][field_name].map { |i| i.to_i } if params[model.underscore].present? and params[model.underscore][field_name].present?
8
+
9
+ collection_selected ||= default_value
10
+
11
+ collection.each do |item| %>
12
+
13
+ <div class="check-line">
14
+ <%= check_box_tag "#{model.underscore}[#{field.to_s}][]", item.id, collection_selected.include?(item.id), id: "#{model.underscore}_#{field.to_s}_#{item.id}", class: "icheck-me", "data-skin" => "flat", "data-color" => "blue" %>
15
+ <%= label_tag "#{model.underscore}_#{field.to_s}_#{item.id}", item.to_s, class: "inline" %>
16
+ </div>
17
+
18
+ <% end %>
@@ -1,8 +1,11 @@
1
1
  <% field_name_from = "#{field}_from" %>
2
2
  <% field_name_to = "#{field}_to" %>
3
3
 
4
+ <% default_value = field_default_value(application, model, field, object) || [] %>
5
+
4
6
  <% val = nil %>
5
7
  <% val = params[model.underscore][field_name_from] if params[model.underscore].present? and params[model.underscore][field_name_from].present? %>
8
+ <% val ||= default_value.first %>
6
9
 
7
10
  <%= text_field_tag "#{model.underscore}[#{field_name_from}]", val, :class => "datepick" %>
8
11
  até
@@ -10,5 +13,6 @@ até
10
13
 
11
14
  <% val = nil %>
12
15
  <% val = params[model.underscore][field_name_to] if params[model.underscore].present? and params[model.underscore][field_name_to].present? %>
16
+ <% val ||= default_value.last %>
13
17
 
14
18
  <%= text_field_tag "#{model.underscore}[#{field_name_to}]", val, :class => "datepick" %>
@@ -0,0 +1,14 @@
1
+ <% field_name_from = "#{field}_from" %>
2
+ <% field_name_to = "#{field}_to" %>
3
+
4
+ <% val = nil %>
5
+ <% val = params[model.underscore][field_name_from] if params[model.underscore].present? and params[model.underscore][field_name_from].present? %>
6
+
7
+ <%= text_field_tag "#{model.underscore}[#{field_name_from}]", val, :class => "price_format" %>
8
+ até
9
+
10
+
11
+ <% val = nil %>
12
+ <% val = params[model.underscore][field_name_to] if params[model.underscore].present? and params[model.underscore][field_name_to].present? %>
13
+
14
+ <%= text_field_tag "#{model.underscore}[#{field_name_to}]", val, :class => "price_format" %>
@@ -3,7 +3,7 @@
3
3
  <div style="width:100%; margin:0; padding:30px 0; background:#f8f8f8;">
4
4
  <div style="width:560px; padding:40px; background:#fff; border-top:4px solid #0f6db3; box-shadow:1px 2px 2px 0 rgba(0,0,0,.1); margin:0 auto;">
5
5
  <div>
6
- <img src="<%=root_url%>images/logo.png" alt="My admin" style="float:left;">
6
+ <img src="/images/logo.png" alt="My admin" style="float:left;">
7
7
  <h2 style="float:right; font-family:'core_sans_m_45_regular'; font-weight:normal; font-size:27px; color:#0f6db3; margin:40px 0 15px;">
8
8
  Recuperar Senha
9
9
  </h2>
@@ -9,7 +9,7 @@ module MyAdmin
9
9
 
10
10
  def generate_install
11
11
  directory = File.expand_path('../templates', __FILE__)
12
- template "controllers/controller.rb", "app/controllers/my_admin/#{controller_name.downcase}_controller.rb"
12
+ template "controllers/controller.rb", "app/controllers/my_admin/#{model.tableize}_controller.rb"
13
13
 
14
14
  File.open("#{Rails.root}/config/initializers/my_admin.rb", "a+"){|f| f << "\nMyAdmin::Application.add([#{model.camelize}])" }
15
15
 
@@ -1,3 +1,3 @@
1
1
  module MyAdmin
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_admin
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
  - Marcos Vinicius von Gal dos Santos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-12 00:00:00.000000000 Z
11
+ date: 2016-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -881,12 +881,14 @@ files:
881
881
  - app/views/my_admin/fields/edit/type/time.html.erb
882
882
  - app/views/my_admin/fields/filter/type/belongs_to.html.erb
883
883
  - app/views/my_admin/fields/filter/type/boolean.html.erb
884
+ - app/views/my_admin/fields/filter/type/checkbox_list.html.erb
884
885
  - app/views/my_admin/fields/filter/type/date.html.erb
885
886
  - app/views/my_admin/fields/filter/type/date_between.html.erb
886
887
  - app/views/my_admin/fields/filter/type/datetime.html.erb
887
888
  - app/views/my_admin/fields/filter/type/default.html.erb
888
889
  - app/views/my_admin/fields/filter/type/default_struct.html.erb
889
890
  - app/views/my_admin/fields/filter/type/email.html.erb
891
+ - app/views/my_admin/fields/filter/type/float_between.html.erb
890
892
  - app/views/my_admin/fields/filter/type/integer_between.html.erb
891
893
  - app/views/my_admin/fields/filter/type/list.html.erb
892
894
  - app/views/my_admin/fields/filter/type/list_string.html.erb