adminpanel 1.2.12 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +3 -4
  3. data/Gemfile +22 -20
  4. data/README.md +12 -9
  5. data/adminpanel.gemspec +29 -28
  6. data/app/assets/fonts/.keep +0 -0
  7. data/app/assets/javascripts/adminpanel/images_form.js +5 -2
  8. data/app/assets/javascripts/adminpanel/imagesloaded.js +5 -2
  9. data/app/assets/javascripts/adminpanel/tables.js +6 -3
  10. data/app/assets/javascripts/application-admin.js +2 -1
  11. data/app/assets/stylesheets/adminpanel/{_clearfix.css.scss → _clearfix.css} +0 -0
  12. data/app/assets/stylesheets/adminpanel/bootstrap.css +2 -2
  13. data/app/assets/stylesheets/adminpanel/medium-editor.css.scss +1 -1
  14. data/app/assets/stylesheets/application-admin.css +2 -1
  15. data/app/controllers/adminpanel/application_controller.rb +28 -21
  16. data/app/controllers/adminpanel/categories_controller.rb +16 -5
  17. data/app/controllers/adminpanel/galleries_controller.rb +11 -5
  18. data/app/controllers/adminpanel/sections_controller.rb +14 -0
  19. data/app/controllers/adminpanel/users_controller.rb +10 -80
  20. data/app/controllers/concerns/adminpanel/galleryzable_actions.rb +33 -0
  21. data/app/controllers/concerns/adminpanel/rest_actions.rb +109 -0
  22. data/app/helpers/adminpanel/application_helper.rb +0 -1
  23. data/app/helpers/adminpanel/custom_form_builder.rb +12 -13
  24. data/app/helpers/adminpanel/router_helper.rb +11 -2
  25. data/app/helpers/adminpanel/shared_pages_helper.rb +0 -1
  26. data/app/models/adminpanel/analytic.rb +3 -2
  27. data/app/models/adminpanel/gallery.rb +8 -4
  28. data/app/models/adminpanel/group.rb +1 -1
  29. data/app/models/adminpanel/image.rb +1 -2
  30. data/app/models/adminpanel/section.rb +19 -10
  31. data/app/models/adminpanel/user.rb +11 -3
  32. data/app/models/concerns/adminpanel/base.rb +149 -0
  33. data/app/models/concerns/adminpanel/galleryzation.rb +66 -0
  34. data/app/models/contact.rb +16 -9
  35. data/app/views/adminpanel/analytics/index.html.erb +2 -1
  36. data/app/views/adminpanel/categories/_categories_table.html.erb +6 -7
  37. data/app/views/adminpanel/categories/_category_form.html.erb +2 -2
  38. data/app/views/adminpanel/categories/create.js.erb +2 -2
  39. data/app/views/adminpanel/categories/index.html.erb +1 -1
  40. data/app/views/adminpanel/galleries/_galleries_table.html.erb +7 -7
  41. data/app/views/adminpanel/galleries/index.html.erb +6 -5
  42. data/app/views/adminpanel/sections/_sections_table.html.erb +2 -2
  43. data/app/views/adminpanel/sections/edit.html.erb +5 -3
  44. data/app/views/adminpanel/sections/show.html.erb +3 -3
  45. data/app/views/adminpanel/sessions/new.html.erb +1 -1
  46. data/app/views/layouts/_side_menu.html.erb +2 -2
  47. data/app/views/layouts/_top_bar.html.erb +3 -3
  48. data/app/views/layouts/admin-login.html.erb +0 -1
  49. data/app/views/layouts/admin.html.erb +3 -3
  50. data/app/views/shared/_delete_icon_button.html.erb +16 -0
  51. data/app/views/shared/_edit_icon_button.html.erb +14 -0
  52. data/app/views/shared/_error_messages.html.erb +1 -1
  53. data/app/views/shared/_form_fields.html.erb +15 -13
  54. data/app/views/shared/_gallery_entries.html.erb +2 -2
  55. data/app/views/shared/_init_editor.html.erb +5 -2
  56. data/app/views/shared/_new_resource_button.html.erb +18 -0
  57. data/app/views/shared/_remote_form_fields.html.erb +1 -1
  58. data/app/views/shared/_show_icon_button.html.erb +14 -0
  59. data/app/views/shared/edit.html.erb +3 -3
  60. data/app/views/shared/index.html.erb +13 -48
  61. data/app/views/shared/new.html.erb +3 -3
  62. data/app/views/shared/show.html.erb +5 -5
  63. data/config/initializers/pluralization_es.rb +16 -0
  64. data/config/locales/en.yml +89 -0
  65. data/config/locales/es.yml +4 -4
  66. data/config/routes.rb +15 -16
  67. data/lib/adminpanel.rb +8 -8
  68. data/lib/adminpanel/version.rb +1 -1
  69. data/lib/generators/adminpanel/gallery/gallery_generator.rb +12 -8
  70. data/lib/generators/adminpanel/gallery/templates/gallery_template.rb +2 -3
  71. data/lib/generators/adminpanel/initialize/templates/category_template.rb +2 -3
  72. data/lib/generators/adminpanel/resource/resource_generator.rb +24 -18
  73. data/lib/generators/adminpanel/resource/templates/controller.rb +5 -0
  74. data/lib/generators/adminpanel/resource/templates/resource.rb +3 -3
  75. data/lib/tasks/adminpanel/adminpanel.rake +43 -90
  76. data/spec/dummy/app/controllers/adminpanel/mugs_controller.rb +9 -0
  77. data/spec/dummy/app/controllers/adminpanel/products_controller.rb +12 -0
  78. data/spec/dummy/app/models/ability.rb +1 -1
  79. data/spec/dummy/app/models/adminpanel/categorization.rb +1 -2
  80. data/spec/dummy/app/models/adminpanel/category.rb +18 -19
  81. data/spec/dummy/app/models/adminpanel/mug.rb +37 -0
  82. data/spec/dummy/app/models/adminpanel/photo.rb +3 -3
  83. data/spec/dummy/app/models/adminpanel/product.rb +2 -2
  84. data/spec/dummy/config/application.rb +2 -11
  85. data/spec/dummy/config/database.yml +0 -6
  86. data/spec/dummy/config/environments/development.rb +11 -23
  87. data/spec/dummy/config/environments/production.rb +40 -32
  88. data/spec/dummy/config/environments/test.rb +13 -18
  89. data/spec/dummy/config/initializers/adminpanel_setup.rb +2 -1
  90. data/spec/dummy/config/locales/.keep +0 -0
  91. data/spec/dummy/db/schema.rb +68 -2
  92. data/spec/features/authentication_pages_spec.rb +15 -15
  93. data/spec/features/galleries_pages_spec.rb +30 -22
  94. data/spec/features/section_pages_spec.rb +15 -18
  95. data/spec/features/shared_pages_spec.rb +97 -127
  96. data/spec/generators/gallery_generator_spec.rb +2 -3
  97. data/spec/generators/resource_generator_spec.rb +20 -3
  98. data/spec/models/gallery_spec.rb +2 -2
  99. data/spec/models/section_spec.rb +8 -15
  100. data/spec/models/user_spec.rb +23 -39
  101. data/spec/spec_helper.rb +9 -1
  102. data/spec/support/factories.rb +52 -0
  103. data/spec/support/helper_methods.rb +25 -5
  104. data/spec/tasks/adminpanel_rake_spec.rb +11 -10
  105. metadata +361 -353
  106. data/app/assets/fonts/FontAwesome.otf +0 -0
  107. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  108. data/app/assets/fonts/fontawesome-webfont.svg +0 -255
  109. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  110. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  111. data/app/assets/stylesheets/adminpanel/colorpicker.css +0 -7
  112. data/app/assets/stylesheets/adminpanel/elfinder.min.css +0 -59
  113. data/app/assets/stylesheets/adminpanel/font-awesome.min.css +0 -34
  114. data/app/helpers/adminpanel/pluralizations_helper.rb +0 -25
  115. data/app/helpers/adminpanel/rest_actions_helper.rb +0 -128
  116. data/app/views/adminpanel/galleries/delete.html.erb +0 -2
  117. data/app/views/adminpanel/galleries/edit.html.erb +0 -19
  118. data/app/views/adminpanel/galleries/new.html.erb +0 -18
  119. data/app/views/adminpanel/galleries/show.html.erb +0 -18
  120. data/app/views/adminpanel/galleries/update.html.erb +0 -2
  121. data/lib/adminpanel/active_record/adminpanel_extension.rb +0 -187
  122. data/spec/dummy/config/locales/en.yml +0 -5
  123. data/spec/support/define_factory_models.rb +0 -45
  124. data/spec/support/submit_forms_without_button.rb +0 -17
  125. data/spec/support/test_database.rb +0 -76
  126. data/spec/uploaders/gallery_uploader_spec.rb +0 -37
  127. data/spec/uploaders/image_uploader_spec.rb +0 -31
