adminpanel 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/adminpanel/shortcuts.js.coffee +5 -0
- data/app/controllers/adminpanel/application_controller.rb +1 -1
- data/app/controllers/adminpanel/sections_controller.rb +0 -13
- data/app/controllers/concerns/adminpanel/rest_actions.rb +1 -1
- data/app/models/adminpanel/permission.rb +1 -1
- data/app/models/adminpanel/section.rb +4 -0
- data/app/views/adminpanel/categories/new.js.erb +3 -0
- data/app/views/adminpanel/icons/_edit.html.erb +1 -1
- data/app/views/adminpanel/icons/_new.html.erb +17 -0
- data/app/views/adminpanel/sections/edit.html.erb +21 -23
- data/app/views/adminpanel/sections/index.html.erb +4 -11
- data/app/views/adminpanel/shared/_new_resource_button.html.erb +1 -1
- data/app/views/adminpanel/shared/new.js.erb +3 -0
- data/app/views/adminpanel/shared/show.html.erb +7 -4
- data/config/locales/en.yml +1 -0
- data/config/routes.rb +0 -5
- data/lib/adminpanel.rb +1 -0
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/contact/contact_generator.rb +17 -4
- data/lib/generators/adminpanel/contact/templates/contact_template.rb +14 -5
- data/lib/generators/adminpanel/dump/dump_generator.rb +6 -2
- data/lib/generators/adminpanel/gallery/templates/uploader.rb +57 -51
- data/lib/generators/adminpanel/initialize/initialize_generator.rb +22 -22
- data/test/dummy/app/models/adminpanel/mug.rb +4 -0
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/features/shared/resource/show_test.rb +1 -0
- data/test/features/shared/ui/collection_name_test.rb +19 -0
- data/test/generators/contact_generator_test.rb +32 -3
- data/test/models/adminpanel/{gallery_test.rb → galleryzable_test.rb} +1 -1
- metadata +8 -7
- data/app/assets/images/adminpanel/odinn.jpg +0 -0
- data/app/assets/images/adminpanel/rails.png +0 -0
- data/app/views/adminpanel/sections/show.html.erb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba3d85c9a8f1cac45611472dac7b5aecc8194696
|
4
|
+
data.tar.gz: e605db29c0d0995d3500fdae6d02b1d0d21ef866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffbddd0d680fb5e46461cffd90b0814bc4e3646a1770b703a1f2342b1fdb4c3dbfed53f7b139892e8590f113ddac3327e5c9229da3e821723e25942078da0347
|
7
|
+
data.tar.gz: 3590b94f5be307f4b7148b537ca596c0303ec09bb1a4250ca45aee7be42905058b40dba62670d8fea6161678fc8be34418cd6c4a064c4b6eda8513485d0cdd32
|
@@ -4,17 +4,8 @@ module Adminpanel
|
|
4
4
|
@sections = Section.all
|
5
5
|
end
|
6
6
|
|
7
|
-
# def new
|
8
|
-
# @section = Section.new
|
9
|
-
# authorize! :create, @section
|
10
|
-
# end
|
11
|
-
|
12
7
|
def edit
|
13
8
|
@section = Section.find(params[:id])
|
14
|
-
# respond_to do |format|
|
15
|
-
# format.html
|
16
|
-
# format.json {render :json => {:section => @section }}
|
17
|
-
# end
|
18
9
|
end
|
19
10
|
|
20
11
|
def update
|
@@ -27,10 +18,6 @@ module Adminpanel
|
|
27
18
|
end
|
28
19
|
end
|
29
20
|
|
30
|
-
def show
|
31
|
-
@section = Section.find(params[:id])
|
32
|
-
end
|
33
|
-
|
34
21
|
private
|
35
22
|
def section_params
|
36
23
|
params.require(:section).permit(
|
@@ -23,7 +23,7 @@ module Adminpanel
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def show
|
26
|
-
render 'adminpanel/shared/show' if stale?(
|
26
|
+
render 'adminpanel/shared/show' if stale?(@resource_instance, public: true)
|
27
27
|
end
|
28
28
|
|
29
29
|
def new
|
@@ -19,7 +19,7 @@ module Adminpanel
|
|
19
19
|
validates_presence_of :resource
|
20
20
|
|
21
21
|
def name
|
22
|
-
"#{I18n.t("#{self.class.name.demodulize.downcase}.#{self.action}")} #{symbol_class(self['resource']).display_name}"
|
22
|
+
"#{self.role.name}: #{I18n.t("#{self.class.name.demodulize.downcase}.#{self.action}")} #{symbol_class(self['resource']).display_name}"
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.form_attributes
|
@@ -1,2 +1,5 @@
|
|
1
1
|
$("#modal-title").html('Agregar <%= @model.display_name %>');
|
2
2
|
$("#modal-container").html('<%= escape_javascript(render "category_form", :resource => @resource_instance) %>');
|
3
|
+
setTimeout(function() {
|
4
|
+
$("#remote-form-modal input[type='text']:first").focus();
|
5
|
+
}, 500);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if @model.has_route?(:new) && can?(:create, @model) %>
|
2
|
+
<%=
|
3
|
+
link_to(
|
4
|
+
content_tag(
|
5
|
+
:i,
|
6
|
+
nil,
|
7
|
+
class: 'fa fa-plus'
|
8
|
+
),
|
9
|
+
{
|
10
|
+
controller: params[:controller],
|
11
|
+
action: :new
|
12
|
+
},
|
13
|
+
title: I18n.t('action.create', resource: @model.display_name),
|
14
|
+
class: 'spinner-link'
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
<% end %>
|
@@ -8,35 +8,33 @@
|
|
8
8
|
<h5><%= @section.name %></h5>
|
9
9
|
</div>
|
10
10
|
<%= adminpanel_form_for @section do |f| %>
|
11
|
-
|
12
|
-
|
13
|
-
<%= render 'adminpanel/shared/error_messages', :object => @section %>
|
11
|
+
<%= f.body do %>
|
12
|
+
<%= render 'adminpanel/shared/error_messages', :object => @section %>
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
<% if @section.has_description %>
|
15
|
+
<%= f.wysiwyg_field 'description', 'label' => I18n.t('section.description') %>
|
16
|
+
<% else %>
|
17
|
+
<%= f.text_field 'description', 'label' => t("section.description") %>
|
18
|
+
<% end %>
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
<% if @section.has_image %>
|
21
|
+
<%= content_tag :div, class: 'file-collection-container', data: { max: @section.max_files } do %>
|
22
|
+
<%= f.fields_for :sectionfiles do |builder| %>
|
23
|
+
<%= render 'adminpanel/shared/image_fields', f: builder %>
|
24
|
+
<% end -%>
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
<% end %>
|
32
|
-
<%= link_to_add_fields 'Agregar Imagen', f, :sectionfiles, visibility %>
|
26
|
+
<% if @section.max_files != 0 && @section.max_files <= @section.sectionfiles.count %>
|
27
|
+
<% visibility = 'hidden' %>
|
28
|
+
<% else %>
|
29
|
+
<% visibility = 'not-hidden' %>
|
33
30
|
<% end %>
|
31
|
+
<%= link_to_add_fields 'Agregar Imagen', f, :sectionfiles, visibility %>
|
34
32
|
<% end %>
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<%= f.footer do %>
|
38
36
|
<%= f.submit t('action.save', resource: @section.name), data: {:disable_with => t("action.submitting")}, :id => "save-button" %>
|
39
|
-
|
37
|
+
<% end %>
|
40
38
|
<% end -%>
|
41
39
|
</div>
|
42
40
|
</div>
|
@@ -7,12 +7,9 @@
|
|
7
7
|
<% current_page = "no-page" %>
|
8
8
|
<% @sections.each_with_index do |section, index| %>
|
9
9
|
<% if current_page != section.page %>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<li>
|
14
|
-
<% end %>
|
15
|
-
<%= link_to (section.page.capitalize), "#tab#{index}", "data-toggle" => "tab" %></li>
|
10
|
+
<li class="<%= active_tab(index) %>">
|
11
|
+
<%= link_to (section.page.capitalize), "#tab#{index}", "data-toggle" => "tab" %>
|
12
|
+
</li>
|
16
13
|
<% current_page = section.page %>
|
17
14
|
<% end %>
|
18
15
|
<% end %>
|
@@ -24,11 +21,7 @@
|
|
24
21
|
<% current_page = "no-page" %>
|
25
22
|
<% @sections.each_with_index do |section, index| %>
|
26
23
|
<% if current_page != section.page %>
|
27
|
-
|
28
|
-
<div class="tab-pane active" id="tab<%= index %>">
|
29
|
-
<% else %>
|
30
|
-
<div class="tab-pane" id="tab<%= index %>">
|
31
|
-
<% end %>
|
24
|
+
<div class="tab-pane <%= active_tab(index) %>" id="tab<%= index %>">
|
32
25
|
<% section_pages = Adminpanel::Section.of_page section.page %>
|
33
26
|
<%= render "sections_table", :sections => section_pages %>
|
34
27
|
</div>
|
@@ -1,2 +1,5 @@
|
|
1
1
|
$("#modal-title").html('Agregar <%= @model.display_name %>');
|
2
2
|
$("#modal-container").html('<%= escape_javascript(render "adminpanel/shared/remote_form_fields", resource: @resource_instance) %>');
|
3
|
+
setTimeout(function() {
|
4
|
+
$("#remote-form-modal input[type='text']:first").focus();
|
5
|
+
}, 500);
|
@@ -13,13 +13,16 @@
|
|
13
13
|
<%= content_tag(:i, nil, class: "fa fa-#{@model.icon}") %>
|
14
14
|
<h5>
|
15
15
|
<%= @model.display_name.humanize %>
|
16
|
+
</h5>
|
17
|
+
<div class="widget-buttons">
|
18
|
+
<%= render 'adminpanel/icons/new' %>
|
16
19
|
|
17
|
-
<%= render 'adminpanel/icons/edit',
|
20
|
+
<%= render 'adminpanel/icons/edit', resource: @resource_instance %>
|
18
21
|
|
19
|
-
<%= render 'adminpanel/icons/facebook',
|
22
|
+
<%= render 'adminpanel/icons/facebook', resource: @resource_instance %>
|
20
23
|
|
21
|
-
<%= render 'adminpanel/icons/twitter',
|
22
|
-
</
|
24
|
+
<%= render 'adminpanel/icons/twitter', resource: @resource_instance %>
|
25
|
+
</div>
|
23
26
|
</div>
|
24
27
|
<div class="widget-body">
|
25
28
|
<div class="widget-tickets widget-tickets-large clearfix">
|
data/config/locales/en.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -4,11 +4,6 @@ Adminpanel::Engine.routes.draw do
|
|
4
4
|
|
5
5
|
Adminpanel.displayable_resources.each do |resource|
|
6
6
|
case resource
|
7
|
-
when :sections
|
8
|
-
# sections cannot be created or destroyed
|
9
|
-
resources :sections, resources_parameters(resource).merge(
|
10
|
-
{ except: [:new, :create, :destroy] }.merge(rest_path_names)
|
11
|
-
)
|
12
7
|
when :analytics
|
13
8
|
resources :analytics, resources_parameters(resource).merge({ only: [:index] }) do
|
14
9
|
collection do
|
data/lib/adminpanel.rb
CHANGED
data/lib/adminpanel/version.rb
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
require 'rails/generators/active_record'
|
2
2
|
module Adminpanel
|
3
3
|
class ContactGenerator < ActiveRecord::Generators::Base
|
4
|
-
desc
|
5
|
-
source_root File.expand_path(
|
6
|
-
argument :name, :
|
4
|
+
desc 'Generate the contact template to use with a mail form'
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :name, type: :string, default: '', required: false
|
7
|
+
argument :fields, type: :array, default: [], required: false
|
7
8
|
|
8
9
|
def copy_contact
|
9
|
-
|
10
|
+
fields = extract_fields
|
11
|
+
template 'contact_template.rb', 'app/models/contact.rb'
|
10
12
|
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def extract_fields
|
16
|
+
if fields.empty? && name == '' # no fields supplied
|
17
|
+
fields << 'email'
|
18
|
+
fields << 'body'
|
19
|
+
elsif name != '' # at least 1 field supplied
|
20
|
+
fields << name
|
21
|
+
end
|
22
|
+
return fields
|
23
|
+
end
|
11
24
|
end
|
12
25
|
end
|
@@ -3,12 +3,21 @@ class Contact
|
|
3
3
|
include ActiveModel::Conversion
|
4
4
|
extend ActiveModel::Naming
|
5
5
|
|
6
|
-
attr_accessor
|
6
|
+
attr_accessor <%= fields.map{|e| ":#{e}" }.join(', ') -%>
|
7
7
|
|
8
|
-
|
8
|
+
<%- if fields.include?('email') -%>
|
9
|
+
# validations for email
|
9
10
|
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
10
|
-
validates_format_of :email, :
|
11
|
-
validates_presence_of :
|
11
|
+
validates_format_of :email, with: VALID_EMAIL_REGEX, message: "#{I18n.t('model.attributes.email')} #{I18n.t('activerecord.errors.messages.invalid')}"
|
12
|
+
validates_presence_of :email, message: "#{I18n.t('model.attributes.email')} #{I18n.t('activerecord.errors.messages.blank')}"
|
13
|
+
<%- fields.delete('email') -%>
|
14
|
+
<%- end -%>
|
15
|
+
|
16
|
+
<%- fields.each do |field| -%>
|
17
|
+
# validations for <%= field %>
|
18
|
+
validates_presence_of :<%= field -%>, message: "#{I18n.t('model.attributes.<%= field -%>')} #{I18n.t('activerecord.errors.messages.blank')}"
|
19
|
+
|
20
|
+
<%- end -%>
|
12
21
|
|
13
22
|
def initialize(attributes = {})
|
14
23
|
attributes.each do |name, value|
|
@@ -17,7 +26,7 @@ class Contact
|
|
17
26
|
end
|
18
27
|
|
19
28
|
def self.display_name
|
20
|
-
'
|
29
|
+
'Mail'
|
21
30
|
end
|
22
31
|
|
23
32
|
def self.get_attribute_label(label)
|
@@ -17,7 +17,7 @@ module Adminpanel
|
|
17
17
|
puts "dumping #{resource.display_name.pluralize(I18n.default_locale)} into db/#{file_name}"
|
18
18
|
|
19
19
|
create_file "db/#{file_name}" do
|
20
|
-
resource.all.to_a.to_json
|
20
|
+
resource.all.to_a.map{|o| o.attributes}.to_json
|
21
21
|
end
|
22
22
|
inject_into_seeds(resource, file_name)
|
23
23
|
end
|
@@ -28,7 +28,11 @@ module Adminpanel
|
|
28
28
|
append_to_file 'db/seeds.rb' do
|
29
29
|
"\nobjects = JSON.parse(open(\"\#{Rails.root}/db/#{file_name}\").read)\n" +
|
30
30
|
"objects.each do |element|\n" +
|
31
|
-
indent("#{resource}.
|
31
|
+
indent("object = #{resource}.new\n", 2) +
|
32
|
+
indent("element.each do |k,v|\n", 2) +
|
33
|
+
indent("object[k] = v\n", 4) +
|
34
|
+
indent("end\n", 2) +
|
35
|
+
indent("object.save\n", 2) +
|
32
36
|
"end\n"
|
33
37
|
end
|
34
38
|
end
|
@@ -13,70 +13,76 @@ module Adminpanel
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# Process files as they are uploaded:
|
16
|
-
# process :
|
16
|
+
# process resize_to_fill: [1366, 768]
|
17
17
|
|
18
18
|
# THE THUMB VERSION IS NECESSARY BY ADMINPANEL, DON'T REMOVE IT!!!!
|
19
19
|
version :thumb do
|
20
|
-
process :
|
20
|
+
process resize_to_limit: [80, 80]
|
21
21
|
end
|
22
22
|
|
23
23
|
# however, you can create your own versions:
|
24
24
|
# version :awesome do
|
25
|
-
# process :
|
25
|
+
# process reside_and_pad: [120, 900]
|
26
26
|
# end
|
27
27
|
|
28
|
-
#
|
28
|
+
# EXAMPLE:
|
29
|
+
# original 300 x 300 (this is a square, thanks)
|
30
|
+
# _________________
|
31
|
+
# | |
|
32
|
+
# | 0 |
|
33
|
+
# | 000 |
|
34
|
+
# | 0 |
|
35
|
+
# | \|/ |
|
36
|
+
# | | |
|
37
|
+
# | / \ |
|
38
|
+
# | |
|
39
|
+
# |_________________|
|
29
40
|
|
30
|
-
# resize_and_pad
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# the color of the background as a hexcode, like “ff45de“
|
42
|
-
# gravity (Magick::GravityType)
|
43
|
-
# how to position the image
|
41
|
+
# resize_and_pad: [700, 300] (fill with transparent to fit size.)
|
42
|
+
# __________________________________
|
43
|
+
# |TTTTT| |TTTTT|
|
44
|
+
# |TTTTT| 0 |TTTTT|
|
45
|
+
# |TTTTT| 000 |TTTTT|
|
46
|
+
# |TTTTT| 0 |TTTTT|
|
47
|
+
# |TTTTT| \|/ |TTTTT| => [700x300]
|
48
|
+
# |TTTTT| | |TTTTT|
|
49
|
+
# |TTTTT| / \ |TTTTT|
|
50
|
+
# |TTTTT| |TTTTT|
|
51
|
+
# |_________________________________|
|
44
52
|
|
45
|
-
# resize_to_fill(
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
53
|
+
# resize_to_fill: [700, 300] (force to fill zooming on the image, crops in half of the image)
|
54
|
+
# __________________________________
|
55
|
+
# | 00000000000000000000 |
|
56
|
+
# | 000000000000000 |
|
57
|
+
# | ||||| |
|
58
|
+
# | \\\\\\\\|||||/////// | => [700x300]
|
59
|
+
# | \\\\\\\\|||||/////// |
|
60
|
+
# | ||||| |
|
61
|
+
# | ||||| |
|
62
|
+
# |_________________________________|
|
55
63
|
|
56
|
-
# resize_to_fit(
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
|
66
|
-
#
|
64
|
+
# resize_to_fit: [120, 60] (resize to no larger than dimension, while
|
65
|
+
# maintaining ratio)
|
66
|
+
# ____________
|
67
|
+
# | |
|
68
|
+
# | 0 |
|
69
|
+
# | \/ | => [60x60] (no larger than any, original ratio)
|
70
|
+
# | /| |
|
71
|
+
# | |
|
72
|
+
# |____________|
|
73
|
+
|
74
|
+
# resize_to_limit: [500, 500] resize_to_fit, but only resizing if original image is larger
|
75
|
+
# _________________
|
76
|
+
# | |
|
77
|
+
# | 0 |
|
78
|
+
# | 000 |
|
79
|
+
# | 0 |
|
80
|
+
# | \|/ | => [300, 300] (original)
|
81
|
+
# | | |
|
82
|
+
# | / \ |
|
83
|
+
# | |
|
84
|
+
# |_________________|
|
67
85
|
|
68
|
-
# resize_to_limit(width, height)
|
69
|
-
#
|
70
|
-
# Resize the image to fit within the specified dimensions while retaining
|
71
|
-
# the original aspect ratio. Will only resize the image if it is larger than
|
72
|
-
# the specified dimensions. The resulting image may be shorter or narrower
|
73
|
-
# than specified in the smaller dimension but will not be larger than the
|
74
|
-
# specified values.
|
75
|
-
#
|
76
|
-
# width (Integer)
|
77
|
-
# the width to scale the image to
|
78
|
-
# height (Integer)
|
79
|
-
# the height to scale the image to
|
80
86
|
def extension_white_list
|
81
87
|
%w(jpg jpeg png)
|
82
88
|
end
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require 'rails/generators/active_record'
|
2
2
|
module Adminpanel
|
3
3
|
class InitializeGenerator < ActiveRecord::Generators::Base
|
4
|
-
desc
|
4
|
+
desc 'Generate the migrations necessary to start the gem'
|
5
5
|
source_root File.expand_path("../templates", __FILE__)
|
6
|
-
argument :name, :
|
6
|
+
argument :name, type: :string, default: 'default', require: false
|
7
7
|
class_option :'skip-category',
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
type: :boolean,
|
9
|
+
aliases: '-c',
|
10
|
+
default: false,
|
11
|
+
desc: 'Skip category skeleton and migration for it if true'
|
12
12
|
class_option :'skip-section-uploader',
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
type: :boolean,
|
14
|
+
aliases: '-u',
|
15
|
+
default: false,
|
16
|
+
desc: 'Skip section uploader if true'
|
17
17
|
class_option :'skip-migration',
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
type: :boolean,
|
19
|
+
aliases: '-m',
|
20
|
+
default: false,
|
21
|
+
desc: 'Skip initial migrations if true'
|
22
22
|
class_option :'skip-setup',
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
type: :boolean,
|
24
|
+
aliases: '-p',
|
25
|
+
default: false,
|
26
|
+
desc: 'Skip setup if true'
|
27
27
|
|
28
28
|
def create_initializer
|
29
29
|
if !options[:'skip-setup']
|
@@ -33,20 +33,20 @@ module Adminpanel
|
|
33
33
|
|
34
34
|
def create_category
|
35
35
|
if !options[:'skip-category']
|
36
|
-
copy_file
|
37
|
-
|
36
|
+
copy_file 'category_template.rb', 'app/models/adminpanel/category.rb'
|
37
|
+
migration_template 'create_adminpanel_categories_table.rb', 'db/migrate/create_adminpanel_categories_table.rb'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def create_section_uploader
|
42
42
|
if !options[:'skip-section-uploader']
|
43
|
-
copy_file
|
43
|
+
copy_file 'section_uploader.rb', 'app/uploaders/adminpanel/section_uploader.rb'
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
def create_adminpanel_migration
|
48
48
|
if !options[:'skip-migration']
|
49
|
-
|
49
|
+
migration_template 'create_adminpanel_tables.rb', 'db/migrate/create_adminpanel_tables.rb'
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -13,7 +13,7 @@ Rails.application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
-
config.
|
16
|
+
config.serve_static_files = true
|
17
17
|
config.static_cache_control = 'public, max-age=3600'
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CollectionNameTest < ViewCase
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
setup :sign_in
|
7
|
+
|
8
|
+
def test_collection_name_overwritten
|
9
|
+
visit adminpanel.mugs_path
|
10
|
+
assert_link 'Irregular Tazas'
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
def sign_in
|
15
|
+
visit adminpanel.signin_path
|
16
|
+
login
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -6,9 +6,38 @@ class ContactGeneratorTest < Rails::Generators::TestCase
|
|
6
6
|
destination Rails.root.join('tmp/generators')
|
7
7
|
setup :prepare_destination
|
8
8
|
|
9
|
-
def
|
10
|
-
run_generator
|
11
|
-
assert_file
|
9
|
+
def test_the_generation_of_the_attr_accessor_params
|
10
|
+
run_generator %w(body email name age country)
|
11
|
+
assert_file(
|
12
|
+
'app/models/contact.rb',
|
13
|
+
/attr_accessor :email, :name, :age, :country, :body/
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_generation_of_validations
|
18
|
+
run_generator %w(body email name age country)
|
19
|
+
assert_file(
|
20
|
+
'app/models/contact.rb',
|
21
|
+
/validates_presence_of :email/,
|
22
|
+
/validates_presence_of :body/,
|
23
|
+
/validates_presence_of :age/,
|
24
|
+
/validates_presence_of :name/,
|
25
|
+
/validates_presence_of :country/
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_generation_of_email_validations
|
30
|
+
run_generator %w(email body)
|
31
|
+
assert_file(
|
32
|
+
'app/models/contact.rb',
|
33
|
+
/# validations for email/,
|
34
|
+
/VALID_EMAIL_REGEX = \/\\A\[\\w\+\\-.\]\+@\[a-z\\d\\-.\]\+\\.\[a-z\]\+\\z\/i/,
|
35
|
+
/validates_format_of :email, with: VALID_EMAIL_REGEX, message: "\#{I18n.t\('model.attributes.email'\)} \#{I18n.t\('activerecord.errors.messages.invalid'\)}"/
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_generation
|
40
|
+
|
12
41
|
end
|
13
42
|
|
14
43
|
def test_runs_without_errors
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adminpanel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Ramon Camacho
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -421,13 +421,11 @@ files:
|
|
421
421
|
- app/assets/images/adminpanel/icons-small.png
|
422
422
|
- app/assets/images/adminpanel/ie-spacer.gif
|
423
423
|
- app/assets/images/adminpanel/loguito.png
|
424
|
-
- app/assets/images/adminpanel/odinn.jpg
|
425
424
|
- app/assets/images/adminpanel/pattern.jpg
|
426
425
|
- app/assets/images/adminpanel/pattern_transp.png
|
427
426
|
- app/assets/images/adminpanel/progress.gif
|
428
427
|
- app/assets/images/adminpanel/quicklook-bg.png
|
429
428
|
- app/assets/images/adminpanel/quicklook-icons.png
|
430
|
-
- app/assets/images/adminpanel/rails.png
|
431
429
|
- app/assets/images/adminpanel/resize.png
|
432
430
|
- app/assets/images/adminpanel/saturation.png
|
433
431
|
- app/assets/images/adminpanel/select2.png
|
@@ -457,6 +455,7 @@ files:
|
|
457
455
|
- app/assets/javascripts/adminpanel/jquery.slimscroll.min.js
|
458
456
|
- app/assets/javascripts/adminpanel/realm.js
|
459
457
|
- app/assets/javascripts/adminpanel/sections.js.coffee
|
458
|
+
- app/assets/javascripts/adminpanel/shortcuts.js.coffee
|
460
459
|
- app/assets/javascripts/adminpanel/spinner.js.coffee
|
461
460
|
- app/assets/javascripts/adminpanel/tables.js
|
462
461
|
- app/assets/javascripts/adminpanel/wysiwyg.js.coffee
|
@@ -540,12 +539,12 @@ files:
|
|
540
539
|
- app/views/adminpanel/icons/_facebook.html.erb
|
541
540
|
- app/views/adminpanel/icons/_move_to_better.html.erb
|
542
541
|
- app/views/adminpanel/icons/_move_to_worst.html.erb
|
542
|
+
- app/views/adminpanel/icons/_new.html.erb
|
543
543
|
- app/views/adminpanel/icons/_show.html.erb
|
544
544
|
- app/views/adminpanel/icons/_twitter.html.erb
|
545
545
|
- app/views/adminpanel/sections/_sections_table.html.erb
|
546
546
|
- app/views/adminpanel/sections/edit.html.erb
|
547
547
|
- app/views/adminpanel/sections/index.html.erb
|
548
|
-
- app/views/adminpanel/sections/show.html.erb
|
549
548
|
- app/views/adminpanel/sessions/new.html.erb
|
550
549
|
- app/views/adminpanel/shared/_breadcrumb.html.erb
|
551
550
|
- app/views/adminpanel/shared/_create_remote_resource_button.html.erb
|
@@ -680,6 +679,7 @@ files:
|
|
680
679
|
- test/features/shared/resource/new_test.rb
|
681
680
|
- test/features/shared/resource/show_test.rb
|
682
681
|
- test/features/shared/ui/action_exclution_test.rb
|
682
|
+
- test/features/shared/ui/collection_name_test.rb
|
683
683
|
- test/features/shared/ui/max_images_gallery_test.rb
|
684
684
|
- test/generators/contact_generator_test.rb
|
685
685
|
- test/generators/dump_generator_test.rb
|
@@ -690,7 +690,7 @@ files:
|
|
690
690
|
- test/helpers/router_helper_test.rb
|
691
691
|
- test/helpers/shared_pages_helper_test.rb
|
692
692
|
- test/models/ability_test.rb
|
693
|
-
- test/models/adminpanel/
|
693
|
+
- test/models/adminpanel/galleryzable_test.rb
|
694
694
|
- test/models/adminpanel/section_test.rb
|
695
695
|
- test/models/adminpanel/user_test.rb
|
696
696
|
- test/support/shared_database.rb
|
@@ -800,6 +800,7 @@ test_files:
|
|
800
800
|
- test/features/shared/resource/new_test.rb
|
801
801
|
- test/features/shared/resource/show_test.rb
|
802
802
|
- test/features/shared/ui/action_exclution_test.rb
|
803
|
+
- test/features/shared/ui/collection_name_test.rb
|
803
804
|
- test/features/shared/ui/max_images_gallery_test.rb
|
804
805
|
- test/generators/contact_generator_test.rb
|
805
806
|
- test/generators/dump_generator_test.rb
|
@@ -810,7 +811,7 @@ test_files:
|
|
810
811
|
- test/helpers/router_helper_test.rb
|
811
812
|
- test/helpers/shared_pages_helper_test.rb
|
812
813
|
- test/models/ability_test.rb
|
813
|
-
- test/models/adminpanel/
|
814
|
+
- test/models/adminpanel/galleryzable_test.rb
|
814
815
|
- test/models/adminpanel/section_test.rb
|
815
816
|
- test/models/adminpanel/user_test.rb
|
816
817
|
- test/support/shared_database.rb
|
Binary file
|
Binary file
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<% provide(:page_title, @section.name.humanize) %>
|
2
|
-
<% breadcrumb_add('Secciones', sections_path) %>
|
3
|
-
|
4
|
-
<div class="row-fluid">
|
5
|
-
<div class="widget widget-padding span12">
|
6
|
-
<div class="widget-header">
|
7
|
-
<i class="fa fa-tasks"></i>
|
8
|
-
<h5><%= @section.name.humanize %>
|
9
|
-
<%= render 'adminpanel/icons/edit', resource: @section, resource_name: @model.display_name %>
|
10
|
-
</h5>
|
11
|
-
</div>
|
12
|
-
<div class="widget-body row-fluid">
|
13
|
-
|
14
|
-
<div class="span2">
|
15
|
-
<b>Descripción</b>
|
16
|
-
</div>
|
17
|
-
<div class="span10">
|
18
|
-
<% if @section.description.nil? %>
|
19
|
-
<%= t("other.no description") %>
|
20
|
-
<% else %>
|
21
|
-
<%= @section.description.html_safe %>
|
22
|
-
<% end %>
|
23
|
-
</div>
|
24
|
-
<div class="span12">
|
25
|
-
<% @section.sectionfiles.each do |image|-%>
|
26
|
-
<%= image_tag(image.file_url :thumb) %>
|
27
|
-
<% end %>
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
</div>
|