@@ -4,9 +4,9 @@
4
4
  <div class="row-fluid">
5
5
  <div class="widget widget-padding span12">
6
6
  <div class="widget-header">
7
- <i class="icon-tasks"></i>
7
+ <i class="fa fa-tasks"></i>
8
8
  <h5><%= @section.name.humanize %>&nbsp;
9
- <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), edit_section_path(@section), :title => "Editar Seccion" %>
9
+ <%= render 'shared/edit_icon_button', resource: @section, resource_name: @model.display_name %>
10
10
  </h5>
11
11
  </div>
12
12
  <div class="widget-body row-fluid">
@@ -28,4 +28,4 @@
28
28
  </div>
29
29
  </div>
30
30
  </div>
31
- </div>
31
+ </div>
@@ -2,7 +2,7 @@
2
2
  <% provide(:section, 'login') %>
3
3
  <div class="widget container-narrow">
4
4
  <div class="widget-header">
5
- <i class="icon-user"></i>
5
+ <i class="fa fa-user"></i>
6
6
  <h5><%= t("authentication.welcome") %></h5>
7
7
  </div>
8
8
  <div class="widget-body clearfix" style="padding:25px;">
@@ -22,8 +22,8 @@
22
22
  content_tag(
23
23
  :i,
24
24
  nil,
25
- :class => resource_class.icon) +
26
- content_tag(:span," #{pluralize_es(resource_class.display_name)}"),
25
+ class:"fa fa-#{resource_class.icon}"
26
+ ) + content_tag(:span," " + resource_class.display_name.pluralize(I18n.default_locale)),
27
27
  [route_symbol(resource.to_s)],
28
28
  :class => "accordion-toggle b_99FFCC
29
29
  #{is_current_section?(resource_class.display_name)}"
@@ -21,9 +21,9 @@
21
21
  <ul class="pull-right">
22
22
  <li>
23
23
  <% if signed_in? %>
24
- <%= link_to content_tag('i', nil, :class => 'icon-off') + ' Logout', signout_path, :method => "delete", :escape => true %>
24
+ <%= link_to content_tag('i', nil, :class => 'fa fa-power-off') + ' Logout', signout_path, :method => "delete", :escape => true %>
25
25
  <% else %>
26
- <%= link_to content_tag('i', nil, :class => 'icon-off') + ' Login', signin_path, :escape => true %>
26
+ <%= link_to content_tag('i', nil, :class => 'fa fa-power-off') + ' Login', signin_path, :escape => true %>
27
27
  <% end %>
28
28
  </li>
29
29
  </ul>
@@ -33,7 +33,7 @@
33
33
  <ul class="pull-right">
34
34
  <li>
35
35
  <% if signed_in? %>
36
- <%= link_to content_tag('i', nil, :class => 'icon-off'), signout_path, :method => "delete", :title => 'Logout', :id => "signout-button" %>
36
+ <%= link_to content_tag('i', nil, :class => 'fa fa-power-off'), signout_path, :method => "delete", :title => 'Logout', :id => "signout-button" %>
37
37
  <% end %>
38
38
  </li>
39
39
  </ul>
@@ -4,7 +4,6 @@
4
4
  <meta charset="utf-8">
5
5
  <title><%= full_title(yield(:page_title)) %></title>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <meta name="author" content="Bluth Company">
8
7
  <%= stylesheet_link_tag "application-admin", :media => "all" %>
9
8
  <%= javascript_include_tag "application-admin" %>
10
9
  <%= csrf_meta_tags %>
@@ -7,7 +7,7 @@
7
7
  <%= stylesheet_link_tag "application-admin", :media => "all" %>
8
8
  <%= javascript_include_tag "application-admin" %>
9
9
  <%= csrf_meta_tags %>
10
- <%= favicon_link_tag "adminpanel/favicon.ico" %>
10
+ <%= favicon_link_tag "adminpanel/favicon.ico" %>
11
11
  <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type="text/css">
12
12
 
13
13
  <%= render 'layouts/shim' %>
@@ -15,7 +15,7 @@
15
15
 
16
16
  <body>
17
17
  <div id="wrap">
18
- <%= render 'layouts/top_bar' %>
18
+ <%= render 'layouts/top_bar' %>
19
19
  <div class="container-fluid">
20
20
  <%= render 'layouts/side_menu' %>
21
21
  <!-- Main window -->
@@ -35,6 +35,6 @@
35
35
  <!--/.fluid-container-->
36
36
  </div>
37
37
  <!-- wrap ends-->
38
- <%= yield :scripts %>
39
38
  </body>
39
+ <%= yield :scripts %>
40
40
  </html>
@@ -0,0 +1,16 @@
1
+ <% if @model.has_route?(:destroy) %>
2
+ <%=
3
+ link_to(
4
+ content_tag(
5
+ :i,
6
+ nil,
7
+ class: 'fa fa-trash-o'
8
+ ),
9
+ [resource],
10
+ title: 'Eliminar',
11
+ id: 'resource-delete',
12
+ method: :delete,
13
+ data: { confirm: "Eliminar #{resource.name}?"}
14
+ )
15
+ %>
16
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if @model.has_route?(:edit) %>
2
+ <%=
3
+ link_to(
4
+ content_tag(
5
+ :i,
6
+ nil,
7
+ :class => 'fa fa-pencil'
8
+ ),
9
+ [:edit, resource],
10
+ :title => t("action.update") + " #{resource.name}",
11
+ data: { no_turbolink: true }
12
+ )
13
+ %>
14
+ <% end %>
@@ -6,7 +6,7 @@
6
6
  <% object.errors.messages.keys.each do |field| %>
7
7
  <% object.errors.messages[field].each do |value| %>
8
8
  <li>
9
- <%= @model.get_attribute_name(field.to_s) %>
9
+ <%= @model.get_attribute_label(field.to_s) %>
10
10
  <%= value %>
11
11
  </li>
12
12
  <% end %>
@@ -1,18 +1,20 @@
1
1
  <% @model.form_attributes.each do |entries| %>
2
2
  <% entries.each do |attribute, properties| %>
3
3
 
4
- <% if properties["type"] == "wysiwyg_field" %>
5
- <% type = properties["type"] %>
6
- <% args = properties.except("type") %>
7
- <%= f.hidden_field attribute, :id => "#{attribute}-field", :value => resource.send(attribute) %>
4
+ <% if properties['type'] == 'wysiwyg_field' %>
5
+ <% type = properties['type'] %>
6
+ <% args = properties.except('type') %>
7
+ <div style="display:none;">
8
+ <%= f.hidden_field attribute, :id => "#{attribute}-field", :value => resource.send(attribute) %>
9
+ </div>
8
10
  <%= f.send(type, attribute, args) %>
9
11
  <%= content_for :scripts do %>
10
12
  <script type="text/javascript">
11
- <%= render "shared/init_editor", :field_var => attribute, :label => properties[:label] %>
13
+ <%= render 'shared/init_editor', :field_var => attribute, :label => properties[:label] %>
12
14
  </script>
13
15
  <% end %>
14
16
 
15
- <% elsif properties["type"] == "adminpanel_file_field" %>
17
+ <% elsif properties['type'] == 'adminpanel_file_field' %>
16
18
  <% if !defined? remote_request %>
17
19
  <%= content_tag :div, :class => 'file-collection-container', :data => {:max => properties['max-files'].nil? ? 0 : properties['max-files'] } do %>
18
20
  <%= f.fields_for(attribute) do |builder| %>
@@ -22,16 +24,16 @@
22
24
  <% end %>
23
25
 
24
26
  <% end %>
25
- <% elsif properties["type"] == "belongs_to" %>
27
+ <% elsif properties['type'] == 'belongs_to' %>
26
28
  <% if !defined? remote_request %>
27
- <% args = properties.except("type", "name", "model") %>
29
+ <% args = properties.except('type', 'model') %>
28
30
  <% args.symbolize_keys! %>
29
31
  <%= f.select(attribute, (@collections["#{properties["model"]}"].collect{|resource| [resource.name, resource.id]}), args) %>
30
32
 
31
33
 
32
34
  <% if(properties['remote_resource'].nil? || properties['remote_resource']) %>
33
35
  <!-- Button to create a new of this belongs_to resource -->
34
- <% model_name = properties['model'].classify.constantize.model_name.demodulize.downcase %>
36
+ <% model_name = properties['model'].classify.constantize.model_name.to_s.demodulize.downcase %>
35
37
  <%=
36
38
  link_to(
37
39
  I18n.t('other.add',
@@ -58,7 +60,7 @@
58
60
  <% if !defined? remote_request %>
59
61
  <div class="control-group">
60
62
  <div class="control-label">
61
- <%= I18n.t('other.choose', :model => pluralize_es(properties['model'].classify.constantize.display_name)) %>
63
+ <%= I18n.t('other.choose', :model => properties['model'].classify.constantize.display_name.pluralize) %>
62
64
  </div>
63
65
  <%= hidden_field_tag("#{class_name_downcase(f.object)}[#{relationship_ids(properties["model"])}][]", nil) %>
64
66
  <div class="controls" id="<%= properties['model'].demodulize.downcase %>-relation">
@@ -70,7 +72,7 @@
70
72
 
71
73
  <% if properties['remote_resource'].nil? || propeties['remote_resource'] %>
72
74
  <!-- Button to create a new of this has_many resource -->
73
- <% model_name = properties['model'].classify.constantize.model_name.demodulize.downcase %>
75
+ <% model_name = properties['model'].classify.constantize.model_name.to_s.demodulize.downcase %>
74
76
  <%=
75
77
  link_to(
76
78
  I18n.t('other.add',
@@ -92,8 +94,8 @@
92
94
  <% end %>
93
95
 
94
96
  <% else %>
95
- <% type = properties["type"] %>
96
- <% args = properties.except("type", "name") %>
97
+ <% type = properties['type'] %>
98
+ <% args = properties.except('type', 'name') %>
97
99
  <%= f.send(type, attribute, args) %>
98
100
  <% end %>
99
101
 
@@ -3,8 +3,8 @@
3
3
  <%= link_to (image_tag image.file_url(:thumb)), image.file.to_s, :rel => "group", :name => @model.display_name %>
4
4
  <ul class="rightboxes">
5
5
  <li>
6
- <%= link_to content_tag(:i, nil, :class => "icon-chevron-up"), [:move_to_better, image], :method => :put, :remote => true %>
7
- <%= link_to content_tag(:i, nil, :class => "icon-chevron-down"), [:move_to_worst, image], :method => :put, :remote => true %>
6
+ <%= link_to content_tag(:i, nil, :class => "fa fa-chevron-up"), [:move_to_better, image], :method => :put, :remote => true %>
7
+ <%= link_to content_tag(:i, nil, :class => "fa fa-chevron-down"), [:move_to_worst, image], :method => :put, :remote => true %>
8
8
  </li>
9
9
  </ul>
10
10
  </li>
@@ -12,7 +12,7 @@ var elements = document.querySelectorAll('#<%= field_var %>'),
12
12
  ]
13
13
  });
14
14
 
15
- $(document).ready(function(){
15
+ var ready = function(){
16
16
  $("#<%= field_var %>").on("focusout", function(){
17
17
 
18
18
 
@@ -21,4 +21,7 @@ $(document).ready(function(){
21
21
  //$("#<%= field_var %>-field").value = <%= field_var %>.serialize()["editable"]["value"];
22
22
  document.getElementById("<%= field_var %>-field").value = <%= field_var %>.serialize()["<%= field_var %>"]["value"];
23
23
  });
24
- });
24
+ }
25
+
26
+ $(document).ready(ready);
27
+ $(document).on('page:load', ready);
@@ -0,0 +1,18 @@
1
+ <% @model.routes_options %>
2
+ <% if @model.has_route?(:new) %>
3
+ <%=
4
+ link_to(
5
+ content_tag(:div,
6
+ content_tag(:i, nil, :class => 'fa fa-plus-circle fa-2x') +
7
+ content_tag(:span, I18n.t("action.create") + " #{@model.display_name}"),
8
+ :class => 'btn btn-box span2'
9
+ ),
10
+ {
11
+ :controller => params[:controller],
12
+ :action => 'new'
13
+ },
14
+ data: { no_turbolink: true },
15
+ id: 'new-resource-button'
16
+ )
17
+ %>
18
+ <% end %>
@@ -7,6 +7,6 @@
7
7
  </div>
8
8
  <div class="modal-footer">
9
9
  <button id="modal-button" class="btn" data-dismiss="modal" aria-hidden="true"><%= I18n.t('action.close') %></button>
10
- <%= f.submit t("action.add") + " " + @model.display_name, :disable_with => t("action.submitting"), :id =>"new-resource-button" %>
10
+ <%= f.submit t("action.add") + " " + @model.display_name, data:{:disable_with => t("action.submitting")}, :id =>"new-resource-button" %>
11
11
  </div>
12
12
  <% end -%>
@@ -0,0 +1,14 @@
1
+ <% if @model.has_route?(:show) %>
2
+ <%=
3
+ link_to(
4
+ content_tag(
5
+ :i,
6
+ nil,
7
+ class: 'fa fa-search-plus'
8
+ ),
9
+ [resource],
10
+ title: t('action.show'),
11
+ id: 'show-resource-icon'
12
+ )
13
+ %>
14
+ <% end %>
@@ -1,6 +1,6 @@
1
1
  <% provide(:page_title,t("action.update") + " #{@model.display_name.capitalize}") -%>
2
2
  <% breadcrumb_add(
3
- @model.display_name.capitalize.pluralize,
3
+ @model.display_name.capitalize.pluralize(I18n.default_locale),
4
4
  {
5
5
  :controller => params[:controller],
6
6
  :action => "index"
@@ -10,7 +10,7 @@
10
10
  <div class="row-fluid">
11
11
  <div class = "widget widget-padding span12">
12
12
  <div class = "widget-header">
13
- <%= content_tag(:i, nil, :class => @model.icon) %>
13
+ <%= content_tag(:i, nil, class: "fa fa-#{@model.icon}") %>
14
14
  <h5><%= t("action.update") + " " + @model.display_name %></h5>
15
15
  </div>
16
16
  <div class = "widget-body">
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  </div>
23
23
  <div class = "widget-footer">
24
- <%= f.submit t("action.save") + " " + @model.display_name, :disable_with => t("action.submitting"), :id =>"new-resource-button" %>
24
+ <%= f.submit t("action.save") + " " + @model.display_name, data:{:disable_with => t("action.submitting")}, :id =>"new-resource-button" %>
25
25
  </div>
26
26
  <% end -%>
27
27
  </div>
@@ -1,23 +1,13 @@
1
- <% provide(:page_title, @model.display_name) -%>
1
+ <% provide(:page_title, @model.display_name.pluralize(I18n.default_locale)) -%>
2
2
  <div class="row-fluid">
3
- <%=
4
- link_to(
5
- content_tag(:div,
6
- content_tag(:i, nil, :class => 'icon-plus-sign icon-2x') + content_tag(:span, I18n.t("action.create") + " #{@model.display_name}", nil),
7
- :class => "btn btn-box span2"),
8
- {
9
- :controller => params[:controller],
10
- :action => "new"
11
- }
12
- )
13
- %>
3
+ <%= render 'shared/new_resource_button' %>
14
4
  </div>
15
5
  <div class="row-fluid">
16
6
  <div class="widget widget-padding span12">
17
7
  <div class="widget-header">
18
- <%= content_tag(:i, nil, :class => @model.icon) %>
8
+ <%= content_tag(:i, nil, class: "fa fa-#{@model.icon}") %>
19
9
  <h5>
20
- <%= pluralize_es(@model.display_name) %>
10
+ <%= @model.display_name.pluralize(I18n.default_locale) %>
21
11
  </h5>
22
12
  </div>
23
13
  <div class="widget-body">
@@ -27,12 +17,12 @@
27
17
  <tr>
28
18
  <% @model.display_attributes('index').each do |fields| %>
29
19
  <% fields.each do |attribute, properties| %>
30
- <% if properties["type"] != "adminpanel_file_field" && properties["type"] != "has_many" %>
31
- <th><%= properties["label"] %></th>
20
+ <% if properties['type'] != 'adminpanel_file_field' && properties['type'] != 'has_many' %>
21
+ <th><%= properties['label'] %></th>
32
22
  <% end %>
33
23
  <% end %>
34
24
  <% end %>
35
- <th><%= I18n.t("actions") %></th>
25
+ <th><%= I18n.t('actions') %></th>
36
26
  </tr>
37
27
  </thead><!-- Ends model attributes -->
38
28
  <tbody>
@@ -42,11 +32,11 @@
42
32
  <% fields.each do |attribute, properties| %>
43
33
  <% if properties["type"] == "wysiwyg_field" %>
44
34
  <td><%= member.send(attribute).html_safe -%></td>
45
- <% elsif properties["type"] == "belongs_to" %>
35
+ <% elsif properties['type'] == 'belongs_to' %>
46
36
  <td>
47
- <%= parent_object_name(member, properties["model"]) %>
37
+ <%= parent_object_name(member, properties['model']) %>
48
38
  </td>
49
- <% elsif properties["type"] == "boolean" %>
39
+ <% elsif properties['type'] == 'boolean' %>
50
40
  <td><%= member.send(attribute) ? I18n.t('action.is_true') : I18n.t('action.is_false') %></td>
51
41
  <% elsif properties["type"] != "adminpanel_file_field" && properties["type"] != "has_many" %>
52
42
  <td><%= member.send(attribute) -%></td>
@@ -54,36 +44,11 @@
54
44
  <% end %>
55
45
  <% end %>
56
46
  <td>
57
- <%=
58
- link_to(
59
- content_tag(:i, nil, :class => 'icon-zoom-in'),
60
- [member],
61
- :title => t("action.show")
62
- )
63
- %>
47
+ <%= render 'shared/show_icon_button', resource: member %>
64
48
 
65
- <%=
66
- link_to(
67
- content_tag(:i, nil, :class => 'icon-pencil'),
68
- [:edit, member],
69
- :title => t("action.update") + " #{@model.display_name}"
70
- )
71
- %>
49
+ <%= render 'shared/edit_icon_button', resource: member %>
72
50
 
73
- <%=
74
- link_to(
75
- content_tag(
76
- :i,
77
- nil,
78
- :class => 'icon-remove'
79
- ),
80
- [member],
81
- :title => I18n.t("action.delete"),
82
- :id => "resource-delete",
83
- :method => :delete,
84
- :data => { :confirm => "Eliminar #{@model.display_name}?" }
85
- )
86
- %>
51
+ <%= render 'shared/delete_icon_button', resource: member %>
87
52
  </td>
88
53
  </tr>
89
54
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <% provide(:page_title, t("action.create") + " #{@model.display_name.capitalize}") -%>
2
2
  <% breadcrumb_add(
3
- @model.display_name.capitalize.pluralize,
3
+ @model.display_name.capitalize.pluralize(I18n.default_locale),
4
4
  {
5
5
  :controller => params[:controller],
6
6
  :action => "index"
@@ -10,7 +10,7 @@
10
10
  <div class="row-fluid">
11
11
  <div class = "widget widget-padding span12">
12
12
  <div class = "widget-header">
13
- <%= content_tag(:i, nil, :class => @model.icon) %>
13
+ <%= content_tag(:i, nil, :class => "fa fa-#{@model.icon}") %>
14
14
  <h5><%= t("action.create") + " " + @model.display_name %></h5>
15
15
  </div>
16
16
  <div class = "widget-body">
@@ -29,7 +29,7 @@
29
29
  <div class = "widget-footer">
30
30
  <%=
31
31
  f.submit t("action.add") + " " + @model.display_name,
32
- :disable_with => t("action.submitting"),
32
+ data: {:disable_with => t("action.submitting")},
33
33
  :id =>"new-#{@model.name.demodulize}-button"
34
34
  %>
35
35
  </div>
@@ -1,6 +1,6 @@
1
1
  <% provide(:page_title, t("action.view") + " #{@model.display_name.capitalize}") -%>
2
2
  <% breadcrumb_add(
3
- @model.display_name.capitalize.pluralize,
3
+ @model.display_name.capitalize.pluralize(I18n.default_locale),
4
4
  {
5
5
  :controller => params[:controller],
6
6
  :action => "index"
@@ -10,9 +10,9 @@
10
10
  <div class="row-fluid">
11
11
  <div class="widget span6">
12
12
  <div class="widget-header">
13
- <%= content_tag(:i, nil, :class => @model.icon) %>
13
+ <%= content_tag(:i, nil, class: "fa fa-#{@model.icon}") %>
14
14
  <h5><%= @model.display_name.humanize %>
15
- <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), [:edit, resource], :title => t("action.update") + " #{@model.display_name}" %>
15
+ <%= render 'shared/edit_icon_button', resource: resource, resource_name: @model.display_name %>
16
16
  </h5>
17
17
  </div>
18
18
  <div class="widget-body">
@@ -59,10 +59,10 @@
59
59
  <div class="widget-header">
60
60
  <%= content_tag(:i, nil, :class => @model.icon) %>
61
61
  <h5><%= I18n.t("Gallery") %>: <%= @model.display_name.humanize %>
62
- <%= link_to content_tag(:i, nil, :class => 'icon-pencil'), [:edit, resource], :title => t("action.update") + " #{@model.display_name}" %>
62
+ <%= render 'shared/edit_icon_button', resource: resource, resource_name: @model.display_name %>
63
63
  </h5>
64
64
  </div>
65
- <% if @model.act_as_a_gallery?.nil? %>
65
+ <% if @model.gallery_children.nil? %>
66
66
  <div class="widget-body row-fluid">
67
67
  <div id="gallery-container" class="js-masonry"
68
68
  data-masonry-options='{ "columnWidth": 3, "itemSelector": ".gallery-item" }'>